root/doc/latex/classldmat.tex @ 248

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

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, (commonly 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_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 
42\hypertarget{classldmat_abe16e0f86668ef61a9a4896c8565dee}{
43\hyperlink{classldmat_abe16e0f86668ef61a9a4896c8565dee}{ldmat} (vec D0)}
44\label{classldmat_abe16e0f86668ef61a9a4896c8565dee}
45
46\begin{CompactList}\small\item\em Construct diagonal matrix with diagonal D0. \item\end{CompactList}\item 
47\hypertarget{classldmat_a12dda6f529580b0377cc45226b43303}{
48\hyperlink{classldmat_a12dda6f529580b0377cc45226b43303}{ldmat} ()}
49\label{classldmat_a12dda6f529580b0377cc45226b43303}
50
51\begin{CompactList}\small\item\em Default constructor. \item\end{CompactList}\item 
52\hypertarget{classldmat_163ee002a7858d104da1c59dd11f016d}{
53\hyperlink{classldmat_163ee002a7858d104da1c59dd11f016d}{ldmat} (const int dim0)}
54\label{classldmat_163ee002a7858d104da1c59dd11f016d}
55
56\begin{CompactList}\small\item\em Default initialization with proper size. \item\end{CompactList}\item 
57\hypertarget{classldmat_1e2734c0164ce5233c4d709679555138}{
58virtual \hyperlink{classldmat_1e2734c0164ce5233c4d709679555138}{$\sim$ldmat} ()}
59\label{classldmat_1e2734c0164ce5233c4d709679555138}
60
61\begin{CompactList}\small\item\em Destructor for future use;. \item\end{CompactList}\item 
62void \hyperlink{classldmat_0f0f6e083e6d947cf58097ffce3ccd1a}{opupdt} (const vec \&v, double w)
63\item 
64\hypertarget{classldmat_2c1ebc071de4bafbba55b80afd8a7e8e}{
65mat \hyperlink{classldmat_2c1ebc071de4bafbba55b80afd8a7e8e}{to\_\-mat} () const }
66\label{classldmat_2c1ebc071de4bafbba55b80afd8a7e8e}
67
68\begin{CompactList}\small\item\em Conversion to full matrix. \item\end{CompactList}\item 
69void \hyperlink{classldmat_e967b9425007f0cb6cd59b845f9756d8}{mult\_\-sym} (const mat \&C)
70\begin{CompactList}\small\item\em Inplace symmetric multiplication by a SQUARE matrix $C$, i.e. $V = C*V*C'$. \item\end{CompactList}\item 
71void \hyperlink{classldmat_4fd155f38eb6dd5af4bdf9c98a7999a9}{mult\_\-sym\_\-t} (const mat \&C)
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 
73\hypertarget{classldmat_a60f2c7e4f3c6a7738eaaaab81ffad20}{
74void \hyperlink{classldmat_a60f2c7e4f3c6a7738eaaaab81ffad20}{add} (const \hyperlink{classldmat}{ldmat} \&ld2, double w=1.0)}
75\label{classldmat_a60f2c7e4f3c6a7738eaaaab81ffad20}
76
77\begin{CompactList}\small\item\em Add another matrix in LD form with weight w. \item\end{CompactList}\item 
78\hypertarget{classldmat_2b42750ba4962d439aa52a77ae12949b}{
79double \hyperlink{classldmat_2b42750ba4962d439aa52a77ae12949b}{logdet} () const }
80\label{classldmat_2b42750ba4962d439aa52a77ae12949b}
81
82\begin{CompactList}\small\item\em Logarithm of a determinant. \item\end{CompactList}\item 
83\hypertarget{classldmat_d64f331b781903e913cb2ee836886f3f}{
84double \hyperlink{classldmat_d64f331b781903e913cb2ee836886f3f}{qform} (const vec \&v) const }
85\label{classldmat_d64f331b781903e913cb2ee836886f3f}
86
87\begin{CompactList}\small\item\em Evaluates quadratic form $x= v'*V*v$;. \item\end{CompactList}\item 
88\hypertarget{classldmat_d876c5f83e02b3e809b35c9de5068f14}{
89double \hyperlink{classldmat_d876c5f83e02b3e809b35c9de5068f14}{invqform} (const vec \&v) const }
90\label{classldmat_d876c5f83e02b3e809b35c9de5068f14}
91
92\begin{CompactList}\small\item\em Evaluates quadratic form $x= v'*inv(V)*v$;. \item\end{CompactList}\item 
93\hypertarget{classldmat_4d6e401de9607332305c27e67972a07a}{
94void \hyperlink{classldmat_4d6e401de9607332305c27e67972a07a}{clear} ()}
95\label{classldmat_4d6e401de9607332305c27e67972a07a}
96
97\begin{CompactList}\small\item\em Clearing matrix so that it corresponds to zeros. \item\end{CompactList}\item 
98\hypertarget{group__math_g0fceb6b5b637cec89bb0a3d2e6be1306}{
99int \hyperlink{group__math_g0fceb6b5b637cec89bb0a3d2e6be1306}{cols} () const }
100\label{group__math_g0fceb6b5b637cec89bb0a3d2e6be1306}
101
102\begin{CompactList}\small\item\em access function \item\end{CompactList}\item 
103\hypertarget{group__math_g96dfb21865db4f5bd36fa70f9b0b1163}{
104int \hyperlink{group__math_g96dfb21865db4f5bd36fa70f9b0b1163}{rows} () const }
105\label{group__math_g96dfb21865db4f5bd36fa70f9b0b1163}
106
107\begin{CompactList}\small\item\em access function \item\end{CompactList}\item 
108vec \hyperlink{classldmat_fc380626ced6f9244fb58c5f0231174d}{sqrt\_\-mult} (const vec \&v) const
109\begin{CompactList}\small\item\em Multiplies square root of $V$ by vector $x$. \item\end{CompactList}\item 
110virtual void \hyperlink{classldmat_2c160cb123c1102face7a50ec566a031}{inv} (\hyperlink{classldmat}{ldmat} \&Inv) const
111\begin{CompactList}\small\item\em Matrix inversion preserving the chosen form. \item\end{CompactList}\item 
112void \hyperlink{classldmat_e7207748909325bb0f99b43f090a2b7e}{mult\_\-sym} (const mat \&C, \hyperlink{classldmat}{ldmat} \&U) const
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 
114void \hyperlink{classldmat_f94dc3a233f3d40fc853d8d4ac3b8eab}{mult\_\-sym\_\-t} (const mat \&C, \hyperlink{classldmat}{ldmat} \&U) const
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 
116void \hyperlink{classldmat_f291faa073e7bc8dfafc7ae93daa2506}{ldform} (const mat \&A, const vec \&D0)
117\begin{CompactList}\small\item\em Transforms general $A'D0 A$ into pure $L'DL$. \item\end{CompactList}\item 
118\hypertarget{classldmat_0884a613b94fde61bfc84288e73ce57f}{
119void \hyperlink{classldmat_0884a613b94fde61bfc84288e73ce57f}{setD} (const vec \&nD)}
120\label{classldmat_0884a613b94fde61bfc84288e73ce57f}
121
122\begin{CompactList}\small\item\em Access functions. \item\end{CompactList}\item 
123\hypertarget{classldmat_7619922b4de18830ce5351c6b5667e60}{
124void \hyperlink{classldmat_7619922b4de18830ce5351c6b5667e60}{setD} (const vec \&nD, int i)}
125\label{classldmat_7619922b4de18830ce5351c6b5667e60}
126
127\begin{CompactList}\small\item\em Access functions. \item\end{CompactList}\item 
128\hypertarget{classldmat_32ff66296627ff5341d7c0b973249614}{
129void \hyperlink{classldmat_32ff66296627ff5341d7c0b973249614}{setL} (const vec \&nL)}
130\label{classldmat_32ff66296627ff5341d7c0b973249614}
131
132\begin{CompactList}\small\item\em Access functions. \item\end{CompactList}\item 
133\hypertarget{classldmat_282c879f50aa9ef934e7f46d86881582}{
134const vec \& \hyperlink{classldmat_282c879f50aa9ef934e7f46d86881582}{\_\-D} () const }
135\label{classldmat_282c879f50aa9ef934e7f46d86881582}
136
137\begin{CompactList}\small\item\em Access functions. \item\end{CompactList}\item 
138\hypertarget{classldmat_5f44f100248c6627314afaa653b9e5bd}{
139const mat \& \hyperlink{classldmat_5f44f100248c6627314afaa653b9e5bd}{\_\-L} () const }
140\label{classldmat_5f44f100248c6627314afaa653b9e5bd}
141
142\begin{CompactList}\small\item\em Access functions. \item\end{CompactList}\item 
143\hyperlink{classldmat}{ldmat} \& \hyperlink{group__math_gca445ee152a56043af946ea095b2d8f8}{operator+=} (const \hyperlink{classldmat}{ldmat} \&ldA)
144\begin{CompactList}\small\item\em add another \hyperlink{classldmat}{ldmat} matrix \item\end{CompactList}\item 
145\hyperlink{classldmat}{ldmat} \& \hyperlink{group__math_ge3f4d2d85ab1ba384c852329aa31d0fb}{operator-=} (const \hyperlink{classldmat}{ldmat} \&ldA)
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}
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 
155\hypertarget{classldmat_4cce04824539c4a8d062d9a36d6e014e}{
156vec \hyperlink{classldmat_4cce04824539c4a8d062d9a36d6e014e}{D}}
157\label{classldmat_4cce04824539c4a8d062d9a36d6e014e}
158
159\begin{CompactList}\small\item\em Positive vector $D$. \item\end{CompactList}\item 
160\hypertarget{classldmat_f74a64b99fe58a75ebd37bb679e121ea}{
161mat \hyperlink{classldmat_f74a64b99fe58a75ebd37bb679e121ea}{L}}
162\label{classldmat_f74a64b99fe58a75ebd37bb679e121ea}
163
164\begin{CompactList}\small\item\em Lower-triangular matrix $L$. \item\end{CompactList}\end{CompactItemize}
165\subsection*{Friends}
166\begin{CompactItemize}
167\item 
168\hypertarget{classldmat_eaaa0baa6026b84cfcbced41c84599d1}{
169std::ostream \& \hyperlink{classldmat_eaaa0baa6026b84cfcbced41c84599d1}{operator$<$$<$} (std::ostream \&os, const \hyperlink{classldmat}{ldmat} \&sq)}
170\label{classldmat_eaaa0baa6026b84cfcbced41c84599d1}
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}
176Matrix stored in LD form, (commonly known as UD).
177
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.
179
180\subsection{Member Function Documentation}
181\hypertarget{classldmat_0f0f6e083e6d947cf58097ffce3ccd1a}{
182\index{ldmat@{ldmat}!opupdt@{opupdt}}
183\index{opupdt@{opupdt}!ldmat@{ldmat}}
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}
186
187
188Perfroms a rank-1 update by outer product of vectors: $V = V + w v v'$. \begin{Desc}
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
195Implements \hyperlink{classsqmat_b223484796661f2dadb5607a86ce0581}{sqmat}.
196
197References D, sqmat::dim, dydr(), and L.
198
199Referenced by add(), ARX::bayes(), and ARX::logpred().\hypertarget{classldmat_e967b9425007f0cb6cd59b845f9756d8}{
200\index{ldmat@{ldmat}!mult\_\-sym@{mult\_\-sym}}
201\index{mult\_\-sym@{mult\_\-sym}!ldmat@{ldmat}}
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}
204
205
206Inplace symmetric multiplication by a SQUARE matrix $C$, i.e. $V = C*V*C'$.
207
208\begin{Desc}
209\item[Parameters:]
210\begin{description}
211\item[{\em C}]multiplying matrix, \end{description}
212\end{Desc}
213
214
215Implements \hyperlink{classsqmat_60fbbfa9e483b8187c135f787ee53afa}{sqmat}.
216
217References D, L, and ldform().\hypertarget{classldmat_4fd155f38eb6dd5af4bdf9c98a7999a9}{
218\index{ldmat@{ldmat}!mult\_\-sym\_\-t@{mult\_\-sym\_\-t}}
219\index{mult\_\-sym\_\-t@{mult\_\-sym\_\-t}!ldmat@{ldmat}}
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}
222
223
224Inplace symmetric multiplication by a SQUARE transpose of matrix $C$, i.e. $V = C'*V*C$.
225
226\begin{Desc}
227\item[Parameters:]
228\begin{description}
229\item[{\em C}]multiplying matrix, \end{description}
230\end{Desc}
231
232
233Implements \hyperlink{classsqmat_6909e906da17725b1b80f3cae7cf3325}{sqmat}.
234
235References D, L, and ldform().\hypertarget{classldmat_fc380626ced6f9244fb58c5f0231174d}{
236\index{ldmat@{ldmat}!sqrt\_\-mult@{sqrt\_\-mult}}
237\index{sqrt\_\-mult@{sqrt\_\-mult}!ldmat@{ldmat}}
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}
240
241
242Multiplies square root of $V$ by vector $x$.
243
244Used e.g. in generating normal samples.
245
246Implements \hyperlink{classsqmat_6b79438b5d7544a9c8e110a145355d8f}{sqmat}.
247
248References D, sqmat::dim, and L.\hypertarget{classldmat_2c160cb123c1102face7a50ec566a031}{
249\index{ldmat@{ldmat}!inv@{inv}}
250\index{inv@{inv}!ldmat@{ldmat}}
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}
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
264References clear(), D, L, ldform(), and ltuinv().\hypertarget{classldmat_e7207748909325bb0f99b43f090a2b7e}{
265\index{ldmat@{ldmat}!mult\_\-sym@{mult\_\-sym}}
266\index{mult\_\-sym@{mult\_\-sym}!ldmat@{ldmat}}
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}
269
270
271Symmetric multiplication of $U$ by a general matrix $C$, result of which is stored in the current class.
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
280References D, L, and ldform().\hypertarget{classldmat_f94dc3a233f3d40fc853d8d4ac3b8eab}{
281\index{ldmat@{ldmat}!mult\_\-sym\_\-t@{mult\_\-sym\_\-t}}
282\index{mult\_\-sym\_\-t@{mult\_\-sym\_\-t}!ldmat@{ldmat}}
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}
285
286
287Symmetric multiplication of $U$ by a transpose of a general matrix $C$, result of which is stored in the current class.
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}
294
295
296References D, L, and ldform().\hypertarget{classldmat_f291faa073e7bc8dfafc7ae93daa2506}{
297\index{ldmat@{ldmat}!ldform@{ldform}}
298\index{ldform@{ldform}!ldmat@{ldmat}}
299\subsubsection[ldform]{\setlength{\rightskip}{0pt plus 5cm}void ldmat::ldform (const mat \& {\em A}, \/  const vec \& {\em D0})}}
300\label{classldmat_f291faa073e7bc8dfafc7ae93daa2506}
301
302
303Transforms general $A'D0 A$ into pure $L'DL$.
304
305The new decomposition fullfills: $A'*diag(D)*A = self.L'*diag(self.D)*self.L$ \begin{Desc}
306\item[Parameters:]
307\begin{description}
308\item[{\em A}]general matrix \item[{\em D0}]general vector \end{description}
309\end{Desc}
310
311
312References D, sqmat::dim, and L.
313
314Referenced by inv(), ldmat(), mult\_\-sym(), and mult\_\-sym\_\-t().
315
316The documentation for this class was generated from the following files:\begin{CompactItemize}
317\item 
318work/git/mixpp/bdm/math/\hyperlink{libDC_8h}{libDC.h}\item 
319work/git/mixpp/bdm/math/libDC.cpp\end{CompactItemize}
Note: See TracBrowser for help on using the browser.