solve¶
- SPQRFactor.solve(b, *, transpose=False, rhs_batch_size=100)[source]¶
Solve a linear system using the SPQR factorization.
Solve a linear system for \(x\) given the right-hand side \(b\) as either a vector or a matrix with multiple right-hand sides.
If
transpose=False, solve\[A x = b\]or, if
transpose=True, solve\[A^{\top} x = b.\]- Parameters:
b ((M,) or (M, K) numpy.ndarray) – The right-hand side vector or matrix.
Mshould be the number of rows inAiftranspose=False, otherwise the number of columns.transpose (bool, optional) – Whether to solve the transposed system. Default is False.
rhs_batch_size (int, optional) – If
bis a 2D sparse array, this parameter controls the number of columns to be solved simultaneously. A larger number will increase memory consumption by converting more columns at a time to dense arrays, but may improve runtime.
- Returns:
x ((N,) or (N, K) numpy.ndarray or sparse array) – The solution vector or matrix. If
bis a 1D array, thenxis returned as a 1D array. Ifbis a 2D array withKcolumns, thenxis returned as a 2D array withKcolumns. Ifbis a sparse array, thenxis also returned as a sparse array.Nis the number of columns inAiftranspose=False, otherwise the number of rows.
See also
Notes
Part of an interface to the SuiteSparse SPQR library [1].
Added in version 0.5.0.
References