qmat.qdelta.diag

QDelta coefficients based on minimization approaches. In particular, generates the diagonal coefficients from [Caklovic et al., 2024].

Examples

>>> from qmat.qcoeff.collocation import Collocation
>>> coll = Collocation(nNodes=4, nodeType="LEGENDRE", quadType="RADAU-RIGHT")
>>>
>>> from qmat import genQDeltaCoeffs
>>> QDelta = genQDeltaCoeffs("MIN-SR-NS", nodes=coll.nodes)
>>>
>>> from qmat.qdelta.diag import MIN_SR_S, MIN_SR_FLEX
>>> minSRS= MIN_SR_S(coll.nNodes, coll.nodeType, coll.quadType)
>>> QDelta = minSRS.getQDelta()
>>> minSRFLEX = MIN_SR_FLEX(coll.nNodes, coll.nodeType, coll.quadType)
>>> QD1, QD2, QD3 = minSRFLEX.genCoeffs(k=[1,2,3])

Classes

MIN

Naive diagonal coefficients based on spectral radius optimization.

FromTable

Base (unregistered) class for diagonal coefficients stored in tables.

MIN3

Magic diagonal coefficients from [Speck, 2021].

MIN_VDHS

Diagonal coefficients from [van der Houwen & Sommeijer, 1991].

MIN_SR_NS

Diagonal MIN-SR-NS coefficients from [Caklovic et al., 2024].

MIN_SR_S

Diagonal MIN-SR-S coefficients from [Caklovic et al., 2024].

MIN_SR_FLEX

Diagonal MIN-SR-FLEX coefficients from [Caklovic et al., 2024]

Jumper

Diagonal coefficients allowing order jump

FlexJumper

Diagonal coefficients allowing order jump while still maintaining high stability

DNODES

Diagonal coefficients build on divided node (1 here)

DNODES2

Diagonal coefficients build on divided node (2 here)

DNODES3

Diagonal coefficients build on divided node (3 here)

DNODES4

Diagonal coefficients build on divided node (4 here)

DNODES5

Diagonal coefficients build on divided node (5 here)

Functions

check(k)

Utility function to check k parameter for k-dependent generators

registerTable(→ FromTable)

Module Contents

check(k)[source]

Utility function to check k parameter for k-dependent generators

class MIN(Q, **kwargs)[source]
Inheritance diagram of qmat.qdelta.diag.MIN

Naive diagonal coefficients based on spectral radius optimization.

aliases = ['MIN-Speck']
rho(x)[source]
computeQDelta(k=None)[source]

Compute and returns the \(Q_\Delta\) matrix, has to be implemented in the specialized class.

Parameters:

k (int, optional) – Iteration number of the approximation. The default is None.

Returns:

QDelta

Return type:

np.ndarray

class FromTable(nNodes, nodeType, quadType, **kwargs)[source]
Inheritance diagram of qmat.qdelta.diag.FromTable

Base (unregistered) class for diagonal coefficients stored in tables.

nNodes
nodeType
quadType
static extractParams(qGen: qmat.qcoeff.collocation.Collocation) dict[source]

Extract from a \(Q\)-generator object all parameters required to instantiate the \(Q_\Delta\)-generator

property size

Dimension of the approximated \(Q\)-coefficients (number of nodes)

computeQDelta(k=None)[source]

Compute and returns the \(Q_\Delta\) matrix, has to be implemented in the specialized class.

Parameters:

k (int, optional) – Iteration number of the approximation. The default is None.

Returns:

QDelta

Return type:

np.ndarray

registerTable(cls: FromTable) FromTable[source]
class MIN3(nNodes, nodeType, quadType, **kwargs)[source]
Inheritance diagram of qmat.qdelta.diag.MIN3

Magic diagonal coefficients from [Speck, 2021].

aliases = ['Magic_Numbers']
class MIN_VDHS(nNodes, nodeType, quadType, **kwargs)[source]
Inheritance diagram of qmat.qdelta.diag.MIN_VDHS

Diagonal coefficients from [van der Houwen & Sommeijer, 1991].

aliases = ['VDHS']
class MIN_SR_NS(nodes, **kwargs)[source]
Inheritance diagram of qmat.qdelta.diag.MIN_SR_NS

Diagonal MIN-SR-NS coefficients from [Caklovic et al., 2024].

aliases = ['MIN-SR-NS', 'MIN_GT']
nodes
static extractParams(qGen: qmat.qdelta.QGenerator) dict[source]

Extract from a \(Q\)-generator object all parameters required to instantiate the \(Q_\Delta\)-generator

property size

Dimension of the approximated \(Q\)-coefficients (number of nodes)

computeQDelta(k=None)[source]

Compute and returns the \(Q_\Delta\) matrix, has to be implemented in the specialized class.

Parameters:

k (int, optional) – Iteration number of the approximation. The default is None.

Returns:

QDelta

Return type:

np.ndarray

