MyMatrix< T > Class Template Reference

#include <matrix.h>

Inheritance diagram for MyMatrix< T >:

Inheritance graph
[legend]
List of all members.

Public Member Functions

int FactoLU ()
 perform LU facotrization
const int m ()
 return m dimention of the matrix
T & myMat ()
 cast to the childs classes
 MyMatrix (int t, int u)
const int n ()
 return n dimention of the matrix
double & operator() (int i, int j)
 access to the coordinate i,j
void print ()
 print to screen the matrix
void PrintToFile (FILE *file)
 print to file by opened FILE pointer
void PrintToFile (char *f)
 print to a given file(by filename) the matrix
int Solve (Vector *residu)
 solve the system Ax=b where b is residu parameter and A is current class.
 ~MyMatrix ()

Protected Attributes

int _m
 dimensions of the matrix
int _n
double * matrix
 data array to store the matrix
int * pivot
 pivot used to perform facto LU

Detailed Description

template<class T>
class MyMatrix< T >

Generic matrix class. The template trick is a nackmann template heritance

Definition at line 51 of file matrix.h.


Constructor & Destructor Documentation

template<class T>
MyMatrix< T >::MyMatrix ( int  t,
int  u 
) [inline]

Definition at line 55 of file matrix.h.

00055 {_m = t;_n = u;};

template<class T>
MyMatrix< T >::~MyMatrix (  )  [inline]

Definition at line 56 of file matrix.h.

00056 {};


Member Function Documentation

template<class T>
int MyMatrix< T >::FactoLU (  )  [inline]

perform LU facotrization

Reimplemented in BandeMatrix, and FullMatrix.

Definition at line 67 of file matrix.h.

00067                {
00068     return myMat().FactoLU();
00069   }

template<class T>
const int MyMatrix< T >::m (  )  [inline]

return m dimention of the matrix

Definition at line 100 of file matrix.h.

Referenced by ShapeMatrix< _Vec_, Dim >::build_least_square_rhs(), ShapeMatrix< _Vec_, Dim >::build_node_shape(), ShapeMatrix< _Vec_, Dim >::buildContinuConstraint(), ShapeMatrix< _Vec_, Dim >::buildFormeFaibleCMatrix(), ShapeMatrix< _Vec_, Dim >::buildLeastSquareMatrix(), ShapeMatrix< _Vec_, Dim >::changeAtomIndirection(), ShapeMatrix< _Vec_, Dim >::correct_forme_faible(), ShapeMatrix< _Vec_, Dim >::GetRelatedAtomsToElem(), ShapeMatrix< _Vec_, Dim >::InterpolateAtom(), FullMatrix::MatProduct(), ShapeMatrix< _Vec_, Dim >::operator()(), and ShapeMatrix< _Vec_, Dim >::print().

00100                {
00101     return _m;
00102   }

template<class T>
T& MyMatrix< T >::myMat (  )  [inline]

cast to the childs classes

Definition at line 59 of file matrix.h.

Referenced by MyMatrix< BandeMatrix >::FactoLU(), MyMatrix< BandeMatrix >::operator()(), MyMatrix< BandeMatrix >::PrintToFile(), and MyMatrix< BandeMatrix >::Solve().

00059 {return static_cast<T&>(*this);}

template<class T>
const int MyMatrix< T >::n (  )  [inline]

return n dimention of the matrix

Definition at line 105 of file matrix.h.

Referenced by ShapeMatrix< _Vec_, Dim >::build_least_square_rhs(), ShapeMatrix< _Vec_, Dim >::build_node_shape(), ShapeMatrix< _Vec_, Dim >::buildContinuConstraint(), ShapeMatrix< _Vec_, Dim >::buildFormeFaibleCMatrix(), ShapeMatrix< _Vec_, Dim >::buildLeastSquareMatrix(), ShapeMatrix< _Vec_, Dim >::correct_forme_faible(), ShapeMatrix< _Vec_, Dim >::GetRelatedNodesToElem(), ShapeMatrix< _Vec_, Dim >::InterpolateAtom(), FullMatrix::MatProduct(), and ShapeMatrix< _Vec_, Dim >::operator()().

00105                {
00106     return _n;
00107   }

template<class T>
double& MyMatrix< T >::operator() ( int  i,
int  j 
) [inline]

access to the coordinate i,j

Reimplemented in BandeMatrix, DiagMatrix, and FullMatrix.

Definition at line 62 of file matrix.h.

00062                                   {
00063     return myMat()(i,j);
00064   }

template<class T>
void MyMatrix< T >::print (  )  [inline]

print to screen the matrix

Definition at line 77 of file matrix.h.

Referenced by ShapeMatrix< _Vec_, Dim >::print().

00077               {
00078     PrintToFile(stdout);
00079   };

template<class T>
void MyMatrix< T >::PrintToFile ( FILE *  file  )  [inline]

print to file by opened FILE pointer

Definition at line 89 of file matrix.h.

00089                               {
00090     for (int i=0;i< _m;++i)
00091       for (int j=0;j< _n;++j)
00092         {
00093           //      LOG(i+1 << "\t" << j+1 << "\n" << myMat()(i,j),0);
00094           if (myMat()(i,j) != 0)
00095             fprintf(file,"%d\t%d\t%.15e\n",i+1,j+1,myMat()(i,j));
00096         }
00097   };

template<class T>
void MyMatrix< T >::PrintToFile ( char *  f  )  [inline]

print to a given file(by filename) the matrix

Definition at line 82 of file matrix.h.

Referenced by FormeFaible< DomainA, DomainC, Dim >::BuildAtomsConstraintMatrix(), MyMethodFull< DomainA, DomainC, Dim >::BuildConstraintMatrix(), FormeFaible< DomainA, DomainC, Dim >::BuildContinuConstraintMatrix(), ShapeMatrix< _Vec_, Dim >::buildLeastSquareMatrix(), MyMatrix< BandeMatrix >::print(), and MyMatrix< BandeMatrix >::PrintToFile().

00082                             {
00083     FILE * file = fopen(f,"wb+");
00084     PrintToFile(file);
00085     fclose(file);
00086   };

template<class T>
int MyMatrix< T >::Solve ( Vector residu  )  [inline]

solve the system Ax=b where b is residu parameter and A is current class.

Reimplemented in BandeMatrix, and FullMatrix.

Definition at line 72 of file matrix.h.

00072                             {
00073     return myMat().Solve(residu);
00074   }


Member Data Documentation

template<class T>
int MyMatrix< T >::_m [protected]

dimensions of the matrix

Definition at line 112 of file matrix.h.

Referenced by MyMatrix< BandeMatrix >::m(), MyMatrix< BandeMatrix >::MyMatrix(), and MyMatrix< BandeMatrix >::PrintToFile().

template<class T>
int MyMatrix< T >::_n [protected]

Definition at line 112 of file matrix.h.

Referenced by MyMatrix< BandeMatrix >::MyMatrix(), MyMatrix< BandeMatrix >::n(), and MyMatrix< BandeMatrix >::PrintToFile().

template<class T>
double* MyMatrix< T >::matrix [protected]

data array to store the matrix

Definition at line 116 of file matrix.h.

Referenced by FullMatrix::MatProduct().

template<class T>
int* MyMatrix< T >::pivot [protected]

pivot used to perform facto LU

Definition at line 114 of file matrix.h.


The documentation for this class was generated from the following file:
Generated on Fri Sep 7 13:13:24 2007 for LibMultiScale by  doxygen 1.5.2