Using Cusolver for solving Ax=b by householder method

Hello All,

I am trying to use cusolver library and want to find solution of linear system. I saw this example on nvidia docs for the same:

http://docs.nvidia.com/cuda/cusolver/index.html#ormqr-example1

The problem is my matrix is not square and it 838 matrix. I tried to check this code for 43 matrix but I am getting this error:

a.out: main1.cu:112: int main(): Assertion `CUSOLVER_STATUS_SUCCESS == cusolver_status' failed.

which is from this part of the code:

// step 5: compute Q^T*B 

cusolver_status= cusolverDnDormqr( cusolverH, CUBLAS_SIDE_LEFT, CUBLAS_OP_T, m, n, n, d_A, lda, d_tau, d_B, ldb, d_work, lwork, devInfo); 

cudaStat1 = cudaDeviceSynchronize();
assert(CUSOLVER_STATUS_SUCCESS == cusolver_status); 
assert(cudaSuccess == cudaStat1);

I looked into the documentation of this cusolverDnDorqmr function also
Here : http://docs.nvidia.com/cuda/cusolver/index.html#cuds-lt-t-gt-ormqr

And I found that in the example they used nrhs(==1) instead of n as suggested in the documentation. I changed this and got the same error even for 3*3 matrix.
I don’t understand what I am doing wrong. Is there is any problem in the example?? or there is some other way to use library for rectangular matrices?? Please help me guys. This thing is the major part of my project and I really have to submit this soon.

I’m not sure a rectangular A matrix makes sense if you are looking for an exact solution (number of equations = number of unknowns) of a linear system. The A matrix in that case should always be square, and I don’t think this method is designed for cases where the A matrix is rectangular, implying overdetermined systems (e.g. use Least Squares) or underdetermined systems (many solutions).

When the nrhs parameter is not 1 in the example, you are solving a set of systems like

Axi=bi i=1,2,3,…

In that case, A is still square (and constant across all members of the set), but the x and b are sets of vectors, treated as matrices in x and b for the purpose of this method.

Thank you very much for your help. Although, I figure out how to use that function for rectangular matrices.

The function (ormqr) can work with rectangular matrices. I’m not sure the solution method works with a rectangular system.