[172] | 1 | \hypertarget{classchmat}{ |
---|
[37] | 2 | \section{chmat Class Reference} |
---|
| 3 | \label{classchmat}\index{chmat@{chmat}} |
---|
[172] | 4 | } |
---|
[37] | 5 | {\tt \#include $<$chmat.h$>$} |
---|
| 6 | |
---|
| 7 | Inheritance diagram for chmat:\nopagebreak |
---|
| 8 | \begin{figure}[H] |
---|
| 9 | \begin{center} |
---|
| 10 | \leavevmode |
---|
[261] | 11 | \includegraphics[width=45pt]{classchmat__inherit__graph} |
---|
[37] | 12 | \end{center} |
---|
| 13 | \end{figure} |
---|
[270] | 14 | |
---|
| 15 | |
---|
| 16 | \subsection{Detailed Description} |
---|
| 17 | Symmetric matrix stored in square root decomposition using upper cholesky. |
---|
| 18 | |
---|
| 19 | This matrix represent $A=Ch' Ch$ where only the upper triangle $Ch$ is stored; \subsection*{Public Member Functions} |
---|
[37] | 20 | \begin{CompactItemize} |
---|
| 21 | \item |
---|
[172] | 22 | void \hyperlink{classchmat_bbc2d98d7455b1f38828907d442836bf}{opupdt} (const vec \&v, double w) |
---|
[37] | 23 | \item |
---|
[172] | 24 | \hypertarget{classchmat_045addd685f8d978efda232d7dcb070e}{ |
---|
| 25 | mat \hyperlink{classchmat_045addd685f8d978efda232d7dcb070e}{to\_\-mat} () const } |
---|
| 26 | \label{classchmat_045addd685f8d978efda232d7dcb070e} |
---|
[37] | 27 | |
---|
| 28 | \begin{CompactList}\small\item\em Conversion to full matrix. \item\end{CompactList}\item |
---|
[172] | 29 | void \hyperlink{classchmat_66f509f92b0ccf020e2a2a32566e0777}{mult\_\-sym} (const mat \&C) |
---|
[79] | 30 | \begin{CompactList}\small\item\em Inplace symmetric multiplication by a SQUARE matrix $C$, i.e. $V = C*V*C'$. \item\end{CompactList}\item |
---|
[172] | 31 | \hypertarget{classchmat_d558ab63475a2f2ebc0c0e149796dcc6}{ |
---|
| 32 | void \textbf{mult\_\-sym} (const mat \&C, \hyperlink{classchmat}{chmat} \&U) const } |
---|
| 33 | \label{classchmat_d558ab63475a2f2ebc0c0e149796dcc6} |
---|
[37] | 34 | |
---|
[79] | 35 | \item |
---|
[172] | 36 | void \hyperlink{classchmat_07f50d1332b901eee962e8b1913102f7}{mult\_\-sym\_\-t} (const mat \&C) |
---|
[79] | 37 | \begin{CompactList}\small\item\em Inplace symmetric multiplication by a SQUARE transpose of matrix $C$, i.e. $V = C'*V*C$. \item\end{CompactList}\item |
---|
[172] | 38 | \hypertarget{classchmat_31c3b985214a150b2a6b4be3b0fd40e3}{ |
---|
| 39 | void \textbf{mult\_\-sym\_\-t} (const mat \&C, \hyperlink{classchmat}{chmat} \&U) const } |
---|
| 40 | \label{classchmat_31c3b985214a150b2a6b4be3b0fd40e3} |
---|
[79] | 41 | |
---|
| 42 | \item |
---|
[172] | 43 | \hypertarget{classchmat_b504ca818203b13e667cb3c503980382}{ |
---|
| 44 | double \hyperlink{classchmat_b504ca818203b13e667cb3c503980382}{logdet} () const } |
---|
| 45 | \label{classchmat_b504ca818203b13e667cb3c503980382} |
---|
[79] | 46 | |
---|
[37] | 47 | \begin{CompactList}\small\item\em Logarithm of a determinant. \item\end{CompactList}\item |
---|
[172] | 48 | vec \hyperlink{classchmat_b22aa239dbaca33e3fb93b4f674d7051}{sqrt\_\-mult} (const vec \&v) const |
---|
[79] | 49 | \begin{CompactList}\small\item\em Multiplies square root of $V$ by vector $x$. \item\end{CompactList}\item |
---|
[172] | 50 | \hypertarget{classchmat_6807737c7ffdb7041256b51db7592248}{ |
---|
| 51 | double \hyperlink{classchmat_6807737c7ffdb7041256b51db7592248}{qform} (const vec \&v) const } |
---|
| 52 | \label{classchmat_6807737c7ffdb7041256b51db7592248} |
---|
[37] | 53 | |
---|
[79] | 54 | \begin{CompactList}\small\item\em Evaluates quadratic form $x= v'*V*v$;. \item\end{CompactList}\item |
---|
[172] | 55 | \hypertarget{classchmat_b49427cff186c62f5df3724e5d2c34b4}{ |
---|
| 56 | double \hyperlink{classchmat_b49427cff186c62f5df3724e5d2c34b4}{invqform} (const vec \&v) const } |
---|
| 57 | \label{classchmat_b49427cff186c62f5df3724e5d2c34b4} |
---|
[37] | 58 | |
---|
[79] | 59 | \begin{CompactList}\small\item\em Evaluates quadratic form $x= v'*inv(V)*v$;. \item\end{CompactList}\item |
---|
[172] | 60 | \hypertarget{classchmat_d0a995d312ecc11d3b43693f5e224ba9}{ |
---|
| 61 | void \hyperlink{classchmat_d0a995d312ecc11d3b43693f5e224ba9}{clear} ()} |
---|
| 62 | \label{classchmat_d0a995d312ecc11d3b43693f5e224ba9} |
---|
[79] | 63 | |
---|
[37] | 64 | \begin{CompactList}\small\item\em Clearing matrix so that it corresponds to zeros. \item\end{CompactList}\item |
---|
[172] | 65 | \hypertarget{classchmat_f3921e3e5e31337cdbda40a3a5467257}{ |
---|
| 66 | void \hyperlink{classchmat_f3921e3e5e31337cdbda40a3a5467257}{add} (const \hyperlink{classchmat}{chmat} \&A2, double w=1.0)} |
---|
| 67 | \label{classchmat_f3921e3e5e31337cdbda40a3a5467257} |
---|
[37] | 68 | |
---|
[172] | 69 | \begin{CompactList}\small\item\em add another \hyperlink{classchmat}{chmat} {\tt A2} with weight {\tt w}. \item\end{CompactList}\item |
---|
| 70 | \hypertarget{classchmat_5ce4e21a9012a4e98c1f0ed1ca5669bd}{ |
---|
| 71 | void \hyperlink{classchmat_5ce4e21a9012a4e98c1f0ed1ca5669bd}{inv} (\hyperlink{classchmat}{chmat} \&Inv) const } |
---|
| 72 | \label{classchmat_5ce4e21a9012a4e98c1f0ed1ca5669bd} |
---|
[37] | 73 | |
---|
[79] | 74 | \begin{CompactList}\small\item\em Inversion in the same form, i.e. cholesky. \item\end{CompactList}\item |
---|
[172] | 75 | \hypertarget{classchmat_ba62fbf7cb8e065a4f3d24457824e89b}{ |
---|
| 76 | virtual \hyperlink{classchmat_ba62fbf7cb8e065a4f3d24457824e89b}{$\sim$chmat} ()} |
---|
| 77 | \label{classchmat_ba62fbf7cb8e065a4f3d24457824e89b} |
---|
[37] | 78 | |
---|
| 79 | \begin{CompactList}\small\item\em Destructor for future use;. \item\end{CompactList}\item |
---|
[172] | 80 | \hypertarget{classchmat_fdd73b0c596161637fd25bdf2c670c39}{ |
---|
| 81 | \hyperlink{classchmat_fdd73b0c596161637fd25bdf2c670c39}{chmat} (const int dim0)} |
---|
| 82 | \label{classchmat_fdd73b0c596161637fd25bdf2c670c39} |
---|
[37] | 83 | |
---|
| 84 | \begin{CompactList}\small\item\em Default constructor. \item\end{CompactList}\item |
---|
[172] | 85 | \hypertarget{classchmat_d4f0a94e81279295e60e72812130f9d4}{ |
---|
| 86 | \hyperlink{classchmat_d4f0a94e81279295e60e72812130f9d4}{chmat} (const vec \&v)} |
---|
| 87 | \label{classchmat_d4f0a94e81279295e60e72812130f9d4} |
---|
[79] | 88 | |
---|
| 89 | \begin{CompactList}\small\item\em Default constructor. \item\end{CompactList}\item |
---|
[172] | 90 | \hypertarget{classchmat_d92f3bd9a727b8c88a8c7385feb3449a}{ |
---|
| 91 | \hyperlink{classchmat_d92f3bd9a727b8c88a8c7385feb3449a}{chmat} (const \hyperlink{classchmat}{chmat} \&Ch0)} |
---|
| 92 | \label{classchmat_d92f3bd9a727b8c88a8c7385feb3449a} |
---|
[79] | 93 | |
---|
| 94 | \begin{CompactList}\small\item\em Copy constructor. \item\end{CompactList}\item |
---|
[172] | 95 | \hypertarget{classchmat_8334a00f30f0a05f893c2aeec395ef10}{ |
---|
| 96 | \hyperlink{classchmat_8334a00f30f0a05f893c2aeec395ef10}{chmat} (const mat \&M)} |
---|
| 97 | \label{classchmat_8334a00f30f0a05f893c2aeec395ef10} |
---|
[37] | 98 | |
---|
| 99 | \begin{CompactList}\small\item\em Default constructor (m3k:cholform). \item\end{CompactList}\item |
---|
[210] | 100 | \hypertarget{classchmat_24de7f42e0a86bb270588cd0dd9d60b4}{ |
---|
| 101 | \hyperlink{classchmat_24de7f42e0a86bb270588cd0dd9d60b4}{chmat} (const \hyperlink{classchmat}{chmat} \&M, const ivec \&perm)} |
---|
| 102 | \label{classchmat_24de7f42e0a86bb270588cd0dd9d60b4} |
---|
| 103 | |
---|
| 104 | \begin{CompactList}\small\item\em Constructor. \item\end{CompactList}\item |
---|
[172] | 105 | \hypertarget{classchmat_9c50d31c999d85d8e9d8cf2b69b6ac8c}{ |
---|
| 106 | mat \& \hyperlink{classchmat_9c50d31c999d85d8e9d8cf2b69b6ac8c}{\_\-Ch} ()} |
---|
| 107 | \label{classchmat_9c50d31c999d85d8e9d8cf2b69b6ac8c} |
---|
[37] | 108 | |
---|
| 109 | \begin{CompactList}\small\item\em Access function. \item\end{CompactList}\item |
---|
[172] | 110 | \hypertarget{classchmat_a4fc7f9b0539b97c414442a22f3db6e8}{ |
---|
| 111 | void \hyperlink{classchmat_a4fc7f9b0539b97c414442a22f3db6e8}{setD} (const vec \&nD)} |
---|
| 112 | \label{classchmat_a4fc7f9b0539b97c414442a22f3db6e8} |
---|
[79] | 113 | |
---|
| 114 | \begin{CompactList}\small\item\em Access functions. \item\end{CompactList}\item |
---|
[172] | 115 | \hypertarget{classchmat_4b9271097d8317d9514c5d0d62cccb39}{ |
---|
| 116 | void \hyperlink{classchmat_4b9271097d8317d9514c5d0d62cccb39}{setD} (const vec \&nD, int i)} |
---|
| 117 | \label{classchmat_4b9271097d8317d9514c5d0d62cccb39} |
---|
[79] | 118 | |
---|
| 119 | \begin{CompactList}\small\item\em Access functions. \item\end{CompactList}\item |
---|
[172] | 120 | \hyperlink{classchmat}{chmat} \& \hyperlink{classchmat_6a8b39fe3a28d2c8e3fc0d74141229fb}{operator+=} (const \hyperlink{classchmat}{chmat} \&A2) |
---|
[79] | 121 | \begin{CompactList}\small\item\em Operators. \item\end{CompactList}\item |
---|
[172] | 122 | \hypertarget{classchmat_a8c3628a8c15eb0009e57c66fcac1a76}{ |
---|
| 123 | \hyperlink{classchmat}{chmat} \& \hyperlink{classchmat_a8c3628a8c15eb0009e57c66fcac1a76}{operator-=} (const \hyperlink{classchmat}{chmat} \&A2)} |
---|
| 124 | \label{classchmat_a8c3628a8c15eb0009e57c66fcac1a76} |
---|
[79] | 125 | |
---|
| 126 | \begin{CompactList}\small\item\em mapping of negative add operation to operators \item\end{CompactList}\item |
---|
[234] | 127 | \hypertarget{classchmat_64f1eec40946d3abad7762899c9f933a}{ |
---|
| 128 | \hyperlink{classchmat}{chmat} \& \textbf{operator$\ast$} (const \hyperlink{classchmat}{chmat} \&A2)} |
---|
| 129 | \label{classchmat_64f1eec40946d3abad7762899c9f933a} |
---|
| 130 | |
---|
| 131 | \item |
---|
| 132 | \hypertarget{classchmat_e0404bcb998f0b82d25f5fc386cc4fa5}{ |
---|
| 133 | \hyperlink{classchmat}{chmat} \& \textbf{operator$\ast$} (const double \&d)} |
---|
| 134 | \label{classchmat_e0404bcb998f0b82d25f5fc386cc4fa5} |
---|
| 135 | |
---|
| 136 | \item |
---|
| 137 | \hypertarget{classchmat_cdb54c921d7b93ac1a04d58cae7a9618}{ |
---|
| 138 | \hyperlink{classchmat}{chmat} \& \textbf{operator=} (const \hyperlink{classchmat}{chmat} \&A2)} |
---|
| 139 | \label{classchmat_cdb54c921d7b93ac1a04d58cae7a9618} |
---|
| 140 | |
---|
| 141 | \item |
---|
[172] | 142 | \hypertarget{classsqmat_ecc2e2540f95a04f4449842588170f5b}{ |
---|
| 143 | int \hyperlink{classsqmat_ecc2e2540f95a04f4449842588170f5b}{cols} () const } |
---|
| 144 | \label{classsqmat_ecc2e2540f95a04f4449842588170f5b} |
---|
[37] | 145 | |
---|
[172] | 146 | \begin{CompactList}\small\item\em Reimplementing common functions of mat: \hyperlink{classsqmat_ecc2e2540f95a04f4449842588170f5b}{cols()}. \item\end{CompactList}\item |
---|
| 147 | \hypertarget{classsqmat_071e80ced9cc3b8cbb360fa7462eb646}{ |
---|
| 148 | int \hyperlink{classsqmat_071e80ced9cc3b8cbb360fa7462eb646}{rows} () const } |
---|
| 149 | \label{classsqmat_071e80ced9cc3b8cbb360fa7462eb646} |
---|
[37] | 150 | |
---|
[172] | 151 | \begin{CompactList}\small\item\em Reimplementing common functions of mat: \hyperlink{classsqmat_ecc2e2540f95a04f4449842588170f5b}{cols()}. \item\end{CompactList}\end{CompactItemize} |
---|
[37] | 152 | \subsection*{Protected Attributes} |
---|
| 153 | \begin{CompactItemize} |
---|
| 154 | \item |
---|
[172] | 155 | \hypertarget{classchmat_95158bb150f5e7f939168abcd577fd9c}{ |
---|
| 156 | mat \hyperlink{classchmat_95158bb150f5e7f939168abcd577fd9c}{Ch}} |
---|
| 157 | \label{classchmat_95158bb150f5e7f939168abcd577fd9c} |
---|
[37] | 158 | |
---|
[79] | 159 | \begin{CompactList}\small\item\em Upper triangle of the cholesky matrix. \item\end{CompactList}\item |
---|
[172] | 160 | \hypertarget{classsqmat_0abed904bdc0882373ba9adba919689d}{ |
---|
| 161 | int \hyperlink{classsqmat_0abed904bdc0882373ba9adba919689d}{dim}} |
---|
| 162 | \label{classsqmat_0abed904bdc0882373ba9adba919689d} |
---|
[37] | 163 | |
---|
| 164 | \begin{CompactList}\small\item\em dimension of the square matrix \item\end{CompactList}\end{CompactItemize} |
---|
| 165 | |
---|
| 166 | |
---|
| 167 | \subsection{Member Function Documentation} |
---|
[172] | 168 | \hypertarget{classchmat_bbc2d98d7455b1f38828907d442836bf}{ |
---|
[37] | 169 | \index{chmat@{chmat}!opupdt@{opupdt}} |
---|
| 170 | \index{opupdt@{opupdt}!chmat@{chmat}} |
---|
[172] | 171 | \subsubsection[opupdt]{\setlength{\rightskip}{0pt plus 5cm}void chmat::opupdt (const vec \& {\em v}, \/ double {\em w})\hspace{0.3cm}{\tt \mbox{[}virtual\mbox{]}}}} |
---|
| 172 | \label{classchmat_bbc2d98d7455b1f38828907d442836bf} |
---|
[37] | 173 | |
---|
| 174 | |
---|
[79] | 175 | Perfroms a rank-1 update by outer product of vectors: $V = V + w v v'$. \begin{Desc} |
---|
[37] | 176 | \item[Parameters:] |
---|
| 177 | \begin{description} |
---|
| 178 | \item[{\em v}]Vector forming the outer product to be added \item[{\em w}]weight of updating; can be negative\end{description} |
---|
| 179 | \end{Desc} |
---|
| 180 | BLAS-2b operation. |
---|
| 181 | |
---|
[172] | 182 | Implements \hyperlink{classsqmat_b223484796661f2dadb5607a86ce0581}{sqmat}. |
---|
[91] | 183 | |
---|
[172] | 184 | References Ch.\hypertarget{classchmat_66f509f92b0ccf020e2a2a32566e0777}{ |
---|
| 185 | \index{chmat@{chmat}!mult\_\-sym@{mult\_\-sym}} |
---|
[91] | 186 | \index{mult\_\-sym@{mult\_\-sym}!chmat@{chmat}} |
---|
[172] | 187 | \subsubsection[mult\_\-sym]{\setlength{\rightskip}{0pt plus 5cm}void chmat::mult\_\-sym (const mat \& {\em C})\hspace{0.3cm}{\tt \mbox{[}virtual\mbox{]}}}} |
---|
| 188 | \label{classchmat_66f509f92b0ccf020e2a2a32566e0777} |
---|
[37] | 189 | |
---|
| 190 | |
---|
[79] | 191 | Inplace symmetric multiplication by a SQUARE matrix $C$, i.e. $V = C*V*C'$. |
---|
[37] | 192 | |
---|
| 193 | \begin{Desc} |
---|
| 194 | \item[Parameters:] |
---|
| 195 | \begin{description} |
---|
| 196 | \item[{\em C}]multiplying matrix, \end{description} |
---|
| 197 | \end{Desc} |
---|
| 198 | |
---|
| 199 | |
---|
[172] | 200 | Implements \hyperlink{classsqmat_60fbbfa9e483b8187c135f787ee53afa}{sqmat}.\hypertarget{classchmat_07f50d1332b901eee962e8b1913102f7}{ |
---|
| 201 | \index{chmat@{chmat}!mult\_\-sym\_\-t@{mult\_\-sym\_\-t}} |
---|
[91] | 202 | \index{mult\_\-sym\_\-t@{mult\_\-sym\_\-t}!chmat@{chmat}} |
---|
[172] | 203 | \subsubsection[mult\_\-sym\_\-t]{\setlength{\rightskip}{0pt plus 5cm}void chmat::mult\_\-sym\_\-t (const mat \& {\em C})\hspace{0.3cm}{\tt \mbox{[}virtual\mbox{]}}}} |
---|
| 204 | \label{classchmat_07f50d1332b901eee962e8b1913102f7} |
---|
[37] | 205 | |
---|
| 206 | |
---|
[79] | 207 | Inplace symmetric multiplication by a SQUARE transpose of matrix $C$, i.e. $V = C'*V*C$. |
---|
[37] | 208 | |
---|
| 209 | \begin{Desc} |
---|
| 210 | \item[Parameters:] |
---|
| 211 | \begin{description} |
---|
| 212 | \item[{\em C}]multiplying matrix, \end{description} |
---|
| 213 | \end{Desc} |
---|
| 214 | |
---|
| 215 | |
---|
[172] | 216 | Implements \hyperlink{classsqmat_6909e906da17725b1b80f3cae7cf3325}{sqmat}.\hypertarget{classchmat_b22aa239dbaca33e3fb93b4f674d7051}{ |
---|
| 217 | \index{chmat@{chmat}!sqrt\_\-mult@{sqrt\_\-mult}} |
---|
[91] | 218 | \index{sqrt\_\-mult@{sqrt\_\-mult}!chmat@{chmat}} |
---|
[172] | 219 | \subsubsection[sqrt\_\-mult]{\setlength{\rightskip}{0pt plus 5cm}vec chmat::sqrt\_\-mult (const vec \& {\em v}) const\hspace{0.3cm}{\tt \mbox{[}virtual\mbox{]}}}} |
---|
| 220 | \label{classchmat_b22aa239dbaca33e3fb93b4f674d7051} |
---|
[37] | 221 | |
---|
| 222 | |
---|
[79] | 223 | Multiplies square root of $V$ by vector $x$. |
---|
[37] | 224 | |
---|
| 225 | Used e.g. in generating normal samples. |
---|
| 226 | |
---|
[172] | 227 | Implements \hyperlink{classsqmat_6b79438b5d7544a9c8e110a145355d8f}{sqmat}. |
---|
[91] | 228 | |
---|
[172] | 229 | References Ch.\hypertarget{classchmat_6a8b39fe3a28d2c8e3fc0d74141229fb}{ |
---|
| 230 | \index{chmat@{chmat}!operator+=@{operator+=}} |
---|
[79] | 231 | \index{operator+=@{operator+=}!chmat@{chmat}} |
---|
[172] | 232 | \subsubsection[operator+=]{\setlength{\rightskip}{0pt plus 5cm}{\bf chmat} \& chmat::operator+= (const {\bf chmat} \& {\em A2})\hspace{0.3cm}{\tt \mbox{[}inline\mbox{]}}}} |
---|
| 233 | \label{classchmat_6a8b39fe3a28d2c8e3fc0d74141229fb} |
---|
[37] | 234 | |
---|
[79] | 235 | |
---|
| 236 | Operators. |
---|
| 237 | |
---|
| 238 | Operations: mapping of add operation to operators |
---|
| 239 | |
---|
[37] | 240 | The documentation for this class was generated from the following files:\begin{CompactItemize} |
---|
| 241 | \item |
---|
[261] | 242 | \hyperlink{chmat_8h}{chmat.h}\item |
---|
| 243 | chmat.cpp\end{CompactItemize} |
---|