Changeset 437 for library/bdm/math/chmat.h
- Timestamp:
- 07/28/09 15:31:57 (15 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
library/bdm/math/chmat.h
r384 r437 40 40 void clear(); 41 41 //! add another chmat \c A2 with weight \c w. 42 void add ( const chmat &A2, double w=1.0 ) {}; 42 void add ( const chmat &A2, double w=1.0 ) { 43 it_assert_debug(dim==A2.dim,"Matrices of unequal dimension"); 44 mat pre=concat_vertical(Ch,sqrt(w)*A2.Ch); 45 mat post=zeros(pre.rows(),pre.cols()); 46 if(!qr(pre,post)) {it_warning("Unstable QR in chmat add");} 47 Ch=post(0,dim-1,0,dim-1); 48 }; 43 49 //!Inversion in the same form, i.e. cholesky 44 50 void inv ( chmat &Inv ) const { ( Inv.Ch ) = itpp::inv ( Ch ).T();}; //Fixme: can be more efficient … … 80 86 //! Operators 81 87 chmat& operator += ( const chmat &A2 ); 82 chmat& operator -= ( const chmat &A2 ) ; 83 chmat& operator * ( const chmat &A2 ); 84 chmat& operator * ( const double &d ){Ch*d; return *this;}; 88 chmat& operator -= ( const chmat &A2 ); 89 chmat& operator * ( const double &d ){Ch*sqrt(d); return *this;}; 85 90 chmat& operator = ( const chmat &A2 ){Ch=A2.Ch;dim=A2.dim;return *this;} 91 chmat& operator *= ( double x ){Ch*=sqrt(x); return *this;}; 86 92 }; 87 93