qmat.qdelta.diag ================ .. py:module:: qmat.qdelta.diag .. autoapi-nested-parse:: QDelta coefficients based on minimization approaches. In particular, generates the diagonal coefficients from `[Caklovic et al., 2024]`_. .. rubric:: 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 ------- .. autoapisummary:: qmat.qdelta.diag.MIN qmat.qdelta.diag.FromTable qmat.qdelta.diag.MIN3 qmat.qdelta.diag.MIN_VDHS qmat.qdelta.diag.MIN_SR_NS qmat.qdelta.diag.MIN_SR_S qmat.qdelta.diag.MIN_SR_FLEX qmat.qdelta.diag.Jumper qmat.qdelta.diag.FlexJumper qmat.qdelta.diag.DNODES qmat.qdelta.diag.DNODES2 qmat.qdelta.diag.DNODES3 qmat.qdelta.diag.DNODES4 qmat.qdelta.diag.DNODES5 Functions --------- .. autoapisummary:: qmat.qdelta.diag.check qmat.qdelta.diag.registerTable Module Contents --------------- .. py:function:: check(k) Utility function to check k parameter for k-dependent generators .. py:class:: MIN(Q, **kwargs) .. autoapi-inheritance-diagram:: qmat.qdelta.diag.MIN :parts: 1 Naive diagonal coefficients based on spectral radius optimization. .. py:attribute:: aliases :value: ['MIN-Speck'] .. py:method:: rho(x) .. py:method:: computeQDelta(k=None) Compute and returns the :math:`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** :rtype: np.ndarray .. py:class:: FromTable(nNodes, nodeType, quadType, **kwargs) .. autoapi-inheritance-diagram:: qmat.qdelta.diag.FromTable :parts: 1 Base (unregistered) class for diagonal coefficients stored in tables. .. py:attribute:: nNodes .. py:attribute:: nodeType .. py:attribute:: quadType .. py:method:: extractParams(qGen: qmat.qcoeff.collocation.Collocation) -> dict :staticmethod: Extract from a :math:`Q`-generator object all parameters required to instantiate the :math:`Q_\Delta`-generator .. py:property:: size Dimension of the approximated :math:`Q`-coefficients (number of nodes) .. py:method:: computeQDelta(k=None) Compute and returns the :math:`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** :rtype: np.ndarray .. py:function:: registerTable(cls: FromTable) -> FromTable .. py:class:: MIN3(nNodes, nodeType, quadType, **kwargs) .. autoapi-inheritance-diagram:: qmat.qdelta.diag.MIN3 :parts: 1 Magic diagonal coefficients from `[Speck, 2021] `_. .. py:attribute:: aliases :value: ['Magic_Numbers'] .. py:class:: MIN_VDHS(nNodes, nodeType, quadType, **kwargs) .. autoapi-inheritance-diagram:: qmat.qdelta.diag.MIN_VDHS :parts: 1 Diagonal coefficients from `[van der Houwen & Sommeijer, 1991] `_. .. py:attribute:: aliases :value: ['VDHS'] .. py:class:: MIN_SR_NS(nodes, **kwargs) .. autoapi-inheritance-diagram:: qmat.qdelta.diag.MIN_SR_NS :parts: 1 Diagonal `MIN-SR-NS` coefficients from `[Caklovic et al., 2024] `_. .. py:attribute:: aliases :value: ['MIN-SR-NS', 'MIN_GT'] .. py:attribute:: nodes .. py:method:: extractParams(qGen: qmat.qdelta.QGenerator) -> dict :staticmethod: Extract from a :math:`Q`-generator object all parameters required to instantiate the :math:`Q_\Delta`-generator .. py:property:: size Dimension of the approximated :math:`Q`-coefficients (number of nodes) .. py:method:: computeQDelta(k=None) Compute and returns the :math:`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** :rtype: np.ndarray .. py:class:: MIN_SR_S(nNodes, nodeType, quadType, **kwargs) .. autoapi-inheritance-diagram:: qmat.qdelta.diag.MIN_SR_S :parts: 1 Diagonal `MIN-SR-S` coefficients from `[Caklovic et al., 2024]`_. :Parameters: * **nNodes** (*int*) -- Number of nodes. * **nodeType** (*str*) -- Type of node distribution, see :class:`qmat.nodes.NodesGenerator` for available types. * **quadType** (*str*) -- Quadrature type for the nodes, see :class:`qmat.nodes.NodesGenerator` for available types. * **\*\*kwargs** -- Additional parameters given during a generic call, not used by this class. .. py:attribute:: aliases :value: ['MIN-SR-S'] .. py:attribute:: coll .. py:attribute:: nodeType .. py:attribute:: quadType .. py:method:: extractParams(qGen: qmat.qcoeff.collocation.Collocation) -> dict :staticmethod: Extract from a :math:`Q`-generator object all parameters required to instantiate the :math:`Q_\Delta`-generator .. py:property:: size Dimension of the approximated :math:`Q`-coefficients (number of nodes) .. py:method:: computeCoeffs(M, a=None, b=None) 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. .. py:method:: fit(coeffs, nodes) :staticmethod: Function fitting given coefficients to a power law .. py:method:: computeQDelta(k=None) Compute and returns the :math:`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** :rtype: np.ndarray .. py:class:: MIN_SR_FLEX(nNodes, nodeType, quadType, **kwargs) .. autoapi-inheritance-diagram:: qmat.qdelta.diag.MIN_SR_FLEX :parts: 1 Diagonal `MIN-SR-FLEX` coefficients from `[Caklovic et al., 2024]`_ :Parameters: * **nNodes** (*int*) -- Number of nodes. * **nodeType** (*str*) -- Type of node distribution, see :class:`qmat.nodes.NodesGenerator` for available types. * **quadType** (*str*) -- Quadrature type for the nodes, see :class:`qmat.nodes.NodesGenerator` for available types. * **\*\*kwargs** -- Additional parameters given during a generic call, not used by this class. .. py:attribute:: aliases :value: ['MIN-SR-FLEX'] .. py:method:: computeQDelta(k=1) Compute and returns the :math:`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** :rtype: np.ndarray .. py:class:: Jumper(nodes, **kwargs) .. autoapi-inheritance-diagram:: qmat.qdelta.diag.Jumper :parts: 1 Diagonal coefficients allowing order jump .. py:attribute:: aliases :value: ['JUMPER', 'FB'] .. py:method:: computeQDelta(k=1) Compute and returns the :math:`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** :rtype: np.ndarray .. py:class:: FlexJumper(nodes, **kwargs) .. autoapi-inheritance-diagram:: qmat.qdelta.diag.FlexJumper :parts: 1 Diagonal coefficients allowing order jump while still maintaining high stability .. py:attribute:: aliases :value: ['FLEX-JUMPER', 'FB2'] .. py:method:: computeQDelta(k=1) Compute and returns the :math:`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** :rtype: np.ndarray .. py:class:: DNODES(nodes, **kwargs) .. autoapi-inheritance-diagram:: qmat.qdelta.diag.DNODES :parts: 1 Diagonal coefficients build on divided node (1 here) .. py:attribute:: divider :value: 1 .. py:attribute:: aliases :value: ['DNODES-1'] .. py:method:: computeQDelta(k=None) Compute and returns the :math:`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** :rtype: np.ndarray .. py:class:: DNODES2(nodes, **kwargs) .. autoapi-inheritance-diagram:: qmat.qdelta.diag.DNODES2 :parts: 1 Diagonal coefficients build on divided node (2 here) .. py:attribute:: divider :value: 2 .. py:attribute:: aliases :value: ['DNODES-2'] .. py:class:: DNODES3(nodes, **kwargs) .. autoapi-inheritance-diagram:: qmat.qdelta.diag.DNODES3 :parts: 1 Diagonal coefficients build on divided node (3 here) .. py:attribute:: divider :value: 3 .. py:attribute:: aliases :value: ['DNODES-3'] .. py:class:: DNODES4(nodes, **kwargs) .. autoapi-inheritance-diagram:: qmat.qdelta.diag.DNODES4 :parts: 1 Diagonal coefficients build on divided node (4 here) .. py:attribute:: divider :value: 4 .. py:attribute:: aliases :value: ['DNODES-4'] .. py:class:: DNODES5(nodes, **kwargs) .. autoapi-inheritance-diagram:: qmat.qdelta.diag.DNODES5 :parts: 1 Diagonal coefficients build on divided node (5 here) .. py:attribute:: divider :value: 5 .. py:attribute:: aliases :value: ['DNODES-5']