Skip to content

cagpjax.linalg.orthogonalize

Orthogonalization methods.

Classes:

Functions:

  • orthogonalize

    Orthogonalize the operator using the specified method.

OrthogonalizationMethod

Bases: Enum

Methods for orthogonalizing a matrix.

Attributes:

  • CGS

    Classical Gram–Schmidt orthogonalization

  • MGS

    Modified Gram–Schmidt orthogonalization

  • QR

    Householder QR decomposition

CGS class-attribute instance-attribute

CGS = 'cgs'

Classical Gram–Schmidt orthogonalization

MGS class-attribute instance-attribute

MGS = 'mgs'

Modified Gram–Schmidt orthogonalization

QR class-attribute instance-attribute

QR = 'qr'

Householder QR decomposition

orthogonalize

orthogonalize(A: Float[Array, 'm n'] | LinearOperator, /, method: OrthogonalizationMethod = OrthogonalizationMethod.QR, n_reortho: int = 0) -> Float[Array, 'm n'] | cola.ops.LinearOperator

Orthogonalize the operator using the specified method.

The columns of the resulting matrix should span a (super-)space of the columns of the input matrix and be mutually orthogonal. For column-rank-deficient matrices, some methods (e.g. Gram-Schmidt variants) may include columns of norm 0.

Parameters:

  • A

    (Float[Array, 'm n'] | LinearOperator) –

    The operator to orthogonalize.

  • method

    (OrthogonalizationMethod, default: QR ) –

    The method to use for orthogonalization.

  • n_reortho

    (int, default: 0 ) –

    The number of times to re-orthogonalize each column. Reorthogonalizing once is generally sufficient to improve orthogonality for Gram-Schmidt variants (see e.g. 10.1007/s00211-005-0615-4).

Returns:

  • Float[Array, 'm n'] | LinearOperator

    The orthogonalized operator. If the input is a LinearOperator, then so is the output.

Source code in src/cagpjax/linalg/orthogonalize.py
def orthogonalize(
    A: Float[Array, "m n"] | cola.ops.LinearOperator,
    /,
    method: OrthogonalizationMethod = OrthogonalizationMethod.QR,
    n_reortho: int = 0,
) -> Float[Array, "m n"] | cola.ops.LinearOperator:
    """
    Orthogonalize the operator using the specified method.

    The columns of the resulting matrix should span a (super-)space of the columns of
    the input matrix and be mutually orthogonal. For column-rank-deficient matrices,
    some methods (e.g. Gram-Schmidt variants) may include columns of norm 0.

    Args:
        A: The operator to orthogonalize.
        method: The method to use for orthogonalization.
        n_reortho: The number of times to _re_-orthogonalize each column.
            Reorthogonalizing once is generally sufficient to improve orthogonality
            for Gram-Schmidt variants
            (see e.g. [10.1007/s00211-005-0615-4](https://doi.org/10.1007/s00211-005-0615-4)).

    Returns:
        The orthogonalized operator. If the input is a LinearOperator, then so is the output.
    """
    return _orthogonalize(A, method, n_reortho)