Hi,

I try to calculate the kernel of am(rows) and n(columns) matrix. (n>m)

Therefore I wanted to decompose it with svd.

Unfortunately I do not really understand the description in the manual.

Has anyone a sample code?

Isn't it sufficient to call or sgebrd and then sorgbr?

The matrix P should then contain the kernel vectors in the last two columns.

Thank you very much.

I apologize asking this question, but I am trying to figure this out for quite some time now...

This is my sample code:

int rows=2;

int cols=3;

//matrix a little bigger to save result

float * a=new float[cols*cols];

a[0]=1; a[1]=0; a[2]=0;

a[3]=0; a[4]=1; a[5]=0;

//any values for the rest(not used for matrix)

a[6]=-2; a[7]=-2; a[8]=-2;

//create values as described in manual

//first dimension of a

int lda= rows;

//diagonal B

float * d=new float [min(rows,cols)];

//details of Q and P

float * tauq= new float[min(rows,cols)];

float * taup= new float[min(rows,cols)];

//off diagonal of B

float * e=new float[max(1,min(rows,cols)-1)];

//temp

float * work=new float[64*(rows+cols)];

int worksize=64*(rows+cols);

int info;

//void sgebrd(int *m,int *n,float *a,int *lda,float *d,float *e,float *tauq,float *taup,float *work,int *lwork,int *info);

sgebrd(&rows,&cols,a,&lda,d,e,tauq,taup,work,&worksize,&info);

if (info<0)

return info;

//lda=rows did not work either

lda=cols;

//read P

sorgbr ( "P", &cols, &cols, &rows, a, &lda, taup , work, &worksize, &info );

if (info<0)

return info;

//the last column is not (0,0,1)