⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tspsm.cc

📁 http://gams.cam.nist.gov/acmd/Staff/RPozo/sparselib++.html
💻 CC
📖 第 1 页 / 共 2 页
字号:
  // lower unit  descra[1] = 1;  descra[2] = 1;  F77NAME(dcscsm) (0, m, 1, 1, NULL, 1.0,           descra, &xAc.val(0), &xAc.row_ind(0), &xAc.col_ptr(0),           &b(0), m, 0.0, &y(1), m,           NULL, 0);  if (verbose) cout << "CSCSM y-x " << norm(y-x) << endl;  if (norm(y-x) > 1.e-12) {    errcount++;    if (verbose) {      cout << "b" << endl << b << endl;      cout << "x" << endl << x << endl;      cout << "y" << endl << y << endl;    }  }/******************************************************************///                                                                ////                   [    1   4   0   0   0   ]                    ////                                                                ////                   |    0   5   7   0   0   |                    ////                                                                ////                   |    0   0   8   9   0   |                    ////                                                                ////                   |    0   0   0  10   0   |                    ////                                                                ////                   [    0   0   0   0  12   ]                    ////                                                                ///******************************************************************/  double yval[] = {1.0, 4.0, 5.0, 7.0, 8.0, 9.0, 10.0, 12.0};  int ycolind[] = {0,   1,   1,   2,   2,   3,   3,    4};  int yrowptr[] = {0,        2,        4,        6,    7,    8};  CompRow_Mat_double yAr(5,5,8,yval,yrowptr,ycolind);  b = yAr * x;  CompCol_Mat_double yAc;  yAc = yAr;  // upper diag  descra[1] = 2;  descra[2] = 0;  F77NAME(dcsrsm) (0, m, 1, 1, NULL, 1.0,           descra, yval, ycolind, yrowptr,           &b(0), m, 0.0, &y(1), m,           NULL, 0);  if (verbose) cout << "CSRSM y-x " << norm(y-x) << endl;  if (norm(y-x) > 1.e-12) {    errcount++;    if (verbose) {      cout << "b" << endl << b << endl;      cout << "x" << endl << x << endl;      cout << "y" << endl << y << endl;    }  }  // lower diag  descra[1] = 1;  descra[2] = 0;  F77NAME(dcscsm) (1, m, 1, 1, NULL, 1.0,           descra, yval, ycolind, yrowptr,           &b(0), m, 0.0, &y(1), m,           NULL, 0);  if (verbose) cout << "CSCSM y-x " << norm(y-x) << endl;  if (norm(y-x) > 1.e-12) {    errcount++;    if (verbose) {      cout << "b" << endl << b << endl;      cout << "x" << endl << x << endl;      cout << "y" << endl << y << endl;    }  }  F77NAME(dcsrsm) (1, m, 1, 1, NULL, 1.0,           descra, &yAc.val(0), &yAc.row_ind(0), &yAc.col_ptr(0),           &b(0), m, 0.0, &y(1), m,           NULL, 0);  if (verbose) cout << "CSRSM y-x " << norm(y-x) << endl;  if (norm(y-x) > 1.e-12) {    errcount++;    if (verbose) {      cout << "b" << endl << b << endl;      cout << "x" << endl << x << endl;      cout << "y" << endl << y << endl;    }  }  // lower diag  descra[1] = 2;  descra[2] = 0;  F77NAME(dcscsm) (0, m, 1, 1, NULL, 1.0,           descra, &yAc.val(0), &yAc.row_ind(0), &yAc.col_ptr(0),           &b(0), m, 0.0, &y(1), m,           NULL, 0);  if (verbose) cout << "CSCSM y-x " << norm(y-x) << endl;  if (norm(y-x) > 1.e-12) {    errcount++;    if (verbose) {      cout << "b" << endl << b << endl;      cout << "x" << endl << x << endl;      cout << "y" << endl << y << endl;    }  }/******************************************************************///                                                                ////                   [    1   4   0   0   0   ]                    ////                                                                ////                   |    0   1   7   0   0   |                    ////                                                                ////                   |    0   0   1   9   0   |                    ////                                                                ////                   |    0   0   0   1   0   |                    ////                                                                ////                   [    0   0   0   0   1   ]                    ////                                                                ///******************************************************************/  double zval[] = {1.0, 4.0, 1.0, 7.0, 1.0, 9.0, 1.0, 1.0};  int zcolind[] = {0,   1,   1,   2,   2,   3,   3,    4};  int zrowptr[] = {0,        2,        4,        6,    7,    8};  double aval[] = {4.0, 7.0, 9.0 };  int acolind[] = {1,   2,   3   };    int arowptr[] = {0,   1,  2, 3, 3, 3 };  CompRow_Mat_double zAr(5,5,8,zval,zrowptr,zcolind);  CompRow_Mat_double aAr(5,5,3,aval,arowptr,acolind);    b = zAr * x;  CompCol_Mat_double aAc;  aAc = aAr;  descra[0] = 0;  // upper unit  descra[1] = 2;  descra[2] = 1;  F77NAME(dcsrsm) (0, m, 1, 1, NULL, 1.0,           descra, aval, acolind, arowptr,           &b(0), m, 0.0, &y(1), m,           NULL, 0);  if (verbose) cout << "CSRSM y-x " << norm(y-x) << endl;  if (norm(y-x) > 1.e-12) {    errcount++;    if (verbose) {      cout << "b" << endl << b << endl;      cout << "x" << endl << x << endl;      cout << "y" << endl << y << endl;    }  }  F77NAME(dcscsm) (1, m, 1, 1, NULL, 1.0,           descra, aval, acolind, arowptr,           &b(0), m, 0.0, &y(1), m,           NULL, 0);  if (verbose) cout << "CSCSM y-x " << norm(y-x) << endl;  if (norm(y-x) > 1.e-12) {    errcount++;    if (verbose) {      cout << "b" << endl << b << endl;      cout << "x" << endl << x << endl;      cout << "y" << endl << y << endl;    }  }  // lower unit  descra[1] = 1;  descra[2] = 1;  F77NAME(dcsrsm) (1, m, 1, 1, NULL, 1.0,           descra, &aAc.val(0), &aAc.row_ind(0), &aAc.col_ptr(0),           &b(0), m, 0.0, &y(1), m,           NULL, 0);  if (verbose) cout << "CSRSM y-x " << norm(y-x) << endl;  if (norm(y-x) > 1.e-12) {    errcount++;    if (verbose) {      cout << "b" << endl << b << endl;      cout << "x" << endl << x << endl;      cout << "y" << endl << y << endl;    }  }  // upper unit  descra[1] = 2;  descra[2] = 1;  F77NAME(dcscsm) (0, m, 1, 1, NULL, 1.0,           descra, &aAc.val(0), &aAc.row_ind(0), &aAc.col_ptr(0),           &b(0), m, 0.0, &y(1), m,           NULL, 0);  if (verbose) cout << "CSCSM y-x " << norm(y-x) << endl;  if (norm(y-x) > 1.e-12) {    errcount++;    if (verbose) {      cout << "b" << endl << b << endl;      cout << "x" << endl << x << endl;      cout << "y" << endl << y << endl;    }  }  if (errcount > 0) {    cout << "There were " << errcount << "errors" << endl;    if (verbose == 0) {      cout << "Run again with -v to find out where" << endl;          }  } else {    cout << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl;    cout << "+   Successful completion of testing for SparseLib++   +" << endl;    cout << "+      No errors detected in Sparse BLAS routines.     +" << endl;    cout << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl;    cout << endl << endl;  }  return errcount;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -