root/doc/latex/classldmat.tex @ 271

Revision 271, 15.6 kB (checked in by smidl, 16 years ago)

Next major revision

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