#include #include #include #include #include "nr.h" using namespace std; // Driver for routine qrdcmp int main(void) { bool sing; int i,j,k,l,m,n; DP con; string txt; ifstream fp("matrx1.dat"); if (fp.fail()) NR::nrerror("Data file matrx1.dat not found"); cout << fixed << setprecision(6); getline(fp,txt); while (!fp.eof()) { getline(fp,txt); fp >> n >> m; getline(fp,txt); Vec_DP c(n),d(n); Mat_DP a(n,n),q(n,n),qt(n,n),r(n,n),x(n,n); getline(fp,txt); for (k=0;k> a[k][l]; getline(fp,txt); getline(fp,txt); for (l=0;l> x[k][l]; getline(fp,txt); getline(fp,txt); // Print out a-matrix for comparison with product of // Q and R decomposition matrices cout << "Original matrix:" << endl; for (k=0;k k) { r[k][l]=a[k][l]; q[k][l]=0.0; } else if (l < k) { r[k][l]=q[k][l]=0.0; } else { r[k][l]=d[k]; q[k][l]=1.0; } } } for (i=n-2;i>=0;i--) { for (con=0.0,k=i;k