#include #include #include #include #include "nr.h" using namespace std; // Driver for routine tridag int main(void) { int k,n; string txt; ifstream fp("matrx2.dat"); if (fp.fail()) NR::nrerror("Data file matrx2.dat not found"); getline(fp,txt); while (!fp.eof()) { getline(fp,txt); fp >> n; getline(fp,txt); Vec_DP diag(n),superd(n),subd(n),rhs(n),u(n); getline(fp,txt); for (k=0;k> diag[k]; getline(fp,txt); getline(fp,txt); for (k=0;k> superd[k]; getline(fp,txt); getline(fp,txt); for (k=1;k> subd[k]; getline(fp,txt); getline(fp,txt); for (k=0;k> rhs[k]; getline(fp,txt); getline(fp,txt); // carry out solution NR::tridag(subd,diag,superd,rhs,u); cout << fixed << setprecision(6); cout << endl << "The solution vector is:" << endl; for (k=0;k