Actual source code: taomat_ga.h
1: //File: taomat_ga.h
2: /**************************************************************
4: Author: Limin Zhang, Ph.D.
5: Mathematics Department
6: Columbia Basin College
7: Pasco, WA 99301
8: Limin.Zhang@cbc2.org
10: Mentor: Jarek Naplocha, Ph.D.
11: Environmental Molecular Science Laboratory
12: Pacific Northwest National Laboratory
13: Richland, WA 99352
15: Date: 7/11/2002
17: Purpose:
18: to design and implement TaoMatrix using
19: global arrays.
21: Revise history:
23: 8/8/02
24: To clean Petsc function calls and marcos.
26: **************************************************************/
30: #ifndef TAOGAMAT_H
31: #define TAOGAMAT_H
33: typedef int GAMat;
35: //ga header files
36: #include "taovec_ga.h" //to define tao/ga vector class
37: #include "ga.h" //to define GA lib functions
39: //tao header files
40: #include taolinearsolver.h
41: #include "tao_solver.h"
42: #include taomat.h
44: class TaoMatGa:public TaoMat
45: {
47: protected:
49: GAMat pm;
50: GAMat pm_pre;
52: public:
54: TaoMatGa (GAMat M);
55: ~TaoMatGa ()
56: {
57: if (this->pm)
58: GA_Destroy (this->pm);
59: }
61: inline GAMat GetMat ()
62: {
63: return this->pm;
64: }
66: /*The user of this function is responsible to free the memory of "this"
67: before resplace it with a different vector. i
68: Otherwise, there is a possible memory leak.
69: */
70: inline int replaceMat (GAMat M)
71: {
72: this->pm = M;
73: return 0;
74: }
76: int Compatible (TaoVec *, TaoVec *, TaoTruth*);
77: int Clone (TaoMat **);
78: int CopyFrom (TaoMat *);
80: int Fill (TaoScalar);
81: int Zero ();
82: int GetDimensions (int *, int *);
84: int Multiply (TaoVec *, TaoVec *);
85: int MultiplyAdd (TaoVec *, TaoVec *, TaoVec *);
86: int MultiplyTranspose (TaoVec *, TaoVec *);
87: int MultiplyTransposeAdd (TaoVec *, TaoVec *, TaoVec *);
89: int SetDiagonal (TaoVec *);
90: int AddDiagonal (TaoVec *);
91: int GetDiagonal (TaoVec *);
92: int ShiftDiagonal (double);
94: int View ();
96: /* These routines not implemented */
97: int RowScale (TaoVec *);
98: int ColScale (TaoVec *);
100: int Presolve ();
101: int Solve (TaoVec *, TaoVec *, TaoTruth *);
103: int CreateReducedMatrix (TaoIndexSet *, TaoIndexSet *, TaoMat **);
104: int SetReducedMatrix (TaoMat *, TaoIndexSet *, TaoIndexSet *);
106: int D_Fischer (TaoVec *, TaoVec *, TaoVec *, TaoVec *,
107: TaoVec *, TaoVec *, TaoVec *, TaoVec *);
109: int Norm1 (double *);
111: friend class TaoGAApplication;
113: };
115: int TaoWrapGaMat (GAMat, TaoMatGa **);
117: #endif