Changeset 19 for bdm/math

Show
Ignore:
Timestamp:
02/16/08 15:12:24 (16 years ago)
Author:
smidl
Message:

Switch to CMake

Location:
bdm/math
Files:
1 removed
2 modified

Legend:

Unmodified
Added
Removed
  • bdm/math/libDC.cpp

    r18 r19  
    2222 
    2323ldmat::ldmat() { 
    24         vec D ; 
    25         mat L; 
    2624        dim = 0; 
     25} 
     26 
     27ldmat::ldmat(const vec D0) { 
     28        D = D0; 
     29        dim = D0.length(); 
     30        L = eye(dim); 
    2731} 
    2832 
     
    6569        os << "L:" << ld.L << endl; 
    6670        os << "D:" << ld.D << endl; 
     71        return os; 
    6772} 
    6873 
     
    165170// sum logarithms of diagobal elements 
    166171        for ( i=0; i<D.length(); i++ ){ldet+=log( D( i ) );}; 
     172        return ldet; 
    167173} 
    168174 
     
    182188        int i; 
    183189        for ( i=0;i<D.length();i++ ){D( i )*=x;}; 
     190        return *this; 
    184191} 
    185192 
     
    187194        int i,j; 
    188195        vec res( dim ); 
    189         double sum; 
     196        //double sum; 
    190197        for ( i=0;i<dim;i++ ) {//for each element of result 
    191198                res( i ) = 0.0; 
     
    194201                } 
    195202        } 
    196         vec res2 = L.transpose()*diag( sqrt( D ) )*x; 
    197         return res2; 
     203//      vec res2 = L.transpose()*diag( sqrt( D ) )*x; 
     204        return res; 
    198205} 
    199206 
  • bdm/math/libDC.h

    r14 r19  
    114114        //! Construct by decomposition of full matrix V. 
    115115        ldmat( mat V ); 
     116        //! Construct diagonal matrix with diagonal D0 
     117        ldmat( vec D0 ); 
    116118        ldmat (); 
    117119 
     
    170172inline ldmat& ldmat::operator += (const ldmat &ldA)  {this->add(ldA);return *this;} 
    171173inline 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();} 
     174inline int ldmat::cols(){return dim;} 
     175inline int ldmat::rows(){return dim;} 
    174176 
    175177#endif // DC_H