root/doc/latex/classldmat.tex @ 270

Revision 270, 15.7 kB (checked in by smidl, 16 years ago)

Changes in the very root classes!
* rv and rvc are no longer compulsory,
* samplecond does not return ll
* BM has drv

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