cmatrixc.h

来自「ARPACK is a collection of Fortran77 subr」· C头文件 代码 · 共 69 行

H
69
字号
/*   ARPACK++ v1.0 8/1/1997   c++ interface to ARPACK code.   MODULE CMatrixC.h   Class template for the stiffness matrix formed by using   piecewise linear elements on [0,1].   ARPACK Authors      Richard Lehoucq      Danny Sorensen      Chao Yang      Dept. of Computational & Applied Mathematics      Rice University      Houston, Texas*/#ifndef CMATRIXC_H#define CMATRIXC_H#include "arcomp.h"#include "matprod.h"template<class T>class ComplexMatrixC: public MatrixWithProduct<arcomplex<T> > { public:  void MultMv(arcomplex<T>* v, arcomplex<T>* w);  // Matrix vector multiplication w <- A*v.  ComplexMatrixC(int nx): MatrixWithProduct<arcomplex<T> >(nx) { }  // Constructor}; // ComplexMatrixC.template<class T>void ComplexMatrixC<T>::MultMv(arcomplex<T>* v, arcomplex<T>* w){  int          j;  arcomplex<T> dd, dl, du, s, h;  const arcomplex<T> one( 1.0, 0.0);  const arcomplex<T> two( 2.0, 0.0);  const arcomplex<T> rho(10.0, 0.0);  h  = one/arcomplex<T>((ncols()+1),0.0);  s  = rho/two;  dd = two/h;  dl = -one/h - s;  du = -one/h + s;  w[0] = dd*v[0] + du*v[1];  for (j=1; j<ncols()-1; j++) {    w[j] = dl*v[j-1] + dd*v[j] + du*v[j+1];  }  w[ncols()-1] = dl*v[ncols()-2] + dd*v[ncols()-1];} //  MultMv.#endif // CMATRIXC_H

⌨️ 快捷键说明

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