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
Line 
1\hypertarget{classldmat}{
2\section{ldmat Class Reference}
3\label{classldmat}\index{ldmat@{ldmat}}
4}
5{\tt \#include $<$libDC.h$>$}
6
7Inheritance diagram for ldmat::\begin{figure}[H]
8\begin{center}
9\leavevmode
10\includegraphics[height=2cm]{classldmat}
11\end{center}
12\end{figure}
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}
19\begin{CompactItemize}
20\item 
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}
24
25\begin{CompactList}\small\item\em Construct by copy of L and D. \item\end{CompactList}\item 
26\hypertarget{classldmat_5f21785358072d36892d538eed1d1ea5}{
27\hyperlink{classldmat_5f21785358072d36892d538eed1d1ea5}{ldmat} (const mat \&V)}
28\label{classldmat_5f21785358072d36892d538eed1d1ea5}
29
30\begin{CompactList}\small\item\em Construct by decomposition of full matrix V. \item\end{CompactList}\item 
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 
36\hypertarget{classldmat_abe16e0f86668ef61a9a4896c8565dee}{
37\hyperlink{classldmat_abe16e0f86668ef61a9a4896c8565dee}{ldmat} (vec D0)}
38\label{classldmat_abe16e0f86668ef61a9a4896c8565dee}
39
40\begin{CompactList}\small\item\em Construct diagonal matrix with diagonal D0. \item\end{CompactList}\item 
41\hypertarget{classldmat_a12dda6f529580b0377cc45226b43303}{
42\hyperlink{classldmat_a12dda6f529580b0377cc45226b43303}{ldmat} ()}
43\label{classldmat_a12dda6f529580b0377cc45226b43303}
44
45\begin{CompactList}\small\item\em Default constructor. \item\end{CompactList}\item 
46\hypertarget{classldmat_163ee002a7858d104da1c59dd11f016d}{
47\hyperlink{classldmat_163ee002a7858d104da1c59dd11f016d}{ldmat} (const int dim0)}
48\label{classldmat_163ee002a7858d104da1c59dd11f016d}
49
50\begin{CompactList}\small\item\em Default initialization with proper size. \item\end{CompactList}\item 
51\hypertarget{classldmat_1e2734c0164ce5233c4d709679555138}{
52virtual \hyperlink{classldmat_1e2734c0164ce5233c4d709679555138}{$\sim$ldmat} ()}
53\label{classldmat_1e2734c0164ce5233c4d709679555138}
54
55\begin{CompactList}\small\item\em Destructor for future use;. \item\end{CompactList}\item 
56void \hyperlink{classldmat_0f0f6e083e6d947cf58097ffce3ccd1a}{opupdt} (const vec \&v, double w)
57\item 
58\hypertarget{classldmat_2c1ebc071de4bafbba55b80afd8a7e8e}{
59mat \hyperlink{classldmat_2c1ebc071de4bafbba55b80afd8a7e8e}{to\_\-mat} () const }
60\label{classldmat_2c1ebc071de4bafbba55b80afd8a7e8e}
61
62\begin{CompactList}\small\item\em Conversion to full matrix. \item\end{CompactList}\item 
63void \hyperlink{classldmat_e967b9425007f0cb6cd59b845f9756d8}{mult\_\-sym} (const mat \&C)
64\begin{CompactList}\small\item\em Inplace symmetric multiplication by a SQUARE matrix $C$, i.e. $V = C*V*C'$. \item\end{CompactList}\item 
65void \hyperlink{classldmat_4fd155f38eb6dd5af4bdf9c98a7999a9}{mult\_\-sym\_\-t} (const mat \&C)
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 
67\hypertarget{classldmat_a60f2c7e4f3c6a7738eaaaab81ffad20}{
68void \hyperlink{classldmat_a60f2c7e4f3c6a7738eaaaab81ffad20}{add} (const \hyperlink{classldmat}{ldmat} \&ld2, double w=1.0)}
69\label{classldmat_a60f2c7e4f3c6a7738eaaaab81ffad20}
70
71\begin{CompactList}\small\item\em Add another matrix in LD form with weight w. \item\end{CompactList}\item 
72\hypertarget{classldmat_2b42750ba4962d439aa52a77ae12949b}{
73double \hyperlink{classldmat_2b42750ba4962d439aa52a77ae12949b}{logdet} () const }
74\label{classldmat_2b42750ba4962d439aa52a77ae12949b}
75
76\begin{CompactList}\small\item\em Logarithm of a determinant. \item\end{CompactList}\item 
77\hypertarget{classldmat_d64f331b781903e913cb2ee836886f3f}{
78double \hyperlink{classldmat_d64f331b781903e913cb2ee836886f3f}{qform} (const vec \&v) const }
79\label{classldmat_d64f331b781903e913cb2ee836886f3f}
80
81\begin{CompactList}\small\item\em Evaluates quadratic form $x= v'*V*v$;. \item\end{CompactList}\item 
82\hypertarget{classldmat_d876c5f83e02b3e809b35c9de5068f14}{
83double \hyperlink{classldmat_d876c5f83e02b3e809b35c9de5068f14}{invqform} (const vec \&v) const }
84\label{classldmat_d876c5f83e02b3e809b35c9de5068f14}
85
86\begin{CompactList}\small\item\em Evaluates quadratic form $x= v'*inv(V)*v$;. \item\end{CompactList}\item 
87\hypertarget{classldmat_4d6e401de9607332305c27e67972a07a}{
88void \hyperlink{classldmat_4d6e401de9607332305c27e67972a07a}{clear} ()}
89\label{classldmat_4d6e401de9607332305c27e67972a07a}
90
91\begin{CompactList}\small\item\em Clearing matrix so that it corresponds to zeros. \item\end{CompactList}\item 
92\hypertarget{group__math_g0fceb6b5b637cec89bb0a3d2e6be1306}{
93int \hyperlink{group__math_g0fceb6b5b637cec89bb0a3d2e6be1306}{cols} () const }
94\label{group__math_g0fceb6b5b637cec89bb0a3d2e6be1306}
95
96\begin{CompactList}\small\item\em access function \item\end{CompactList}\item 
97\hypertarget{group__math_g96dfb21865db4f5bd36fa70f9b0b1163}{
98int \hyperlink{group__math_g96dfb21865db4f5bd36fa70f9b0b1163}{rows} () const }
99\label{group__math_g96dfb21865db4f5bd36fa70f9b0b1163}
100
101\begin{CompactList}\small\item\em access function \item\end{CompactList}\item 
102vec \hyperlink{classldmat_fc380626ced6f9244fb58c5f0231174d}{sqrt\_\-mult} (const vec \&v) const
103\begin{CompactList}\small\item\em Multiplies square root of $V$ by vector $x$. \item\end{CompactList}\item 
104virtual void \hyperlink{classldmat_2c160cb123c1102face7a50ec566a031}{inv} (\hyperlink{classldmat}{ldmat} \&Inv) const
105\begin{CompactList}\small\item\em Matrix inversion preserving the chosen form. \item\end{CompactList}\item 
106void \hyperlink{classldmat_e7207748909325bb0f99b43f090a2b7e}{mult\_\-sym} (const mat \&C, \hyperlink{classldmat}{ldmat} \&U) const
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 
108void \hyperlink{classldmat_f94dc3a233f3d40fc853d8d4ac3b8eab}{mult\_\-sym\_\-t} (const mat \&C, \hyperlink{classldmat}{ldmat} \&U) const
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 
110void \hyperlink{classldmat_f291faa073e7bc8dfafc7ae93daa2506}{ldform} (const mat \&A, const vec \&D0)
111\begin{CompactList}\small\item\em Transforms general $A'D0 A$ into pure $L'DL$. \item\end{CompactList}\item 
112\hypertarget{classldmat_0884a613b94fde61bfc84288e73ce57f}{
113void \hyperlink{classldmat_0884a613b94fde61bfc84288e73ce57f}{setD} (const vec \&nD)}
114\label{classldmat_0884a613b94fde61bfc84288e73ce57f}
115
116\begin{CompactList}\small\item\em Access functions. \item\end{CompactList}\item 
117\hypertarget{classldmat_7619922b4de18830ce5351c6b5667e60}{
118void \hyperlink{classldmat_7619922b4de18830ce5351c6b5667e60}{setD} (const vec \&nD, int i)}
119\label{classldmat_7619922b4de18830ce5351c6b5667e60}
120
121\begin{CompactList}\small\item\em Access functions. \item\end{CompactList}\item 
122\hypertarget{classldmat_32ff66296627ff5341d7c0b973249614}{
123void \hyperlink{classldmat_32ff66296627ff5341d7c0b973249614}{setL} (const vec \&nL)}
124\label{classldmat_32ff66296627ff5341d7c0b973249614}
125
126\begin{CompactList}\small\item\em Access functions. \item\end{CompactList}\item 
127\hypertarget{classldmat_282c879f50aa9ef934e7f46d86881582}{
128const vec \& \hyperlink{classldmat_282c879f50aa9ef934e7f46d86881582}{\_\-D} () const }
129\label{classldmat_282c879f50aa9ef934e7f46d86881582}
130
131\begin{CompactList}\small\item\em Access functions. \item\end{CompactList}\item 
132\hypertarget{classldmat_5f44f100248c6627314afaa653b9e5bd}{
133const mat \& \hyperlink{classldmat_5f44f100248c6627314afaa653b9e5bd}{\_\-L} () const }
134\label{classldmat_5f44f100248c6627314afaa653b9e5bd}
135
136\begin{CompactList}\small\item\em Access functions. \item\end{CompactList}\item 
137\hyperlink{classldmat}{ldmat} \& \hyperlink{group__math_gca445ee152a56043af946ea095b2d8f8}{operator+=} (const \hyperlink{classldmat}{ldmat} \&ldA)
138\begin{CompactList}\small\item\em add another \hyperlink{classldmat}{ldmat} matrix \item\end{CompactList}\item 
139\hyperlink{classldmat}{ldmat} \& \hyperlink{group__math_ge3f4d2d85ab1ba384c852329aa31d0fb}{operator-=} (const \hyperlink{classldmat}{ldmat} \&ldA)
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}
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 
149\hypertarget{classldmat_4cce04824539c4a8d062d9a36d6e014e}{
150vec \hyperlink{classldmat_4cce04824539c4a8d062d9a36d6e014e}{D}}
151\label{classldmat_4cce04824539c4a8d062d9a36d6e014e}
152
153\begin{CompactList}\small\item\em Positive vector $D$. \item\end{CompactList}\item 
154\hypertarget{classldmat_f74a64b99fe58a75ebd37bb679e121ea}{
155mat \hyperlink{classldmat_f74a64b99fe58a75ebd37bb679e121ea}{L}}
156\label{classldmat_f74a64b99fe58a75ebd37bb679e121ea}
157
158\begin{CompactList}\small\item\em Lower-triangular matrix $L$. \item\end{CompactList}\end{CompactItemize}
159\subsection*{Friends}
160\begin{CompactItemize}
161\item 
162\hypertarget{classldmat_eaaa0baa6026b84cfcbced41c84599d1}{
163std::ostream \& \hyperlink{classldmat_eaaa0baa6026b84cfcbced41c84599d1}{operator$<$$<$} (std::ostream \&os, const \hyperlink{classldmat}{ldmat} \&sq)}
164\label{classldmat_eaaa0baa6026b84cfcbced41c84599d1}
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}
170\hypertarget{classldmat_0f0f6e083e6d947cf58097ffce3ccd1a}{
171\index{ldmat@{ldmat}!opupdt@{opupdt}}
172\index{opupdt@{opupdt}!ldmat@{ldmat}}
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}
175
176
177Perfroms a rank-1 update by outer product of vectors: $V = V + w v v'$. \begin{Desc}
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
184Implements \hyperlink{classsqmat_b223484796661f2dadb5607a86ce0581}{sqmat}.
185
186References D, sqmat::dim, dydr(), and L.
187
188Referenced by add(), bdm::ARX::bayes(), and bdm::ARX::logpred().\hypertarget{classldmat_e967b9425007f0cb6cd59b845f9756d8}{
189\index{ldmat@{ldmat}!mult\_\-sym@{mult\_\-sym}}
190\index{mult\_\-sym@{mult\_\-sym}!ldmat@{ldmat}}
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}
193
194
195Inplace symmetric multiplication by a SQUARE matrix $C$, i.e. $V = C*V*C'$.
196
197\begin{Desc}
198\item[Parameters:]
199\begin{description}
200\item[{\em C}]multiplying matrix, \end{description}
201\end{Desc}
202
203
204Implements \hyperlink{classsqmat_60fbbfa9e483b8187c135f787ee53afa}{sqmat}.
205
206References D, L, and ldform().\hypertarget{classldmat_4fd155f38eb6dd5af4bdf9c98a7999a9}{
207\index{ldmat@{ldmat}!mult\_\-sym\_\-t@{mult\_\-sym\_\-t}}
208\index{mult\_\-sym\_\-t@{mult\_\-sym\_\-t}!ldmat@{ldmat}}
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}
211
212
213Inplace symmetric multiplication by a SQUARE transpose of matrix $C$, i.e. $V = C'*V*C$.
214
215\begin{Desc}
216\item[Parameters:]
217\begin{description}
218\item[{\em C}]multiplying matrix, \end{description}
219\end{Desc}
220
221
222Implements \hyperlink{classsqmat_6909e906da17725b1b80f3cae7cf3325}{sqmat}.
223
224References D, L, and ldform().\hypertarget{classldmat_fc380626ced6f9244fb58c5f0231174d}{
225\index{ldmat@{ldmat}!sqrt\_\-mult@{sqrt\_\-mult}}
226\index{sqrt\_\-mult@{sqrt\_\-mult}!ldmat@{ldmat}}
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}
229
230
231Multiplies square root of $V$ by vector $x$.
232
233Used e.g. in generating normal samples.
234
235Implements \hyperlink{classsqmat_6b79438b5d7544a9c8e110a145355d8f}{sqmat}.
236
237References D, sqmat::dim, and L.\hypertarget{classldmat_2c160cb123c1102face7a50ec566a031}{
238\index{ldmat@{ldmat}!inv@{inv}}
239\index{inv@{inv}!ldmat@{ldmat}}
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}
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
253References clear(), D, L, ldform(), and ltuinv().
254
255Referenced by bdm::egiw::variance().\hypertarget{classldmat_e7207748909325bb0f99b43f090a2b7e}{
256\index{ldmat@{ldmat}!mult\_\-sym@{mult\_\-sym}}
257\index{mult\_\-sym@{mult\_\-sym}!ldmat@{ldmat}}
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}
260
261
262Symmetric multiplication of $U$ by a general matrix $C$, result of which is stored in the current class.
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
271References D, L, and ldform().\hypertarget{classldmat_f94dc3a233f3d40fc853d8d4ac3b8eab}{
272\index{ldmat@{ldmat}!mult\_\-sym\_\-t@{mult\_\-sym\_\-t}}
273\index{mult\_\-sym\_\-t@{mult\_\-sym\_\-t}!ldmat@{ldmat}}
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}
276
277
278Symmetric multiplication of $U$ by a transpose of a general matrix $C$, result of which is stored in the current class.
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}
285
286
287References D, L, and ldform().\hypertarget{classldmat_f291faa073e7bc8dfafc7ae93daa2506}{
288\index{ldmat@{ldmat}!ldform@{ldform}}
289\index{ldform@{ldform}!ldmat@{ldmat}}
290\subsubsection[ldform]{\setlength{\rightskip}{0pt plus 5cm}void ldmat::ldform (const mat \& {\em A}, \/  const vec \& {\em D0})}}
291\label{classldmat_f291faa073e7bc8dfafc7ae93daa2506}
292
293
294Transforms general $A'D0 A$ into pure $L'DL$.
295
296The new decomposition fullfills: $A'*diag(D)*A = self.L'*diag(self.D)*self.L$ \begin{Desc}
297\item[Parameters:]
298\begin{description}
299\item[{\em A}]general matrix \item[{\em D0}]general vector \end{description}
300\end{Desc}
301
302
303References D, sqmat::dim, and L.
304
305Referenced by inv(), ldmat(), mult\_\-sym(), and mult\_\-sym\_\-t().
306
307The documentation for this class was generated from the following files:\begin{CompactItemize}
308\item 
309\hyperlink{libDC_8h}{libDC.h}\item 
310libDC.cpp\end{CompactItemize}
Note: See TracBrowser for help on using the browser.