Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

DGELS results do not seem correct.

cy8z
Beginner
661 Views

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.

0 Kudos
2 Replies
lonsunshine
Beginner
661 Views
I think your hand calculation is wrong.
0 Kudos
mecej4
Honored Contributor III
661 Views

The solution given by DGELS is correct. Matlab gives:[bash]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

[/bash]

0 Kudos
Reply