class MIN_SR_S(nNodes, nodeType, quadType, **kwargs)[source]
Inheritance diagram of qmat.qdelta.diag.MIN_SR_S

Diagonal MIN-SR-S coefficients from [Caklovic et al., 2024].

Parameters:
  • nNodes (int) – Number of nodes.

  • nodeType (str) – Type of node distribution, see qmat.nodes.NodesGenerator for available types.

  • quadType (str) – Quadrature type for the nodes, see qmat.nodes.NodesGenerator for available types.

  • **kwargs – Additional parameters given during a generic call, not used by this class.

aliases = ['MIN-SR-S']
coll
nodeType
quadType
static extractParams(qGen: qmat.qcoeff.collocation.Collocation) dict[source]

Extract from a \(Q\)-generator object all parameters required to instantiate the \(Q_\Delta\)-generator

property size

Dimension of the approximated \(Q\)-coefficients (number of nodes)

computeCoeffs(M, a=None, b=None)[source]

Compute diagonal coefficients for a given number of nodes M. If a and b are given, then it uses as initial guess:

>>> a * nodes**b / M

If a is not given, then do not care about b and uses as initial guess:

>>> nodes / M
Parameters:
  • M (int) – Number of collocation nodes.

  • a (float, optional) – a coefficient for the initial guess.

  • b (float, optional) – b coefficient for the initial guess.

Returns:

  • coeffs (array) – The diagonal coefficients.

  • nodes (array) – The nodes associated to the current coefficients.

static fit(coeffs, nodes)[source]

Function fitting given coefficients to a power law

computeQDelta(k=None)[source]

Compute and returns the \(Q_\Delta\) matrix, has to be implemented in the specialized class.

Parameters:

k (int, optional) – Iteration number of the approximation. The default is None.

Returns:

QDelta

Return type:

np.ndarray

class MIN_SR_FLEX(nNodes, nodeType, quadType, **kwargs)[source]
Inheritance diagram of qmat.qdelta.diag.MIN_SR_FLEX

Diagonal MIN-SR-FLEX coefficients from [Caklovic et al., 2024]

Parameters:
  • nNodes (int) – Number of nodes.

  • nodeType (str) – Type of node distribution, see qmat.nodes.NodesGenerator for available types.

  • quadType (str) – Quadrature type for the nodes, see qmat.nodes.NodesGenerator for available types.

  • **kwargs – Additional parameters given during a generic call, not used by this class.

aliases = ['MIN-SR-FLEX']
computeQDelta(k=1)[source]

Compute and returns the \(Q_\Delta\) matrix, has to be implemented in the specialized class.

Parameters:

k (int, optional) – Iteration number of the approximation. The default is None.

Returns:

QDelta

Return type:

np.ndarray

class Jumper(nodes, **kwargs)[source]
Inheritance diagram of qmat.qdelta.diag.Jumper

Diagonal coefficients allowing order jump

aliases = ['JUMPER', 'FB']
computeQDelta(k=1)[source]

Compute and returns the \(Q_\Delta\) matrix, has to be implemented in the specialized class.

Parameters:

k (int, optional) – Iteration number of the approximation. The default is None.

Returns:

QDelta

Return type:

np.ndarray

class FlexJumper(nodes, **kwargs)[source]
Inheritance diagram of qmat.qdelta.diag.FlexJumper

Diagonal coefficients allowing order jump while still maintaining high stability

aliases = ['FLEX-JUMPER', 'FB2']
computeQDelta(k=1)[source]

Compute and returns the \(Q_\Delta\) matrix, has to be implemented in the specialized class.

Parameters:

k (int, optional) – Iteration number of the approximation. The default is None.

Returns:

QDelta

Return type:

np.ndarray

class DNODES(nodes, **kwargs)[source]
Inheritance diagram of qmat.qdelta.diag.DNODES

Diagonal coefficients build on divided node (1 here)

divider = 1
aliases = ['DNODES-1']
computeQDelta(k=None)[source]

Compute and returns the \(Q_\Delta\) matrix, has to be implemented in the specialized class.

Parameters:

k (int, optional) – Iteration number of the approximation. The default is None.

Returns:

QDelta

Return type:

np.ndarray

class DNODES2(nodes, **kwargs)[source]
Inheritance diagram of qmat.qdelta.diag.DNODES2

Diagonal coefficients build on divided node (2 here)

divider = 2
aliases = ['DNODES-2']
class DNODES3(nodes, **kwargs)[source]
Inheritance diagram of qmat.qdelta.diag.DNODES3

Diagonal coefficients build on divided node (3 here)

divider = 3
aliases = ['DNODES-3']
class DNODES4(nodes, **kwargs)[source]
Inheritance diagram of qmat.qdelta.diag.DNODES4

Diagonal coefficients build on divided node (4 here)

divider = 4
aliases = ['DNODES-4']
class DNODES5(nodes, **kwargs)[source]
Inheritance diagram of qmat.qdelta.diag.DNODES5

Diagonal coefficients build on divided node (5 here)

divider = 5
aliases = ['DNODES-5']