Changeset 76 for bdm/math/chmat.cpp
- Timestamp:
- 04/18/08 14:01:20 (16 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
bdm/math/chmat.cpp
r39 r76 11 11 mat Z; 12 12 mat R; 13 mat Q; 14 Z = concat_vertical ( Ch,mat(w*v) ); 15 qr ( Z,Q,R ); 13 mat V(1,v.length()); 14 V.set_row(0,v*w); 15 Z = concat_vertical ( Ch,V ); 16 qr ( Z,R ); 16 17 Ch = R ( 0, Ch.rows()-1, 0, Ch.cols()-1 ); 17 18 }; 18 inline mat chmat::to_mat() {mat F=Ch.T()*Ch;return F;};19 inline mat chmat::to_mat() {mat F=Ch.T() *Ch;return F;}; 19 20 void chmat::mult_sym ( const mat &C ) { 20 it_error("not implemented");21 it_error ( "not implemented" ); 21 22 }; 22 void chmat::mult_sym ( const mat &C , chmat &U ) const {23 it_error("not implemented");23 void chmat::mult_sym ( const mat &C , chmat &U ) const { 24 it_error ( "not implemented" ); 24 25 }; 25 26 void chmat::mult_sym_t ( const mat &C ) { 26 it_error("not implemented");27 it_error ( "not implemented" ); 27 28 }; 28 29 void chmat::mult_sym_t ( const mat &C, chmat &U ) const { 29 it_error("not implemented");30 it_error ( "not implemented" ); 30 31 }; 31 32 double chmat::logdet() const { 32 33 double ldet=0.0; int i; 33 34 //sum of logs of (possibly negative!) diagonal entries 34 for ( i=0;i<Ch.rows();i++ ) {ldet+=log ( std::fabs(Ch ( i,i )) );}35 for ( i=0;i<Ch.rows();i++ ) {ldet+=log ( std::fabs ( Ch ( i,i ) ) );} 35 36 return 2*ldet; //compensate for Ch being sqrt() 36 37 }; … … 38 39 inline vec chmat::sqrt_mult ( const vec &v ) const {vec pom; pom = Ch*v; return pom;}; 39 40 inline double chmat::qform ( const vec &v ) const {vec pom; pom = Ch*v; return pom*pom;}; 41 inline double chmat::invqform ( const vec &v ) const { 42 vec pom(v.length()); 43 forward_substitution(Ch.T(),v,pom); 44 return pom*pom; 45 }; 40 46 inline void chmat::clear() {Ch.clear();};