Changeset 24
- Timestamp:
- 02/19/08 13:48:02 (17 years ago)
- Files:
-
- 3 modified
Legend:
- Unmodified
- Added
- Removed
-
bdm/math/libDC.cpp
r22 r24 186 186 } 187 187 188 double ldmat::qform( vec &v ) {188 double ldmat::qform( const vec &v ) { 189 189 double x = 0.0, sum; 190 190 int i,j; … … 204 204 } 205 205 206 vec ldmat::sqrt_mult( vec &x ) {206 vec ldmat::sqrt_mult( const vec &x ) { 207 207 int i,j; 208 208 vec res( dim ); -
bdm/math/libDC.h
r22 r24 57 57 Used e.g. in generating normal samples. 58 58 */ 59 virtual vec sqrt_mult ( vec &v ) =0;59 virtual vec sqrt_mult (const vec &v ) =0; 60 60 61 61 /*! … … 63 63 64 64 */ 65 virtual double qform ( vec &v ) =0;65 virtual double qform (const vec &v ) =0; 66 66 67 67 // //! easy version of the … … 110 110 111 111 double logdet() {return log ( det ( M ) );}; 112 double qform ( vec &v ) {return ( v* ( M*v ) );};113 vec sqrt_mult ( vec &v ) {it_error ( "not implemented" );return v;};112 double qform (const vec &v ) {return ( v* ( M*v ) );}; 113 vec sqrt_mult (const vec &v ) {it_error ( "not implemented" );return v;}; 114 114 115 115 fsqmat& operator += ( const fsqmat &A ) {M+=A.M;return *this;}; … … 138 138 void add ( const ldmat &ld2, double w=1.0 ); 139 139 double logdet(); 140 double qform ( vec &v );140 double qform (const vec &v ); 141 141 // sqmat& operator -= ( const sqmat & ld2 ); 142 142 void clear(); 143 143 int cols(); 144 144 int rows(); 145 vec sqrt_mult ( vec &v );145 vec sqrt_mult ( const vec &v ); 146 146 147 147 /*! \brief Matrix inversion preserving the chosen form. -
tests/test0.cpp
r18 r24 44 44 mat V = "1 2; 2 3"; 45 45 ldmat lV(V); 46 // cout << "ld:" << lV.to_mat() << "eye:"<< I <<endl; 46 ldmat ilV(V); 47 lV.inv(ilV); 48 cout << "ld:" << lV << "eye:"<< V*(ilV.to_mat()) <<endl; 47 49 48 50