Changeset 737 for library/bdm/math
- Timestamp:
- 11/25/09 12:14:38 (15 years ago)
- Location:
- library/bdm/math
- Files:
-
- 5 modified
Legend:
- Unmodified
- Added
- Removed
-
library/bdm/math/chmat.cpp
r565 r737 4 4 //using std::endl; 5 5 6 namespace bdm 7 { 6 namespace bdm { 8 7 9 8 void chmat::opupdt ( const vec &v, double w ) { -
library/bdm/math/chmat.h
r725 r737 17 17 #include "square_mat.h" 18 18 19 namespace bdm 20 { 19 namespace bdm { 21 20 22 21 /*! \brief Symmetric matrix stored in square root decomposition using upper cholesky … … 110 109 void setCh ( const chmat &Ch0 ) { 111 110 Ch = Ch0._Ch(); 112 dim =Ch0.rows();111 dim = Ch0.rows(); 113 112 } 114 113 //! access function … … 116 115 //TODO check if Ch0 is OK!!! 117 116 Ch = Ch0; 118 dim =Ch0.rows();117 dim = Ch0.rows(); 119 118 } 120 119 121 120 //! Access functions 122 121 void setD ( const vec &nD, int i ) { … … 126 125 } 127 126 128 //! Operator 127 //! Operator 129 128 chmat& operator += ( const chmat &A2 ); 130 //! Operator 129 //! Operator 131 130 chmat& operator -= ( const chmat &A2 ); 132 //! Operator 131 //! Operator 133 132 chmat& operator * ( const double &d ) { 134 133 Ch*sqrt ( d ); 135 134 return *this; 136 135 }; 137 //! Operator 136 //! Operator 138 137 chmat& operator = ( const chmat &A2 ) { 139 138 Ch = A2.Ch; … … 141 140 return *this; 142 141 } 143 //! Operator 142 //! Operator 144 143 chmat& operator *= ( double x ) { 145 144 Ch *= sqrt ( x ); -
library/bdm/math/functions.h
r665 r737 84 84 vec eval ( const vec &cond ) { 85 85 bdm_assert_debug ( cond.length() == ( dimx + dimu ), "linfn::eval Wrong cond." ); 86 if ( dimu>0){86 if ( dimu > 0 ) { 87 87 return eval ( cond ( 0, dimx - 1 ), cond ( dimx, dimx + dimu - 1 ) );//-1 = end (in matlab) 88 88 } else { 89 return eval ( cond ( 0, dimx - 1 ), vec (0) );//-1 = end (in matlab)89 return eval ( cond ( 0, dimx - 1 ), vec ( 0 ) );//-1 = end (in matlab) 90 90 } 91 91 92 92 } 93 93 -
library/bdm/math/square_mat.cpp
r725 r737 2 2 #include "square_mat.h" 3 3 4 namespace bdm 5 { 4 namespace bdm { 6 5 7 6 using namespace itpp; -
library/bdm/math/square_mat.h
r700 r737 18 18 #include "../bdmerror.h" 19 19 20 namespace bdm 21 { 20 namespace bdm { 22 21 23 22 using namespace itpp; … … 43 42 BLAS-2b operation. 44 43 */ 45 virtual void opupdt ( const vec &v, double w ) { bdm_error("not implemented"); }; 44 virtual void opupdt ( const vec &v, double w ) { 45 bdm_error ( "not implemented" ); 46 }; 46 47 47 48 /*! \brief Conversion to full matrix. 48 49 */ 49 50 50 virtual mat to_mat() const { bdm_error("not implemented"); return mat(0,0); } 51 virtual mat to_mat() const { 52 bdm_error ( "not implemented" ); 53 return mat ( 0, 0 ); 54 } 51 55 52 56 /*! \brief Inplace symmetric multiplication by a SQUARE matrix \f$C\f$, i.e. \f$V = C*V*C'\f$ 53 57 @param C multiplying matrix, 54 58 */ 55 virtual void mult_sym ( const mat &C ) { bdm_error("not implemented"); }; 59 virtual void mult_sym ( const mat &C ) { 60 bdm_error ( "not implemented" ); 61 }; 56 62 57 63 /*! \brief Inplace symmetric multiplication by a SQUARE transpose of matrix \f$C\f$, i.e. \f$V = C'*V*C\f$ 58 64 @param C multiplying matrix, 59 65 */ 60 virtual void mult_sym_t ( const mat &C ) { bdm_error("not implemented"); } 66 virtual void mult_sym_t ( const mat &C ) { 67 bdm_error ( "not implemented" ); 68 } 61 69 62 70 … … 65 73 66 74 */ 67 virtual double logdet() const { bdm_error("not implemented"); return 0;}; 75 virtual double logdet() const { 76 bdm_error ( "not implemented" ); 77 return 0; 78 }; 68 79 69 80 /*! … … 72 83 Used e.g. in generating normal samples. 73 84 */ 74 virtual vec sqrt_mult ( const vec &v ) const { bdm_error("not implemented"); return vec(0); }; 85 virtual vec sqrt_mult ( const vec &v ) const { 86 bdm_error ( "not implemented" ); 87 return vec ( 0 ); 88 }; 75 89 76 90 /*! … … 78 92 79 93 */ 80 virtual double qform ( const vec &v ) const { bdm_error("not implemented"); return 0; }; 94 virtual double qform ( const vec &v ) const { 95 bdm_error ( "not implemented" ); 96 return 0; 97 }; 81 98 82 99 /*! … … 84 101 85 102 */ 86 virtual double invqform ( const vec &v ) const { bdm_error("not implemented"); return 0; }; 103 virtual double invqform ( const vec &v ) const { 104 bdm_error ( "not implemented" ); 105 return 0; 106 }; 87 107 88 108 // //! easy version of the … … 90 110 91 111 //! Clearing matrix so that it corresponds to zeros. 92 virtual void clear() { bdm_error("not implemented"); }; 112 virtual void clear() { 113 bdm_error ( "not implemented" ); 114 }; 93 115 94 116 //! Reimplementing common functions of mat: cols(). … … 214 236 return *this; 215 237 }; 216 238 217 239 //! cast to normal mat 218 operator mat&() {return M;}; 219 240 operator mat&() { 241 return M; 242 }; 243 220 244 // fsqmat& operator = ( const fsqmat &A) {M=A.M; return *this;}; 221 245 //! print full matrix 222 246 friend std::ostream &operator<< ( std::ostream &os, const fsqmat &sq ); 223 247 //!access function 224 mat & _M ( ) {return M;}; 248 mat & _M ( ) { 249 return M; 250 }; 225 251 226 252 };