00001 #ifndef __RealBlockSMatrix_H__
00002 #define __RealBlockSMatrix_H__
00003
00004
00005
00040 #include <stdio.h>
00041 #include "RealSMatrix.hpp"
00042
00043 class RealBlockSMatrix
00044 {
00045 private:
00046
00047 int width;
00048
00049 int n;
00050 int localWidth;
00051 RealSMatrix** data;
00052
00053 public:
00054
00055 RealBlockSMatrix(int n, int lwidth);
00056 RealBlockSMatrix(int n, const RealSMatrix& m);
00057 RealBlockSMatrix(const RealBlockSMatrix& m);
00058 RealBlockSMatrix operator=(const RealBlockSMatrix& m);
00059
00060 ~RealBlockSMatrix();
00061
00062 RealBlockSMatrix* copy();
00063
00064 RealBlockSMatrix* AtA(RealBlockSMatrix* dest=0);
00065
00066 RealBlockSMatrix t();
00067
00068 int numberOItems(){ return n*n; }
00069 int getXitems(){ return n; }
00070 int getYitems(){ return n; }
00071
00072 int getItemWidth()const { return localWidth; }
00073 int getItemHeight()const { return localWidth; }
00074
00075 int size(){ return width*width; }
00076
00077 int getWidth()const { return width; }
00078 int getHeight()const { return width; }
00079
00080
00081 void set0(int i, int j, RealSMatrix* value){ data[i][j]= value; }
00082 RealSMatrix* get0(int i, int j)const { return data[i][j]; }
00083
00084
00085 void set(int i, int j, RealSMatrix* value){ data[i-1][j-1]= value; }
00086 RealSMatrix* get(int i, int j)const { return data[i-1][j-1]; }
00087
00088
00089
00090 void set0(int i, int j, double value);
00091 double get0(int i, int j)const;
00092
00093
00094 void set(int i, int j, double value);
00095 double get(int i, int j)const;
00096
00097
00098 void setAll(double value=0.0);
00099 void set(RealBlockSMatrix* from);
00100
00101
00102 RealBlockSMatrix* multA_X(RealBlockSMatrix* dest);
00103
00104 void addA_kX(RealBlockSMatrix& dest, double k=1.0);
00105 void addA_k_vvT(RealVector& v, double k=1.0);
00106 double vTAv(RealVector& v);
00107 double rayleighQuotient(RealVector& v){return vTAv(v)/v.vT_v();}
00108
00109 double det();
00110 double trace();
00111 double cond();
00112
00113
00114 double normeMin();
00115 double normeInfinite();
00116 double norme2();
00117 double normeF();
00118
00119 double sum();
00120
00121 double minimum();
00122 double maximum();
00123 double mean(){ return sum()/size(); }
00124 double sigma();
00125
00126
00127 RealBlockSMatrix* jacobiEV(RealVector* dEigenValue, RealBlockSMatrix* vEigenVector);
00128
00129
00130 RealBlockSMatrix sqrt();
00131 RealBlockSMatrix pow(double pow);
00132 RealBlockSMatrix sqr();
00133 RealBlockSMatrix exp();
00134 RealBlockSMatrix log();
00135 RealBlockSMatrix log(double base);
00136
00137 RealBlockSMatrix sin();
00138 RealBlockSMatrix cos();
00139 RealBlockSMatrix tan();
00140
00141
00142
00143
00144
00145 void operator+=(double value);
00146 void operator-=(double value);
00147 void operator*=(double value);
00148 void operator/=(double value);
00149
00150
00151 void operator+=(const RealBlockSMatrix& m);
00152 void operator-=(const RealBlockSMatrix& m);
00153 void operator*=(const RealBlockSMatrix& m);
00154
00155
00156 friend RealVectorT operator*(const RealVectorT& vt, const RealBlockSMatrix& m);
00157 friend RealVector operator*(const RealBlockSMatrix& m, const RealVector& v);
00158
00159 void output();
00160 void output(FILE* file);
00161 };
00162
00163 #endif
00164
00165