NeoPZ
pzshtmat.h
Go to the documentation of this file.
1 
6 #ifndef SHTMATRIXHPP
7 #define SHTMATRIXHPP
8 
9 #include <iostream>
10 
17 template <class TObj>
18 class TPZGenMatrix {
19 
20 protected:
22  TObj *fMem;
24  int64_t fRows, fCols;
25 
26 public:
27 
29  TPZGenMatrix ();
31  TPZGenMatrix (const int64_t rows ,const int64_t columns);
32 
39  TPZGenMatrix (const TPZGenMatrix & A);
40 
41  ~TPZGenMatrix();
42 
43  void Print (const char *mess,std::ostream & out = std::cout) const;
44 
45  int64_t Rows() const {return fRows;}
46 
47  int64_t Cols() const {return fCols;}
48 
49  void Resize(const int64_t newrow,const int64_t newcol);
50 
51  //DEFINE OPERATORS
52 
53  TPZGenMatrix<TObj>& operator=(const TPZGenMatrix<TObj> & rval); //makes this.p = rval.p
54 
55 
56  TObj & operator()(const int64_t row,const int64_t column = 0) const; //get value, set value
57 
58 };
59 
63 template <class TObj>
64 class TPZGenAMatrix : public TPZGenMatrix<TObj> {
65 
66  TPZGenAMatrix () : TPZGenMatrix<TObj>() {} //creates NULL matrix
67 
68  TPZGenAMatrix (const int64_t rows ,const int64_t columns) : TPZGenMatrix<TObj>(rows,columns) {} //creates a rowsXcolumns matrix
69 
70  TPZGenAMatrix operator+(const TPZGenAMatrix<TObj> & rval) const;
71 
72  TPZGenAMatrix operator+(const TObj x) const;
73 
74  // friend TPZGenAMatrix operator+(const TObj x, const TPZGenAMatrix<TObj>& rval); // {return (rval+x);}
75 
76  TPZGenAMatrix operator-(const TPZGenAMatrix<TObj> & rval) const;
77 
78  TPZGenAMatrix operator-(const TObj rval) const;
79 
80  // friend TPZGenAMatrix operator-(const TObj x, const TPZGenAMatrix<TObj>& rval); // {return ((-rval)+x);}
81 
82  TPZGenAMatrix operator-() const;
83 
84  TPZGenAMatrix operator*(const TPZGenAMatrix<TObj> & rval) const;
85 
86  TPZGenAMatrix operator*(const TObj rval) const;
87 
88  // friend TPZGenAMatrix operator*(const TObj x, const TPZGenAMatrix<TObj>& rval); // {return (rval*x);}
89 
90  TPZGenAMatrix<TObj>& operator+=(const TPZGenAMatrix<TObj> & rval);
91 
92  TPZGenAMatrix<TObj>& operator+=(const TObj x);
93 
95 
96  TPZGenAMatrix<TObj>& operator-=(const TObj x);
97 
98  TPZGenAMatrix<TObj>& operator*=(const TObj x);
99 
100 
101  TPZGenAMatrix<TObj> Transpose() const;
102 
103 
104 };
105 
108 #endif
109 
TPZFlopCounter operator+(double val1, const TPZFlopCounter &val2)
Performs . Doesn&#39;t increments counters.
Definition: pzreal.h:595
Implements a generic matrix of objects which implement arithmetic operations. Matrix.
Definition: pzshtmat.h:64
void Print(const char *mess, std::ostream &out=std::cout) const
Definition: pzshtmat.cpp:269
TPZVec< T > & operator-=(TPZVec< T > &a, const TPZVec< T > &b)
substracts two vectors
Definition: pzvec_extras.h:80
TPZGenMatrix()
Constructor creating Null matrix.
Definition: pzshtmat.cpp:12
void Resize(const int64_t newrow, const int64_t newcol)
Definition: pzshtmat.cpp:54
int64_t fRows
Number of rows and columns.
Definition: pzshtmat.h:24
TObj & operator()(const int64_t row, const int64_t column=0) const
Definition: pzshtmat.cpp:217
TPZFlopCounter operator-(double val1, const TPZFlopCounter &val2)
Performs . Doesn&#39;t increments counters.
Definition: pzreal.h:611
TPZGenAMatrix(const int64_t rows, const int64_t columns)
Definition: pzshtmat.h:68
Implements generic class which holds a matrix of objects. Matrix.
Definition: pzshtmat.h:18
TObj * fMem
Pointer to matrix.
Definition: pzshtmat.h:22
int64_t Cols() const
Definition: pzshtmat.h:47
int64_t Rows() const
Definition: pzshtmat.h:45
TPZFlopCounter operator*(double val1, const TPZFlopCounter &val2)
Performs . Doesn&#39;t increments counters.
Definition: pzreal.h:579
TPZGenMatrix< TObj > & operator=(const TPZGenMatrix< TObj > &rval)
Definition: pzshtmat.cpp:79
int64_t fCols
Definition: pzshtmat.h:24