work/mixpp/libDC.h

Go to the documentation of this file.
00001 
00013 #ifndef DC_H
00014 #define DC_H
00015 
00016 #include <itpp/itbase.h>
00017 
00018 using namespace itpp;
00019 
00024 class sqmat {
00025 public:
00033         virtual void opupdt( const vec &v, double w ) =0;
00034 
00038         virtual mat to_mat() =0;
00039 
00044         virtual void mult_sym( const mat &C, bool trans=true ) =0;
00045 
00046         
00051         virtual double logdet() =0;
00052 
00057         virtual double qform(vec &v) =0;
00058 
00059 //      //! easy version of the 
00060 //      sqmat inv();
00061 
00062         friend std::ostream &operator<< ( std::ostream &os, sqmat &sq );
00063 
00065         virtual void clear() =0;
00066         
00068         virtual int cols() =0;
00069 
00071         virtual int rows() =0;
00072 
00073 };
00074 
00075 
00080 class fsqmat: sqmat {
00081         void opupdt( const vec &v, double w );
00082         mat to_mat();
00083         void mult_sym( const mat &C, bool trans=false );
00084    void mult_sym( const mat &C, fsqmat &U, bool trans=false );
00085         void inv(fsqmat &Inv);
00086         void clear();
00087         
00089         fsqmat(const mat &M);
00090         
00096         virtual void inv(fsqmat* Inv);
00097 };
00098 
00099 class ldmat: sqmat {
00100 public:
00101 
00103         ldmat( const mat &L, const vec &D );
00105         ldmat( mat V );
00106         ldmat ();
00107 
00108         // Reimplementation of compulsory operatios
00109 
00110         void opupdt( const vec &v, double w );
00111         mat to_mat();
00112    void mult_sym( const mat &C, bool trans=false );
00113         void add ( const ldmat &ld2, double w=1.0 );
00114         double logdet();
00115         double qform(vec &v);
00116 //      sqmat& operator -= ( const sqmat & ld2 );
00117         void clear();
00118         int cols();
00119         int rows();
00120 
00126         virtual void inv(ldmat &Inv);
00127         
00133    void mult_sym( const mat &C, ldmat &U, bool trans=false );
00134 
00135         ldmat& operator += (const ldmat &ldA);
00136         ldmat& operator -= (const ldmat &ldA);
00137         ldmat& operator *= (double x);
00138         
00139 protected:
00140         vec D;
00141         mat L;
00142 
00143 };
00144 
00146 
00147 inline ldmat& ldmat::operator += (const ldmat &ldA)  {this->add(ldA);return *this;}
00148 inline ldmat& ldmat::operator -= (const ldmat &ldA)  {this->add(ldA,-1.0);return *this;}
00149 inline int ldmat::cols(){return L.cols();}
00150 inline int ldmat::rows(){return L.rows();}
00151 
00152 #endif // DC_H

Generated on Wed Jan 23 11:30:10 2008 for mixpp by  doxygen 1.5.3