root/doc/latex/classldmat.tex @ 172

Revision 172, 16.4 kB (checked in by smidl, 16 years ago)

Latex doc

  • Property svn:eol-style set to native
Line 
1\hypertarget{classldmat}{
2\section{ldmat Class Reference}
3\label{classldmat}\index{ldmat@{ldmat}}
4}
5Matrix stored in LD form, (typically known as UD). 
6
7
8{\tt \#include $<$libDC.h$>$}
9
10Inheritance diagram for ldmat:\nopagebreak
11\begin{figure}[H]
12\begin{center}
13\leavevmode
14\includegraphics[width=43pt]{classldmat__inherit__graph}
15\end{center}
16\end{figure}
17Collaboration diagram for ldmat:\nopagebreak
18\begin{figure}[H]
19\begin{center}
20\leavevmode
21\includegraphics[width=43pt]{classldmat__coll__graph}
22\end{center}
23\end{figure}
24\subsection*{Public Member Functions}
25\begin{CompactItemize}
26\item 
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}
30
31\begin{CompactList}\small\item\em Construct by copy of L and D. \item\end{CompactList}\item 
32\hypertarget{classldmat_5f21785358072d36892d538eed1d1ea5}{
33\hyperlink{classldmat_5f21785358072d36892d538eed1d1ea5}{ldmat} (const mat \&V)}
34\label{classldmat_5f21785358072d36892d538eed1d1ea5}
35
36\begin{CompactList}\small\item\em Construct by decomposition of full matrix V. \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{classldmat_0fceb6b5b637cec89bb0a3d2e6be1306}{
94int \hyperlink{classldmat_0fceb6b5b637cec89bb0a3d2e6be1306}{cols} () const }
95\label{classldmat_0fceb6b5b637cec89bb0a3d2e6be1306}
96
97\begin{CompactList}\small\item\em access function \item\end{CompactList}\item 
98\hypertarget{classldmat_96dfb21865db4f5bd36fa70f9b0b1163}{
99int \hyperlink{classldmat_96dfb21865db4f5bd36fa70f9b0b1163}{rows} () const }
100\label{classldmat_96dfb21865db4f5bd36fa70f9b0b1163}
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{classldmat_ca445ee152a56043af946ea095b2d8f8}{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{classldmat_e3f4d2d85ab1ba384c852329aa31d0fb}{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{Detailed Description}
171Matrix stored in LD form, (typically known as UD).
172
173Matrix 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.
174
175\subsection{Member Function Documentation}
176\hypertarget{classldmat_0f0f6e083e6d947cf58097ffce3ccd1a}{
177\index{ldmat@{ldmat}!opupdt@{opupdt}}
178\index{opupdt@{opupdt}!ldmat@{ldmat}}
179\subsubsection[opupdt]{\setlength{\rightskip}{0pt plus 5cm}void ldmat::opupdt (const vec \& {\em v}, \/  double {\em w})\hspace{0.3cm}{\tt  \mbox{[}virtual\mbox{]}}}}
180\label{classldmat_0f0f6e083e6d947cf58097ffce3ccd1a}
181
182
183Perfroms a rank-1 update by outer product of vectors: $V = V + w v v'$. \begin{Desc}
184\item[Parameters:]
185\begin{description}
186\item[{\em v}]Vector forming the outer product to be added \item[{\em w}]weight of updating; can be negative\end{description}
187\end{Desc}
188BLAS-2b operation.
189
190Implements \hyperlink{classsqmat_b223484796661f2dadb5607a86ce0581}{sqmat}.
191
192References D, sqmat::dim, and L.
193
194Referenced by add(), ARX::bayes(), and ARX::logpred().\hypertarget{classldmat_e967b9425007f0cb6cd59b845f9756d8}{
195\index{ldmat@{ldmat}!mult\_\-sym@{mult\_\-sym}}
196\index{mult\_\-sym@{mult\_\-sym}!ldmat@{ldmat}}
197\subsubsection[mult\_\-sym]{\setlength{\rightskip}{0pt plus 5cm}void ldmat::mult\_\-sym (const mat \& {\em C})\hspace{0.3cm}{\tt  \mbox{[}virtual\mbox{]}}}}
198\label{classldmat_e967b9425007f0cb6cd59b845f9756d8}
199
200
201Inplace symmetric multiplication by a SQUARE matrix $C$, i.e. $V = C*V*C'$.
202
203\begin{Desc}
204\item[Parameters:]
205\begin{description}
206\item[{\em C}]multiplying matrix, \end{description}
207\end{Desc}
208
209
210Implements \hyperlink{classsqmat_60fbbfa9e483b8187c135f787ee53afa}{sqmat}.
211
212References D, L, and ldform().\hypertarget{classldmat_4fd155f38eb6dd5af4bdf9c98a7999a9}{
213\index{ldmat@{ldmat}!mult\_\-sym\_\-t@{mult\_\-sym\_\-t}}
214\index{mult\_\-sym\_\-t@{mult\_\-sym\_\-t}!ldmat@{ldmat}}
215\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{]}}}}
216\label{classldmat_4fd155f38eb6dd5af4bdf9c98a7999a9}
217
218
219Inplace symmetric multiplication by a SQUARE transpose of matrix $C$, i.e. $V = C'*V*C$.
220
221\begin{Desc}
222\item[Parameters:]
223\begin{description}
224\item[{\em C}]multiplying matrix, \end{description}
225\end{Desc}
226
227
228Implements \hyperlink{classsqmat_6909e906da17725b1b80f3cae7cf3325}{sqmat}.
229
230References D, L, and ldform().\hypertarget{classldmat_fc380626ced6f9244fb58c5f0231174d}{
231\index{ldmat@{ldmat}!sqrt\_\-mult@{sqrt\_\-mult}}
232\index{sqrt\_\-mult@{sqrt\_\-mult}!ldmat@{ldmat}}
233\subsubsection[sqrt\_\-mult]{\setlength{\rightskip}{0pt plus 5cm}vec ldmat::sqrt\_\-mult (const vec \& {\em v}) const\hspace{0.3cm}{\tt  \mbox{[}virtual\mbox{]}}}}
234\label{classldmat_fc380626ced6f9244fb58c5f0231174d}
235
236
237Multiplies square root of $V$ by vector $x$.
238
239Used e.g. in generating normal samples.
240
241Implements \hyperlink{classsqmat_6b79438b5d7544a9c8e110a145355d8f}{sqmat}.
242
243References D, sqmat::dim, and L.\hypertarget{classldmat_2c160cb123c1102face7a50ec566a031}{
244\index{ldmat@{ldmat}!inv@{inv}}
245\index{inv@{inv}!ldmat@{ldmat}}
246\subsubsection[inv]{\setlength{\rightskip}{0pt plus 5cm}void ldmat::inv ({\bf ldmat} \& {\em Inv}) const\hspace{0.3cm}{\tt  \mbox{[}virtual\mbox{]}}}}
247\label{classldmat_2c160cb123c1102face7a50ec566a031}
248
249
250Matrix inversion preserving the chosen form.
251
252\begin{Desc}
253\item[Parameters:]
254\begin{description}
255\item[{\em Inv}]a space where the inverse is stored. \end{description}
256\end{Desc}
257
258
259References clear(), D, L, and ldform().\hypertarget{classldmat_e7207748909325bb0f99b43f090a2b7e}{
260\index{ldmat@{ldmat}!mult\_\-sym@{mult\_\-sym}}
261\index{mult\_\-sym@{mult\_\-sym}!ldmat@{ldmat}}
262\subsubsection[mult\_\-sym]{\setlength{\rightskip}{0pt plus 5cm}void ldmat::mult\_\-sym (const mat \& {\em C}, \/  {\bf ldmat} \& {\em U}) const}}
263\label{classldmat_e7207748909325bb0f99b43f090a2b7e}
264
265
266Symmetric multiplication of $U$ by a general matrix $C$, result of which is stored in the current class.
267
268\begin{Desc}
269\item[Parameters:]
270\begin{description}
271\item[{\em C}]matrix to multiply with \item[{\em U}]a space where the inverse is stored. \end{description}
272\end{Desc}
273
274
275References D, L, and ldform().\hypertarget{classldmat_f94dc3a233f3d40fc853d8d4ac3b8eab}{
276\index{ldmat@{ldmat}!mult\_\-sym\_\-t@{mult\_\-sym\_\-t}}
277\index{mult\_\-sym\_\-t@{mult\_\-sym\_\-t}!ldmat@{ldmat}}
278\subsubsection[mult\_\-sym\_\-t]{\setlength{\rightskip}{0pt plus 5cm}void ldmat::mult\_\-sym\_\-t (const mat \& {\em C}, \/  {\bf ldmat} \& {\em U}) const}}
279\label{classldmat_f94dc3a233f3d40fc853d8d4ac3b8eab}
280
281
282Symmetric multiplication of $U$ by a transpose of a general matrix $C$, result of which is stored in the current class.
283
284\begin{Desc}
285\item[Parameters:]
286\begin{description}
287\item[{\em C}]matrix to multiply with \item[{\em U}]a space where the inverse is stored. \end{description}
288\end{Desc}
289
290
291References D, L, and ldform().\hypertarget{classldmat_f291faa073e7bc8dfafc7ae93daa2506}{
292\index{ldmat@{ldmat}!ldform@{ldform}}
293\index{ldform@{ldform}!ldmat@{ldmat}}
294\subsubsection[ldform]{\setlength{\rightskip}{0pt plus 5cm}void ldmat::ldform (const mat \& {\em A}, \/  const vec \& {\em D0})}}
295\label{classldmat_f291faa073e7bc8dfafc7ae93daa2506}
296
297
298Transforms general $A'D0 A$ into pure $L'DL$.
299
300The new decomposition fullfills: $A'*diag(D)*A = self.L'*diag(self.D)*self.L$ \begin{Desc}
301\item[Parameters:]
302\begin{description}
303\item[{\em A}]general matrix \item[{\em D0}]general vector \end{description}
304\end{Desc}
305
306
307References D, sqmat::dim, and L.
308
309Referenced by inv(), ldmat(), mult\_\-sym(), and mult\_\-sym\_\-t().\hypertarget{classldmat_ca445ee152a56043af946ea095b2d8f8}{
310\index{ldmat@{ldmat}!operator+=@{operator+=}}
311\index{operator+=@{operator+=}!ldmat@{ldmat}}
312\subsubsection[operator+=]{\setlength{\rightskip}{0pt plus 5cm}{\bf ldmat} \& ldmat::operator+= (const {\bf ldmat} \& {\em ldA})\hspace{0.3cm}{\tt  \mbox{[}inline\mbox{]}}}}
313\label{classldmat_ca445ee152a56043af946ea095b2d8f8}
314
315
316add another \hyperlink{classldmat}{ldmat} matrix
317
318Operations: mapping of add operation to operators \hypertarget{classldmat_e3f4d2d85ab1ba384c852329aa31d0fb}{
319\index{ldmat@{ldmat}!operator-=@{operator-=}}
320\index{operator-=@{operator-=}!ldmat@{ldmat}}
321\subsubsection[operator-=]{\setlength{\rightskip}{0pt plus 5cm}{\bf ldmat} \& ldmat::operator-= (const {\bf ldmat} \& {\em ldA})\hspace{0.3cm}{\tt  \mbox{[}inline\mbox{]}}}}
322\label{classldmat_e3f4d2d85ab1ba384c852329aa31d0fb}
323
324
325subtract another \hyperlink{classldmat}{ldmat} matrix
326
327mapping of negative add operation to operators
328
329The documentation for this class was generated from the following files:\begin{CompactItemize}
330\item 
331work/git/mixpp/bdm/math/\hyperlink{libDC_8h}{libDC.h}\item 
332work/git/mixpp/bdm/math/libDC.cpp\end{CompactItemize}
Note: See TracBrowser for help on using the browser.