00001 #ifndef __F4TriDiagonalMatrix_H__ 00002 #define __F4TriDiagonalMatrix_H__ 00003 00004 00005 00025 #include <stdio.h> 00026 #include "Float4Vector.hpp" 00027 00028 class F4TriDiagonalMatrix 00029 { 00030 private: 00031 00032 int N; 00033 00034 Float4Vector* up; // N-1 size upper diagonal 00035 Float4Vector* d; // N size diagonal 00036 Float4Vector* low; // N-1 size lower diagonal 00037 00038 public: 00039 00040 F4TriDiagonalMatrix(int asize); 00041 F4TriDiagonalMatrix(const F4TriDiagonalMatrix& v); 00042 F4TriDiagonalMatrix operator=(const F4TriDiagonalMatrix& v); 00043 00044 ~F4TriDiagonalMatrix(){ delete d; delete up; delete low;} 00045 00046 F4TriDiagonalMatrix t(); 00047 00048 void load(F4TriDiagonalMatrix* m); 00049 void load(Float4Vector* u1, Float4Vector* d1, Float4Vector* l1); 00050 00051 inline int size()const { return (3*N-2); } 00052 00053 inline int getWidth()const { return N; } 00054 inline int getHeight()const { return N; } 00055 00056 inline Float4Vector* getUvalues(){ return up; } 00057 inline Float4Vector* getDvalues(){ return d; } 00058 inline Float4Vector* getLvalues(){ return low; } 00059 00060 inline float* getD0(){return d->get0();} 00061 inline float* getU0(){return up->get0();} 00062 inline float* getL0(){return low->get0();} 00063 00064 inline float* getD(){return d->get();} 00065 inline float* getU(){return up->get();} 00066 inline float* getL(){return low->get();} 00067 00068 // base 0 00069 void set0(int line, int i, int j, float value); 00070 float get0(int line, int i, int j)const ; 00071 00072 inline void setD0(int line, int i, float value){ d->set0(line, i, value); } 00073 inline float getD0(int line, int i)const { return d->get0(line, i); } 00074 00075 inline void setU0(int line, int i, float value){ up->set0(line, i, value); } 00076 inline float getU0(int line, int i)const { return up->get0(line, i); } 00077 00078 inline void setL0(int line, int i, float value){ low->set0(line, i, value); } 00079 inline float getL0(int line, int i)const { return low->get0(line, i); } 00080 00081 // base 1 00082 void set(int line, int i, int j, float value); 00083 float get(int line, int i, int j)const ; 00084 00085 inline void setD(int line, int i, float value){ d->set(line, i, value); } 00086 inline float getD(int line, int i)const { return d->get(line, i); } 00087 00088 inline void setU(int line, int i, float value){ up->set(line, i, value); } 00089 inline float getU(int line, int i)const { return up->get(line, i); } 00090 00091 inline void setL(int line, int i, float value){ low->set(line, i, value); } 00092 inline float getL(int line, int i)const { return low->get(line, i); } 00093 00094 00095 // computations 00096 float det(int line); 00097 float trace(int line); 00098 00099 00100 float norme2(int line); 00101 float sum(int line); 00102 00103 float minimum(int line); 00104 float maximum(int line); 00105 float mean(int line){ return sum(line)/size(); } 00106 float sigma(int line); 00107 00108 00109 void output(); 00110 void output(FILE* file); 00111 }; 00112 00113 #endif 00114 00115