## Another output for QR factorization than in example

Open discussion regarding features, bugs, issues, vendors, etc.

### Another output for QR factorization than in example

Hello,

when i tried to implement the QR factorization example as described in the IBM Example: http://www.cepba.upc.edu/docs/ibm_doc/m ... sl368.html

i get another output for the Matrix R than they show on this page.
My code is:

Code: Select all
double *A1,*work,*tau;

A1 = (double*)calloc(12,sizeof(double));

A1[0] = 0.0;
A1[1] = 2.0;
A1[2] = 2.0;
A1[3] = 0.0;
A1[4] = 2.0;
A1[5] = 2.0;
A1[6] = 2.0;
A1[7] = -1.0;
A1[8] = -1.0;
A1[9] = 1.0;
A1[10] = -1.0;
A1[11] = -1.0;

int m = 6;
int n = 2;
int lda = 6;

work = (double*)calloc(2,sizeof(double));
tau  = (double*)calloc(2,sizeof(double));

int lwork = 2;
int info;

for(int i=0; i < 12; i++){
printf("%f \n",A1[i]);
}
printf("------------------------------------------------------------\n");

dgeqrf_(&m,&n,A1,&m,tau,work,&n,&info);

for(int i=0; i < 12; i++){
printf("%f \n",A1[i]);
}
printf("------------------------------------------------------------\n");

And my output is:

Code: Select all
-4.0
0.5
0.5
0.0
0.5
0.5
2.0
2.236068
0.309017
-0.309017
0.309017
0.309017

Can anybody say where my problem is?
Mat

Posts: 47
Joined: Sat Aug 19, 2006 9:54 am

Hello Mat,
what about setting A(4,2) (i.e. A1[9]) to 1.5 as in IBM ESSL example?
(You have set it to 1.0.)
Julie
Julie

Posts: 299
Joined: Wed Feb 23, 2005 12:32 am
Location: ICL, Denver. Colorado

:oops:

sorry - after about 2 hours of checking if i really used the correct matrix A it seems i was blind yesterday evening. Thanks a lot.
The next time i will go to sleep if i can't see the forest because of the trees...*grmpf.

Thanks for your patient help again.
Mat

Posts: 47
Joined: Sat Aug 19, 2006 9:54 am