LAPACK Archives

[Lapack] Question on dsysv

Your matrix LHS below is rank 1, i.e. singular, so an
error message is expected. My version of Matlab
also gives an error message (from "A\b"). And the
right-hand-side vector (RHS) is not spanned by the
columns of LHS, so a least-squares solution will
also have a nonzero residual.
Jim Demmel


On 4/13/15 10:32 PM, Hao Wang wrote:

Hi

 Great thanks for the windows edition of lapack. I successful compiled 
lapack on my computer. While I failed to solve the function AX=B with 
dsysv_(). I get the same B as output, which means the function is 
unsolvable. While it should?not be, I validate this with matlab.

Best wishes.

#include <iostream>

#include <stdio.h>

#include <array>

#include <vector>

extern "C" void dsysv_(const char *uplo, const int *N, const int 
*nrhs, double *A,const int *lda,int* ipi , double *b,const int 
*ldb,double *work,const int *lwork,int *info);

int main(void)

{

char uplo = 'U';

int n = 6;

int nrhs = 1;

int lDA = 6;

int ipiv[6];

int lDB = 6;

double worksize;

int lwork = -1;

int info;

double LHS[36]={ 1  ,   2 ,  3  ,   4  , 5  ,   6,

           2 ,   4   , 6  ,   8 , 10   , 12,

           3 ,   6  , 9  ,  12 ,  15 ,   18,

           4 ,  8 ,   12, 16  ,  20 , 24,

           5 , 10 ,   15 ,   20, 25 ,   30,

           6 , 12  ,  18 , 24 ,   30 ,   36};

double RHS[6]={ 154,308,462,616,770,900};

dsysv_(&uplo, &n, &nrhs, LHS, &lDA, ipiv, RHS, &lDB, &worksize, 
&lwork, &info);

std::vector<double> work((int)worksize);

lwork = (int)worksize;

dsysv_(&uplo, &n, &nrhs, LHS, &lDA, ipiv, RHS, &lDB, work.data(), 
&lwork, &info);

for(int i=0;i<6;i++)

std::cout<< RHS[i]<<std::endl;

std::cout<<info<<std::endl;

}



_______________________________________________
Lapack mailing list
Lapack@Domain.Removed
http://lists.eecs.utk.edu/mailman/listinfo/lapack

-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://lists.eecs.utk.edu/mailman/private/lapack/attachments/20150417/2c8442f5/attachment.html>

<Prev in Thread] Current Thread [Next in Thread>


For additional information you may use the LAPACK/ScaLAPACK Forum.
Or one of the mailing lists, or