22 | | <a name="l00017"></a>00017 |
23 | | <a name="l00018"></a>00018 <span class="keyword">using namespace </span>itpp; |
24 | | <a name="l00019"></a>00019 |
25 | | <a name="l00021"></a>00021 <span class="keywordtype">void</span> dydr( <span class="keywordtype">double</span> * r, <span class="keywordtype">double</span> *f, <span class="keywordtype">double</span> *Dr, <span class="keywordtype">double</span> *Df, <span class="keywordtype">double</span> *R, <span class="keywordtype">int</span> jl, <span class="keywordtype">int</span> jh, <span class="keywordtype">double</span> *kr, <span class="keywordtype">int</span> m, <span class="keywordtype">int</span> mx ); |
26 | | <a name="l00022"></a>00022 |
27 | | <a name="l00024"></a>00024 <span class="comment">//TODO can be done via: dtrtri.f from lapack</span> |
28 | | <a name="l00025"></a>00025 mat ltuinv( <span class="keyword">const</span> mat &L ); |
29 | | <a name="l00026"></a>00026 |
30 | | <a name="l00031"></a><a class="code" href="classsqmat.html">00031</a> <span class="keyword">class </span><a class="code" href="classsqmat.html" title="Virtual class for representation of double symmetric matrices in square-root form...">sqmat</a> |
31 | | <a name="l00032"></a>00032 { |
32 | | <a name="l00033"></a>00033 <span class="keyword">public</span>: |
33 | | <a name="l00041"></a>00041 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classsqmat.html#b223484796661f2dadb5607a86ce0581">opupdt</a> ( <span class="keyword">const</span> vec &v, <span class="keywordtype">double</span> w ) =0; |
34 | | <a name="l00042"></a>00042 |
35 | | <a name="l00046"></a>00046 <span class="keyword">virtual</span> mat <a class="code" href="classsqmat.html#cd0ea3701e4493f353499755fba6e07f" title="Conversion to full matrix.">to_mat</a>() <span class="keyword">const</span> =0; |
36 | | <a name="l00047"></a>00047 |
37 | | <a name="l00051"></a>00051 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classsqmat.html#60fbbfa9e483b8187c135f787ee53afa" title="Inplace symmetric multiplication by a SQUARE matrix , i.e. .">mult_sym</a> ( <span class="keyword">const</span> mat &C ) =0; |
38 | | <a name="l00052"></a>00052 |
39 | | <a name="l00056"></a>00056 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classsqmat.html#6909e906da17725b1b80f3cae7cf3325" title="Inplace symmetric multiplication by a SQUARE transpose of matrix , i.e. .">mult_sym_t</a> ( <span class="keyword">const</span> mat &C ) =0; |
40 | | <a name="l00057"></a>00057 |
| 22 | <a name="l00017"></a>00017 <span class="preprocessor">#include "../itpp_ext.h"</span> |
| 23 | <a name="l00018"></a>00018 |
| 24 | <a name="l00019"></a>00019 <span class="keyword">using namespace </span>itpp; |
| 25 | <a name="l00020"></a>00020 |
| 26 | <a name="l00022"></a>00022 <span class="keywordtype">void</span> dydr( <span class="keywordtype">double</span> * r, <span class="keywordtype">double</span> *f, <span class="keywordtype">double</span> *Dr, <span class="keywordtype">double</span> *Df, <span class="keywordtype">double</span> *R, <span class="keywordtype">int</span> jl, <span class="keywordtype">int</span> jh, <span class="keywordtype">double</span> *kr, <span class="keywordtype">int</span> m, <span class="keywordtype">int</span> mx ); |
| 27 | <a name="l00023"></a>00023 |
| 28 | <a name="l00025"></a>00025 <span class="comment">//TODO can be done via: dtrtri.f from lapack</span> |
| 29 | <a name="l00026"></a>00026 mat ltuinv( <span class="keyword">const</span> mat &L ); |
| 30 | <a name="l00027"></a>00027 |
| 31 | <a name="l00032"></a><a class="code" href="classsqmat.html">00032</a> <span class="keyword">class </span><a class="code" href="classsqmat.html" title="Virtual class for representation of double symmetric matrices in square-root form...">sqmat</a> |
| 32 | <a name="l00033"></a>00033 { |
| 33 | <a name="l00034"></a>00034 <span class="keyword">public</span>: |
| 34 | <a name="l00042"></a>00042 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classsqmat.html#b223484796661f2dadb5607a86ce0581">opupdt</a> ( <span class="keyword">const</span> vec &v, <span class="keywordtype">double</span> w ) =0; |
| 35 | <a name="l00043"></a>00043 |
| 36 | <a name="l00047"></a>00047 <span class="keyword">virtual</span> mat <a class="code" href="classsqmat.html#cd0ea3701e4493f353499755fba6e07f" title="Conversion to full matrix.">to_mat</a>() <span class="keyword">const</span> =0; |
| 37 | <a name="l00048"></a>00048 |
| 38 | <a name="l00052"></a>00052 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classsqmat.html#60fbbfa9e483b8187c135f787ee53afa" title="Inplace symmetric multiplication by a SQUARE matrix , i.e. .">mult_sym</a> ( <span class="keyword">const</span> mat &C ) =0; |
| 39 | <a name="l00053"></a>00053 |
| 40 | <a name="l00057"></a>00057 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classsqmat.html#6909e906da17725b1b80f3cae7cf3325" title="Inplace symmetric multiplication by a SQUARE transpose of matrix , i.e. .">mult_sym_t</a> ( <span class="keyword">const</span> mat &C ) =0; |
42 | | <a name="l00063"></a>00063 <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="classsqmat.html#0a772b396750eeeed85d69fa72478b45" title="Logarithm of a determinant.">logdet</a>() <span class="keyword">const</span> =0; |
43 | | <a name="l00064"></a>00064 |
44 | | <a name="l00070"></a>00070 <span class="keyword">virtual</span> vec <a class="code" href="classsqmat.html#6b79438b5d7544a9c8e110a145355d8f" title="Multiplies square root of by vector .">sqrt_mult</a> (<span class="keyword">const</span> vec &v ) <span class="keyword">const</span> =0; |
45 | | <a name="l00071"></a>00071 |
46 | | <a name="l00076"></a>00076 <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="classsqmat.html#fc026312eb02ba09f85d5aacd6f05ab3" title="Evaluates quadratic form ;.">qform</a> (<span class="keyword">const</span> vec &v ) <span class="keyword">const</span> =0; |
47 | | <a name="l00077"></a>00077 |
48 | | <a name="l00082"></a>00082 <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="classsqmat.html#6230e8e8a9341866aaa0ce008691aac2" title="Evaluates quadratic form ;.">invqform</a> (<span class="keyword">const</span> vec &v ) <span class="keyword">const</span> =0; |
49 | | <a name="l00083"></a>00083 |
50 | | <a name="l00084"></a>00084 <span class="comment">// //! easy version of the</span> |
51 | | <a name="l00085"></a>00085 <span class="comment">// sqmat inv();</span> |
52 | | <a name="l00086"></a>00086 |
53 | | <a name="l00088"></a>00088 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classsqmat.html#6fca246f9eabbdeb8cac03030e826b5e" title="Clearing matrix so that it corresponds to zeros.">clear</a>() =0; |
54 | | <a name="l00089"></a>00089 |
55 | | <a name="l00091"></a><a class="code" href="classsqmat.html#ecc2e2540f95a04f4449842588170f5b">00091</a> <span class="keywordtype">int</span> <a class="code" href="classsqmat.html#ecc2e2540f95a04f4449842588170f5b" title="Reimplementing common functions of mat: cols().">cols</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classsqmat.html#0abed904bdc0882373ba9adba919689d" title="dimension of the square matrix">dim</a>;}; |
56 | | <a name="l00092"></a>00092 |
57 | | <a name="l00094"></a><a class="code" href="classsqmat.html#071e80ced9cc3b8cbb360fa7462eb646">00094</a> <span class="keywordtype">int</span> <a class="code" href="classsqmat.html#071e80ced9cc3b8cbb360fa7462eb646" title="Reimplementing common functions of mat: cols().">rows</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classsqmat.html#0abed904bdc0882373ba9adba919689d" title="dimension of the square matrix">dim</a>;}; |
58 | | <a name="l00095"></a>00095 |
59 | | <a name="l00097"></a><a class="code" href="classsqmat.html#0481f2067bb32aaea7e6d4f27e46b656">00097</a> <span class="keyword">virtual</span> <a class="code" href="classsqmat.html#0481f2067bb32aaea7e6d4f27e46b656" title="Destructor for future use;.">~sqmat</a>(){}; |
60 | | <a name="l00099"></a><a class="code" href="classsqmat.html#4268750c040c716b2c05037f725078a2">00099</a> <a class="code" href="classsqmat.html#4268750c040c716b2c05037f725078a2" title="Default constructor.">sqmat</a>(<span class="keyword">const</span> <span class="keywordtype">int</span> dim0): <a class="code" href="classsqmat.html#0abed904bdc0882373ba9adba919689d" title="dimension of the square matrix">dim</a>(dim0){}; |
61 | | <a name="l00100"></a>00100 <span class="keyword">protected</span>: |
62 | | <a name="l00102"></a>00102 <span class="keywordtype">int</span> <a class="code" href="classsqmat.html#0abed904bdc0882373ba9adba919689d" title="dimension of the square matrix">dim</a>; |
63 | | <a name="l00103"></a>00103 }; |
64 | | <a name="l00104"></a>00104 |
| 42 | <a name="l00059"></a>00059 |
| 43 | <a name="l00064"></a>00064 <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="classsqmat.html#0a772b396750eeeed85d69fa72478b45" title="Logarithm of a determinant.">logdet</a>() <span class="keyword">const</span> =0; |
| 44 | <a name="l00065"></a>00065 |
| 45 | <a name="l00071"></a>00071 <span class="keyword">virtual</span> vec <a class="code" href="classsqmat.html#6b79438b5d7544a9c8e110a145355d8f" title="Multiplies square root of by vector .">sqrt_mult</a> (<span class="keyword">const</span> vec &v ) <span class="keyword">const</span> =0; |
| 46 | <a name="l00072"></a>00072 |
| 47 | <a name="l00077"></a>00077 <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="classsqmat.html#fc026312eb02ba09f85d5aacd6f05ab3" title="Evaluates quadratic form ;.">qform</a> (<span class="keyword">const</span> vec &v ) <span class="keyword">const</span> =0; |
| 48 | <a name="l00078"></a>00078 |
| 49 | <a name="l00083"></a>00083 <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="classsqmat.html#6230e8e8a9341866aaa0ce008691aac2" title="Evaluates quadratic form ;.">invqform</a> (<span class="keyword">const</span> vec &v ) <span class="keyword">const</span> =0; |
| 50 | <a name="l00084"></a>00084 |
| 51 | <a name="l00085"></a>00085 <span class="comment">// //! easy version of the</span> |
| 52 | <a name="l00086"></a>00086 <span class="comment">// sqmat inv();</span> |
| 53 | <a name="l00087"></a>00087 |
| 54 | <a name="l00089"></a>00089 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classsqmat.html#6fca246f9eabbdeb8cac03030e826b5e" title="Clearing matrix so that it corresponds to zeros.">clear</a>() =0; |
| 55 | <a name="l00090"></a>00090 |
| 56 | <a name="l00092"></a><a class="code" href="classsqmat.html#ecc2e2540f95a04f4449842588170f5b">00092</a> <span class="keywordtype">int</span> <a class="code" href="classsqmat.html#ecc2e2540f95a04f4449842588170f5b" title="Reimplementing common functions of mat: cols().">cols</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classsqmat.html#0abed904bdc0882373ba9adba919689d" title="dimension of the square matrix">dim</a>;}; |
| 57 | <a name="l00093"></a>00093 |
| 58 | <a name="l00095"></a><a class="code" href="classsqmat.html#071e80ced9cc3b8cbb360fa7462eb646">00095</a> <span class="keywordtype">int</span> <a class="code" href="classsqmat.html#071e80ced9cc3b8cbb360fa7462eb646" title="Reimplementing common functions of mat: cols().">rows</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classsqmat.html#0abed904bdc0882373ba9adba919689d" title="dimension of the square matrix">dim</a>;}; |
| 59 | <a name="l00096"></a>00096 |
| 60 | <a name="l00098"></a><a class="code" href="classsqmat.html#0481f2067bb32aaea7e6d4f27e46b656">00098</a> <span class="keyword">virtual</span> <a class="code" href="classsqmat.html#0481f2067bb32aaea7e6d4f27e46b656" title="Destructor for future use;.">~sqmat</a>(){}; |
| 61 | <a name="l00100"></a><a class="code" href="classsqmat.html#4268750c040c716b2c05037f725078a2">00100</a> <a class="code" href="classsqmat.html#4268750c040c716b2c05037f725078a2" title="Default constructor.">sqmat</a>(<span class="keyword">const</span> <span class="keywordtype">int</span> dim0): <a class="code" href="classsqmat.html#0abed904bdc0882373ba9adba919689d" title="dimension of the square matrix">dim</a>(dim0){}; |
| 62 | <a name="l00101"></a>00101 <span class="keyword">protected</span>: |
| 63 | <a name="l00103"></a>00103 <span class="keywordtype">int</span> <a class="code" href="classsqmat.html#0abed904bdc0882373ba9adba919689d" title="dimension of the square matrix">dim</a>; |
| 64 | <a name="l00104"></a>00104 }; |
66 | | <a name="l00110"></a><a class="code" href="classfsqmat.html">00110</a> <span class="keyword">class </span><a class="code" href="classfsqmat.html" title="Fake sqmat. This class maps sqmat operations to operations on full matrix.">fsqmat</a>: <span class="keyword">public</span> <a class="code" href="classsqmat.html" title="Virtual class for representation of double symmetric matrices in square-root form...">sqmat</a> |
67 | | <a name="l00111"></a>00111 { |
68 | | <a name="l00112"></a>00112 <span class="keyword">protected</span>: |
69 | | <a name="l00114"></a><a class="code" href="classfsqmat.html#a7a1fcb9aae19d1e4daddfc9c22ce453">00114</a> mat <a class="code" href="classfsqmat.html#a7a1fcb9aae19d1e4daddfc9c22ce453" title="Full matrix on which the operations are performed.">M</a>; |
70 | | <a name="l00115"></a>00115 <span class="keyword">public</span>: |
71 | | <a name="l00116"></a>00116 <span class="keywordtype">void</span> <a class="code" href="classfsqmat.html#b36530e155667fe9f1bd58394e50c65a">opupdt</a> ( <span class="keyword">const</span> vec &v, <span class="keywordtype">double</span> w ); |
72 | | <a name="l00117"></a>00117 mat <a class="code" href="classfsqmat.html#f54fc955e8e3b43d15afa92124bc24b3" title="Conversion to full matrix.">to_mat</a>() <span class="keyword">const</span>; |
73 | | <a name="l00118"></a>00118 <span class="keywordtype">void</span> <a class="code" href="classfsqmat.html#5530d2756b5d991de755e6121c9a452e" title="Inplace symmetric multiplication by a SQUARE matrix , i.e. .">mult_sym</a> ( <span class="keyword">const</span> mat &C); |
74 | | <a name="l00119"></a>00119 <span class="keywordtype">void</span> <a class="code" href="classfsqmat.html#92052a8adc2054b63e42d1373d145c89" title="Inplace symmetric multiplication by a SQUARE transpose of matrix , i.e. .">mult_sym_t</a> ( <span class="keyword">const</span> mat &C); |
75 | | <a name="l00121"></a>00121 <span class="keywordtype">void</span> <a class="code" href="classfsqmat.html#5530d2756b5d991de755e6121c9a452e" title="Inplace symmetric multiplication by a SQUARE matrix , i.e. .">mult_sym</a> ( <span class="keyword">const</span> mat &C, <a class="code" href="classfsqmat.html" title="Fake sqmat. This class maps sqmat operations to operations on full matrix.">fsqmat</a> &U) <span class="keyword">const</span>; |
76 | | <a name="l00123"></a>00123 <span class="keywordtype">void</span> <a class="code" href="classfsqmat.html#92052a8adc2054b63e42d1373d145c89" title="Inplace symmetric multiplication by a SQUARE transpose of matrix , i.e. .">mult_sym_t</a> ( <span class="keyword">const</span> mat &C, <a class="code" href="classfsqmat.html" title="Fake sqmat. This class maps sqmat operations to operations on full matrix.">fsqmat</a> &U) <span class="keyword">const</span>; |
77 | | <a name="l00124"></a>00124 <span class="keywordtype">void</span> <a class="code" href="classfsqmat.html#cfa4c359483d2322f32d1d50050f8ac4" title="Clearing matrix so that it corresponds to zeros.">clear</a>(); |
78 | | <a name="l00125"></a>00125 |
79 | | <a name="l00127"></a>00127 <a class="code" href="classfsqmat.html#79e3f73e0ccd663c7f7e08083d272940" title="Default initialization.">fsqmat</a>(); <span class="comment">// mat will be initialized OK</span> |
80 | | <a name="l00129"></a>00129 <span class="comment"></span> <a class="code" href="classfsqmat.html#79e3f73e0ccd663c7f7e08083d272940" title="Default initialization.">fsqmat</a>(<span class="keyword">const</span> <span class="keywordtype">int</span> dim0); <span class="comment">// mat will be initialized OK</span> |
81 | | <a name="l00131"></a>00131 <span class="comment"></span> <a class="code" href="classfsqmat.html#79e3f73e0ccd663c7f7e08083d272940" title="Default initialization.">fsqmat</a> ( <span class="keyword">const</span> mat &<a class="code" href="classfsqmat.html#a7a1fcb9aae19d1e4daddfc9c22ce453" title="Full matrix on which the operations are performed.">M</a> ); |
82 | | <a name="l00133"></a><a class="code" href="classfsqmat.html#c01f3e9bb590f2a2921369d672f3ce1e">00133</a> <a class="code" href="classfsqmat.html#79e3f73e0ccd663c7f7e08083d272940" title="Default initialization.">fsqmat</a> ( <span class="keyword">const</span> vec &d ):<a class="code" href="classsqmat.html" title="Virtual class for representation of double symmetric matrices in square-root form...">sqmat</a>(d.length()){<a class="code" href="classfsqmat.html#a7a1fcb9aae19d1e4daddfc9c22ce453" title="Full matrix on which the operations are performed.">M</a>=diag(d);}; |
83 | | <a name="l00134"></a>00134 |
84 | | <a name="l00136"></a><a class="code" href="classfsqmat.html#2a8f104e4befbc2aa90d8b11edfedb2e">00136</a> <span class="keyword">virtual</span> <a class="code" href="classfsqmat.html#2a8f104e4befbc2aa90d8b11edfedb2e" title="Destructor for future use;.">~fsqmat</a>(){}; |
85 | | <a name="l00137"></a>00137 |
| 66 | <a name="l00106"></a>00106 |
| 67 | <a name="l00111"></a><a class="code" href="classfsqmat.html">00111</a> <span class="keyword">class </span><a class="code" href="classfsqmat.html" title="Fake sqmat. This class maps sqmat operations to operations on full matrix.">fsqmat</a>: <span class="keyword">public</span> <a class="code" href="classsqmat.html" title="Virtual class for representation of double symmetric matrices in square-root form...">sqmat</a> |
| 68 | <a name="l00112"></a>00112 { |
| 69 | <a name="l00113"></a>00113 <span class="keyword">protected</span>: |
| 70 | <a name="l00115"></a><a class="code" href="classfsqmat.html#a7a1fcb9aae19d1e4daddfc9c22ce453">00115</a> mat <a class="code" href="classfsqmat.html#a7a1fcb9aae19d1e4daddfc9c22ce453" title="Full matrix on which the operations are performed.">M</a>; |
| 71 | <a name="l00116"></a>00116 <span class="keyword">public</span>: |
| 72 | <a name="l00117"></a>00117 <span class="keywordtype">void</span> <a class="code" href="classfsqmat.html#b36530e155667fe9f1bd58394e50c65a">opupdt</a> ( <span class="keyword">const</span> vec &v, <span class="keywordtype">double</span> w ); |
| 73 | <a name="l00118"></a>00118 mat <a class="code" href="classfsqmat.html#f54fc955e8e3b43d15afa92124bc24b3" title="Conversion to full matrix.">to_mat</a>() <span class="keyword">const</span>; |
| 74 | <a name="l00119"></a>00119 <span class="keywordtype">void</span> <a class="code" href="classfsqmat.html#5530d2756b5d991de755e6121c9a452e" title="Inplace symmetric multiplication by a SQUARE matrix , i.e. .">mult_sym</a> ( <span class="keyword">const</span> mat &C); |
| 75 | <a name="l00120"></a>00120 <span class="keywordtype">void</span> <a class="code" href="classfsqmat.html#92052a8adc2054b63e42d1373d145c89" title="Inplace symmetric multiplication by a SQUARE transpose of matrix , i.e. .">mult_sym_t</a> ( <span class="keyword">const</span> mat &C); |
| 76 | <a name="l00122"></a>00122 <span class="keywordtype">void</span> <a class="code" href="classfsqmat.html#5530d2756b5d991de755e6121c9a452e" title="Inplace symmetric multiplication by a SQUARE matrix , i.e. .">mult_sym</a> ( <span class="keyword">const</span> mat &C, <a class="code" href="classfsqmat.html" title="Fake sqmat. This class maps sqmat operations to operations on full matrix.">fsqmat</a> &U) <span class="keyword">const</span>; |
| 77 | <a name="l00124"></a>00124 <span class="keywordtype">void</span> <a class="code" href="classfsqmat.html#92052a8adc2054b63e42d1373d145c89" title="Inplace symmetric multiplication by a SQUARE transpose of matrix , i.e. .">mult_sym_t</a> ( <span class="keyword">const</span> mat &C, <a class="code" href="classfsqmat.html" title="Fake sqmat. This class maps sqmat operations to operations on full matrix.">fsqmat</a> &U) <span class="keyword">const</span>; |
| 78 | <a name="l00125"></a>00125 <span class="keywordtype">void</span> <a class="code" href="classfsqmat.html#cfa4c359483d2322f32d1d50050f8ac4" title="Clearing matrix so that it corresponds to zeros.">clear</a>(); |
| 79 | <a name="l00126"></a>00126 |
| 80 | <a name="l00128"></a>00128 <a class="code" href="classfsqmat.html#79e3f73e0ccd663c7f7e08083d272940" title="Default initialization.">fsqmat</a>(); <span class="comment">// mat will be initialized OK</span> |
| 81 | <a name="l00130"></a>00130 <span class="comment"></span> <a class="code" href="classfsqmat.html#79e3f73e0ccd663c7f7e08083d272940" title="Default initialization.">fsqmat</a>(<span class="keyword">const</span> <span class="keywordtype">int</span> dim0); <span class="comment">// mat will be initialized OK</span> |
| 82 | <a name="l00132"></a>00132 <span class="comment"></span> <a class="code" href="classfsqmat.html#79e3f73e0ccd663c7f7e08083d272940" title="Default initialization.">fsqmat</a> ( <span class="keyword">const</span> mat &<a class="code" href="classfsqmat.html#a7a1fcb9aae19d1e4daddfc9c22ce453" title="Full matrix on which the operations are performed.">M</a> ); |
| 83 | <a name="l00134"></a><a class="code" href="classfsqmat.html#c01f3e9bb590f2a2921369d672f3ce1e">00134</a> <a class="code" href="classfsqmat.html#79e3f73e0ccd663c7f7e08083d272940" title="Default initialization.">fsqmat</a> ( <span class="keyword">const</span> vec &d ):<a class="code" href="classsqmat.html" title="Virtual class for representation of double symmetric matrices in square-root form...">sqmat</a>(d.length()){<a class="code" href="classfsqmat.html#a7a1fcb9aae19d1e4daddfc9c22ce453" title="Full matrix on which the operations are performed.">M</a>=diag(d);}; |
| 84 | <a name="l00135"></a>00135 |
| 85 | <a name="l00137"></a><a class="code" href="classfsqmat.html#2a8f104e4befbc2aa90d8b11edfedb2e">00137</a> <span class="keyword">virtual</span> <a class="code" href="classfsqmat.html#2a8f104e4befbc2aa90d8b11edfedb2e" title="Destructor for future use;.">~fsqmat</a>(){}; |
87 | | <a name="l00144"></a>00144 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classfsqmat.html#9fa853e1ca28f2a1a1c43377e798ecb1" title="Matrix inversion preserving the chosen form.">inv</a> ( <a class="code" href="classfsqmat.html" title="Fake sqmat. This class maps sqmat operations to operations on full matrix.">fsqmat</a> &Inv ); |
88 | | <a name="l00145"></a>00145 |
89 | | <a name="l00146"></a><a class="code" href="classfsqmat.html#eb0d1358f536e4453b5f99d0418ca1e5">00146</a> <span class="keywordtype">double</span> <a class="code" href="classfsqmat.html#eb0d1358f536e4453b5f99d0418ca1e5" title="Logarithm of a determinant.">logdet</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> log ( det ( <a class="code" href="classfsqmat.html#a7a1fcb9aae19d1e4daddfc9c22ce453" title="Full matrix on which the operations are performed.">M</a> ) );}; |
90 | | <a name="l00147"></a><a class="code" href="classfsqmat.html#a6c91b0389e73404324b2314b08d6e87">00147</a> <span class="keywordtype">double</span> <a class="code" href="classfsqmat.html#a6c91b0389e73404324b2314b08d6e87" title="Evaluates quadratic form ;.">qform</a> (<span class="keyword">const</span> vec &v )<span class="keyword"> const </span>{<span class="keywordflow">return</span> ( v* ( <a class="code" href="classfsqmat.html#a7a1fcb9aae19d1e4daddfc9c22ce453" title="Full matrix on which the operations are performed.">M</a>*v ) );}; |
91 | | <a name="l00148"></a><a class="code" href="classfsqmat.html#58075da64ddadd4df40654c35b928c6f">00148</a> <span class="keywordtype">double</span> <a class="code" href="classfsqmat.html#58075da64ddadd4df40654c35b928c6f" title="Evaluates quadratic form ;.">invqform</a> (<span class="keyword">const</span> vec &v )<span class="keyword"> const </span>{<span class="keywordflow">return</span> ( v* ( itpp::inv(<a class="code" href="classfsqmat.html#a7a1fcb9aae19d1e4daddfc9c22ce453" title="Full matrix on which the operations are performed.">M</a>)*v ) );}; |
92 | | <a name="l00149"></a><a class="code" href="classfsqmat.html#842a774077ee34ac3c36d180ab33e103">00149</a> vec <a class="code" href="classfsqmat.html#842a774077ee34ac3c36d180ab33e103" title="Multiplies square root of by vector .">sqrt_mult</a> (<span class="keyword">const</span> vec &v )<span class="keyword"> const </span>{mat Ch=chol(<a class="code" href="classfsqmat.html#a7a1fcb9aae19d1e4daddfc9c22ce453" title="Full matrix on which the operations are performed.">M</a>); <span class="keywordflow">return</span> Ch*v;}; |
93 | | <a name="l00150"></a>00150 |
94 | | <a name="l00152"></a><a class="code" href="classfsqmat.html#a2e0bf7dbbbbe1d3358064c4ad455f1f">00152</a> <span class="keywordtype">void</span> <span class="keyword">add</span> ( <span class="keyword">const</span> <a class="code" href="classfsqmat.html" title="Fake sqmat. This class maps sqmat operations to operations on full matrix.">fsqmat</a> &fsq2, <span class="keywordtype">double</span> w=1.0 ){<a class="code" href="classfsqmat.html#a7a1fcb9aae19d1e4daddfc9c22ce453" title="Full matrix on which the operations are performed.">M</a>+=fsq2.M;}; |
95 | | <a name="l00153"></a>00153 |
96 | | <a name="l00155"></a><a class="code" href="classfsqmat.html#922f8190c13987cbcdb33ec2bf5cf105">00155</a> <span class="keywordtype">void</span> <a class="code" href="classfsqmat.html#922f8190c13987cbcdb33ec2bf5cf105" title="Access functions.">setD</a> (<span class="keyword">const</span> vec &nD){<a class="code" href="classfsqmat.html#a7a1fcb9aae19d1e4daddfc9c22ce453" title="Full matrix on which the operations are performed.">M</a>=diag(nD);} |
97 | | <a name="l00157"></a><a class="code" href="classfsqmat.html#bcf837b2956745e8986044f5600dbd6e">00157</a> vec <a class="code" href="classfsqmat.html#bcf837b2956745e8986044f5600dbd6e" title="Access functions.">getD</a> (){<span class="keywordflow">return</span> diag(<a class="code" href="classfsqmat.html#a7a1fcb9aae19d1e4daddfc9c22ce453" title="Full matrix on which the operations are performed.">M</a>);} |
98 | | <a name="l00159"></a><a class="code" href="classfsqmat.html#03a8f49eb4d38a054ecc522be59cd2ad">00159</a> <span class="keywordtype">void</span> <a class="code" href="classfsqmat.html#922f8190c13987cbcdb33ec2bf5cf105" 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="classfsqmat.html#a7a1fcb9aae19d1e4daddfc9c22ce453" title="Full matrix on which the operations are performed.">M</a>(j,j)=nD(j-i);}} <span class="comment">//Fixme can be more general</span> |
99 | | <a name="l00160"></a>00160 |
| 87 | <a name="l00139"></a>00139 |
| 88 | <a name="l00145"></a>00145 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classfsqmat.html#9fa853e1ca28f2a1a1c43377e798ecb1" title="Matrix inversion preserving the chosen form.">inv</a> ( <a class="code" href="classfsqmat.html" title="Fake sqmat. This class maps sqmat operations to operations on full matrix.">fsqmat</a> &Inv ); |
| 89 | <a name="l00146"></a>00146 |
| 90 | <a name="l00147"></a><a class="code" href="classfsqmat.html#eb0d1358f536e4453b5f99d0418ca1e5">00147</a> <span class="keywordtype">double</span> <a class="code" href="classfsqmat.html#eb0d1358f536e4453b5f99d0418ca1e5" title="Logarithm of a determinant.">logdet</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> log ( det ( <a class="code" href="classfsqmat.html#a7a1fcb9aae19d1e4daddfc9c22ce453" title="Full matrix on which the operations are performed.">M</a> ) );}; |
| 91 | <a name="l00148"></a><a class="code" href="classfsqmat.html#a6c91b0389e73404324b2314b08d6e87">00148</a> <span class="keywordtype">double</span> <a class="code" href="classfsqmat.html#a6c91b0389e73404324b2314b08d6e87" title="Evaluates quadratic form ;.">qform</a> (<span class="keyword">const</span> vec &v )<span class="keyword"> const </span>{<span class="keywordflow">return</span> ( v* ( <a class="code" href="classfsqmat.html#a7a1fcb9aae19d1e4daddfc9c22ce453" title="Full matrix on which the operations are performed.">M</a>*v ) );}; |
| 92 | <a name="l00149"></a><a class="code" href="classfsqmat.html#58075da64ddadd4df40654c35b928c6f">00149</a> <span class="keywordtype">double</span> <a class="code" href="classfsqmat.html#58075da64ddadd4df40654c35b928c6f" title="Evaluates quadratic form ;.">invqform</a> (<span class="keyword">const</span> vec &v )<span class="keyword"> const </span>{<span class="keywordflow">return</span> ( v* ( itpp::inv(<a class="code" href="classfsqmat.html#a7a1fcb9aae19d1e4daddfc9c22ce453" title="Full matrix on which the operations are performed.">M</a>)*v ) );}; |
| 93 | <a name="l00150"></a><a class="code" href="classfsqmat.html#842a774077ee34ac3c36d180ab33e103">00150</a> vec <a class="code" href="classfsqmat.html#842a774077ee34ac3c36d180ab33e103" title="Multiplies square root of by vector .">sqrt_mult</a> (<span class="keyword">const</span> vec &v )<span class="keyword"> const </span>{mat Ch=chol(<a class="code" href="classfsqmat.html#a7a1fcb9aae19d1e4daddfc9c22ce453" title="Full matrix on which the operations are performed.">M</a>); <span class="keywordflow">return</span> Ch*v;}; |
| 94 | <a name="l00151"></a>00151 |
| 95 | <a name="l00153"></a><a class="code" href="classfsqmat.html#a2e0bf7dbbbbe1d3358064c4ad455f1f">00153</a> <span class="keywordtype">void</span> <span class="keyword">add</span> ( <span class="keyword">const</span> <a class="code" href="classfsqmat.html" title="Fake sqmat. This class maps sqmat operations to operations on full matrix.">fsqmat</a> &fsq2, <span class="keywordtype">double</span> w=1.0 ){<a class="code" href="classfsqmat.html#a7a1fcb9aae19d1e4daddfc9c22ce453" title="Full matrix on which the operations are performed.">M</a>+=fsq2.M;}; |
| 96 | <a name="l00154"></a>00154 |
| 97 | <a name="l00156"></a><a class="code" href="classfsqmat.html#922f8190c13987cbcdb33ec2bf5cf105">00156</a> <span class="keywordtype">void</span> <a class="code" href="classfsqmat.html#922f8190c13987cbcdb33ec2bf5cf105" title="Access functions.">setD</a> (<span class="keyword">const</span> vec &nD){<a class="code" href="classfsqmat.html#a7a1fcb9aae19d1e4daddfc9c22ce453" title="Full matrix on which the operations are performed.">M</a>=diag(nD);} |
| 98 | <a name="l00158"></a><a class="code" href="classfsqmat.html#bcf837b2956745e8986044f5600dbd6e">00158</a> vec <a class="code" href="classfsqmat.html#bcf837b2956745e8986044f5600dbd6e" title="Access functions.">getD</a> (){<span class="keywordflow">return</span> diag(<a class="code" href="classfsqmat.html#a7a1fcb9aae19d1e4daddfc9c22ce453" title="Full matrix on which the operations are performed.">M</a>);} |
| 99 | <a name="l00160"></a><a class="code" href="classfsqmat.html#03a8f49eb4d38a054ecc522be59cd2ad">00160</a> <span class="keywordtype">void</span> <a class="code" href="classfsqmat.html#922f8190c13987cbcdb33ec2bf5cf105" 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="classfsqmat.html#a7a1fcb9aae19d1e4daddfc9c22ce453" title="Full matrix on which the operations are performed.">M</a>(j,j)=nD(j-i);}} <span class="comment">//Fixme can be more general</span> |
101 | | <a name="l00163"></a><a class="code" href="classfsqmat.html#514d1fdd8a382dbd6a774f2cf1ebd3de">00163</a> <a class="code" href="classfsqmat.html" title="Fake sqmat. This class maps sqmat operations to operations on full matrix.">fsqmat</a>& <a class="code" href="classfsqmat.html#514d1fdd8a382dbd6a774f2cf1ebd3de" title="add another fsqmat matrix">operator += </a>( <span class="keyword">const</span> <a class="code" href="classfsqmat.html" title="Fake sqmat. This class maps sqmat operations to operations on full matrix.">fsqmat</a> &A ) {<a class="code" href="classfsqmat.html#a7a1fcb9aae19d1e4daddfc9c22ce453" title="Full matrix on which the operations are performed.">M</a>+=A.<a class="code" href="classfsqmat.html#a7a1fcb9aae19d1e4daddfc9c22ce453" title="Full matrix on which the operations are performed.">M</a>;<span class="keywordflow">return</span> *<span class="keyword">this</span>;}; |
102 | | <a name="l00165"></a><a class="code" href="classfsqmat.html#e976bc9d899961e1d2087b0630ed33b7">00165</a> <a class="code" href="classfsqmat.html" title="Fake sqmat. This class maps sqmat operations to operations on full matrix.">fsqmat</a>& <a class="code" href="classfsqmat.html#e976bc9d899961e1d2087b0630ed33b7" title="subtrack another fsqmat matrix">operator -= </a>( <span class="keyword">const</span> <a class="code" href="classfsqmat.html" title="Fake sqmat. This class maps sqmat operations to operations on full matrix.">fsqmat</a> &A ) {<a class="code" href="classfsqmat.html#a7a1fcb9aae19d1e4daddfc9c22ce453" title="Full matrix on which the operations are performed.">M</a>-=A.<a class="code" href="classfsqmat.html#a7a1fcb9aae19d1e4daddfc9c22ce453" title="Full matrix on which the operations are performed.">M</a>;<span class="keywordflow">return</span> *<span class="keyword">this</span>;}; |
103 | | <a name="l00167"></a><a class="code" href="classfsqmat.html#af800e7b2146da5e60897255dde80059">00167</a> <a class="code" href="classfsqmat.html" title="Fake sqmat. This class maps sqmat operations to operations on full matrix.">fsqmat</a>& <a class="code" href="classfsqmat.html#af800e7b2146da5e60897255dde80059" title="multiply by a scalar">operator *= </a>( <span class="keywordtype">double</span> x ) {<a class="code" href="classfsqmat.html#a7a1fcb9aae19d1e4daddfc9c22ce453" title="Full matrix on which the operations are performed.">M</a>*=x;<span class="keywordflow">return</span> *<span class="keyword">this</span>;}; |
104 | | <a name="l00168"></a>00168 <span class="comment">// fsqmat& operator = ( const fsqmat &A) {M=A.M; return *this;};</span> |
105 | | <a name="l00170"></a>00170 <span class="comment"></span> <span class="keyword">friend</span> std::ostream &<a class="code" href="classfsqmat.html#e06aba54d61e807b41bd68b5ee6ac22f" title="print full matrix">operator<< </a>( std::ostream &os, <span class="keyword">const</span> <a class="code" href="classfsqmat.html" title="Fake sqmat. This class maps sqmat operations to operations on full matrix.">fsqmat</a> &sq ); |
106 | | <a name="l00171"></a>00171 |
107 | | <a name="l00172"></a>00172 }; |
108 | | <a name="l00173"></a>00173 |
109 | | <a name="l00179"></a><a class="code" href="classldmat.html">00179</a> <span class="keyword">class </span><a class="code" href="classldmat.html" title="Matrix stored in LD form, (typically known as UD).">ldmat</a>: <a class="code" href="classsqmat.html" title="Virtual class for representation of double symmetric matrices in square-root form...">sqmat</a> |
110 | | <a name="l00180"></a>00180 { |
111 | | <a name="l00181"></a>00181 <span class="keyword">public</span>: |
112 | | <a name="l00182"></a>00182 |
| 101 | <a name="l00162"></a>00162 |
| 102 | <a name="l00164"></a><a class="code" href="classfsqmat.html#514d1fdd8a382dbd6a774f2cf1ebd3de">00164</a> <a class="code" href="classfsqmat.html" title="Fake sqmat. This class maps sqmat operations to operations on full matrix.">fsqmat</a>& <a class="code" href="classfsqmat.html#514d1fdd8a382dbd6a774f2cf1ebd3de" title="add another fsqmat matrix">operator += </a>( <span class="keyword">const</span> <a class="code" href="classfsqmat.html" title="Fake sqmat. This class maps sqmat operations to operations on full matrix.">fsqmat</a> &A ) {<a class="code" href="classfsqmat.html#a7a1fcb9aae19d1e4daddfc9c22ce453" title="Full matrix on which the operations are performed.">M</a>+=A.<a class="code" href="classfsqmat.html#a7a1fcb9aae19d1e4daddfc9c22ce453" title="Full matrix on which the operations are performed.">M</a>;<span class="keywordflow">return</span> *<span class="keyword">this</span>;}; |
| 103 | <a name="l00166"></a><a class="code" href="classfsqmat.html#e976bc9d899961e1d2087b0630ed33b7">00166</a> <a class="code" href="classfsqmat.html" title="Fake sqmat. This class maps sqmat operations to operations on full matrix.">fsqmat</a>& <a class="code" href="classfsqmat.html#e976bc9d899961e1d2087b0630ed33b7" title="subtrack another fsqmat matrix">operator -= </a>( <span class="keyword">const</span> <a class="code" href="classfsqmat.html" title="Fake sqmat. This class maps sqmat operations to operations on full matrix.">fsqmat</a> &A ) {<a class="code" href="classfsqmat.html#a7a1fcb9aae19d1e4daddfc9c22ce453" title="Full matrix on which the operations are performed.">M</a>-=A.<a class="code" href="classfsqmat.html#a7a1fcb9aae19d1e4daddfc9c22ce453" title="Full matrix on which the operations are performed.">M</a>;<span class="keywordflow">return</span> *<span class="keyword">this</span>;}; |
| 104 | <a name="l00168"></a><a class="code" href="classfsqmat.html#af800e7b2146da5e60897255dde80059">00168</a> <a class="code" href="classfsqmat.html" title="Fake sqmat. This class maps sqmat operations to operations on full matrix.">fsqmat</a>& <a class="code" href="classfsqmat.html#af800e7b2146da5e60897255dde80059" title="multiply by a scalar">operator *= </a>( <span class="keywordtype">double</span> x ) {<a class="code" href="classfsqmat.html#a7a1fcb9aae19d1e4daddfc9c22ce453" title="Full matrix on which the operations are performed.">M</a>*=x;<span class="keywordflow">return</span> *<span class="keyword">this</span>;}; |
| 105 | <a name="l00169"></a>00169 <span class="comment">// fsqmat& operator = ( const fsqmat &A) {M=A.M; return *this;};</span> |
| 106 | <a name="l00171"></a>00171 <span class="comment"></span> <span class="keyword">friend</span> std::ostream &<a class="code" href="classfsqmat.html#e06aba54d61e807b41bd68b5ee6ac22f" title="print full matrix">operator<< </a>( std::ostream &os, <span class="keyword">const</span> <a class="code" href="classfsqmat.html" title="Fake sqmat. This class maps sqmat operations to operations on full matrix.">fsqmat</a> &sq ); |
| 107 | <a name="l00172"></a>00172 |
| 108 | <a name="l00173"></a>00173 }; |
| 109 | <a name="l00174"></a>00174 |
| 110 | <a name="l00180"></a><a class="code" href="classldmat.html">00180</a> <span class="keyword">class </span><a class="code" href="classldmat.html" title="Matrix stored in LD form, (commonly known as UD).">ldmat</a>: <a class="code" href="classsqmat.html" title="Virtual class for representation of double symmetric matrices in square-root form...">sqmat</a> |
| 111 | <a name="l00181"></a>00181 { |
| 112 | <a name="l00182"></a>00182 <span class="keyword">public</span>: |
123 | | <a name="l00199"></a>00199 <span class="keywordtype">void</span> <a class="code" href="classldmat.html#0f0f6e083e6d947cf58097ffce3ccd1a">opupdt</a> ( <span class="keyword">const</span> vec &v, <span class="keywordtype">double</span> w ); |
124 | | <a name="l00200"></a>00200 mat <a class="code" href="classldmat.html#2c1ebc071de4bafbba55b80afd8a7e8e" title="Conversion to full matrix.">to_mat</a>() <span class="keyword">const</span>; |
125 | | <a name="l00201"></a>00201 <span class="keywordtype">void</span> <a class="code" href="classldmat.html#e967b9425007f0cb6cd59b845f9756d8" title="Inplace symmetric multiplication by a SQUARE matrix , i.e. .">mult_sym</a> ( <span class="keyword">const</span> mat &C); |
126 | | <a name="l00202"></a>00202 <span class="keywordtype">void</span> <a class="code" href="classldmat.html#4fd155f38eb6dd5af4bdf9c98a7999a9" title="Inplace symmetric multiplication by a SQUARE transpose of matrix , i.e. .">mult_sym_t</a> ( <span class="keyword">const</span> mat &C); |
127 | | <a name="l00204"></a>00204 <span class="keywordtype">void</span> <span class="keyword">add</span> ( <span class="keyword">const</span> <a class="code" href="classldmat.html" title="Matrix stored in LD form, (typically known as UD).">ldmat</a> &ld2, <span class="keywordtype">double</span> w=1.0 ); |
128 | | <a name="l00205"></a>00205 <span class="keywordtype">double</span> <a class="code" href="classldmat.html#2b42750ba4962d439aa52a77ae12949b" title="Logarithm of a determinant.">logdet</a>() <span class="keyword">const</span>; |
129 | | <a name="l00206"></a>00206 <span class="keywordtype">double</span> <a class="code" href="classldmat.html#d64f331b781903e913cb2ee836886f3f" title="Evaluates quadratic form ;.">qform</a> (<span class="keyword">const</span> vec &v ) <span class="keyword">const</span>; |
130 | | <a name="l00207"></a>00207 <span class="keywordtype">double</span> <a class="code" href="classldmat.html#d876c5f83e02b3e809b35c9de5068f14" title="Evaluates quadratic form ;.">invqform</a> (<span class="keyword">const</span> vec &v ) <span class="keyword">const</span>; |
131 | | <a name="l00208"></a>00208 <span class="comment">// sqmat& operator -= ( const sqmat & ld2 );</span> |
132 | | <a name="l00209"></a>00209 <span class="keywordtype">void</span> <a class="code" href="classldmat.html#4d6e401de9607332305c27e67972a07a" title="Clearing matrix so that it corresponds to zeros.">clear</a>(); |
133 | | <a name="l00210"></a>00210 <span class="keywordtype">int</span> <a class="code" href="classldmat.html#0fceb6b5b637cec89bb0a3d2e6be1306" title="access function">cols</a>() <span class="keyword">const</span>; |
134 | | <a name="l00211"></a>00211 <span class="keywordtype">int</span> <a class="code" href="classldmat.html#96dfb21865db4f5bd36fa70f9b0b1163" title="access function">rows</a>() <span class="keyword">const</span>; |
135 | | <a name="l00212"></a>00212 vec <a class="code" href="classldmat.html#fc380626ced6f9244fb58c5f0231174d" title="Multiplies square root of by vector .">sqrt_mult</a> ( <span class="keyword">const</span> vec &v ) <span class="keyword">const</span>; |
136 | | <a name="l00213"></a>00213 |
137 | | <a name="l00217"></a>00217 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classldmat.html#2c160cb123c1102face7a50ec566a031" title="Matrix inversion preserving the chosen form.">inv</a> ( <a class="code" href="classldmat.html" title="Matrix stored in LD form, (typically known as UD).">ldmat</a> &Inv ) <span class="keyword">const</span>; |
138 | | <a name="l00218"></a>00218 |
139 | | <a name="l00223"></a>00223 <span class="keywordtype">void</span> <a class="code" href="classldmat.html#e967b9425007f0cb6cd59b845f9756d8" title="Inplace symmetric multiplication by a SQUARE matrix , i.e. .">mult_sym</a> ( <span class="keyword">const</span> mat &C, <a class="code" href="classldmat.html" title="Matrix stored in LD form, (typically known as UD).">ldmat</a> &U) <span class="keyword">const</span>; |
140 | | <a name="l00224"></a>00224 |
141 | | <a name="l00229"></a>00229 <span class="keywordtype">void</span> <a class="code" href="classldmat.html#4fd155f38eb6dd5af4bdf9c98a7999a9" title="Inplace symmetric multiplication by a SQUARE transpose of matrix , i.e. .">mult_sym_t</a> ( <span class="keyword">const</span> mat &C, <a class="code" href="classldmat.html" title="Matrix stored in LD form, (typically known as UD).">ldmat</a> &U) <span class="keyword">const</span>; |
142 | | <a name="l00230"></a>00230 |
143 | | <a name="l00231"></a>00231 |
144 | | <a name="l00238"></a>00238 <span class="keywordtype">void</span> <a class="code" href="classldmat.html#f291faa073e7bc8dfafc7ae93daa2506" title="Transforms general into pure .">ldform</a> (<span class="keyword">const</span> mat &A,<span class="keyword">const</span> vec &D0 ); |
145 | | <a name="l00239"></a>00239 |
146 | | <a name="l00241"></a><a class="code" href="classldmat.html#0884a613b94fde61bfc84288e73ce57f">00241</a> <span class="keywordtype">void</span> <a class="code" href="classldmat.html#0884a613b94fde61bfc84288e73ce57f" title="Access functions.">setD</a> (<span class="keyword">const</span> vec &nD){D=nD;} |
147 | | <a name="l00243"></a><a class="code" href="classldmat.html#7619922b4de18830ce5351c6b5667e60">00243</a> <span class="keywordtype">void</span> <a class="code" href="classldmat.html#0884a613b94fde61bfc84288e73ce57f" title="Access functions.">setD</a> (<span class="keyword">const</span> vec &nD, <span class="keywordtype">int</span> i){D.replace_mid(i,nD);} <span class="comment">//Fixme can be more general</span> |
148 | | <a name="l00245"></a><a class="code" href="classldmat.html#32ff66296627ff5341d7c0b973249614">00245</a> <span class="comment"></span> <span class="keywordtype">void</span> <a class="code" href="classldmat.html#32ff66296627ff5341d7c0b973249614" title="Access functions.">setL</a> (<span class="keyword">const</span> vec &nL){L=nL;} |
149 | | <a name="l00246"></a>00246 |
150 | | <a name="l00248"></a><a class="code" href="classldmat.html#282c879f50aa9ef934e7f46d86881582">00248</a> <span class="keyword">const</span> vec& <a class="code" href="classldmat.html#282c879f50aa9ef934e7f46d86881582" title="Access functions.">_D</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> D;} |
151 | | <a name="l00250"></a><a class="code" href="classldmat.html#5f44f100248c6627314afaa653b9e5bd">00250</a> <span class="keyword">const</span> mat& <a class="code" href="classldmat.html#5f44f100248c6627314afaa653b9e5bd" title="Access functions.">_L</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> L;} |
152 | | <a name="l00251"></a>00251 |
153 | | <a name="l00253"></a>00253 <a class="code" href="classldmat.html" title="Matrix stored in LD form, (typically known as UD).">ldmat</a>& <a class="code" href="classldmat.html#ca445ee152a56043af946ea095b2d8f8" title="add another ldmat matrix">operator += </a>( <span class="keyword">const</span> <a class="code" href="classldmat.html" title="Matrix stored in LD form, (typically known as UD).">ldmat</a> &ldA ); |
154 | | <a name="l00255"></a>00255 <a class="code" href="classldmat.html" title="Matrix stored in LD form, (typically known as UD).">ldmat</a>& <a class="code" href="classldmat.html#e3f4d2d85ab1ba384c852329aa31d0fb" title="subtract another ldmat matrix">operator -= </a>( <span class="keyword">const</span> <a class="code" href="classldmat.html" title="Matrix stored in LD form, (typically known as UD).">ldmat</a> &ldA ); |
155 | | <a name="l00257"></a>00257 <a class="code" href="classldmat.html" title="Matrix stored in LD form, (typically known as UD).">ldmat</a>& <a class="code" href="classldmat.html#875b7e6dcf73ae7001329099019fdb1d" title="multiply by a scalar">operator *= </a>( <span class="keywordtype">double</span> x ); |
156 | | <a name="l00258"></a>00258 |
157 | | <a name="l00260"></a>00260 <span class="keyword">friend</span> std::ostream &<a class="code" href="classldmat.html#eaaa0baa6026b84cfcbced41c84599d1" title="print both L and D ">operator<< </a>( std::ostream &os, <span class="keyword">const</span> <a class="code" href="classldmat.html" title="Matrix stored in LD form, (typically known as UD).">ldmat</a> &sq ); |
158 | | <a name="l00261"></a>00261 |
159 | | <a name="l00262"></a>00262 <span class="keyword">protected</span>: |
160 | | <a name="l00264"></a><a class="code" href="classldmat.html#4cce04824539c4a8d062d9a36d6e014e">00264</a> vec D; |
161 | | <a name="l00266"></a><a class="code" href="classldmat.html#f74a64b99fe58a75ebd37bb679e121ea">00266</a> mat L; |
162 | | <a name="l00267"></a>00267 |
163 | | <a name="l00268"></a>00268 }; |
| 122 | <a name="l00199"></a>00199 <span class="comment">// Reimplementation of compulsory operatios</span> |
| 123 | <a name="l00200"></a>00200 |
| 124 | <a name="l00201"></a>00201 <span class="keywordtype">void</span> <a class="code" href="classldmat.html#0f0f6e083e6d947cf58097ffce3ccd1a">opupdt</a> ( <span class="keyword">const</span> vec &v, <span class="keywordtype">double</span> w ); |
| 125 | <a name="l00202"></a>00202 mat <a class="code" href="classldmat.html#2c1ebc071de4bafbba55b80afd8a7e8e" title="Conversion to full matrix.">to_mat</a>() <span class="keyword">const</span>; |
| 126 | <a name="l00203"></a>00203 <span class="keywordtype">void</span> <a class="code" href="classldmat.html#e967b9425007f0cb6cd59b845f9756d8" title="Inplace symmetric multiplication by a SQUARE matrix , i.e. .">mult_sym</a> ( <span class="keyword">const</span> mat &C); |
| 127 | <a name="l00204"></a>00204 <span class="keywordtype">void</span> <a class="code" href="classldmat.html#4fd155f38eb6dd5af4bdf9c98a7999a9" title="Inplace symmetric multiplication by a SQUARE transpose of matrix , i.e. .">mult_sym_t</a> ( <span class="keyword">const</span> mat &C); |
| 128 | <a name="l00206"></a>00206 <span class="keywordtype">void</span> <span class="keyword">add</span> ( <span class="keyword">const</span> <a class="code" href="classldmat.html" title="Matrix stored in LD form, (commonly known as UD).">ldmat</a> &ld2, <span class="keywordtype">double</span> w=1.0 ); |
| 129 | <a name="l00207"></a>00207 <span class="keywordtype">double</span> <a class="code" href="classldmat.html#2b42750ba4962d439aa52a77ae12949b" title="Logarithm of a determinant.">logdet</a>() <span class="keyword">const</span>; |
| 130 | <a name="l00208"></a>00208 <span class="keywordtype">double</span> <a class="code" href="classldmat.html#d64f331b781903e913cb2ee836886f3f" title="Evaluates quadratic form ;.">qform</a> (<span class="keyword">const</span> vec &v ) <span class="keyword">const</span>; |
| 131 | <a name="l00209"></a>00209 <span class="keywordtype">double</span> <a class="code" href="classldmat.html#d876c5f83e02b3e809b35c9de5068f14" title="Evaluates quadratic form ;.">invqform</a> (<span class="keyword">const</span> vec &v ) <span class="keyword">const</span>; |
| 132 | <a name="l00210"></a>00210 <span class="keywordtype">void</span> <a class="code" href="classldmat.html#4d6e401de9607332305c27e67972a07a" title="Clearing matrix so that it corresponds to zeros.">clear</a>(); |
| 133 | <a name="l00211"></a>00211 <span class="keywordtype">int</span> <a class="code" href="classldmat.html#0fceb6b5b637cec89bb0a3d2e6be1306" title="access function">cols</a>() <span class="keyword">const</span>; |
| 134 | <a name="l00212"></a>00212 <span class="keywordtype">int</span> <a class="code" href="classldmat.html#96dfb21865db4f5bd36fa70f9b0b1163" title="access function">rows</a>() <span class="keyword">const</span>; |
| 135 | <a name="l00213"></a>00213 vec <a class="code" href="classldmat.html#fc380626ced6f9244fb58c5f0231174d" title="Multiplies square root of by vector .">sqrt_mult</a> ( <span class="keyword">const</span> vec &v ) <span class="keyword">const</span>; |
| 136 | <a name="l00214"></a>00214 |
| 137 | <a name="l00215"></a>00215 |
| 138 | <a name="l00219"></a>00219 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classldmat.html#2c160cb123c1102face7a50ec566a031" title="Matrix inversion preserving the chosen form.">inv</a> ( <a class="code" href="classldmat.html" title="Matrix stored in LD form, (commonly known as UD).">ldmat</a> &Inv ) <span class="keyword">const</span>; |
| 139 | <a name="l00220"></a>00220 |
| 140 | <a name="l00225"></a>00225 <span class="keywordtype">void</span> <a class="code" href="classldmat.html#e967b9425007f0cb6cd59b845f9756d8" title="Inplace symmetric multiplication by a SQUARE matrix , i.e. .">mult_sym</a> ( <span class="keyword">const</span> mat &C, <a class="code" href="classldmat.html" title="Matrix stored in LD form, (commonly known as UD).">ldmat</a> &U) <span class="keyword">const</span>; |
| 141 | <a name="l00226"></a>00226 |
| 142 | <a name="l00231"></a>00231 <span class="keywordtype">void</span> <a class="code" href="classldmat.html#4fd155f38eb6dd5af4bdf9c98a7999a9" title="Inplace symmetric multiplication by a SQUARE transpose of matrix , i.e. .">mult_sym_t</a> ( <span class="keyword">const</span> mat &C, <a class="code" href="classldmat.html" title="Matrix stored in LD form, (commonly known as UD).">ldmat</a> &U) <span class="keyword">const</span>; |
| 143 | <a name="l00232"></a>00232 |
| 144 | <a name="l00233"></a>00233 |
| 145 | <a name="l00240"></a>00240 <span class="keywordtype">void</span> <a class="code" href="classldmat.html#f291faa073e7bc8dfafc7ae93daa2506" title="Transforms general into pure .">ldform</a> (<span class="keyword">const</span> mat &A,<span class="keyword">const</span> vec &D0 ); |
| 146 | <a name="l00241"></a>00241 |
| 147 | <a name="l00243"></a><a class="code" href="classldmat.html#0884a613b94fde61bfc84288e73ce57f">00243</a> <span class="keywordtype">void</span> <a class="code" href="classldmat.html#0884a613b94fde61bfc84288e73ce57f" title="Access functions.">setD</a> (<span class="keyword">const</span> vec &nD){D=nD;} |
| 148 | <a name="l00245"></a><a class="code" href="classldmat.html#7619922b4de18830ce5351c6b5667e60">00245</a> <span class="keywordtype">void</span> <a class="code" href="classldmat.html#0884a613b94fde61bfc84288e73ce57f" title="Access functions.">setD</a> (<span class="keyword">const</span> vec &nD, <span class="keywordtype">int</span> i){D.replace_mid(i,nD);} <span class="comment">//Fixme can be more general</span> |
| 149 | <a name="l00247"></a><a class="code" href="classldmat.html#32ff66296627ff5341d7c0b973249614">00247</a> <span class="comment"></span> <span class="keywordtype">void</span> <a class="code" href="classldmat.html#32ff66296627ff5341d7c0b973249614" title="Access functions.">setL</a> (<span class="keyword">const</span> vec &nL){L=nL;} |
| 150 | <a name="l00248"></a>00248 |
| 151 | <a name="l00250"></a><a class="code" href="classldmat.html#282c879f50aa9ef934e7f46d86881582">00250</a> <span class="keyword">const</span> vec& <a class="code" href="classldmat.html#282c879f50aa9ef934e7f46d86881582" title="Access functions.">_D</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> D;} |
| 152 | <a name="l00252"></a><a class="code" href="classldmat.html#5f44f100248c6627314afaa653b9e5bd">00252</a> <span class="keyword">const</span> mat& <a class="code" href="classldmat.html#5f44f100248c6627314afaa653b9e5bd" title="Access functions.">_L</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> L;} |
| 153 | <a name="l00253"></a>00253 |
| 154 | <a name="l00255"></a>00255 <a class="code" href="classldmat.html" title="Matrix stored in LD form, (commonly known as UD).">ldmat</a>& <a class="code" href="classldmat.html#ca445ee152a56043af946ea095b2d8f8" title="add another ldmat matrix">operator += </a>( <span class="keyword">const</span> <a class="code" href="classldmat.html" title="Matrix stored in LD form, (commonly known as UD).">ldmat</a> &ldA ); |
| 155 | <a name="l00257"></a>00257 <a class="code" href="classldmat.html" title="Matrix stored in LD form, (commonly known as UD).">ldmat</a>& <a class="code" href="classldmat.html#e3f4d2d85ab1ba384c852329aa31d0fb" title="subtract another ldmat matrix">operator -= </a>( <span class="keyword">const</span> <a class="code" href="classldmat.html" title="Matrix stored in LD form, (commonly known as UD).">ldmat</a> &ldA ); |
| 156 | <a name="l00259"></a>00259 <a class="code" href="classldmat.html" title="Matrix stored in LD form, (commonly known as UD).">ldmat</a>& <a class="code" href="classldmat.html#875b7e6dcf73ae7001329099019fdb1d" title="multiply by a scalar">operator *= </a>( <span class="keywordtype">double</span> x ); |
| 157 | <a name="l00260"></a>00260 |
| 158 | <a name="l00262"></a>00262 <span class="keyword">friend</span> std::ostream &<a class="code" href="classldmat.html#eaaa0baa6026b84cfcbced41c84599d1" title="print both L and D ">operator<< </a>( std::ostream &os, <span class="keyword">const</span> <a class="code" href="classldmat.html" title="Matrix stored in LD form, (commonly known as UD).">ldmat</a> &sq ); |
| 159 | <a name="l00263"></a>00263 |
| 160 | <a name="l00264"></a>00264 <span class="keyword">protected</span>: |
| 161 | <a name="l00266"></a><a class="code" href="classldmat.html#4cce04824539c4a8d062d9a36d6e014e">00266</a> vec D; |
| 162 | <a name="l00268"></a><a class="code" href="classldmat.html#f74a64b99fe58a75ebd37bb679e121ea">00268</a> mat L; |