48 | | <a name="l00051"></a><a class="code" href="classchmat.html#fdd73b0c596161637fd25bdf2c670c39">00051</a> <a class="code" href="classchmat.html#fdd73b0c596161637fd25bdf2c670c39" title="Default constructor.">chmat</a> ( <span class="keyword">const</span> <span class="keywordtype">int</span> dim0 ) : <a class="code" href="classsqmat.html" title="Virtual class for representation of double symmetric matrices in square-root form...">sqmat</a> ( dim0 ),<a class="code" href="classchmat.html#95158bb150f5e7f939168abcd577fd9c" title="Upper triangle of the cholesky matrix.">Ch</a> ( dim0,dim0 ) {}; |
49 | | <a name="l00053"></a><a class="code" href="classchmat.html#d4f0a94e81279295e60e72812130f9d4">00053</a> <a class="code" href="classchmat.html#fdd73b0c596161637fd25bdf2c670c39" title="Default constructor.">chmat</a> ( <span class="keyword">const</span> vec &v) : <a class="code" href="classsqmat.html" title="Virtual class for representation of double symmetric matrices in square-root form...">sqmat</a> ( v.length() ),<a class="code" href="classchmat.html#95158bb150f5e7f939168abcd577fd9c" title="Upper triangle of the cholesky matrix.">Ch</a> ( diag(sqrt(v)) ) {}; |
50 | | <a name="l00055"></a><a class="code" href="classchmat.html#d92f3bd9a727b8c88a8c7385feb3449a">00055</a> <a class="code" href="classchmat.html#fdd73b0c596161637fd25bdf2c670c39" title="Default constructor.">chmat</a> ( <span class="keyword">const</span> <a class="code" href="classchmat.html" title="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</a> &Ch0) : <a class="code" href="classsqmat.html" title="Virtual class for representation of double symmetric matrices in square-root form...">sqmat</a> ( Ch0.<a class="code" href="classsqmat.html#0abed904bdc0882373ba9adba919689d" title="dimension of the square matrix">dim</a>),<a class="code" href="classchmat.html#95158bb150f5e7f939168abcd577fd9c" title="Upper triangle of the cholesky matrix.">Ch</a> ( Ch0.<a class="code" href="classsqmat.html#0abed904bdc0882373ba9adba919689d" title="dimension of the square matrix">dim</a>,Ch0.<a class="code" href="classsqmat.html#0abed904bdc0882373ba9adba919689d" title="dimension of the square matrix">dim</a> ) {<a class="code" href="classchmat.html#95158bb150f5e7f939168abcd577fd9c" title="Upper triangle of the cholesky matrix.">Ch</a>=Ch0.<a class="code" href="classchmat.html#95158bb150f5e7f939168abcd577fd9c" title="Upper triangle of the cholesky matrix.">Ch</a>;}; |
51 | | <a name="l00057"></a><a class="code" href="classchmat.html#8334a00f30f0a05f893c2aeec395ef10">00057</a> <a class="code" href="classchmat.html#fdd73b0c596161637fd25bdf2c670c39" title="Default constructor.">chmat</a> ( <span class="keyword">const</span> mat &M ) : <a class="code" href="classsqmat.html" title="Virtual class for representation of double symmetric matrices in square-root form...">sqmat</a> ( M.<a class="code" href="classsqmat.html#071e80ced9cc3b8cbb360fa7462eb646" title="Reimplementing common functions of mat: cols().">rows</a>() ),<a class="code" href="classchmat.html#95158bb150f5e7f939168abcd577fd9c" title="Upper triangle of the cholesky matrix.">Ch</a> ( M.<a class="code" href="classsqmat.html#071e80ced9cc3b8cbb360fa7462eb646" title="Reimplementing common functions of mat: cols().">rows</a>(),M.<a class="code" href="classsqmat.html#ecc2e2540f95a04f4449842588170f5b" title="Reimplementing common functions of mat: cols().">cols</a>() ) { |
52 | | <a name="l00058"></a>00058 mat Q; |
53 | | <a name="l00059"></a>00059 it_assert_debug ( M.rows() ==M.cols(),<span class="stringliteral">"chmat:: input matrix must be square!"</span> ); |
54 | | <a name="l00060"></a>00060 <a class="code" href="classchmat.html#95158bb150f5e7f939168abcd577fd9c" title="Upper triangle of the cholesky matrix.">Ch</a>=chol ( M ); |
55 | | <a name="l00061"></a>00061 }; |
56 | | <a name="l00063"></a><a class="code" href="classchmat.html#24de7f42e0a86bb270588cd0dd9d60b4">00063</a> <a class="code" href="classchmat.html#fdd73b0c596161637fd25bdf2c670c39" title="Default constructor.">chmat</a> ( <span class="keyword">const</span> <a class="code" href="classchmat.html" title="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</a> &M, <span class="keyword">const</span> ivec &perm ):<a class="code" href="classsqmat.html" title="Virtual class for representation of double symmetric matrices in square-root form...">sqmat</a>(M.<a class="code" href="classsqmat.html#071e80ced9cc3b8cbb360fa7462eb646" title="Reimplementing common functions of mat: cols().">rows</a>()){it_error(<span class="stringliteral">"not implemneted"</span>);}; |
57 | | <a name="l00065"></a><a class="code" href="classchmat.html#9c50d31c999d85d8e9d8cf2b69b6ac8c">00065</a> mat & <a class="code" href="classchmat.html#9c50d31c999d85d8e9d8cf2b69b6ac8c" title="Access function.">_Ch</a>() {<span class="keywordflow">return</span> <a class="code" href="classchmat.html#95158bb150f5e7f939168abcd577fd9c" title="Upper triangle of the cholesky matrix.">Ch</a>;} |
58 | | <a name="l00067"></a><a class="code" href="classchmat.html#a4fc7f9b0539b97c414442a22f3db6e8">00067</a> <span class="keywordtype">void</span> <a class="code" href="classchmat.html#a4fc7f9b0539b97c414442a22f3db6e8" title="Access functions.">setD</a> ( <span class="keyword">const</span> vec &nD ) {<a class="code" href="classchmat.html#95158bb150f5e7f939168abcd577fd9c" title="Upper triangle of the cholesky matrix.">Ch</a>=diag ( sqrt(nD) );} |
59 | | <a name="l00069"></a><a class="code" href="classchmat.html#4b9271097d8317d9514c5d0d62cccb39">00069</a> <span class="keywordtype">void</span> <a class="code" href="classchmat.html#a4fc7f9b0539b97c414442a22f3db6e8" title="Access functions.">setD</a> ( <span class="keyword">const</span> vec &nD, <span class="keywordtype">int</span> i ) {<span class="keywordflow">for</span> ( <span class="keywordtype">int</span> j=i;j<nD.length();j++ ) {<a class="code" href="classchmat.html#95158bb150f5e7f939168abcd577fd9c" title="Upper triangle of the cholesky matrix.">Ch</a>( j,j ) =sqrt(nD ( j-i ));}} <span class="comment">//Fixme can be more general</span> |
60 | | <a name="l00070"></a>00070 |
61 | | <a name="l00072"></a>00072 <a class="code" href="classchmat.html" title="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</a>& <a class="code" href="classchmat.html#6a8b39fe3a28d2c8e3fc0d74141229fb" title="Operators.">operator += </a>( <span class="keyword">const</span> <a class="code" href="classchmat.html" title="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</a> &A2 ); |
62 | | <a name="l00073"></a>00073 <a class="code" href="classchmat.html" title="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</a>& <a class="code" href="classchmat.html#a8c3628a8c15eb0009e57c66fcac1a76" title="mapping of negative add operation to operators">operator -= </a>( <span class="keyword">const</span> <a class="code" href="classchmat.html" title="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</a> &A2 ) ; |
63 | | <a name="l00074"></a>00074 <a class="code" href="classchmat.html" title="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</a>& operator * ( <span class="keyword">const</span> <a class="code" href="classchmat.html" title="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</a> &A2 ); |
64 | | <a name="l00075"></a>00075 <a class="code" href="classchmat.html" title="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</a>& operator * ( <span class="keyword">const</span> <span class="keywordtype">double</span> &d ){<a class="code" href="classchmat.html#95158bb150f5e7f939168abcd577fd9c" title="Upper triangle of the cholesky matrix.">Ch</a>*d; <span class="keywordflow">return</span> *<span class="keyword">this</span>;}; |
65 | | <a name="l00076"></a>00076 <a class="code" href="classchmat.html" title="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</a>& operator = ( <span class="keyword">const</span> <a class="code" href="classchmat.html" title="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</a> &A2 ){<a class="code" href="classchmat.html#95158bb150f5e7f939168abcd577fd9c" title="Upper triangle of the cholesky matrix.">Ch</a>=A2.<a class="code" href="classchmat.html#95158bb150f5e7f939168abcd577fd9c" title="Upper triangle of the cholesky matrix.">Ch</a>;<a class="code" href="classsqmat.html#0abed904bdc0882373ba9adba919689d" title="dimension of the square matrix">dim</a>=A2.<a class="code" href="classsqmat.html#0abed904bdc0882373ba9adba919689d" title="dimension of the square matrix">dim</a>;<span class="keywordflow">return</span> *<span class="keyword">this</span>;} |
66 | | <a name="l00077"></a>00077 }; |
67 | | <a name="l00078"></a>00078 |
68 | | <a name="l00079"></a>00079 |
69 | | <a name="l00082"></a><a class="code" href="classchmat.html#6a8b39fe3a28d2c8e3fc0d74141229fb">00082</a> <span class="keyword">inline</span> <a class="code" href="classchmat.html" title="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</a>& <a class="code" href="classchmat.html#6a8b39fe3a28d2c8e3fc0d74141229fb" title="Operators.">chmat::operator += </a>( <span class="keyword">const</span> <a class="code" href="classchmat.html" title="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</a> &A2 ) {this-><span class="keyword">add</span> ( A2 );<span class="keywordflow">return</span> *<span class="keyword">this</span>;} |
70 | | <a name="l00084"></a><a class="code" href="classchmat.html#a8c3628a8c15eb0009e57c66fcac1a76">00084</a> <span class="keyword">inline</span> <a class="code" href="classchmat.html" title="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</a>& <a class="code" href="classchmat.html#a8c3628a8c15eb0009e57c66fcac1a76" title="mapping of negative add operation to operators">chmat::operator -= </a>( <span class="keyword">const</span> <a class="code" href="classchmat.html" title="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</a> &A2 ) {this-><span class="keyword">add</span> ( A2,-1.0 );<span class="keywordflow">return</span> *<span class="keyword">this</span>;} |
71 | | <a name="l00085"></a>00085 |
72 | | <a name="l00086"></a>00086 <span class="preprocessor">#endif // CHMAT_H</span> |
| 48 | <a name="l00051"></a>00051 <a class="code" href="classchmat.html" title="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</a> ( ) : <a class="code" href="classsqmat.html" title="Virtual class for representation of double symmetric matrices in square-root form...">sqmat</a> (),<a class="code" href="classchmat.html#95158bb150f5e7f939168abcd577fd9c" title="Upper triangle of the cholesky matrix.">Ch</a> ( ) {}; |
| 49 | <a name="l00053"></a><a class="code" href="classchmat.html#fdd73b0c596161637fd25bdf2c670c39">00053</a> <a class="code" href="classchmat.html" title="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</a> ( <span class="keyword">const</span> <span class="keywordtype">int</span> dim0 ) : <a class="code" href="classsqmat.html" title="Virtual class for representation of double symmetric matrices in square-root form...">sqmat</a> ( dim0 ),<a class="code" href="classchmat.html#95158bb150f5e7f939168abcd577fd9c" title="Upper triangle of the cholesky matrix.">Ch</a> ( dim0,dim0 ) {}; |
| 50 | <a name="l00055"></a><a class="code" href="classchmat.html#d4f0a94e81279295e60e72812130f9d4">00055</a> <a class="code" href="classchmat.html" title="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</a> ( <span class="keyword">const</span> vec &v) : <a class="code" href="classsqmat.html" title="Virtual class for representation of double symmetric matrices in square-root form...">sqmat</a> ( v.length() ),<a class="code" href="classchmat.html#95158bb150f5e7f939168abcd577fd9c" title="Upper triangle of the cholesky matrix.">Ch</a> ( diag(sqrt(v)) ) {}; |
| 51 | <a name="l00057"></a><a class="code" href="classchmat.html#d92f3bd9a727b8c88a8c7385feb3449a">00057</a> <a class="code" href="classchmat.html" title="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</a> ( <span class="keyword">const</span> <a class="code" href="classchmat.html" title="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</a> &Ch0) : <a class="code" href="classsqmat.html" title="Virtual class for representation of double symmetric matrices in square-root form...">sqmat</a> ( Ch0.<a class="code" href="classsqmat.html#0abed904bdc0882373ba9adba919689d" title="dimension of the square matrix">dim</a>),<a class="code" href="classchmat.html#95158bb150f5e7f939168abcd577fd9c" title="Upper triangle of the cholesky matrix.">Ch</a> ( Ch0.<a class="code" href="classsqmat.html#0abed904bdc0882373ba9adba919689d" title="dimension of the square matrix">dim</a>,Ch0.<a class="code" href="classsqmat.html#0abed904bdc0882373ba9adba919689d" title="dimension of the square matrix">dim</a> ) {<a class="code" href="classchmat.html#95158bb150f5e7f939168abcd577fd9c" title="Upper triangle of the cholesky matrix.">Ch</a>=Ch0.<a class="code" href="classchmat.html#95158bb150f5e7f939168abcd577fd9c" title="Upper triangle of the cholesky matrix.">Ch</a>;}; |
| 52 | <a name="l00059"></a><a class="code" href="classchmat.html#8334a00f30f0a05f893c2aeec395ef10">00059</a> <a class="code" href="classchmat.html" title="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</a> ( <span class="keyword">const</span> mat &M ) : <a class="code" href="classsqmat.html" title="Virtual class for representation of double symmetric matrices in square-root form...">sqmat</a> ( M.<a class="code" href="classsqmat.html#071e80ced9cc3b8cbb360fa7462eb646" title="Reimplementing common functions of mat: cols().">rows</a>() ),<a class="code" href="classchmat.html#95158bb150f5e7f939168abcd577fd9c" title="Upper triangle of the cholesky matrix.">Ch</a> ( M.<a class="code" href="classsqmat.html#071e80ced9cc3b8cbb360fa7462eb646" title="Reimplementing common functions of mat: cols().">rows</a>(),M.<a class="code" href="classsqmat.html#ecc2e2540f95a04f4449842588170f5b" title="Reimplementing common functions of mat: cols().">cols</a>() ) { |
| 53 | <a name="l00060"></a>00060 mat Q; |
| 54 | <a name="l00061"></a>00061 it_assert_debug ( M.rows() ==M.cols(),<span class="stringliteral">"chmat:: input matrix must be square!"</span> ); |
| 55 | <a name="l00062"></a>00062 <a class="code" href="classchmat.html#95158bb150f5e7f939168abcd577fd9c" title="Upper triangle of the cholesky matrix.">Ch</a>=chol ( M ); |
| 56 | <a name="l00063"></a>00063 }; |
| 57 | <a name="l00065"></a><a class="code" href="classchmat.html#24de7f42e0a86bb270588cd0dd9d60b4">00065</a> <a class="code" href="classchmat.html" title="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</a> ( <span class="keyword">const</span> <a class="code" href="classchmat.html" title="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</a> &M, <span class="keyword">const</span> ivec &perm ):<a class="code" href="classsqmat.html" title="Virtual class for representation of double symmetric matrices in square-root form...">sqmat</a>(M.<a class="code" href="classsqmat.html#071e80ced9cc3b8cbb360fa7462eb646" title="Reimplementing common functions of mat: cols().">rows</a>()){it_error(<span class="stringliteral">"not implemneted"</span>);}; |
| 58 | <a name="l00067"></a><a class="code" href="classchmat.html#9c50d31c999d85d8e9d8cf2b69b6ac8c">00067</a> mat & <a class="code" href="classchmat.html#9c50d31c999d85d8e9d8cf2b69b6ac8c" title="Access function.">_Ch</a>() {<span class="keywordflow">return</span> <a class="code" href="classchmat.html#95158bb150f5e7f939168abcd577fd9c" title="Upper triangle of the cholesky matrix.">Ch</a>;} |
| 59 | <a name="l00069"></a><a class="code" href="classchmat.html#a4fc7f9b0539b97c414442a22f3db6e8">00069</a> <span class="keywordtype">void</span> <a class="code" href="classchmat.html#a4fc7f9b0539b97c414442a22f3db6e8" title="Access functions.">setD</a> ( <span class="keyword">const</span> vec &nD ) {<a class="code" href="classchmat.html#95158bb150f5e7f939168abcd577fd9c" title="Upper triangle of the cholesky matrix.">Ch</a>=diag ( sqrt(nD) );} |
| 60 | <a name="l00071"></a><a class="code" href="classchmat.html#4b9271097d8317d9514c5d0d62cccb39">00071</a> <span class="keywordtype">void</span> <a class="code" href="classchmat.html#a4fc7f9b0539b97c414442a22f3db6e8" title="Access functions.">setD</a> ( <span class="keyword">const</span> vec &nD, <span class="keywordtype">int</span> i ) {<span class="keywordflow">for</span> ( <span class="keywordtype">int</span> j=i;j<nD.length();j++ ) {<a class="code" href="classchmat.html#95158bb150f5e7f939168abcd577fd9c" title="Upper triangle of the cholesky matrix.">Ch</a>( j,j ) =sqrt(nD ( j-i ));}} <span class="comment">//Fixme can be more general</span> |
| 61 | <a name="l00072"></a>00072 |
| 62 | <a name="l00074"></a>00074 <a class="code" href="classchmat.html" title="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</a>& <a class="code" href="classchmat.html#6a8b39fe3a28d2c8e3fc0d74141229fb" title="Operators.">operator += </a>( <span class="keyword">const</span> <a class="code" href="classchmat.html" title="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</a> &A2 ); |
| 63 | <a name="l00075"></a>00075 <a class="code" href="classchmat.html" title="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</a>& <a class="code" href="classchmat.html#a8c3628a8c15eb0009e57c66fcac1a76" title="mapping of negative add operation to operators">operator -= </a>( <span class="keyword">const</span> <a class="code" href="classchmat.html" title="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</a> &A2 ) ; |
| 64 | <a name="l00076"></a>00076 <a class="code" href="classchmat.html" title="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</a>& operator * ( <span class="keyword">const</span> <a class="code" href="classchmat.html" title="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</a> &A2 ); |
| 65 | <a name="l00077"></a>00077 <a class="code" href="classchmat.html" title="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</a>& operator * ( <span class="keyword">const</span> <span class="keywordtype">double</span> &d ){<a class="code" href="classchmat.html#95158bb150f5e7f939168abcd577fd9c" title="Upper triangle of the cholesky matrix.">Ch</a>*d; <span class="keywordflow">return</span> *<span class="keyword">this</span>;}; |
| 66 | <a name="l00078"></a>00078 <a class="code" href="classchmat.html" title="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</a>& operator = ( <span class="keyword">const</span> <a class="code" href="classchmat.html" title="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</a> &A2 ){<a class="code" href="classchmat.html#95158bb150f5e7f939168abcd577fd9c" title="Upper triangle of the cholesky matrix.">Ch</a>=A2.<a class="code" href="classchmat.html#95158bb150f5e7f939168abcd577fd9c" title="Upper triangle of the cholesky matrix.">Ch</a>;<a class="code" href="classsqmat.html#0abed904bdc0882373ba9adba919689d" title="dimension of the square matrix">dim</a>=A2.<a class="code" href="classsqmat.html#0abed904bdc0882373ba9adba919689d" title="dimension of the square matrix">dim</a>;<span class="keywordflow">return</span> *<span class="keyword">this</span>;} |
| 67 | <a name="l00079"></a>00079 }; |
| 68 | <a name="l00080"></a>00080 |
| 69 | <a name="l00081"></a>00081 |
| 70 | <a name="l00084"></a><a class="code" href="classchmat.html#6a8b39fe3a28d2c8e3fc0d74141229fb">00084</a> <span class="keyword">inline</span> <a class="code" href="classchmat.html" title="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</a>& <a class="code" href="classchmat.html#6a8b39fe3a28d2c8e3fc0d74141229fb" title="Operators.">chmat::operator += </a>( <span class="keyword">const</span> <a class="code" href="classchmat.html" title="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</a> &A2 ) {this-><span class="keyword">add</span> ( A2 );<span class="keywordflow">return</span> *<span class="keyword">this</span>;} |
| 71 | <a name="l00086"></a><a class="code" href="classchmat.html#a8c3628a8c15eb0009e57c66fcac1a76">00086</a> <span class="keyword">inline</span> <a class="code" href="classchmat.html" title="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</a>& <a class="code" href="classchmat.html#a8c3628a8c15eb0009e57c66fcac1a76" title="mapping of negative add operation to operators">chmat::operator -= </a>( <span class="keyword">const</span> <a class="code" href="classchmat.html" title="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</a> &A2 ) {this-><span class="keyword">add</span> ( A2,-1.0 );<span class="keywordflow">return</span> *<span class="keyword">this</span>;} |
| 72 | <a name="l00087"></a>00087 |
| 73 | <a name="l00088"></a>00088 <span class="preprocessor">#endif // CHMAT_H</span> |