95 tfxx::numeric::RNGgaussian rng;
107 aff::Iterator<Tmatrix> I(G);
118 aff::Iterator<Tmatrix> I(mknown);
127 cout <<
"Solve least squares problem" << endl;
128 cout <<
"===========================" << endl;
133 "Find solution such that |r|^2 becomes minimal" << endl;
139 cout <<
"\nMatrix of partial derivatives (G):\n";
141 cout <<
"\nData vector (d):\n";
151 cout <<
"\nSystem of linear equations to be solved:\n" 152 "M * m = rhs\n" << endl;
154 cout <<
"With matrix M=G^T*G:\n";
156 cout <<
"and vector rhs=G^T*d:\n";
164 cout <<
"\nsolution vector mopt:\n";
166 cout <<
"\nexpected solution (mknown):\n";
168 cout <<
"\nresidual (mopt-mknown):\n";
#define TF_LSQEXAMPLE_CC_VERSION
void printmatrix(const Tmatrix::Tcoc &m)
TDmatrix transposeNxM(const TDmatrix::Tcoc &A)
calculate transpose of NxM matrix.
TDmatrix dotNxM(const TDmatrix::Tcoc &A, const TDmatrix::Tcoc &B)
dot product for NxM matrices.
void dposv(char UPLO, TDmatrix &A, TDmatrix &B, int &INFO, const bool &debug)
Compute the solution to a real system of linear equations A * X = B.