spqr_solve¶
- sksparse.spqr.spqr_solve(A, b, *, transpose=False, min2norm=True, 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:
A ((M, N) array_like or sparse array) – An array convertible to a sparse matrix.
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.
min2norm (bool, optional) – If True, compute the minimum 2-norm solution when
Ais underdetermined.transposeis ignored in this case. Default is True. If False, the solution of an underdetermined system is not guaranteed to be the minimum 2-norm solution.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