SPQRFactor

class sksparse.spqr.SPQRFactor[source]

The main object used for creating and manipulating SPQR factorizations.

The constructor computes the sybolic analysis of the matrix and determines a fill-reducing ordering such that:

\[Q R = A E\]

where \(E\) is a column permutation matrix, \(Q\) is an orthogonal matrix, and \(R\) is an upper-triangular matrix.

The numerical factorization is computed in one of two ways:

  1. by setting use_singletons=True in the constructor, which computes

    both the symbolic and numeric factorizations at once, or

  2. by calling SPQRFactor.factorize(), which computes the numeric

    factorization after symbolic analysis has been performed.

The first method is useful when factoring a single matrix, but solving multiple right-hand sides.

The second method is useful when factoring multiple matrices with the same sparsity pattern but different numerical values.

Parameters:
  • A ((M, N) array_like or sparse array) – An array convertible to a sparse matrix.

  • use_singletons (bool, optional) – If True, directly compute the numeric factorization to exploit singleton rows. Otherwise, only perform symbolic analysis. Default is False.

  • order (str, optional) – The column ordering strategy to use. Let \(S\) be the matrix \(A\) with singleton rows/columns removed, the ordering options are:

    • default: COLAMD(S),

    • fixed: identity permutation (i.e. no singletons removed),

    • natural: singletons removed, but no fill-reducing ordering applied,

    • colamd: COLAMD(S),

    • amd: AMD(\(S^{\top} S\)),

    • metis: METIS(\(S^{\top} S\)),

    • best: try all of amd, colamd, metis and pick the best,

    • cholmod: Same as best,

    • bestamd: try amd and colamd and pick the best.

  • tol (float, optional) – If the 2-norm of a column in A is less than tol, that column is considered to be a zero column. If tol = 0, no columns are treated as zero. If None, the default tolerance is used. The default is tol = \(20 \epsilon (M + N) \sqrt{\max{\mathrm{diag}(A^{\top} A)}}\), where \(\epsilon\) is the machine precision.

is_numeric[source]

Whether the numeric factorization has been computed.

Type:

bool

shape[source]

The shape of the input matrix (M, N).

Type:

tuple

itype[source]

The integer type used for indices (int32 or int64).

Type:

dtype

dtype[source]

The data type of the matrix (float64 or complex128).

Type:

dtype

rank[source]

The rank of the matrix as determined by SPQR.

Type:

int

perm[source]

The combined singleton and fill-reducing column permutation vector.

Type:

ndarray of int

info[source]

An object containing various SPQR statistics.

Type:

SPQRInfo

Notes

This object is an interface to the SuiteSparse SPQR library [1].

Added in version 0.5.0.

References

Methods

__init__

Initialize the SPQRFactor object and perform symbolic analysis.

copy

Return a deep copy of the SPQRFactor object.

factorize

Compute the numeric factorization of the matrix.

qmult

Multiply by Q using the Householder representation.

solve

Solve a linear system using the SPQR factorization.