root/doc/latex/classldmat.tex @ 219

Revision 219, 15.9 kB (checked in by smidl, 16 years ago)

doc

  • Property svn:eol-style set to native
RevLine 
[172]1\hypertarget{classldmat}{
[33]2\section{ldmat Class Reference}
3\label{classldmat}\index{ldmat@{ldmat}}
[172]4}
[181]5Matrix stored in LD form, (commonly known as UD). 
[33]6
7
8{\tt \#include $<$libDC.h$>$}
9
10Inheritance diagram for ldmat:\nopagebreak
11\begin{figure}[H]
12\begin{center}
13\leavevmode
[91]14\includegraphics[width=43pt]{classldmat__inherit__graph}
[33]15\end{center}
16\end{figure}
17Collaboration diagram for ldmat:\nopagebreak
18\begin{figure}[H]
19\begin{center}
20\leavevmode
[91]21\includegraphics[width=43pt]{classldmat__coll__graph}
[33]22\end{center}
23\end{figure}
24\subsection*{Public Member Functions}
25\begin{CompactItemize}
26\item 
[172]27\hypertarget{classldmat_968113788422e858da23a477e98fd3a1}{
28\hyperlink{classldmat_968113788422e858da23a477e98fd3a1}{ldmat} (const mat \&\hyperlink{classldmat_f74a64b99fe58a75ebd37bb679e121ea}{L}, const vec \&\hyperlink{classldmat_4cce04824539c4a8d062d9a36d6e014e}{D})}
29\label{classldmat_968113788422e858da23a477e98fd3a1}
[33]30
31\begin{CompactList}\small\item\em Construct by copy of L and D. \item\end{CompactList}\item 
[172]32\hypertarget{classldmat_5f21785358072d36892d538eed1d1ea5}{
33\hyperlink{classldmat_5f21785358072d36892d538eed1d1ea5}{ldmat} (const mat \&V)}
34\label{classldmat_5f21785358072d36892d538eed1d1ea5}
[33]35
36\begin{CompactList}\small\item\em Construct by decomposition of full matrix V. \item\end{CompactList}\item 
[181]37\hypertarget{classldmat_8e88c818f9605bc726e52c4136c71cc5}{
38\hyperlink{classldmat_8e88c818f9605bc726e52c4136c71cc5}{ldmat} (const \hyperlink{classldmat}{ldmat} \&V0, const ivec \&perm)}
39\label{classldmat_8e88c818f9605bc726e52c4136c71cc5}
40
41\begin{CompactList}\small\item\em Construct by restructuring of V0 accordint to permutation vector perm. \item\end{CompactList}\item 
[172]42\hypertarget{classldmat_abe16e0f86668ef61a9a4896c8565dee}{
43\hyperlink{classldmat_abe16e0f86668ef61a9a4896c8565dee}{ldmat} (vec D0)}
44\label{classldmat_abe16e0f86668ef61a9a4896c8565dee}
[33]45
46\begin{CompactList}\small\item\em Construct diagonal matrix with diagonal D0. \item\end{CompactList}\item 
[172]47\hypertarget{classldmat_a12dda6f529580b0377cc45226b43303}{
48\hyperlink{classldmat_a12dda6f529580b0377cc45226b43303}{ldmat} ()}
49\label{classldmat_a12dda6f529580b0377cc45226b43303}
[33]50
51\begin{CompactList}\small\item\em Default constructor. \item\end{CompactList}\item 
[172]52\hypertarget{classldmat_163ee002a7858d104da1c59dd11f016d}{
53\hyperlink{classldmat_163ee002a7858d104da1c59dd11f016d}{ldmat} (const int dim0)}
54\label{classldmat_163ee002a7858d104da1c59dd11f016d}
[33]55
56\begin{CompactList}\small\item\em Default initialization with proper size. \item\end{CompactList}\item 
[172]57\hypertarget{classldmat_1e2734c0164ce5233c4d709679555138}{
58virtual \hyperlink{classldmat_1e2734c0164ce5233c4d709679555138}{$\sim$ldmat} ()}
59\label{classldmat_1e2734c0164ce5233c4d709679555138}
[33]60
61\begin{CompactList}\small\item\em Destructor for future use;. \item\end{CompactList}\item 
[172]62void \hyperlink{classldmat_0f0f6e083e6d947cf58097ffce3ccd1a}{opupdt} (const vec \&v, double w)
[33]63\item 
[172]64\hypertarget{classldmat_2c1ebc071de4bafbba55b80afd8a7e8e}{
65mat \hyperlink{classldmat_2c1ebc071de4bafbba55b80afd8a7e8e}{to\_\-mat} () const }
66\label{classldmat_2c1ebc071de4bafbba55b80afd8a7e8e}
[33]67
68\begin{CompactList}\small\item\em Conversion to full matrix. \item\end{CompactList}\item 
[172]69void \hyperlink{classldmat_e967b9425007f0cb6cd59b845f9756d8}{mult\_\-sym} (const mat \&C)
[79]70\begin{CompactList}\small\item\em Inplace symmetric multiplication by a SQUARE matrix $C$, i.e. $V = C*V*C'$. \item\end{CompactList}\item 
[172]71void \hyperlink{classldmat_4fd155f38eb6dd5af4bdf9c98a7999a9}{mult\_\-sym\_\-t} (const mat \&C)
[79]72\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]73\hypertarget{classldmat_a60f2c7e4f3c6a7738eaaaab81ffad20}{
74void \hyperlink{classldmat_a60f2c7e4f3c6a7738eaaaab81ffad20}{add} (const \hyperlink{classldmat}{ldmat} \&ld2, double w=1.0)}
75\label{classldmat_a60f2c7e4f3c6a7738eaaaab81ffad20}
[33]76
77\begin{CompactList}\small\item\em Add another matrix in LD form with weight w. \item\end{CompactList}\item 
[172]78\hypertarget{classldmat_2b42750ba4962d439aa52a77ae12949b}{
79double \hyperlink{classldmat_2b42750ba4962d439aa52a77ae12949b}{logdet} () const }
80\label{classldmat_2b42750ba4962d439aa52a77ae12949b}
[33]81
82\begin{CompactList}\small\item\em Logarithm of a determinant. \item\end{CompactList}\item 
[172]83\hypertarget{classldmat_d64f331b781903e913cb2ee836886f3f}{
84double \hyperlink{classldmat_d64f331b781903e913cb2ee836886f3f}{qform} (const vec \&v) const }
85\label{classldmat_d64f331b781903e913cb2ee836886f3f}
[33]86
[79]87\begin{CompactList}\small\item\em Evaluates quadratic form $x= v'*V*v$;. \item\end{CompactList}\item 
[172]88\hypertarget{classldmat_d876c5f83e02b3e809b35c9de5068f14}{
89double \hyperlink{classldmat_d876c5f83e02b3e809b35c9de5068f14}{invqform} (const vec \&v) const }
90\label{classldmat_d876c5f83e02b3e809b35c9de5068f14}
[79]91
92\begin{CompactList}\small\item\em Evaluates quadratic form $x= v'*inv(V)*v$;. \item\end{CompactList}\item 
[172]93\hypertarget{classldmat_4d6e401de9607332305c27e67972a07a}{
94void \hyperlink{classldmat_4d6e401de9607332305c27e67972a07a}{clear} ()}
95\label{classldmat_4d6e401de9607332305c27e67972a07a}
[33]96
97\begin{CompactList}\small\item\em Clearing matrix so that it corresponds to zeros. \item\end{CompactList}\item 
[219]98\hypertarget{group__math_g0fceb6b5b637cec89bb0a3d2e6be1306}{
99int \hyperlink{group__math_g0fceb6b5b637cec89bb0a3d2e6be1306}{cols} () const }
100\label{group__math_g0fceb6b5b637cec89bb0a3d2e6be1306}
[33]101
102\begin{CompactList}\small\item\em access function \item\end{CompactList}\item 
[219]103\hypertarget{group__math_g96dfb21865db4f5bd36fa70f9b0b1163}{
104int \hyperlink{group__math_g96dfb21865db4f5bd36fa70f9b0b1163}{rows} () const }
105\label{group__math_g96dfb21865db4f5bd36fa70f9b0b1163}
[33]106
107\begin{CompactList}\small\item\em access function \item\end{CompactList}\item 
[172]108vec \hyperlink{classldmat_fc380626ced6f9244fb58c5f0231174d}{sqrt\_\-mult} (const vec \&v) const
[79]109\begin{CompactList}\small\item\em Multiplies square root of $V$ by vector $x$. \item\end{CompactList}\item 
[172]110virtual void \hyperlink{classldmat_2c160cb123c1102face7a50ec566a031}{inv} (\hyperlink{classldmat}{ldmat} \&Inv) const
[33]111\begin{CompactList}\small\item\em Matrix inversion preserving the chosen form. \item\end{CompactList}\item 
[172]112void \hyperlink{classldmat_e7207748909325bb0f99b43f090a2b7e}{mult\_\-sym} (const mat \&C, \hyperlink{classldmat}{ldmat} \&U) const
[79]113\begin{CompactList}\small\item\em Symmetric multiplication of $U$ by a general matrix $C$, result of which is stored in the current class. \item\end{CompactList}\item 
[172]114void \hyperlink{classldmat_f94dc3a233f3d40fc853d8d4ac3b8eab}{mult\_\-sym\_\-t} (const mat \&C, \hyperlink{classldmat}{ldmat} \&U) const
[79]115\begin{CompactList}\small\item\em Symmetric multiplication of $U$ by a transpose of a general matrix $C$, result of which is stored in the current class. \item\end{CompactList}\item 
[172]116void \hyperlink{classldmat_f291faa073e7bc8dfafc7ae93daa2506}{ldform} (const mat \&A, const vec \&D0)
[79]117\begin{CompactList}\small\item\em Transforms general $A'D0 A$ into pure $L'DL$. \item\end{CompactList}\item 
[172]118\hypertarget{classldmat_0884a613b94fde61bfc84288e73ce57f}{
119void \hyperlink{classldmat_0884a613b94fde61bfc84288e73ce57f}{setD} (const vec \&nD)}
120\label{classldmat_0884a613b94fde61bfc84288e73ce57f}
[33]121
122\begin{CompactList}\small\item\em Access functions. \item\end{CompactList}\item 
[172]123\hypertarget{classldmat_7619922b4de18830ce5351c6b5667e60}{
124void \hyperlink{classldmat_7619922b4de18830ce5351c6b5667e60}{setD} (const vec \&nD, int i)}
125\label{classldmat_7619922b4de18830ce5351c6b5667e60}
[33]126
127\begin{CompactList}\small\item\em Access functions. \item\end{CompactList}\item 
[172]128\hypertarget{classldmat_32ff66296627ff5341d7c0b973249614}{
129void \hyperlink{classldmat_32ff66296627ff5341d7c0b973249614}{setL} (const vec \&nL)}
130\label{classldmat_32ff66296627ff5341d7c0b973249614}
[33]131
132\begin{CompactList}\small\item\em Access functions. \item\end{CompactList}\item 
[172]133\hypertarget{classldmat_282c879f50aa9ef934e7f46d86881582}{
134const vec \& \hyperlink{classldmat_282c879f50aa9ef934e7f46d86881582}{\_\-D} () const }
135\label{classldmat_282c879f50aa9ef934e7f46d86881582}
[99]136
137\begin{CompactList}\small\item\em Access functions. \item\end{CompactList}\item 
[172]138\hypertarget{classldmat_5f44f100248c6627314afaa653b9e5bd}{
139const mat \& \hyperlink{classldmat_5f44f100248c6627314afaa653b9e5bd}{\_\-L} () const }
140\label{classldmat_5f44f100248c6627314afaa653b9e5bd}
[99]141
142\begin{CompactList}\small\item\em Access functions. \item\end{CompactList}\item 
[219]143\hyperlink{classldmat}{ldmat} \& \hyperlink{group__math_gca445ee152a56043af946ea095b2d8f8}{operator+=} (const \hyperlink{classldmat}{ldmat} \&ldA)
[172]144\begin{CompactList}\small\item\em add another \hyperlink{classldmat}{ldmat} matrix \item\end{CompactList}\item 
[219]145\hyperlink{classldmat}{ldmat} \& \hyperlink{group__math_ge3f4d2d85ab1ba384c852329aa31d0fb}{operator-=} (const \hyperlink{classldmat}{ldmat} \&ldA)
[172]146\begin{CompactList}\small\item\em subtract another \hyperlink{classldmat}{ldmat} matrix \item\end{CompactList}\item 
147\hypertarget{classldmat_875b7e6dcf73ae7001329099019fdb1d}{
148\hyperlink{classldmat}{ldmat} \& \hyperlink{classldmat_875b7e6dcf73ae7001329099019fdb1d}{operator$\ast$=} (double x)}
149\label{classldmat_875b7e6dcf73ae7001329099019fdb1d}
[33]150
151\begin{CompactList}\small\item\em multiply by a scalar \item\end{CompactList}\end{CompactItemize}
152\subsection*{Protected Attributes}
153\begin{CompactItemize}
154\item 
[172]155\hypertarget{classldmat_4cce04824539c4a8d062d9a36d6e014e}{
156vec \hyperlink{classldmat_4cce04824539c4a8d062d9a36d6e014e}{D}}
157\label{classldmat_4cce04824539c4a8d062d9a36d6e014e}
[33]158
[79]159\begin{CompactList}\small\item\em Positive vector $D$. \item\end{CompactList}\item 
[172]160\hypertarget{classldmat_f74a64b99fe58a75ebd37bb679e121ea}{
161mat \hyperlink{classldmat_f74a64b99fe58a75ebd37bb679e121ea}{L}}
162\label{classldmat_f74a64b99fe58a75ebd37bb679e121ea}
[33]163
[79]164\begin{CompactList}\small\item\em Lower-triangular matrix $L$. \item\end{CompactList}\end{CompactItemize}
[33]165\subsection*{Friends}
166\begin{CompactItemize}
167\item 
[172]168\hypertarget{classldmat_eaaa0baa6026b84cfcbced41c84599d1}{
169std::ostream \& \hyperlink{classldmat_eaaa0baa6026b84cfcbced41c84599d1}{operator$<$$<$} (std::ostream \&os, const \hyperlink{classldmat}{ldmat} \&sq)}
170\label{classldmat_eaaa0baa6026b84cfcbced41c84599d1}
[33]171
172\begin{CompactList}\small\item\em print both {\tt L} and {\tt D} \item\end{CompactList}\end{CompactItemize}
173
174
175\subsection{Detailed Description}
[181]176Matrix stored in LD form, (commonly known as UD).
[33]177
[79]178Matrix is decomposed as follows: \[M = L'DL\] where only $L$ and $D$ matrices are stored. All inplace operations modifies only these and the need to compose and decompose the matrix is avoided.
[33]179
180\subsection{Member Function Documentation}
[172]181\hypertarget{classldmat_0f0f6e083e6d947cf58097ffce3ccd1a}{
[33]182\index{ldmat@{ldmat}!opupdt@{opupdt}}
183\index{opupdt@{opupdt}!ldmat@{ldmat}}
[172]184\subsubsection[opupdt]{\setlength{\rightskip}{0pt plus 5cm}void ldmat::opupdt (const vec \& {\em v}, \/  double {\em w})\hspace{0.3cm}{\tt  \mbox{[}virtual\mbox{]}}}}
185\label{classldmat_0f0f6e083e6d947cf58097ffce3ccd1a}
[33]186
187
[79]188Perfroms a rank-1 update by outer product of vectors: $V = V + w v v'$. \begin{Desc}
[33]189\item[Parameters:]
190\begin{description}
191\item[{\em v}]Vector forming the outer product to be added \item[{\em w}]weight of updating; can be negative\end{description}
192\end{Desc}
193BLAS-2b operation.
194
[172]195Implements \hyperlink{classsqmat_b223484796661f2dadb5607a86ce0581}{sqmat}.
[91]196
[219]197References D, sqmat::dim, dydr(), and L.
[91]198
[172]199Referenced by add(), ARX::bayes(), and ARX::logpred().\hypertarget{classldmat_e967b9425007f0cb6cd59b845f9756d8}{
200\index{ldmat@{ldmat}!mult\_\-sym@{mult\_\-sym}}
[91]201\index{mult\_\-sym@{mult\_\-sym}!ldmat@{ldmat}}
[172]202\subsubsection[mult\_\-sym]{\setlength{\rightskip}{0pt plus 5cm}void ldmat::mult\_\-sym (const mat \& {\em C})\hspace{0.3cm}{\tt  \mbox{[}virtual\mbox{]}}}}
203\label{classldmat_e967b9425007f0cb6cd59b845f9756d8}
[33]204
205
[79]206Inplace symmetric multiplication by a SQUARE matrix $C$, i.e. $V = C*V*C'$.
[33]207
208\begin{Desc}
209\item[Parameters:]
210\begin{description}
211\item[{\em C}]multiplying matrix, \end{description}
212\end{Desc}
213
214
[172]215Implements \hyperlink{classsqmat_60fbbfa9e483b8187c135f787ee53afa}{sqmat}.
[91]216
[172]217References D, L, and ldform().\hypertarget{classldmat_4fd155f38eb6dd5af4bdf9c98a7999a9}{
218\index{ldmat@{ldmat}!mult\_\-sym\_\-t@{mult\_\-sym\_\-t}}
[91]219\index{mult\_\-sym\_\-t@{mult\_\-sym\_\-t}!ldmat@{ldmat}}
[172]220\subsubsection[mult\_\-sym\_\-t]{\setlength{\rightskip}{0pt plus 5cm}void ldmat::mult\_\-sym\_\-t (const mat \& {\em C})\hspace{0.3cm}{\tt  \mbox{[}virtual\mbox{]}}}}
221\label{classldmat_4fd155f38eb6dd5af4bdf9c98a7999a9}
[33]222
223
[79]224Inplace symmetric multiplication by a SQUARE transpose of matrix $C$, i.e. $V = C'*V*C$.
[33]225
226\begin{Desc}
227\item[Parameters:]
228\begin{description}
229\item[{\em C}]multiplying matrix, \end{description}
230\end{Desc}
231
232
[172]233Implements \hyperlink{classsqmat_6909e906da17725b1b80f3cae7cf3325}{sqmat}.
[91]234
[172]235References D, L, and ldform().\hypertarget{classldmat_fc380626ced6f9244fb58c5f0231174d}{
236\index{ldmat@{ldmat}!sqrt\_\-mult@{sqrt\_\-mult}}
[91]237\index{sqrt\_\-mult@{sqrt\_\-mult}!ldmat@{ldmat}}
[172]238\subsubsection[sqrt\_\-mult]{\setlength{\rightskip}{0pt plus 5cm}vec ldmat::sqrt\_\-mult (const vec \& {\em v}) const\hspace{0.3cm}{\tt  \mbox{[}virtual\mbox{]}}}}
239\label{classldmat_fc380626ced6f9244fb58c5f0231174d}
[33]240
241
[79]242Multiplies square root of $V$ by vector $x$.
[33]243
244Used e.g. in generating normal samples.
245
[172]246Implements \hyperlink{classsqmat_6b79438b5d7544a9c8e110a145355d8f}{sqmat}.
[91]247
[172]248References D, sqmat::dim, and L.\hypertarget{classldmat_2c160cb123c1102face7a50ec566a031}{
249\index{ldmat@{ldmat}!inv@{inv}}
[33]250\index{inv@{inv}!ldmat@{ldmat}}
[172]251\subsubsection[inv]{\setlength{\rightskip}{0pt plus 5cm}void ldmat::inv ({\bf ldmat} \& {\em Inv}) const\hspace{0.3cm}{\tt  \mbox{[}virtual\mbox{]}}}}
252\label{classldmat_2c160cb123c1102face7a50ec566a031}
[33]253
254
255Matrix inversion preserving the chosen form.
256
257\begin{Desc}
258\item[Parameters:]
259\begin{description}
260\item[{\em Inv}]a space where the inverse is stored. \end{description}
261\end{Desc}
262
263
[219]264References clear(), D, L, ldform(), and ltuinv().\hypertarget{classldmat_e7207748909325bb0f99b43f090a2b7e}{
[172]265\index{ldmat@{ldmat}!mult\_\-sym@{mult\_\-sym}}
[91]266\index{mult\_\-sym@{mult\_\-sym}!ldmat@{ldmat}}
[172]267\subsubsection[mult\_\-sym]{\setlength{\rightskip}{0pt plus 5cm}void ldmat::mult\_\-sym (const mat \& {\em C}, \/  {\bf ldmat} \& {\em U}) const}}
268\label{classldmat_e7207748909325bb0f99b43f090a2b7e}
[91]269
270
[79]271Symmetric multiplication of $U$ by a general matrix $C$, result of which is stored in the current class.
[33]272
273\begin{Desc}
274\item[Parameters:]
275\begin{description}
276\item[{\em C}]matrix to multiply with \item[{\em U}]a space where the inverse is stored. \end{description}
277\end{Desc}
278
279
[172]280References D, L, and ldform().\hypertarget{classldmat_f94dc3a233f3d40fc853d8d4ac3b8eab}{
281\index{ldmat@{ldmat}!mult\_\-sym\_\-t@{mult\_\-sym\_\-t}}
[91]282\index{mult\_\-sym\_\-t@{mult\_\-sym\_\-t}!ldmat@{ldmat}}
[172]283\subsubsection[mult\_\-sym\_\-t]{\setlength{\rightskip}{0pt plus 5cm}void ldmat::mult\_\-sym\_\-t (const mat \& {\em C}, \/  {\bf ldmat} \& {\em U}) const}}
284\label{classldmat_f94dc3a233f3d40fc853d8d4ac3b8eab}
[91]285
286
[79]287Symmetric multiplication of $U$ by a transpose of a general matrix $C$, result of which is stored in the current class.
[33]288
289\begin{Desc}
290\item[Parameters:]
291\begin{description}
292\item[{\em C}]matrix to multiply with \item[{\em U}]a space where the inverse is stored. \end{description}
293\end{Desc}
[91]294
295
[172]296References D, L, and ldform().\hypertarget{classldmat_f291faa073e7bc8dfafc7ae93daa2506}{
297\index{ldmat@{ldmat}!ldform@{ldform}}
[33]298\index{ldform@{ldform}!ldmat@{ldmat}}
[172]299\subsubsection[ldform]{\setlength{\rightskip}{0pt plus 5cm}void ldmat::ldform (const mat \& {\em A}, \/  const vec \& {\em D0})}}
300\label{classldmat_f291faa073e7bc8dfafc7ae93daa2506}
[33]301
302
[79]303Transforms general $A'D0 A$ into pure $L'DL$.
[33]304
[79]305The new decomposition fullfills: $A'*diag(D)*A = self.L'*diag(self.D)*self.L$ \begin{Desc}
[33]306\item[Parameters:]
307\begin{description}
308\item[{\em A}]general matrix \item[{\em D0}]general vector \end{description}
309\end{Desc}
[91]310
311
312References D, sqmat::dim, and L.
313
[219]314Referenced by inv(), ldmat(), mult\_\-sym(), and mult\_\-sym\_\-t().
[33]315
316The documentation for this class was generated from the following files:\begin{CompactItemize}
317\item 
[172]318work/git/mixpp/bdm/math/\hyperlink{libDC_8h}{libDC.h}\item 
[145]319work/git/mixpp/bdm/math/libDC.cpp\end{CompactItemize}
Note: See TracBrowser for help on using the browser.