# AX=B versus Ax=b

1. Jan 7, 2009

### callingearth

Hi all,
I required some help in a linear algebra problem. I've been told to build a sparse matrix solver which solves AX=B where dim(A) = n *n , dim(X) = n*nrhs and hence dim(B) = n*nrhs. This I have to implement on a GPU (I know this is offbeat but needed the math help :) I have an implementation which solved Ax=b wherein dim(A) = n*n and x is a vector i.e. dim(x) = n*1. This is solved using a preconditioned Conjugate Gradient algorithm. (If really interested could read this - http://alice.loria.fr/publications/papers/2008/CNC/Buatois_et_al_CNC.pdf ). I would like to know how I can map the AX=B problem to Ax=b problem (if possible)?

Thanks,
Vandhan Ramesh

2. Jan 7, 2009

### Unco

Hi Vandhan,

If X = [x_1 x_2 ... x_{nrhs}] where x_i's are the columns (which are nx1 vectors), and similarly B = [b_1 b_2 ... b_{nrhs}], then we can write AX = B as A[x_1 x_2 ... x_{nrhs}] = [b_1 b_2 ... b_{nrhs}], i.e., [Ax_1 Ax_2 ... Ax_{nrhs}] = [b_1 b_2 ... b_{nrhs}]. In this way the matrix*matrix=matrix equation becomes a system of matrix*vector=vector equations.

3. Jan 10, 2009

### callingearth

Thanks a lot. So now if I have a data of AX=B, i.e. B's dataset of dimension N * NRHS, all I need to do is solve NRHS times Ax=b, right?

Vandhan