Toast++  1.0.2 (r.539)
Forward and inverse modelling in optical tomography
crmatrix_cm.h
1 // -*-C++-*-
2 // ==========================================================================
3 // Module mathlib
4 // File crmatrix_cm.h
5 // Declaration of class SCCompRowMatrixMixed ("complex mixed")
6 //
7 // This is derived from TCompRowMatrix<scomplex> and adds some methods
8 // for double precision complex arguments.
9 //
10 // Inheritance:
11 // ------------
12 // TGenericSparseMatrix<scomplex>
13 // ----> TCompRowMatrix<scomplex>
14 // ----> SCCompRowMatrixMixed
15 // ==========================================================================
16 
17 #ifndef __CRMATRIX_CM
18 #define __CRMATRIX_CM
19 
20 #include "crmatrix.h"
21 
22 // ==========================================================================
23 // Nonmember declarations
24 
27 
28 int GMRES (const SCCompRowMatrixMixed &A, const CVector &b, CVector &x,
29  double &tol, const SCPreconditionerMixed *precon = 0, int restart = 10,
30  int maxit = 0, void (*clbk)(void*) = 0);
31 // Specialised GMRES solver using a single-precision complex compressed row
32 // matrix, and double precision complex vectors.
33 
34 // ==========================================================================
35 // class SCCompRowMatrixMixed
36 
37 class SCCompRowMatrixMixed: public TCompRowMatrix<std::complex<float> > {
38 public:
39  // constructors, destructor
41  SCCompRowMatrixMixed (int rows, int cols);
42  SCCompRowMatrixMixed (int rows, int cols,
43  const idxtype *_rowptr, const idxtype *_colidx,
44  const std::complex<float> *data = 0);
47 
48  int SparseRow (int r, idxtype *ci, std::complex<double> *rv) const;
49 
50  // matrix x vector methods using double precision vectors
51  void Ax (const CVector &x, CVector &b) const;
52  void Ax (const CVector &x, CVector &b, int r1, int r2) const;
53  void ATx (const CVector &x, CVector &b) const;
54 
55  // mixed precision operators
56  inline CVector operator* (const CVector &x) const
57  { CVector b; Ax (x, b); return b; }
58  // matrix x vector multiplication
59 };
60 
61 #endif // !__CRMATRIX_CM
Definition: crmatrix_cm.h:37
Compressed-row sparse matrix class.
Definition: cdmatrix.h:27
Definition: precon.h:238