I got an error when I try to use CNiMath::LeastSquaresFit(). Please teach me what I was wrong.
The error message is "Math Exception:Input matrix is singular. The system of equation cannot be solved."
I donot thick my matrix is singular. The program code is as follows:
CNiReal64Matrix HMat(3,2);
HMat(0,0) = 1.0;
HMat(0,1) = 2.0;
HMat(1,0) = 5.0;
HMat(1,1) = 4.0;
HMat(2,0) = 5.0;
HMat(2,1) = 3.0;
CNiReal64Vector YVec(3);
YVec[0] = 5.0;
YVec[1] = 6.0;
YVec[2] = 7.0;
CNiReal64Vector stdDev(3);
stdDev.Set(0.0);
CNiReal64Vector BVec(2), ZVec(3);
CNiReal64Matrix Covari(3,3);
double mse;
CNiMath::LeastSquaresFit(HMat,YVec,stdDev,ZVec,BVec, Covari,mse);
Please check it. Thank you.