root/bdm/math/chmat.cpp @ 262

Revision 262, 1.3 kB (checked in by smidl, 15 years ago)

cleanup of include files

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