Legend:
- Unmodified
- Added
- Removed
-
bdm/math/libDC.cpp
r18 r19 22 22 23 23 ldmat::ldmat() { 24 vec D ;25 mat L;26 24 dim = 0; 25 } 26 27 ldmat::ldmat(const vec D0) { 28 D = D0; 29 dim = D0.length(); 30 L = eye(dim); 27 31 } 28 32 … … 65 69 os << "L:" << ld.L << endl; 66 70 os << "D:" << ld.D << endl; 71 return os; 67 72 } 68 73 … … 165 170 // sum logarithms of diagobal elements 166 171 for ( i=0; i<D.length(); i++ ){ldet+=log( D( i ) );}; 172 return ldet; 167 173 } 168 174 … … 182 188 int i; 183 189 for ( i=0;i<D.length();i++ ){D( i )*=x;}; 190 return *this; 184 191 } 185 192 … … 187 194 int i,j; 188 195 vec res( dim ); 189 double sum;196 //double sum; 190 197 for ( i=0;i<dim;i++ ) {//for each element of result 191 198 res( i ) = 0.0; … … 194 201 } 195 202 } 196 vec res2 = L.transpose()*diag( sqrt( D ) )*x;197 return res 2;203 // vec res2 = L.transpose()*diag( sqrt( D ) )*x; 204 return res; 198 205 } 199 206 -
bdm/math/libDC.h
r14 r19 114 114 //! Construct by decomposition of full matrix V. 115 115 ldmat( mat V ); 116 //! Construct diagonal matrix with diagonal D0 117 ldmat( vec D0 ); 116 118 ldmat (); 117 119 … … 170 172 inline ldmat& ldmat::operator += (const ldmat &ldA) {this->add(ldA);return *this;} 171 173 inline ldmat& ldmat::operator -= (const ldmat &ldA) {this->add(ldA,-1.0);return *this;} 172 inline int ldmat::cols(){return L.cols();}173 inline int ldmat::rows(){return L.rows();}174 inline int ldmat::cols(){return dim;} 175 inline int ldmat::rows(){return dim;} 174 176 175 177 #endif // DC_H