Legend:
- Unmodified
- Added
- Removed
-
bdm/math/libDC.cpp
r32 r37 5 5 6 6 using std::endl; 7 8 //! Auxiliary function dydr; dyadic reduction9 void dydr( double * r, double *f, double *Dr, double *Df, double *R, int jl, int jh, double *kr, int m, int mx );10 11 //! Auxiliary function ltuinv; inversion of a triangular matrix;12 //TODO can be done via: dtrtri.f from lapack13 mat ltuinv( const mat &L );14 7 15 8 void fsqmat::opupdt ( const vec &v, double w ) {M+=outer_product ( v,v*w );}; -
bdm/math/libDC.h
r33 r37 18 18 using namespace itpp; 19 19 20 //! Auxiliary function dydr; dyadic reduction 21 void dydr( double * r, double *f, double *Dr, double *Df, double *R, int jl, int jh, double *kr, int m, int mx ); 22 23 //! Auxiliary function ltuinv; inversion of a triangular matrix; 24 //TODO can be done via: dtrtri.f from lapack 25 mat ltuinv( const mat &L ); 26 20 27 /*! \brief Virtual class for representation of double symmetric matrices in square-root form. 21 28 22 All operations defined on this class should be optimized for the chose ddecomposition.29 All operations defined on this class should be optimized for the chosen decomposition. 23 30 */ 24 31 class sqmat … … 117 124 //! Constructor 118 125 fsqmat ( const mat &M ); 126 //! Constructor 127 fsqmat ( const vec &d ):sqmat(d.length()){M=diag(d);}; 119 128 120 129 //! Destructor for future use; … … 131 140 double logdet() const {return log ( det ( M ) );}; 132 141 double qform (const vec &v ) const {return ( v* ( M*v ) );}; 133 vec sqrt_mult (const vec &v ) const {it_error ( "not implemented" );return v;}; 142 vec sqrt_mult (const vec &v ) const {mat Ch=chol(M); return Ch*v;}; 143 144 //! Access functions 145 void setD (const vec &nD){M=diag(nD);} 146 //! Access functions 147 void setD (const vec &nD, int i){for(int j=i;j<nD.length();j++){M(j,j)=nD(j-i);}} //Fixme can be more general 134 148 135 149 //! add another fsqmat matrix … … 236 250 }; 237 251 252 238 253 //////// Operations: 239 254 //!mapping of add operation to operators