cg_test.cpp

来自「矩阵运算源码最新版本」· C++ 代码 · 共 26 行

CPP
26 行
字号
#include <boost/numeric/mtl/mtl.hpp>#include <boost/numeric/itl/cg.hpp>#include <boost/numeric/itl/itl.hpp>using namespace mtl;using namespace itl;int main(){  // For a more realistic example set size to 1000 or larger  const int size = 100, N = size * size;  compressed2D<double> A(N, N);  matrix::laplacian_setup(A, size, size);  dense_vector<double> x(N, 1.0), b(N);  b = A * x;  x= 0;  noisy_iteration<double> iter(b, N, 1.e-6);  cg(A, x, b, iter);  return 0;}

⌨️ 快捷键说明

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