sparse linear system with simple rhs

387 Views Asked by At

Are there any special algorithms which solves a sparse linear system efficiently when the rhs of the system has only a few nonzero elements or the the rhs is a basis vector ?

Edit:

The size of the matrix has commonly more than a few ten thousand entries and is complex, unsymmetric but square. I want to calculate the solution to the system many times but not more than the size of the rhs. The rhs changes but has a constant number in the range of 1 to 200 non zero entries. This value is fix, but the position in the vector change for each run.

2

There are 2 best solutions below

0
On

There are bunch of solvers that can do that. You can look for a reference here: https://eigen.tuxfamily.org/dox/group__TopicSparseSystems.html

2
On

Suppose we want to find solution to $AX = Y$ where $A$ is a sparse matrix and $Y$ is a sparse vector.

Even if $Y$ is sparse you still need to factorize the matrix $A$ for example using the LU factorization $LU = PAQ$, where $P$, $Q$ are permutation matrices. Then $X = QU^{-1}L^{-1}PY$.

The only places, where the sparsity of $Y$ can be used, are triagular solves $L^{-1}z$ and $U^{-1}w$ with sparse triangular matrices $L$, $U$, sparse vector $z$ and possibly sparse vector $w$ (in general $w$ can be dense).

There are specialized algorithms for solving sparse triangular systems with sparse RHS, mathematically equivalent to triangular solvers with dense RHS, but with very different implementation.

In general factorization step cannot be avoided or simplified when RHS is sparse.

Iterative solvers are not helpful here, since they always assume, that RHS is dense.