# DGELS results do not seem correct.

## DGELS results do not seem correct.

When I call DGELS using the following data: double dA[] = { 1,4,1,5,1,6,1,7,1,8,1,9,1,10,1,11,1,12,1,13,1,14 };
double dB[] = {3.29907758366425,4.46748916656078,19.4376447934279,1.33605625551027,5.63502536637876,5.81066320575566,10.7498837262887,18.834615880912,18.9891064366877,16.2408547103099,5.6606499534616};
char sMatrixType[] = "N";
intiArows = 11;
intiAcols = 2;
intiBcols = 1;
double dwork[512];
intiinfo = 0;
intiwork = 512;

dgels(sMatrixType, &iArows, &iAcols, &iBcols, dA, &iArows, dB, &iArows, dwork, &iwork, &iinfo); For AX=B,DGELS returns1.5727, 0.7746. However, when I do a Least Squares calculation by hand, I get 2.0509, 0.8878. Should SGELS return a solution w/ error minimized? Please help. Best regards, EP.

3 Beiträge / 0 neu
Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.

I think your hand calculation is wrong.

The solution given by DGELS is correct. Matlab gives:

```A=reshape([1,4,1,5,1,6,1,7,1,8,1,9,1,10,1,11,1,12,1,13,1,14],[11,2]);
b=[3.29907758366425,4.46748916656078,19.4376447934279,1.33605625551027,5.63502536637876,...
5.81066320575566,10.7498837262887,18.834615880912,18.9891064366877,16.2408547103099,5.6606499534616]';
x=A\b
x =
1.5728
0.7747
```