root/bdm/math/chmat.cpp @ 39

Revision 39, 1.2 kB (checked in by smidl, 16 years ago)

Choleski DC matrix

  • Property svn:eol-style set to native
Line 
1#include <itpp/itbase.h>
2#include "chmat.h"
3
4using namespace itpp;
5
6//using std::endl;
7
8
9void chmat::opupdt ( const vec &v, double w ) {
10//TODO see cholupdt in lhotse
11        mat Z;
12        mat R;
13        mat Q;
14        Z = concat_vertical ( Ch,mat(w*v) );
15         qr ( Z,Q,R );
16        Ch = R ( 0, Ch.rows()-1, 0, Ch.cols()-1 );
17};
18inline mat chmat::to_mat(){mat F=Ch.T()*Ch;return F;};
19void chmat::mult_sym ( const mat &C ) {
20it_error("not implemented");
21};
22void chmat::mult_sym ( const mat &C , chmat &U) const {
23it_error("not implemented");
24};
25void chmat::mult_sym_t ( const mat &C ) {
26it_error("not implemented");
27};
28void chmat::mult_sym_t ( const mat &C, chmat &U ) const {
29it_error("not implemented");
30};
31double chmat::logdet() const {
32        double ldet=0.0; int i;
33        //sum of logs of (possibly negative!) diagonal entries
34        for (i=0;i<Ch.rows();i++ ) {ldet+=log ( std::fabs(Ch ( i,i )) );}
35        return 2*ldet; //compensate for Ch being sqrt()
36};
37//TODO can be done more efficiently using BLAS, see triangular matrices
38inline vec chmat::sqrt_mult ( const vec &v ) const {vec pom; pom = Ch*v; return pom;};
39inline double chmat::qform ( const vec &v ) const {vec pom; pom = Ch*v; return pom*pom;};
40inline void chmat::clear() {Ch.clear();};
Note: See TracBrowser for help on using the browser.