You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need to solve upper-triangular systems with both dense and sparse matrices. To this end, I'm looking at solve_triangular for dense and spsolve_triangular for sparse.
solve_triangular correctly discards the unused part, i.e., the solution works even if the input matrix A is not triangular. This is useful in many cases, e.g., in stationary methods like Gauss-Seidel; it saves you all matrix-manipulation shenanigans.
spsolve_triangular one the other hand flat out won't accept non-triangular matrices:
importnumpyasnpfromscipy.sparseimportcsr_matrixfromscipy.sparse.linalgimportspsolve_triangularA=csr_matrix([
[1.0, 2.0],
[3.0, 4.0]
])
b=np.array([1.0, 1.0])
sol=spsolve_triangular(A, b)
numpy.linalg.LinAlgError: A is not triangular: A[0, 1] is nonzero.
This is a feature request for accepting non-triangular matrices to spsolve_triangular to avoid having to create temporary matrices for the solution of triangular problems.
This is with SciPy 1.6.3.
The text was updated successfully, but these errors were encountered:
It's a little complex because we're doing indexing tricks to avoid seeking through the nonzero entries of each row to find the diagonal entry. I think a rewrite could improve the code's readability and remove this limitation at the same time. We'll want to be careful not to incur a performance penalty, as well.
I need to solve upper-triangular systems with both dense and sparse matrices. To this end, I'm looking at solve_triangular for dense and spsolve_triangular for sparse.
solve_triangular
correctly discards the unused part, i.e., the solution works even if the input matrixA
is not triangular. This is useful in many cases, e.g., in stationary methods like Gauss-Seidel; it saves you all matrix-manipulation shenanigans.spsolve_triangular one the other hand flat out won't accept non-triangular matrices:
This is a feature request for accepting non-triangular matrices to spsolve_triangular to avoid having to create temporary matrices for the solution of triangular problems.
This is with SciPy 1.6.3.
The text was updated successfully, but these errors were encountered: