#include #include #include #include #include "nr.h" using namespace std; // Driver for routine svdcmp int main(void) { int j,k,l,m,n; string txt; ifstream fp("matrx3.dat"); // read input matrices if (fp.fail()) NR::nrerror("Data file matrx3.dat not found"); getline(fp,txt); while (!fp.eof()) { getline(fp,txt); fp >> m >> n; getline(fp,txt); Vec_DP w(n); Mat_DP a(m,n),u(m,n),v(n,n); getline(fp,txt); // copy original matrix into u cout << fixed << setprecision(6); for (k=0;k> a[k][l]; u[k][l]=a[k][l]; } getline(fp,txt); getline(fp,txt); // perform decomposition NR::svdcmp(u,w,v); // write results cout << "Decomposition matrices:" << endl; cout << "Matrix u" << endl; for (k=0;k