Rotem.O
Rotem.O

Reputation: 103

Solve linear equation of AX=B

I currently solve Ax=b equation two times.

where A is sparse matrix NxN

x, b are vectors of size N. (I have b1 and b2)

I want to reduce times by solving both of them in one shot using cusparse functions.

so what I though is to build from the 2 b's I have, one matrix of size Nx2, and solve it with A as the equation AX=B can do.

  1. Is it theoretically right?
  2. which cusparse function should I use?

please pay attention I'm working with sparse matrix and not dense matrix.

Thanks!

Upvotes: 2

Views: 1330

Answers (1)

talonmies
talonmies

Reputation: 72345

To answer your questions

  1. Yes, it is possible to solve a suitably well conditioned sparse problem for multiple RHS vectors in this way.

  2. Unless your LHS sparse matrix is either tridiagonal or triangular, then you can't use cusparse directly for this.

    cusolver 7.5 contains several "low level" routines for factorising sparse matrices, meaning that you can factorize once and reuse the factorisation several times with different RHS, for example cusolverSpXcsrluSolve() can be called after an LU factorisation to solve using the same precomputed factorisation as many times as you require. (Note I originally had assumed that there was a sparse getrs like function in cusolve, and it appears there isn't. I certainly talked to NVIDIA about the use case for one some years ago and thought they had added it, sorry for the confusion there).

Upvotes: 1

Related Questions