1 | <?xml version='1.0' encoding='UTF-8' standalone='no'?> |
---|
2 | <doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.5.6"> |
---|
3 | <compounddef id="libDC_8cpp" kind="file"> |
---|
4 | <compoundname>libDC.cpp</compoundname> |
---|
5 | <includes local="no">itpp/itbase.h</includes> |
---|
6 | <includes refid="libDC_8h" local="yes">libDC.h</includes> |
---|
7 | <incdepgraph> |
---|
8 | <node id="300"> |
---|
9 | <label>itpp/itbase.h</label> |
---|
10 | </node> |
---|
11 | <node id="299"> |
---|
12 | <label>work/git/mixpp/bdm/math/libDC.cpp</label> |
---|
13 | <link refid="libDC.cpp"/> |
---|
14 | <childnode refid="300" relation="include"> |
---|
15 | </childnode> |
---|
16 | <childnode refid="301" relation="include"> |
---|
17 | </childnode> |
---|
18 | </node> |
---|
19 | <node id="301"> |
---|
20 | <label>libDC.h</label> |
---|
21 | <link refid="libDC_8h"/> |
---|
22 | <childnode refid="300" relation="include"> |
---|
23 | </childnode> |
---|
24 | </node> |
---|
25 | </incdepgraph> |
---|
26 | <sectiondef kind="func"> |
---|
27 | <memberdef kind="function" id="libDC_8cpp_1a797c793c4a08bf1b05d8259dfb2c676" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> |
---|
28 | <type>std::ostream &</type> |
---|
29 | <definition>std::ostream& operator<<</definition> |
---|
30 | <argsstring>(std::ostream &os, const fsqmat &ld)</argsstring> |
---|
31 | <name>operator<<</name> |
---|
32 | <param> |
---|
33 | <type>std::ostream &</type> |
---|
34 | <declname>os</declname> |
---|
35 | </param> |
---|
36 | <param> |
---|
37 | <type>const <ref refid="classfsqmat" kindref="compound">fsqmat</ref> &</type> |
---|
38 | <declname>ld</declname> |
---|
39 | </param> |
---|
40 | <briefdescription> |
---|
41 | </briefdescription> |
---|
42 | <detaileddescription> |
---|
43 | </detaileddescription> |
---|
44 | <inbodydescription> |
---|
45 | </inbodydescription> |
---|
46 | <location file="/home/smidl/work/git/mixpp/bdm/math/libDC.cpp" line="26" bodyfile="/home/smidl/work/git/mixpp/bdm/math/libDC.cpp" bodystart="26" bodyend="29"/> |
---|
47 | </memberdef> |
---|
48 | <memberdef kind="function" id="libDC_8cpp_13fdcec63285777e273bd639b0023d4bb" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> |
---|
49 | <type>std::ostream &</type> |
---|
50 | <definition>std::ostream& operator<<</definition> |
---|
51 | <argsstring>(std::ostream &os, const ldmat &ld)</argsstring> |
---|
52 | <name>operator<<</name> |
---|
53 | <param> |
---|
54 | <type>std::ostream &</type> |
---|
55 | <declname>os</declname> |
---|
56 | </param> |
---|
57 | <param> |
---|
58 | <type>const <ref refid="classldmat" kindref="compound">ldmat</ref> &</type> |
---|
59 | <declname>ld</declname> |
---|
60 | </param> |
---|
61 | <briefdescription> |
---|
62 | </briefdescription> |
---|
63 | <detaileddescription> |
---|
64 | </detaileddescription> |
---|
65 | <inbodydescription> |
---|
66 | </inbodydescription> |
---|
67 | <location file="/home/smidl/work/git/mixpp/bdm/math/libDC.cpp" line="74" bodyfile="/home/smidl/work/git/mixpp/bdm/math/libDC.cpp" bodystart="74" bodyend="78"/> |
---|
68 | </memberdef> |
---|
69 | <memberdef kind="function" id="libDC_8cpp_16715d039e6d5d97005cf9e2522dfa474" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> |
---|
70 | <type>mat</type> |
---|
71 | <definition>mat ltuinv</definition> |
---|
72 | <argsstring>(const mat &L)</argsstring> |
---|
73 | <name>ltuinv</name> |
---|
74 | <param> |
---|
75 | <type>const mat &</type> |
---|
76 | <declname>L</declname> |
---|
77 | </param> |
---|
78 | <briefdescription> |
---|
79 | <para>Auxiliary function ltuinv; inversion of a triangular matrix;. </para> </briefdescription> |
---|
80 | <detaileddescription> |
---|
81 | </detaileddescription> |
---|
82 | <inbodydescription> |
---|
83 | </inbodydescription> |
---|
84 | <location file="/home/smidl/work/git/mixpp/bdm/math/libDC.cpp" line="301" bodyfile="/home/smidl/work/git/mixpp/bdm/math/libDC.cpp" bodystart="301" bodyend="320"/> |
---|
85 | <references refid="classsqmat_10abed904bdc0882373ba9adba919689d" compoundref="libDC_8h" startline="99">sqmat::dim</references> |
---|
86 | <references refid="classldmat_1f74a64b99fe58a75ebd37bb679e121ea" compoundref="libDC_8h" startline="266">ldmat::L</references> |
---|
87 | </memberdef> |
---|
88 | <memberdef kind="function" id="libDC_8cpp_14ed56e73b49db8e7f4a63fa926a8dca4" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> |
---|
89 | <type>void</type> |
---|
90 | <definition>void dydr</definition> |
---|
91 | <argsstring>(double *r, double *f, double *Dr, double *Df, double *R, int jl, int jh, double *kr, int m, int mx)</argsstring> |
---|
92 | <name>dydr</name> |
---|
93 | <param> |
---|
94 | <type>double *</type> |
---|
95 | <declname>r</declname> |
---|
96 | </param> |
---|
97 | <param> |
---|
98 | <type>double *</type> |
---|
99 | <declname>f</declname> |
---|
100 | </param> |
---|
101 | <param> |
---|
102 | <type>double *</type> |
---|
103 | <declname>Dr</declname> |
---|
104 | </param> |
---|
105 | <param> |
---|
106 | <type>double *</type> |
---|
107 | <declname>Df</declname> |
---|
108 | </param> |
---|
109 | <param> |
---|
110 | <type>double *</type> |
---|
111 | <declname>R</declname> |
---|
112 | </param> |
---|
113 | <param> |
---|
114 | <type>int</type> |
---|
115 | <declname>jl</declname> |
---|
116 | </param> |
---|
117 | <param> |
---|
118 | <type>int</type> |
---|
119 | <declname>jh</declname> |
---|
120 | </param> |
---|
121 | <param> |
---|
122 | <type>double *</type> |
---|
123 | <declname>kr</declname> |
---|
124 | </param> |
---|
125 | <param> |
---|
126 | <type>int</type> |
---|
127 | <declname>m</declname> |
---|
128 | </param> |
---|
129 | <param> |
---|
130 | <type>int</type> |
---|
131 | <declname>mx</declname> |
---|
132 | </param> |
---|
133 | <briefdescription> |
---|
134 | <para>Auxiliary function dydr; dyadic reduction. </para> </briefdescription> |
---|
135 | <detaileddescription> |
---|
136 | </detaileddescription> |
---|
137 | <inbodydescription> |
---|
138 | </inbodydescription> |
---|
139 | <location file="/home/smidl/work/git/mixpp/bdm/math/libDC.cpp" line="352" bodyfile="/home/smidl/work/git/mixpp/bdm/math/libDC.cpp" bodystart="322" bodyend="382"/> |
---|
140 | </memberdef> |
---|
141 | </sectiondef> |
---|
142 | <briefdescription> |
---|
143 | </briefdescription> |
---|
144 | <detaileddescription> |
---|
145 | </detaileddescription> |
---|
146 | <programlisting> |
---|
147 | <codeline lineno="1"><highlight class="preprocessor">#include<sp/><itpp/itbase.h></highlight><highlight class="normal"></highlight></codeline> |
---|
148 | <codeline lineno="2"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>"<ref refid="libDC_8h" kindref="compound" tooltip="Matrices in decomposed forms (LDL&#39;, LU, UDU&#39;, etc).">libDC.h</ref>"</highlight><highlight class="normal"></highlight></codeline> |
---|
149 | <codeline lineno="3"><highlight class="normal"></highlight></codeline> |
---|
150 | <codeline lineno="4"><highlight class="normal"></highlight><highlight class="keyword">using<sp/>namespace<sp/></highlight><highlight class="normal">itpp;</highlight></codeline> |
---|
151 | <codeline lineno="5"><highlight class="normal"></highlight></codeline> |
---|
152 | <codeline lineno="6"><highlight class="normal"></highlight><highlight class="keyword">using</highlight><highlight class="normal"><sp/>std::endl;</highlight></codeline> |
---|
153 | <codeline lineno="7"><highlight class="normal"></highlight></codeline> |
---|
154 | <codeline lineno="8" refid="classfsqmat_1b36530e155667fe9f1bd58394e50c65a" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classfsqmat_1b36530e155667fe9f1bd58394e50c65a" kindref="member">fsqmat::opupdt</ref><sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>vec<sp/>&v,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>w<sp/>)<sp/>{<ref refid="classfsqmat_1a7a1fcb9aae19d1e4daddfc9c22ce453" kindref="member" tooltip="Full matrix on which the operations are performed.">M</ref>+=outer_product<sp/>(<sp/>v,v*w<sp/>);};</highlight></codeline> |
---|
155 | <codeline lineno="9" refid="classfsqmat_1cedf4f048309056f4262c930914dfda8" refkind="member"><highlight class="normal">mat<sp/><ref refid="classfsqmat_1cedf4f048309056f4262c930914dfda8" kindref="member" tooltip="Conversion to full matrix.">fsqmat::to_mat</ref>()<sp/><sp/>{</highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="classfsqmat_1a7a1fcb9aae19d1e4daddfc9c22ce453" kindref="member" tooltip="Full matrix on which the operations are performed.">M</ref>;};</highlight></codeline> |
---|
156 | <codeline lineno="10" refid="classfsqmat_15530d2756b5d991de755e6121c9a452e" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classfsqmat_15530d2756b5d991de755e6121c9a452e" kindref="member" tooltip="Inplace symmetric multiplication by a SQUARE matrix , i.e. .">fsqmat::mult_sym</ref><sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>mat<sp/>&C)<sp/>{<ref refid="classfsqmat_1a7a1fcb9aae19d1e4daddfc9c22ce453" kindref="member" tooltip="Full matrix on which the operations are performed.">M</ref>=C<sp/>*<ref refid="classfsqmat_1a7a1fcb9aae19d1e4daddfc9c22ce453" kindref="member" tooltip="Full matrix on which the operations are performed.">M</ref>*C.T();};</highlight></codeline> |
---|
157 | <codeline lineno="11" refid="classfsqmat_192052a8adc2054b63e42d1373d145c89" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classfsqmat_192052a8adc2054b63e42d1373d145c89" kindref="member" tooltip="Inplace symmetric multiplication by a SQUARE transpose of matrix , i.e. .">fsqmat::mult_sym_t</ref><sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>mat<sp/>&C)<sp/>{<ref refid="classfsqmat_1a7a1fcb9aae19d1e4daddfc9c22ce453" kindref="member" tooltip="Full matrix on which the operations are performed.">M</ref>=C.T()<sp/>*<ref refid="classfsqmat_1a7a1fcb9aae19d1e4daddfc9c22ce453" kindref="member" tooltip="Full matrix on which the operations are performed.">M</ref>*C;};</highlight></codeline> |
---|
158 | <codeline lineno="12" refid="classfsqmat_1d4eddc3743c8865cc5ed92d14de0e3e3" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classfsqmat_15530d2756b5d991de755e6121c9a452e" kindref="member" tooltip="Inplace symmetric multiplication by a SQUARE matrix , i.e. .">fsqmat::mult_sym</ref><sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>mat<sp/>&C,<sp/><ref refid="classfsqmat" kindref="compound" tooltip="Fake sqmat. This class maps sqmat operations to operations on full matrix.">fsqmat</ref><sp/>&U)</highlight><highlight class="keyword"><sp/>const<sp/></highlight><highlight class="normal">{<sp/>U.<ref refid="classfsqmat_1a7a1fcb9aae19d1e4daddfc9c22ce453" kindref="member" tooltip="Full matrix on which the operations are performed.">M</ref><sp/>=<sp/>(<sp/>C<sp/>*(<ref refid="classfsqmat_1a7a1fcb9aae19d1e4daddfc9c22ce453" kindref="member" tooltip="Full matrix on which the operations are performed.">M</ref>*C.T())<sp/>);};</highlight></codeline> |
---|
159 | <codeline lineno="13" refid="classfsqmat_1ae4949ad2a32553c7fa04d6d1483770a" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classfsqmat_192052a8adc2054b63e42d1373d145c89" kindref="member" tooltip="Inplace symmetric multiplication by a SQUARE transpose of matrix , i.e. .">fsqmat::mult_sym_t</ref><sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>mat<sp/>&C,<sp/><ref refid="classfsqmat" kindref="compound" tooltip="Fake sqmat. This class maps sqmat operations to operations on full matrix.">fsqmat</ref><sp/>&U)</highlight><highlight class="keyword"><sp/>const<sp/></highlight><highlight class="normal">{<sp/>U.<ref refid="classfsqmat_1a7a1fcb9aae19d1e4daddfc9c22ce453" kindref="member" tooltip="Full matrix on which the operations are performed.">M</ref><sp/>=<sp/>(<sp/>C.T()<sp/>*(<ref refid="classfsqmat_1a7a1fcb9aae19d1e4daddfc9c22ce453" kindref="member" tooltip="Full matrix on which the operations are performed.">M</ref>*C)<sp/>);};</highlight></codeline> |
---|
160 | <codeline lineno="14" refid="classfsqmat_19fa853e1ca28f2a1a1c43377e798ecb1" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classfsqmat_19fa853e1ca28f2a1a1c43377e798ecb1" kindref="member" tooltip="Matrix inversion preserving the chosen form.">fsqmat::inv</ref><sp/>(<sp/><ref refid="classfsqmat" kindref="compound" tooltip="Fake sqmat. This class maps sqmat operations to operations on full matrix.">fsqmat</ref><sp/>&Inv<sp/>)<sp/>{mat<sp/>IM<sp/>=<sp/>itpp::inv<sp/>(<sp/><ref refid="classfsqmat_1a7a1fcb9aae19d1e4daddfc9c22ce453" kindref="member" tooltip="Full matrix on which the operations are performed.">M</ref><sp/>);<sp/>Inv=IM;};</highlight></codeline> |
---|
161 | <codeline lineno="15" refid="classfsqmat_1cfa4c359483d2322f32d1d50050f8ac4" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classfsqmat_1cfa4c359483d2322f32d1d50050f8ac4" kindref="member" tooltip="Clearing matrix so that it corresponds to zeros.">fsqmat::clear</ref>()<sp/>{<ref refid="classfsqmat_1a7a1fcb9aae19d1e4daddfc9c22ce453" kindref="member" tooltip="Full matrix on which the operations are performed.">M</ref>.clear();};</highlight></codeline> |
---|
162 | <codeline lineno="16" refid="classfsqmat_11929fbc9fe375f1d67f979d0d302336f" refkind="member"><highlight class="normal"><ref refid="classfsqmat_179e3f73e0ccd663c7f7e08083d272940" kindref="member" tooltip="Default initialization.">fsqmat::fsqmat</ref><sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>mat<sp/>&M0<sp/>)<sp/>:<sp/><ref refid="classsqmat" kindref="compound" tooltip="Virtual class for representation of double symmetric matrices in square-root form...">sqmat</ref>(M0.<ref refid="classsqmat_1ecc2e2540f95a04f4449842588170f5b" kindref="member" tooltip="Reimplementing common functions of mat: cols().">cols</ref>())</highlight></codeline> |
---|
163 | <codeline lineno="17"><highlight class="normal">{</highlight></codeline> |
---|
164 | <codeline lineno="18"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>it_assert_debug<sp/>(<sp/>(<sp/>M0.cols()<sp/>==M0.rows()<sp/>),</highlight><highlight class="stringliteral">"M0<sp/>must<sp/>be<sp/>square"</highlight><highlight class="normal"><sp/>);</highlight></codeline> |
---|
165 | <codeline lineno="19"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classfsqmat_1a7a1fcb9aae19d1e4daddfc9c22ce453" kindref="member" tooltip="Full matrix on which the operations are performed.">M</ref>=M0;</highlight></codeline> |
---|
166 | <codeline lineno="20"><highlight class="normal">};</highlight></codeline> |
---|
167 | <codeline lineno="21"><highlight class="normal"></highlight></codeline> |
---|
168 | <codeline lineno="22"><highlight class="normal"></highlight><highlight class="comment">//fsqmat::fsqmat()<sp/>{};</highlight><highlight class="normal"></highlight></codeline> |
---|
169 | <codeline lineno="23"><highlight class="normal"></highlight></codeline> |
---|
170 | <codeline lineno="24" refid="classfsqmat_140eae99305e7c7240fa95cfec125b06f" refkind="member"><highlight class="normal"><ref refid="classfsqmat_179e3f73e0ccd663c7f7e08083d272940" kindref="member" tooltip="Default initialization.">fsqmat::fsqmat</ref>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>dim0):<sp/><ref refid="classsqmat" kindref="compound" tooltip="Virtual class for representation of double symmetric matrices in square-root form...">sqmat</ref>(dim0),<sp/><ref refid="classfsqmat_1a7a1fcb9aae19d1e4daddfc9c22ce453" kindref="member" tooltip="Full matrix on which the operations are performed.">M</ref>(dim0,dim0)<sp/>{};</highlight></codeline> |
---|
171 | <codeline lineno="25"><highlight class="normal"></highlight></codeline> |
---|
172 | <codeline lineno="26" refid="classfsqmat_1e06aba54d61e807b41bd68b5ee6ac22f" refkind="member"><highlight class="normal">std::ostream<sp/>&<ref refid="classfsqmat_1e06aba54d61e807b41bd68b5ee6ac22f" kindref="member" tooltip="print full matrix">operator<< </ref>(<sp/>std::ostream<sp/>&os,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="classfsqmat" kindref="compound" tooltip="Fake sqmat. This class maps sqmat operations to operations on full matrix.">fsqmat</ref><sp/>&ld<sp/>)<sp/>{</highlight></codeline> |
---|
173 | <codeline lineno="27"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>os<sp/><<<sp/>ld.<ref refid="classfsqmat_1a7a1fcb9aae19d1e4daddfc9c22ce453" kindref="member" tooltip="Full matrix on which the operations are performed.">M</ref><sp/><<<sp/>endl;</highlight></codeline> |
---|
174 | <codeline lineno="28"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>os;</highlight></codeline> |
---|
175 | <codeline lineno="29"><highlight class="normal">}</highlight></codeline> |
---|
176 | <codeline lineno="30"><highlight class="normal"></highlight></codeline> |
---|
177 | <codeline lineno="31"><highlight class="normal"></highlight></codeline> |
---|
178 | <codeline lineno="32" refid="classldmat_1968113788422e858da23a477e98fd3a1" refkind="member"><highlight class="normal"><ref refid="classldmat_1a12dda6f529580b0377cc45226b43303" kindref="member" tooltip="Default constructor.">ldmat::ldmat</ref>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>mat<sp/>&exL,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>vec<sp/>&exD<sp/>)<sp/>:<sp/><ref refid="classsqmat" kindref="compound" tooltip="Virtual class for representation of double symmetric matrices in square-root form...">sqmat</ref>(exD.length())<sp/>{</highlight></codeline> |
---|
179 | <codeline lineno="33"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classldmat_14cce04824539c4a8d062d9a36d6e014e" kindref="member" tooltip="Positive vector .">D</ref><sp/>=<sp/>exD;</highlight></codeline> |
---|
180 | <codeline lineno="34"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classldmat_1f74a64b99fe58a75ebd37bb679e121ea" kindref="member" tooltip="Lower-triangular matrix .">L</ref><sp/>=<sp/>exL;</highlight></codeline> |
---|
181 | <codeline lineno="35"><highlight class="normal">}</highlight></codeline> |
---|
182 | <codeline lineno="36"><highlight class="normal"></highlight></codeline> |
---|
183 | <codeline lineno="37" refid="classldmat_1a12dda6f529580b0377cc45226b43303" refkind="member"><highlight class="normal"><ref refid="classldmat_1a12dda6f529580b0377cc45226b43303" kindref="member" tooltip="Default constructor.">ldmat::ldmat</ref>()<sp/>:<ref refid="classsqmat" kindref="compound" tooltip="Virtual class for representation of double symmetric matrices in square-root form...">sqmat</ref>(0)<sp/>{}</highlight></codeline> |
---|
184 | <codeline lineno="38"><highlight class="normal"></highlight></codeline> |
---|
185 | <codeline lineno="39" refid="classldmat_1163ee002a7858d104da1c59dd11f016d" refkind="member"><highlight class="normal"><ref refid="classldmat_1a12dda6f529580b0377cc45226b43303" kindref="member" tooltip="Default constructor.">ldmat::ldmat</ref>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>dim0):<sp/><ref refid="classsqmat" kindref="compound" tooltip="Virtual class for representation of double symmetric matrices in square-root form...">sqmat</ref>(dim0),<sp/><ref refid="classldmat_14cce04824539c4a8d062d9a36d6e014e" kindref="member" tooltip="Positive vector .">D</ref>(dim0),<ref refid="classldmat_1f74a64b99fe58a75ebd37bb679e121ea" kindref="member" tooltip="Lower-triangular matrix .">L</ref>(dim0,dim0)<sp/>{}</highlight></codeline> |
---|
186 | <codeline lineno="40"><highlight class="normal"></highlight></codeline> |
---|
187 | <codeline lineno="41" refid="classldmat_1abe16e0f86668ef61a9a4896c8565dee" refkind="member"><highlight class="normal"><ref refid="classldmat_1a12dda6f529580b0377cc45226b43303" kindref="member" tooltip="Default constructor.">ldmat::ldmat</ref>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>vec<sp/>D0):<ref refid="classsqmat" kindref="compound" tooltip="Virtual class for representation of double symmetric matrices in square-root form...">sqmat</ref>(D0.length())<sp/>{</highlight></codeline> |
---|
188 | <codeline lineno="42"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classldmat_14cce04824539c4a8d062d9a36d6e014e" kindref="member" tooltip="Positive vector .">D</ref><sp/>=<sp/>D0;</highlight></codeline> |
---|
189 | <codeline lineno="43"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classldmat_1f74a64b99fe58a75ebd37bb679e121ea" kindref="member" tooltip="Lower-triangular matrix .">L</ref><sp/>=<sp/>eye(<ref refid="classsqmat_10abed904bdc0882373ba9adba919689d" kindref="member" tooltip="dimension of the square matrix">dim</ref>);</highlight></codeline> |
---|
190 | <codeline lineno="44"><highlight class="normal">}</highlight></codeline> |
---|
191 | <codeline lineno="45"><highlight class="normal"></highlight></codeline> |
---|
192 | <codeline lineno="46" refid="classldmat_15f21785358072d36892d538eed1d1ea5" refkind="member"><highlight class="normal"><ref refid="classldmat_1a12dda6f529580b0377cc45226b43303" kindref="member" tooltip="Default constructor.">ldmat::ldmat</ref>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>mat<sp/>&V<sp/>):<ref refid="classsqmat" kindref="compound" tooltip="Virtual class for representation of double symmetric matrices in square-root form...">sqmat</ref>(V.<ref refid="classldmat_10fceb6b5b637cec89bb0a3d2e6be1306" kindref="member" tooltip="access function">cols</ref>())<sp/>{</highlight></codeline> |
---|
193 | <codeline lineno="47"><highlight class="normal"></highlight><highlight class="comment">//TODO<sp/>check<sp/>if<sp/>correct!!<sp/>Based<sp/>on<sp/>heuristic<sp/>observation<sp/>of<sp/>lu()</highlight><highlight class="normal"></highlight></codeline> |
---|
194 | <codeline lineno="48"><highlight class="normal"></highlight></codeline> |
---|
195 | <codeline lineno="49"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>it_assert_debug(<sp/><ref refid="classsqmat_10abed904bdc0882373ba9adba919689d" kindref="member" tooltip="dimension of the square matrix">dim</ref><sp/>==<sp/>V.rows(),</highlight><highlight class="stringliteral">"ldmat::ldmat<sp/>matrix<sp/>V<sp/>is<sp/>not<sp/>square!"</highlight><highlight class="normal"><sp/>);</highlight></codeline> |
---|
196 | <codeline lineno="50"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> |
---|
197 | <codeline lineno="51"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>L<sp/>and<sp/>D<sp/>will<sp/>be<sp/>allocated<sp/>by<sp/>ldform()</highlight><highlight class="normal"></highlight></codeline> |
---|
198 | <codeline lineno="52"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> |
---|
199 | <codeline lineno="53"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//Chol<sp/>is<sp/>unstable</highlight><highlight class="normal"></highlight></codeline> |
---|
200 | <codeline lineno="54"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>this-><ref refid="classldmat_1f291faa073e7bc8dfafc7ae93daa2506" kindref="member" tooltip="Transforms general into pure .">ldform</ref>(chol(V),ones(<ref refid="classsqmat_10abed904bdc0882373ba9adba919689d" kindref="member" tooltip="dimension of the square matrix">dim</ref>));</highlight></codeline> |
---|
201 | <codeline lineno="55"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/><sp/><sp/><sp/><sp/>this->ldform(ul(V),ones(dim));</highlight><highlight class="normal"></highlight></codeline> |
---|
202 | <codeline lineno="56"><highlight class="normal">}</highlight></codeline> |
---|
203 | <codeline lineno="57"><highlight class="normal"></highlight></codeline> |
---|
204 | <codeline lineno="58" refid="classldmat_10f0f6e083e6d947cf58097ffce3ccd1a" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classldmat_10f0f6e083e6d947cf58097ffce3ccd1a" kindref="member">ldmat::opupdt</ref>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>vec<sp/>&v,<sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>w<sp/>)<sp/>{</highlight></codeline> |
---|
205 | <codeline lineno="59"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="classsqmat_10abed904bdc0882373ba9adba919689d" kindref="member" tooltip="dimension of the square matrix">dim</ref><sp/>=<sp/><ref refid="classldmat_14cce04824539c4a8d062d9a36d6e014e" kindref="member" tooltip="Positive vector .">D</ref>.length();</highlight></codeline> |
---|
206 | <codeline lineno="60"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>kr;</highlight></codeline> |
---|
207 | <codeline lineno="61"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>r<sp/>=<sp/>v;</highlight></codeline> |
---|
208 | <codeline lineno="62"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//beware!<sp/>it<sp/>is<sp/>potentionally<sp/>dangerous,<sp/>if<sp/>ITpp<sp/>change<sp/>_behaviour<sp/>of<sp/>_data()!</highlight><highlight class="normal"></highlight></codeline> |
---|
209 | <codeline lineno="63"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*Lraw<sp/>=<sp/><ref refid="classldmat_1f74a64b99fe58a75ebd37bb679e121ea" kindref="member" tooltip="Lower-triangular matrix .">L</ref>._data();</highlight></codeline> |
---|
210 | <codeline lineno="64"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*Draw<sp/>=<sp/><ref refid="classldmat_14cce04824539c4a8d062d9a36d6e014e" kindref="member" tooltip="Positive vector .">D</ref>._data();</highlight></codeline> |
---|
211 | <codeline lineno="65"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*rraw<sp/>=<sp/>r._data();</highlight></codeline> |
---|
212 | <codeline lineno="66"><highlight class="normal"></highlight></codeline> |
---|
213 | <codeline lineno="67"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>it_assert_debug(<sp/>v.length()<sp/>==<sp/>dim,<sp/></highlight><highlight class="stringliteral">"LD::ldupdt<sp/>vector<sp/>v<sp/>is<sp/>not<sp/>compatible<sp/>with<sp/>this<sp/>ld."</highlight><highlight class="normal"><sp/>);</highlight></codeline> |
---|
214 | <codeline lineno="68"><highlight class="normal"></highlight></codeline> |
---|
215 | <codeline lineno="69"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i<sp/>=<sp/>dim<sp/>-<sp/>1;<sp/>i<sp/>>=<sp/>0;<sp/>i--<sp/>)<sp/>{</highlight></codeline> |
---|
216 | <codeline lineno="70"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dydr(<sp/>rraw,<sp/>Lraw<sp/>+<sp/>i,<sp/>&w,<sp/>Draw<sp/>+<sp/>i,<sp/>rraw<sp/>+<sp/>i,<sp/>0,<sp/>i,<sp/>&kr,<sp/>1,<sp/>dim<sp/>);</highlight></codeline> |
---|
217 | <codeline lineno="71"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> |
---|
218 | <codeline lineno="72"><highlight class="normal">}</highlight></codeline> |
---|
219 | <codeline lineno="73"><highlight class="normal"></highlight></codeline> |
---|
220 | <codeline lineno="74" refid="classldmat_1eaaa0baa6026b84cfcbced41c84599d1" refkind="member"><highlight class="normal">std::ostream<sp/>&<ref refid="classldmat_1eaaa0baa6026b84cfcbced41c84599d1" kindref="member" tooltip="print both L and D ">operator<< </ref>(<sp/>std::ostream<sp/>&os,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="classldmat" kindref="compound" tooltip="Matrix stored in LD form, (typically known as UD).">ldmat</ref><sp/>&ld<sp/>)<sp/>{</highlight></codeline> |
---|
221 | <codeline lineno="75"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>os<sp/><<<sp/></highlight><highlight class="stringliteral">"L:"</highlight><highlight class="normal"><sp/><<<sp/>ld.<ref refid="classldmat_1f74a64b99fe58a75ebd37bb679e121ea" kindref="member" tooltip="Lower-triangular matrix .">L</ref><sp/><<<sp/>endl;</highlight></codeline> |
---|
222 | <codeline lineno="76"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>os<sp/><<<sp/></highlight><highlight class="stringliteral">"D:"</highlight><highlight class="normal"><sp/><<<sp/>ld.<ref refid="classldmat_14cce04824539c4a8d062d9a36d6e014e" kindref="member" tooltip="Positive vector .">D</ref><sp/><<<sp/>endl;</highlight></codeline> |
---|
223 | <codeline lineno="77"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>os;</highlight></codeline> |
---|
224 | <codeline lineno="78"><highlight class="normal">}</highlight></codeline> |
---|
225 | <codeline lineno="79"><highlight class="normal"></highlight></codeline> |
---|
226 | <codeline lineno="80" refid="classldmat_15b0515da8dc2293d9e4360b74cc26c9e" refkind="member"><highlight class="normal">mat<sp/><ref refid="classldmat_15b0515da8dc2293d9e4360b74cc26c9e" kindref="member" tooltip="Conversion to full matrix.">ldmat::to_mat</ref>()<sp/>{</highlight></codeline> |
---|
227 | <codeline lineno="81"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="classsqmat_10abed904bdc0882373ba9adba919689d" kindref="member" tooltip="dimension of the square matrix">dim</ref><sp/>=<sp/><ref refid="classldmat_14cce04824539c4a8d062d9a36d6e014e" kindref="member" tooltip="Positive vector .">D</ref>.length();</highlight></codeline> |
---|
228 | <codeline lineno="82"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mat<sp/>V(<sp/>dim,<sp/>dim<sp/>);</highlight></codeline> |
---|
229 | <codeline lineno="83"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>sum;</highlight></codeline> |
---|
230 | <codeline lineno="84"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>r,<sp/>c,<sp/>cc;</highlight></codeline> |
---|
231 | <codeline lineno="85"><highlight class="normal"></highlight></codeline> |
---|
232 | <codeline lineno="86"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(<sp/>r<sp/>=<sp/>0;r<sp/><<sp/>dim;r++<sp/>)<sp/>{<sp/></highlight><highlight class="comment">//row<sp/>cycle</highlight><highlight class="normal"></highlight></codeline> |
---|
233 | <codeline lineno="87"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(<sp/>c<sp/>=<sp/>r;c<sp/><<sp/>dim;c++<sp/>)<sp/>{</highlight></codeline> |
---|
234 | <codeline lineno="88"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//column<sp/>cycle,<sp/>using<sp/>symmetricity<sp/>=><sp/>c=r!</highlight><highlight class="normal"></highlight></codeline> |
---|
235 | <codeline lineno="89"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>sum<sp/>=<sp/>0.0;</highlight></codeline> |
---|
236 | <codeline lineno="90"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(<sp/>cc<sp/>=<sp/>c;cc<sp/><<sp/>dim;cc++<sp/>)<sp/>{<sp/></highlight><highlight class="comment">//cycle<sp/>over<sp/>the<sp/>remaining<sp/>part<sp/>of<sp/>the<sp/>vector</highlight><highlight class="normal"></highlight></codeline> |
---|
237 | <codeline lineno="91"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>sum<sp/>+=<sp/><ref refid="classldmat_1f74a64b99fe58a75ebd37bb679e121ea" kindref="member" tooltip="Lower-triangular matrix .">L</ref>(<sp/>cc,<sp/>r<sp/>)<sp/>*<sp/><ref refid="classldmat_14cce04824539c4a8d062d9a36d6e014e" kindref="member" tooltip="Positive vector .">D</ref>(<sp/>cc<sp/>)<sp/>*<sp/><ref refid="classldmat_1f74a64b99fe58a75ebd37bb679e121ea" kindref="member" tooltip="Lower-triangular matrix .">L</ref>(<sp/>cc,<sp/>c<sp/>);</highlight></codeline> |
---|
238 | <codeline lineno="92"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//here<sp/>L(cc,r)<sp/>=<sp/>L(r,cc)';</highlight><highlight class="normal"></highlight></codeline> |
---|
239 | <codeline lineno="93"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> |
---|
240 | <codeline lineno="94"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>V(<sp/>r,<sp/>c<sp/>)<sp/>=<sp/>sum;</highlight></codeline> |
---|
241 | <codeline lineno="95"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>symmetricity</highlight><highlight class="normal"></highlight></codeline> |
---|
242 | <codeline lineno="96"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<sp/>r<sp/>!=<sp/>c<sp/>)<sp/>{V(<sp/>c,<sp/>r<sp/>)<sp/>=<sp/>sum;};</highlight></codeline> |
---|
243 | <codeline lineno="97"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> |
---|
244 | <codeline lineno="98"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> |
---|
245 | <codeline lineno="99"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mat<sp/>V2<sp/>=<sp/><ref refid="classldmat_1f74a64b99fe58a75ebd37bb679e121ea" kindref="member" tooltip="Lower-triangular matrix .">L</ref>.transpose()*diag(<sp/><ref refid="classldmat_14cce04824539c4a8d062d9a36d6e014e" kindref="member" tooltip="Positive vector .">D</ref><sp/>)*<ref refid="classldmat_1f74a64b99fe58a75ebd37bb679e121ea" kindref="member" tooltip="Lower-triangular matrix .">L</ref>;</highlight></codeline> |
---|
246 | <codeline lineno="100"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>V2;</highlight></codeline> |
---|
247 | <codeline lineno="101"><highlight class="normal">}</highlight></codeline> |
---|
248 | <codeline lineno="102"><highlight class="normal"></highlight></codeline> |
---|
249 | <codeline lineno="103"><highlight class="normal"></highlight></codeline> |
---|
250 | <codeline lineno="104" refid="classldmat_1a60f2c7e4f3c6a7738eaaaab81ffad20" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classldmat_1a60f2c7e4f3c6a7738eaaaab81ffad20" kindref="member" tooltip="Add another matrix in LD form with weight w.">ldmat::add</ref>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="classldmat" kindref="compound" tooltip="Matrix stored in LD form, (typically known as UD).">ldmat</ref><sp/>&ld2,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>w<sp/>)<sp/>{</highlight></codeline> |
---|
251 | <codeline lineno="105"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="classsqmat_10abed904bdc0882373ba9adba919689d" kindref="member" tooltip="dimension of the square matrix">dim</ref><sp/>=<sp/><ref refid="classldmat_14cce04824539c4a8d062d9a36d6e014e" kindref="member" tooltip="Positive vector .">D</ref>.length();</highlight></codeline> |
---|
252 | <codeline lineno="106"><highlight class="normal"></highlight></codeline> |
---|
253 | <codeline lineno="107"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>it_assert_debug(<sp/>ld2.<ref refid="classldmat_14cce04824539c4a8d062d9a36d6e014e" kindref="member" tooltip="Positive vector .">D</ref>.length()<sp/>==<sp/>dim,<sp/></highlight><highlight class="stringliteral">"LD.add()<sp/>incompatible<sp/>sizes<sp/>of<sp/>LDs;"</highlight><highlight class="normal"><sp/>);</highlight></codeline> |
---|
254 | <codeline lineno="108"><highlight class="normal"></highlight></codeline> |
---|
255 | <codeline lineno="109"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//Fixme<sp/>can<sp/>be<sp/>done<sp/>more<sp/>efficiently<sp/>either<sp/>via<sp/>dydr<sp/>or<sp/>ldform</highlight><highlight class="normal"></highlight></codeline> |
---|
256 | <codeline lineno="110"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>r<sp/>=<sp/>0;<sp/>r<sp/><<sp/>dim;<sp/>r++<sp/>)<sp/>{</highlight></codeline> |
---|
257 | <codeline lineno="111"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Add<sp/>columns<sp/>of<sp/>ld2.L'<sp/>(i.e.<sp/>rows<sp/>of<sp/>ld2.L)<sp/>as<sp/>dyads<sp/>weighted<sp/>by<sp/>ld2.D</highlight><highlight class="normal"></highlight></codeline> |
---|
258 | <codeline lineno="112"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>this-><ref refid="classldmat_10f0f6e083e6d947cf58097ffce3ccd1a" kindref="member">opupdt</ref>(<sp/>ld2.<ref refid="classldmat_1f74a64b99fe58a75ebd37bb679e121ea" kindref="member" tooltip="Lower-triangular matrix .">L</ref>.get_row(<sp/>r<sp/>),<sp/>w*ld2.<ref refid="classldmat_14cce04824539c4a8d062d9a36d6e014e" kindref="member" tooltip="Positive vector .">D</ref>(<sp/>r<sp/>)<sp/>);</highlight></codeline> |
---|
259 | <codeline lineno="113"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> |
---|
260 | <codeline lineno="114"><highlight class="normal">}</highlight></codeline> |
---|
261 | <codeline lineno="115"><highlight class="normal"></highlight></codeline> |
---|
262 | <codeline lineno="116" refid="classldmat_14d6e401de9607332305c27e67972a07a" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classldmat_14d6e401de9607332305c27e67972a07a" kindref="member" tooltip="Clearing matrix so that it corresponds to zeros.">ldmat::clear</ref>(){<ref refid="classldmat_1f74a64b99fe58a75ebd37bb679e121ea" kindref="member" tooltip="Lower-triangular matrix .">L</ref>.clear();<sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i=0;i<<ref refid="classldmat_1f74a64b99fe58a75ebd37bb679e121ea" kindref="member" tooltip="Lower-triangular matrix .">L</ref>.cols();i++<sp/>){<ref refid="classldmat_1f74a64b99fe58a75ebd37bb679e121ea" kindref="member" tooltip="Lower-triangular matrix .">L</ref>(<sp/>i,i<sp/>)=1;};<sp/><ref refid="classldmat_14cce04824539c4a8d062d9a36d6e014e" kindref="member" tooltip="Positive vector .">D</ref>.clear();}</highlight></codeline> |
---|
263 | <codeline lineno="117"><highlight class="normal"></highlight></codeline> |
---|
264 | <codeline lineno="118" refid="classldmat_12c160cb123c1102face7a50ec566a031" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classldmat_12c160cb123c1102face7a50ec566a031" kindref="member" tooltip="Matrix inversion preserving the chosen form.">ldmat::inv</ref>(<sp/><ref refid="classldmat" kindref="compound" tooltip="Matrix stored in LD form, (typically known as UD).">ldmat</ref><sp/>&Inv<sp/>)</highlight><highlight class="keyword"><sp/>const<sp/></highlight><highlight class="normal">{</highlight></codeline> |
---|
265 | <codeline lineno="119"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Inv.<ref refid="classldmat_14d6e401de9607332305c27e67972a07a" kindref="member" tooltip="Clearing matrix so that it corresponds to zeros.">clear</ref>();<sp/><sp/><sp/></highlight><highlight class="comment">//Inv<sp/>=<sp/>zero<sp/>in<sp/>LD</highlight><highlight class="normal"></highlight></codeline> |
---|
266 | <codeline lineno="120"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mat<sp/>U<sp/>=<sp/>ltuinv(<sp/><ref refid="classldmat_1f74a64b99fe58a75ebd37bb679e121ea" kindref="member" tooltip="Lower-triangular matrix .">L</ref><sp/>);</highlight></codeline> |
---|
267 | <codeline lineno="121"><highlight class="normal"></highlight></codeline> |
---|
268 | <codeline lineno="122"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Inv.<ref refid="classldmat_1f291faa073e7bc8dfafc7ae93daa2506" kindref="member" tooltip="Transforms general into pure .">ldform</ref>(<sp/>U.transpose(),<sp/>1.0<sp/>/<sp/><ref refid="classldmat_14cce04824539c4a8d062d9a36d6e014e" kindref="member" tooltip="Positive vector .">D</ref><sp/>);</highlight></codeline> |
---|
269 | <codeline lineno="123"><highlight class="normal">}</highlight></codeline> |
---|
270 | <codeline lineno="124"><highlight class="normal"></highlight></codeline> |
---|
271 | <codeline lineno="125" refid="classldmat_1e967b9425007f0cb6cd59b845f9756d8" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classldmat_1e967b9425007f0cb6cd59b845f9756d8" kindref="member" tooltip="Inplace symmetric multiplication by a SQUARE matrix , i.e. .">ldmat::mult_sym</ref>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>mat<sp/>&C)<sp/>{</highlight></codeline> |
---|
272 | <codeline lineno="126"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mat<sp/>A<sp/>=<sp/><ref refid="classldmat_1f74a64b99fe58a75ebd37bb679e121ea" kindref="member" tooltip="Lower-triangular matrix .">L</ref>*C.T();</highlight></codeline> |
---|
273 | <codeline lineno="127"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>this-><ref refid="classldmat_1f291faa073e7bc8dfafc7ae93daa2506" kindref="member" tooltip="Transforms general into pure .">ldform</ref>(A,<ref refid="classldmat_14cce04824539c4a8d062d9a36d6e014e" kindref="member" tooltip="Positive vector .">D</ref>);</highlight></codeline> |
---|
274 | <codeline lineno="128"><highlight class="normal">}</highlight></codeline> |
---|
275 | <codeline lineno="129"><highlight class="normal"></highlight></codeline> |
---|
276 | <codeline lineno="130" refid="classldmat_14fd155f38eb6dd5af4bdf9c98a7999a9" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classldmat_14fd155f38eb6dd5af4bdf9c98a7999a9" kindref="member" tooltip="Inplace symmetric multiplication by a SQUARE transpose of matrix , i.e. .">ldmat::mult_sym_t</ref>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>mat<sp/>&C)<sp/>{</highlight></codeline> |
---|
277 | <codeline lineno="131"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mat<sp/>A<sp/>=<sp/><ref refid="classldmat_1f74a64b99fe58a75ebd37bb679e121ea" kindref="member" tooltip="Lower-triangular matrix .">L</ref>*C;</highlight></codeline> |
---|
278 | <codeline lineno="132"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>this-><ref refid="classldmat_1f291faa073e7bc8dfafc7ae93daa2506" kindref="member" tooltip="Transforms general into pure .">ldform</ref>(A,<ref refid="classldmat_14cce04824539c4a8d062d9a36d6e014e" kindref="member" tooltip="Positive vector .">D</ref>);</highlight></codeline> |
---|
279 | <codeline lineno="133"><highlight class="normal">}</highlight></codeline> |
---|
280 | <codeline lineno="134"><highlight class="normal"></highlight></codeline> |
---|
281 | <codeline lineno="135" refid="classldmat_1e7207748909325bb0f99b43f090a2b7e" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classldmat_1e967b9425007f0cb6cd59b845f9756d8" kindref="member" tooltip="Inplace symmetric multiplication by a SQUARE matrix , i.e. .">ldmat::mult_sym</ref>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>mat<sp/>&C,<sp/><ref refid="classldmat" kindref="compound" tooltip="Matrix stored in LD form, (typically known as UD).">ldmat</ref><sp/>&U)</highlight><highlight class="keyword"><sp/>const<sp/></highlight><highlight class="normal">{</highlight></codeline> |
---|
282 | <codeline lineno="136"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mat<sp/>A=<ref refid="classldmat_1f74a64b99fe58a75ebd37bb679e121ea" kindref="member" tooltip="Lower-triangular matrix .">L</ref>*C.T();<sp/></highlight><highlight class="comment">//could<sp/>be<sp/>done<sp/>more<sp/>efficiently<sp/>using<sp/>BLAS</highlight><highlight class="normal"></highlight></codeline> |
---|
283 | <codeline lineno="137"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>U.<ref refid="classldmat_1f291faa073e7bc8dfafc7ae93daa2506" kindref="member" tooltip="Transforms general into pure .">ldform</ref>(A,<ref refid="classldmat_14cce04824539c4a8d062d9a36d6e014e" kindref="member" tooltip="Positive vector .">D</ref>);</highlight></codeline> |
---|
284 | <codeline lineno="138"><highlight class="normal">}</highlight></codeline> |
---|
285 | <codeline lineno="139"><highlight class="normal"></highlight></codeline> |
---|
286 | <codeline lineno="140" refid="classldmat_1f94dc3a233f3d40fc853d8d4ac3b8eab" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classldmat_14fd155f38eb6dd5af4bdf9c98a7999a9" kindref="member" tooltip="Inplace symmetric multiplication by a SQUARE transpose of matrix , i.e. .">ldmat::mult_sym_t</ref>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>mat<sp/>&C,<sp/><ref refid="classldmat" kindref="compound" tooltip="Matrix stored in LD form, (typically known as UD).">ldmat</ref><sp/>&U)</highlight><highlight class="keyword"><sp/>const<sp/></highlight><highlight class="normal">{</highlight></codeline> |
---|
287 | <codeline lineno="141"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mat<sp/>A=<ref refid="classldmat_1f74a64b99fe58a75ebd37bb679e121ea" kindref="member" tooltip="Lower-triangular matrix .">L</ref>*C;</highlight></codeline> |
---|
288 | <codeline lineno="142"><highlight class="normal"></highlight><highlight class="comment">/*<sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>nD=zeros(U.rows());</highlight></codeline> |
---|
289 | <codeline lineno="143"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>nD.replace_mid(0,<sp/>D);<sp/>//I<sp/>case<sp/>that<sp/>D<sp/><<sp/>nD*/</highlight><highlight class="normal"></highlight></codeline> |
---|
290 | <codeline lineno="144"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>U.<ref refid="classldmat_1f291faa073e7bc8dfafc7ae93daa2506" kindref="member" tooltip="Transforms general into pure .">ldform</ref>(A,<ref refid="classldmat_14cce04824539c4a8d062d9a36d6e014e" kindref="member" tooltip="Positive vector .">D</ref>);</highlight></codeline> |
---|
291 | <codeline lineno="145"><highlight class="normal">}</highlight></codeline> |
---|
292 | <codeline lineno="146"><highlight class="normal"></highlight></codeline> |
---|
293 | <codeline lineno="147"><highlight class="normal"></highlight></codeline> |
---|
294 | <codeline lineno="148" refid="classldmat_12b42750ba4962d439aa52a77ae12949b" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/><ref refid="classldmat_12b42750ba4962d439aa52a77ae12949b" kindref="member" tooltip="Logarithm of a determinant.">ldmat::logdet</ref>()</highlight><highlight class="keyword"><sp/>const<sp/></highlight><highlight class="normal">{</highlight></codeline> |
---|
295 | <codeline lineno="149"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>ldet<sp/>=<sp/>0.0;</highlight></codeline> |
---|
296 | <codeline lineno="150"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i;</highlight></codeline> |
---|
297 | <codeline lineno="151"><highlight class="normal"></highlight><highlight class="comment">//<sp/>sum<sp/>logarithms<sp/>of<sp/>diagobal<sp/>elements</highlight><highlight class="normal"></highlight></codeline> |
---|
298 | <codeline lineno="152"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(<sp/>i=0;<sp/>i<<ref refid="classldmat_14cce04824539c4a8d062d9a36d6e014e" kindref="member" tooltip="Positive vector .">D</ref>.length();<sp/>i++<sp/>){ldet+=log(<sp/><ref refid="classldmat_14cce04824539c4a8d062d9a36d6e014e" kindref="member" tooltip="Positive vector .">D</ref>(<sp/>i<sp/>)<sp/>);};</highlight></codeline> |
---|
299 | <codeline lineno="153"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ldet;</highlight></codeline> |
---|
300 | <codeline lineno="154"><highlight class="normal">}</highlight></codeline> |
---|
301 | <codeline lineno="155"><highlight class="normal"></highlight></codeline> |
---|
302 | <codeline lineno="156" refid="classldmat_1d64f331b781903e913cb2ee836886f3f" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/><ref refid="classldmat_1d64f331b781903e913cb2ee836886f3f" kindref="member" tooltip="Evaluates quadratic form ;.">ldmat::qform</ref>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>vec<sp/>&v<sp/>)</highlight><highlight class="keyword"><sp/>const<sp/></highlight><highlight class="normal">{</highlight></codeline> |
---|
303 | <codeline lineno="157"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>x<sp/>=<sp/>0.0,<sp/>sum;</highlight></codeline> |
---|
304 | <codeline lineno="158"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i,j;</highlight></codeline> |
---|
305 | <codeline lineno="159"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>s(v.length());</highlight></codeline> |
---|
306 | <codeline lineno="160"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>S=<ref refid="classldmat_1f74a64b99fe58a75ebd37bb679e121ea" kindref="member" tooltip="Lower-triangular matrix .">L</ref>*v;</highlight></codeline> |
---|
307 | <codeline lineno="161"><highlight class="normal"></highlight></codeline> |
---|
308 | <codeline lineno="162"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(<sp/>i=0;<sp/>i<<ref refid="classldmat_14cce04824539c4a8d062d9a36d6e014e" kindref="member" tooltip="Positive vector .">D</ref>.length();<sp/>i++<sp/>)<sp/>{<sp/></highlight><highlight class="comment">//rows<sp/>of<sp/>L</highlight><highlight class="normal"></highlight></codeline> |
---|
309 | <codeline lineno="163"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>sum<sp/>=<sp/>0.0;</highlight></codeline> |
---|
310 | <codeline lineno="164"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(<sp/>j=0;<sp/>j<=i;<sp/>j++<sp/>){sum+=<ref refid="classldmat_1f74a64b99fe58a75ebd37bb679e121ea" kindref="member" tooltip="Lower-triangular matrix .">L</ref>(<sp/>i,j<sp/>)*v(<sp/>j<sp/>);}</highlight></codeline> |
---|
311 | <codeline lineno="165"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>x<sp/>+=<ref refid="classldmat_14cce04824539c4a8d062d9a36d6e014e" kindref="member" tooltip="Positive vector .">D</ref>(<sp/>i<sp/>)*sum*sum;</highlight></codeline> |
---|
312 | <codeline lineno="166"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>s(i)=sum;</highlight></codeline> |
---|
313 | <codeline lineno="167"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>};</highlight></codeline> |
---|
314 | <codeline lineno="168"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>x;</highlight></codeline> |
---|
315 | <codeline lineno="169"><highlight class="normal">}</highlight></codeline> |
---|
316 | <codeline lineno="170"><highlight class="normal"></highlight></codeline> |
---|
317 | <codeline lineno="171" refid="classldmat_1d876c5f83e02b3e809b35c9de5068f14" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/><ref refid="classldmat_1d876c5f83e02b3e809b35c9de5068f14" kindref="member" tooltip="Evaluates quadratic form ;.">ldmat::invqform</ref>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>vec<sp/>&v<sp/>)</highlight><highlight class="keyword"><sp/>const<sp/></highlight><highlight class="normal">{</highlight></codeline> |
---|
318 | <codeline lineno="172"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>x<sp/>=<sp/>0.0;</highlight></codeline> |
---|
319 | <codeline lineno="173"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i;</highlight></codeline> |
---|
320 | <codeline lineno="174"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>pom(v.length());</highlight></codeline> |
---|
321 | <codeline lineno="175"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> |
---|
322 | <codeline lineno="176"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>backward_substitution(<ref refid="classldmat_1f74a64b99fe58a75ebd37bb679e121ea" kindref="member" tooltip="Lower-triangular matrix .">L</ref>.T(),v,pom);</highlight></codeline> |
---|
323 | <codeline lineno="177"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> |
---|
324 | <codeline lineno="178"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(<sp/>i=0;<sp/>i<<ref refid="classldmat_14cce04824539c4a8d062d9a36d6e014e" kindref="member" tooltip="Positive vector .">D</ref>.length();<sp/>i++<sp/>)<sp/>{<sp/></highlight><highlight class="comment">//rows<sp/>of<sp/>L</highlight><highlight class="normal"></highlight></codeline> |
---|
325 | <codeline lineno="179"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>x<sp/>+=pom(i)*pom(i)/<ref refid="classldmat_14cce04824539c4a8d062d9a36d6e014e" kindref="member" tooltip="Positive vector .">D</ref>(i);</highlight></codeline> |
---|
326 | <codeline lineno="180"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>};</highlight></codeline> |
---|
327 | <codeline lineno="181"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>x;</highlight></codeline> |
---|
328 | <codeline lineno="182"><highlight class="normal">}</highlight></codeline> |
---|
329 | <codeline lineno="183"><highlight class="normal"></highlight></codeline> |
---|
330 | <codeline lineno="184" refid="classldmat_1875b7e6dcf73ae7001329099019fdb1d" refkind="member"><highlight class="normal"><ref refid="classldmat" kindref="compound" tooltip="Matrix stored in LD form, (typically known as UD).">ldmat</ref>&<sp/><ref refid="classldmat_1875b7e6dcf73ae7001329099019fdb1d" kindref="member" tooltip="multiply by a scalar">ldmat::operator *= </ref>(<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>x<sp/>)<sp/>{</highlight></codeline> |
---|
331 | <codeline lineno="185"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classldmat_14cce04824539c4a8d062d9a36d6e014e" kindref="member" tooltip="Positive vector .">D</ref>*=x;</highlight></codeline> |
---|
332 | <codeline lineno="186"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>*</highlight><highlight class="keyword">this</highlight><highlight class="normal">;</highlight></codeline> |
---|
333 | <codeline lineno="187"><highlight class="normal">}</highlight></codeline> |
---|
334 | <codeline lineno="188"><highlight class="normal"></highlight></codeline> |
---|
335 | <codeline lineno="189" refid="classldmat_1fc380626ced6f9244fb58c5f0231174d" refkind="member"><highlight class="normal">vec<sp/><ref refid="classldmat_1fc380626ced6f9244fb58c5f0231174d" kindref="member" tooltip="Multiplies square root of by vector .">ldmat::sqrt_mult</ref>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>vec<sp/>&x<sp/>)</highlight><highlight class="keyword"><sp/>const<sp/></highlight><highlight class="normal">{</highlight></codeline> |
---|
336 | <codeline lineno="190"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i,j;</highlight></codeline> |
---|
337 | <codeline lineno="191"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>res(<sp/><ref refid="classsqmat_10abed904bdc0882373ba9adba919689d" kindref="member" tooltip="dimension of the square matrix">dim</ref><sp/>);</highlight></codeline> |
---|
338 | <codeline lineno="192"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//double<sp/>sum;</highlight><highlight class="normal"></highlight></codeline> |
---|
339 | <codeline lineno="193"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(<sp/>i=0;i<<ref refid="classsqmat_10abed904bdc0882373ba9adba919689d" kindref="member" tooltip="dimension of the square matrix">dim</ref>;i++<sp/>)<sp/>{</highlight><highlight class="comment">//for<sp/>each<sp/>element<sp/>of<sp/>result</highlight><highlight class="normal"></highlight></codeline> |
---|
340 | <codeline lineno="194"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>res(<sp/>i<sp/>)<sp/>=<sp/>0.0;</highlight></codeline> |
---|
341 | <codeline lineno="195"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(<sp/>j=i;j<dim;j++<sp/>)<sp/>{</highlight><highlight class="comment">//sum<sp/>D(j)*L(:,i).*x</highlight><highlight class="normal"></highlight></codeline> |
---|
342 | <codeline lineno="196"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>res(<sp/>i<sp/>)<sp/>+=<sp/>sqrt(<sp/><ref refid="classldmat_14cce04824539c4a8d062d9a36d6e014e" kindref="member" tooltip="Positive vector .">D</ref>(<sp/>j<sp/>)<sp/>)*<ref refid="classldmat_1f74a64b99fe58a75ebd37bb679e121ea" kindref="member" tooltip="Lower-triangular matrix .">L</ref>(<sp/>j,i<sp/>)*x(<sp/>j<sp/>);</highlight></codeline> |
---|
343 | <codeline lineno="197"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> |
---|
344 | <codeline lineno="198"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> |
---|
345 | <codeline lineno="199"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>res2<sp/>=<sp/>L.transpose()*diag(<sp/>sqrt(<sp/>D<sp/>)<sp/>)*x;</highlight><highlight class="normal"></highlight></codeline> |
---|
346 | <codeline lineno="200"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>res;</highlight></codeline> |
---|
347 | <codeline lineno="201"><highlight class="normal">}</highlight></codeline> |
---|
348 | <codeline lineno="202"><highlight class="normal"></highlight></codeline> |
---|
349 | <codeline lineno="203" refid="classldmat_1f291faa073e7bc8dfafc7ae93daa2506" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classldmat_1f291faa073e7bc8dfafc7ae93daa2506" kindref="member" tooltip="Transforms general into pure .">ldmat::ldform</ref>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>mat<sp/>&A,</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>vec<sp/>&D0<sp/>)</highlight></codeline> |
---|
350 | <codeline lineno="204"><highlight class="normal">{</highlight></codeline> |
---|
351 | <codeline lineno="205"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>m<sp/>=<sp/>A.rows();</highlight></codeline> |
---|
352 | <codeline lineno="206"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>n<sp/>=<sp/>A.cols();</highlight></codeline> |
---|
353 | <codeline lineno="207"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>mn<sp/>=<sp/>(m<n)<sp/>?<sp/>m<sp/>:n<sp/>;</highlight></codeline> |
---|
354 | <codeline lineno="208"><highlight class="normal"></highlight></codeline> |
---|
355 | <codeline lineno="209"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/><sp/><sp/><sp/><sp/>it_assert_debug(<sp/>A.cols()==dim,"ldmat::ldform<sp/>A<sp/>is<sp/>not<sp/>compatible"<sp/>);</highlight><highlight class="normal"></highlight></codeline> |
---|
356 | <codeline lineno="210"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>it_assert_debug(<sp/>D0.length()==A.rows(),</highlight><highlight class="stringliteral">"ldmat::ldform<sp/>Vector<sp/>D<sp/>must<sp/>have<sp/>the<sp/>length<sp/>as<sp/>row<sp/>count<sp/>of<sp/>A"</highlight><highlight class="normal"><sp/>);</highlight></codeline> |
---|
357 | <codeline lineno="211"><highlight class="normal"></highlight></codeline> |
---|
358 | <codeline lineno="212"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classldmat_1f74a64b99fe58a75ebd37bb679e121ea" kindref="member" tooltip="Lower-triangular matrix .">L</ref>=concat_vertical(<sp/>zeros(<sp/>n,n<sp/>),<sp/>diag(<sp/>sqrt(<sp/>D0<sp/>)<sp/>)*A<sp/>);</highlight></codeline> |
---|
359 | <codeline lineno="213"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classldmat_14cce04824539c4a8d062d9a36d6e014e" kindref="member" tooltip="Positive vector .">D</ref>=zeros(<sp/>n+m<sp/>);</highlight></codeline> |
---|
360 | <codeline lineno="214"><highlight class="normal"></highlight></codeline> |
---|
361 | <codeline lineno="215"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//unnecessary<sp/>big<sp/>L<sp/>and<sp/>D<sp/>will<sp/>be<sp/>made<sp/>smaller<sp/>at<sp/>the<sp/>end<sp/>of<sp/>file<sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="normal"></highlight></codeline> |
---|
362 | <codeline lineno="216"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>w=zeros(<sp/>n+m<sp/>);</highlight></codeline> |
---|
363 | <codeline lineno="217"><highlight class="normal"><sp/><sp/><sp/></highlight></codeline> |
---|
364 | <codeline lineno="218"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>sum,<sp/>beta,<sp/>pom;</highlight></codeline> |
---|
365 | <codeline lineno="219"><highlight class="normal"></highlight></codeline> |
---|
366 | <codeline lineno="220"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>cc=0;</highlight></codeline> |
---|
367 | <codeline lineno="221"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i=n;<sp/></highlight><highlight class="comment">//<sp/>indexovani<sp/>o<sp/>1<sp/>niz,<sp/>nez<sp/>v<sp/>matlabu</highlight><highlight class="normal"></highlight></codeline> |
---|
368 | <codeline lineno="222"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>ii,j,jj;</highlight></codeline> |
---|
369 | <codeline lineno="223"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(<sp/>(i>n-mn-cc)<sp/>&&<sp/>(i>0)<sp/>)<sp/></highlight></codeline> |
---|
370 | <codeline lineno="224"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>{</highlight></codeline> |
---|
371 | <codeline lineno="225"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>i--;</highlight></codeline> |
---|
372 | <codeline lineno="226"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>sum<sp/>=<sp/>0.0;</highlight></codeline> |
---|
373 | <codeline lineno="227"><highlight class="normal"></highlight></codeline> |
---|
374 | <codeline lineno="228"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>last_v<sp/>=<sp/>m+i-n+cc+1;</highlight></codeline> |
---|
375 | <codeline lineno="229"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> |
---|
376 | <codeline lineno="230"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>v<sp/>=<sp/>zeros(<sp/>last_v<sp/>+<sp/>1<sp/>);<sp/></highlight><highlight class="comment">//prepare<sp/>v</highlight><highlight class="normal"></highlight></codeline> |
---|
377 | <codeline lineno="231"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(<sp/>ii=n-cc-1;ii<m+i+1;ii++<sp/>)<sp/></highlight></codeline> |
---|
378 | <codeline lineno="232"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>{</highlight></codeline> |
---|
379 | <codeline lineno="233"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>sum+=<sp/><ref refid="classldmat_1f74a64b99fe58a75ebd37bb679e121ea" kindref="member" tooltip="Lower-triangular matrix .">L</ref>(<sp/>ii,i<sp/>)*<ref refid="classldmat_1f74a64b99fe58a75ebd37bb679e121ea" kindref="member" tooltip="Lower-triangular matrix .">L</ref>(<sp/>ii,i<sp/>);</highlight></codeline> |
---|
380 | <codeline lineno="234"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>v(<sp/>ii-n+cc+1<sp/>)=<ref refid="classldmat_1f74a64b99fe58a75ebd37bb679e121ea" kindref="member" tooltip="Lower-triangular matrix .">L</ref>(<sp/>ii,i<sp/>);<sp/></highlight><highlight class="comment">//assign<sp/>v</highlight><highlight class="normal"></highlight></codeline> |
---|
381 | <codeline lineno="235"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> |
---|
382 | <codeline lineno="236"><highlight class="normal"></highlight></codeline> |
---|
383 | <codeline lineno="237"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<sp/><ref refid="classldmat_1f74a64b99fe58a75ebd37bb679e121ea" kindref="member" tooltip="Lower-triangular matrix .">L</ref>(<sp/>m+i,i<sp/>)==0<sp/>)<sp/></highlight></codeline> |
---|
384 | <codeline lineno="238"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>beta<sp/>=<sp/>sqrt(<sp/>sum<sp/>);<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> |
---|
385 | <codeline lineno="239"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline> |
---|
386 | <codeline lineno="240"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>beta<sp/>=<sp/><ref refid="classldmat_1f74a64b99fe58a75ebd37bb679e121ea" kindref="member" tooltip="Lower-triangular matrix .">L</ref>(<sp/>m+i,i<sp/>)+sign(<sp/><ref refid="classldmat_1f74a64b99fe58a75ebd37bb679e121ea" kindref="member" tooltip="Lower-triangular matrix .">L</ref>(<sp/>m+i,i<sp/>)<sp/>)*sqrt(<sp/>sum<sp/>);<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> |
---|
387 | <codeline lineno="241"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/></highlight></codeline> |
---|
388 | <codeline lineno="242"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<sp/>std::fabs(<sp/>beta<sp/>)<eps<sp/>)</highlight></codeline> |
---|
389 | <codeline lineno="243"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>{</highlight></codeline> |
---|
390 | <codeline lineno="244"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>cc++;</highlight></codeline> |
---|
391 | <codeline lineno="245"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>L.set_row(<sp/>n-cc,<sp/>L.get_row(<sp/>m+i<sp/>)<sp/>);</highlight></codeline> |
---|
392 | <codeline lineno="246"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>L.set_row(<sp/>m+i,zeros(L.cols())<sp/>);</highlight></codeline> |
---|
393 | <codeline lineno="247"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classldmat_14cce04824539c4a8d062d9a36d6e014e" kindref="member" tooltip="Positive vector .">D</ref>(<sp/>m+i<sp/>)=0;<sp/><ref refid="classldmat_1f74a64b99fe58a75ebd37bb679e121ea" kindref="member" tooltip="Lower-triangular matrix .">L</ref>(<sp/>m+i,i<sp/>)=1;</highlight></codeline> |
---|
394 | <codeline lineno="248"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>L.set_submatrix(<sp/>n-cc,m+i-1,i,i,0<sp/>);</highlight></codeline> |
---|
395 | <codeline lineno="249"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">continue</highlight><highlight class="normal">;</highlight></codeline> |
---|
396 | <codeline lineno="250"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> |
---|
397 | <codeline lineno="251"><highlight class="normal"></highlight></codeline> |
---|
398 | <codeline lineno="252"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>sum-=v(last_v)*v(last_v);</highlight></codeline> |
---|
399 | <codeline lineno="253"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>sum/=beta*beta;</highlight></codeline> |
---|
400 | <codeline lineno="254"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>sum++;</highlight></codeline> |
---|
401 | <codeline lineno="255"><highlight class="normal"></highlight></codeline> |
---|
402 | <codeline lineno="256"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>v/=beta;</highlight></codeline> |
---|
403 | <codeline lineno="257"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>v(last_v)=1;</highlight></codeline> |
---|
404 | <codeline lineno="258"><highlight class="normal"></highlight></codeline> |
---|
405 | <codeline lineno="259"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pom=-2.0/sum;</highlight></codeline> |
---|
406 | <codeline lineno="260"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>echo<sp/>to<sp/>venca<sp/><sp/><sp/></highlight><highlight class="normal"></highlight></codeline> |
---|
407 | <codeline lineno="261"><highlight class="normal"></highlight></codeline> |
---|
408 | <codeline lineno="262"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(<sp/>j=i;j>=0;j--<sp/>)<sp/></highlight></codeline> |
---|
409 | <codeline lineno="263"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>{</highlight></codeline> |
---|
410 | <codeline lineno="264"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>w_elem<sp/>=<sp/>0;<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> |
---|
411 | <codeline lineno="265"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(<sp/>ii=n-<sp/><sp/><sp/><sp/><sp/>cc;ii<=m+i+1;ii++<sp/>)<sp/></highlight></codeline> |
---|
412 | <codeline lineno="266"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>w_elem+=<sp/>v(<sp/>ii-n+cc<sp/>)*<ref refid="classldmat_1f74a64b99fe58a75ebd37bb679e121ea" kindref="member" tooltip="Lower-triangular matrix .">L</ref>(<sp/>ii-1,j<sp/>);<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> |
---|
413 | <codeline lineno="267"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>w(j)=w_elem*pom;</highlight></codeline> |
---|
414 | <codeline lineno="268"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> |
---|
415 | <codeline lineno="269"><highlight class="normal"></highlight></codeline> |
---|
416 | <codeline lineno="270"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(<sp/>ii=n-cc-1;ii<=m+i;ii++<sp/>)<sp/></highlight></codeline> |
---|
417 | <codeline lineno="271"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(<sp/>jj=0;jj<i;jj++<sp/>)<sp/></highlight></codeline> |
---|
418 | <codeline lineno="272"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classldmat_1f74a64b99fe58a75ebd37bb679e121ea" kindref="member" tooltip="Lower-triangular matrix .">L</ref>(<sp/>ii,jj<sp/>)+=<sp/>v(<sp/>ii-n+cc+1)*w(<sp/>jj<sp/>);</highlight></codeline> |
---|
419 | <codeline lineno="273"><highlight class="normal"></highlight></codeline> |
---|
420 | <codeline lineno="274"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(<sp/>ii=n-cc-1;ii<m+i;ii++<sp/>)</highlight></codeline> |
---|
421 | <codeline lineno="275"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classldmat_1f74a64b99fe58a75ebd37bb679e121ea" kindref="member" tooltip="Lower-triangular matrix .">L</ref>(<sp/>ii,i<sp/>)=<sp/>0;</highlight></codeline> |
---|
422 | <codeline lineno="276"><highlight class="normal"></highlight></codeline> |
---|
423 | <codeline lineno="277"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classldmat_1f74a64b99fe58a75ebd37bb679e121ea" kindref="member" tooltip="Lower-triangular matrix .">L</ref>(<sp/>m+i,i<sp/>)+=w(<sp/>i<sp/>);</highlight></codeline> |
---|
424 | <codeline lineno="278"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classldmat_14cce04824539c4a8d062d9a36d6e014e" kindref="member" tooltip="Positive vector .">D</ref>(<sp/>m+i<sp/>)=<ref refid="classldmat_1f74a64b99fe58a75ebd37bb679e121ea" kindref="member" tooltip="Lower-triangular matrix .">L</ref>(<sp/>m+i,i<sp/>)*<ref refid="classldmat_1f74a64b99fe58a75ebd37bb679e121ea" kindref="member" tooltip="Lower-triangular matrix .">L</ref>(<sp/>m+i,i<sp/>);</highlight></codeline> |
---|
425 | <codeline lineno="279"><highlight class="normal"></highlight></codeline> |
---|
426 | <codeline lineno="280"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(<sp/>ii=0;ii<=i;ii++<sp/>)<sp/></highlight></codeline> |
---|
427 | <codeline lineno="281"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classldmat_1f74a64b99fe58a75ebd37bb679e121ea" kindref="member" tooltip="Lower-triangular matrix .">L</ref>(<sp/>m+i,ii<sp/>)/=<ref refid="classldmat_1f74a64b99fe58a75ebd37bb679e121ea" kindref="member" tooltip="Lower-triangular matrix .">L</ref>(<sp/>m+i,i<sp/>);<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> |
---|
428 | <codeline lineno="282"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> |
---|
429 | <codeline lineno="283"><highlight class="normal"></highlight></codeline> |
---|
430 | <codeline lineno="284"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<sp/>i>=0<sp/>)</highlight></codeline> |
---|
431 | <codeline lineno="285"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(<sp/>ii=0;ii<i;ii++<sp/>)<sp/></highlight></codeline> |
---|
432 | <codeline lineno="286"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>{</highlight></codeline> |
---|
433 | <codeline lineno="287"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>jj<sp/>=<sp/><ref refid="classldmat_14cce04824539c4a8d062d9a36d6e014e" kindref="member" tooltip="Positive vector .">D</ref>.length()-1-n+ii;</highlight></codeline> |
---|
434 | <codeline lineno="288"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classldmat_14cce04824539c4a8d062d9a36d6e014e" kindref="member" tooltip="Positive vector .">D</ref>(jj)<sp/>=<sp/>0;</highlight></codeline> |
---|
435 | <codeline lineno="289"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>L.set_row(jj,zeros(L.cols()));<sp/></highlight><highlight class="comment">//TODO:<sp/>set_row<sp/>accepts<sp/>Num_T</highlight><highlight class="normal"></highlight></codeline> |
---|
436 | <codeline lineno="290"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classldmat_1f74a64b99fe58a75ebd37bb679e121ea" kindref="member" tooltip="Lower-triangular matrix .">L</ref>(jj,jj)=1;</highlight></codeline> |
---|
437 | <codeline lineno="291"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> |
---|
438 | <codeline lineno="292"><highlight class="normal"></highlight></codeline> |
---|
439 | <codeline lineno="293"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>L.del_rows(0,m-1);</highlight></codeline> |
---|
440 | <codeline lineno="294"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classldmat_14cce04824539c4a8d062d9a36d6e014e" kindref="member" tooltip="Positive vector .">D</ref>.del(0,m-1);</highlight></codeline> |
---|
441 | <codeline lineno="295"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> |
---|
442 | <codeline lineno="296"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classsqmat_10abed904bdc0882373ba9adba919689d" kindref="member" tooltip="dimension of the square matrix">dim</ref><sp/>=<sp/>L.rows();</highlight></codeline> |
---|
443 | <codeline lineno="297"><highlight class="normal">}</highlight></codeline> |
---|
444 | <codeline lineno="298"><highlight class="normal"></highlight></codeline> |
---|
445 | <codeline lineno="300"><highlight class="normal"></highlight></codeline> |
---|
446 | <codeline lineno="301" refid="libDC_8h_16715d039e6d5d97005cf9e2522dfa474" refkind="member"><highlight class="normal">mat<sp/>ltuinv(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>mat<sp/>&<ref refid="classldmat_1f74a64b99fe58a75ebd37bb679e121ea" kindref="member" tooltip="Lower-triangular matrix .">L</ref><sp/>)<sp/>{</highlight></codeline> |
---|
447 | <codeline lineno="302"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="classsqmat_10abed904bdc0882373ba9adba919689d" kindref="member" tooltip="dimension of the square matrix">dim</ref><sp/>=<sp/>L.cols();</highlight></codeline> |
---|
448 | <codeline lineno="303"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mat<sp/>Il<sp/>=<sp/>eye(<sp/>dim<sp/>);</highlight></codeline> |
---|
449 | <codeline lineno="304"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i,<sp/>j,<sp/>k,<sp/>m;</highlight></codeline> |
---|
450 | <codeline lineno="305"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>s;</highlight></codeline> |
---|
451 | <codeline lineno="306"><highlight class="normal"></highlight></codeline> |
---|
452 | <codeline lineno="307"><highlight class="normal"></highlight><highlight class="comment">//Fixme<sp/>blind<sp/>transcription<sp/>of<sp/>ltuinv.m</highlight><highlight class="normal"></highlight></codeline> |
---|
453 | <codeline lineno="308"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(<sp/>k<sp/>=<sp/>1;<sp/>k<sp/><<sp/>(<sp/>dim<sp/>);k++<sp/>)<sp/>{</highlight></codeline> |
---|
454 | <codeline lineno="309"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(<sp/>i<sp/>=<sp/>0;<sp/>i<sp/><<sp/>(<sp/>dim<sp/>-<sp/>k<sp/>);i++<sp/>)<sp/>{</highlight></codeline> |
---|
455 | <codeline lineno="310"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>j<sp/>=<sp/>i<sp/>+<sp/>k;<sp/></highlight><highlight class="comment">//change<sp/>in<sp/>.m<sp/>1+1=2,<sp/>here<sp/>0+0+1=1</highlight><highlight class="normal"></highlight></codeline> |
---|
456 | <codeline lineno="311"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>s<sp/>=<sp/><ref refid="classldmat_1f74a64b99fe58a75ebd37bb679e121ea" kindref="member" tooltip="Lower-triangular matrix .">L</ref>(<sp/>j,<sp/>i<sp/>);</highlight></codeline> |
---|
457 | <codeline lineno="312"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(<sp/>m<sp/>=<sp/>i<sp/>+<sp/>1;<sp/>m<sp/><<sp/>(<sp/>j<sp/>);<sp/>m++<sp/>)<sp/>{</highlight></codeline> |
---|
458 | <codeline lineno="313"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>s<sp/>+=<sp/><ref refid="classldmat_1f74a64b99fe58a75ebd37bb679e121ea" kindref="member" tooltip="Lower-triangular matrix .">L</ref>(<sp/>m,<sp/>i<sp/>)<sp/>*<sp/>Il(<sp/>j,<sp/>m<sp/>);</highlight></codeline> |
---|
459 | <codeline lineno="314"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> |
---|
460 | <codeline lineno="315"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Il(<sp/>j,<sp/>i<sp/>)<sp/>=<sp/>-s;</highlight></codeline> |
---|
461 | <codeline lineno="316"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> |
---|
462 | <codeline lineno="317"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> |
---|
463 | <codeline lineno="318"><highlight class="normal"></highlight></codeline> |
---|
464 | <codeline lineno="319"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>Il;</highlight></codeline> |
---|
465 | <codeline lineno="320"><highlight class="normal">}</highlight></codeline> |
---|
466 | <codeline lineno="321"><highlight class="normal"></highlight></codeline> |
---|
467 | <codeline lineno="322" refid="libDC_8h_14ed56e73b49db8e7f4a63fa926a8dca4" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>dydr(<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*<sp/>r,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*f,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*Dr,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*Df,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*R,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>jl,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>jh,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>*kr,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>m,<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>mx<sp/>)</highlight></codeline> |
---|
468 | <codeline lineno="323"><highlight class="normal"></highlight><highlight class="comment">/********************************************************************</highlight></codeline> |
---|
469 | <codeline lineno="324"><highlight class="comment"></highlight></codeline> |
---|
470 | <codeline lineno="325"><highlight class="comment"><sp/><sp/><sp/>dydr<sp/>=<sp/>dyadic<sp/>reduction,<sp/>performs<sp/>transformation<sp/>of<sp/>sum<sp/>of</highlight></codeline> |
---|
471 | <codeline lineno="326"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>2<sp/>dyads<sp/>r*Dr*r'+<sp/>f*Df*f'<sp/>so<sp/>that<sp/>the<sp/>element<sp/>of<sp/>r<sp/>pointed</highlight></codeline> |
---|
472 | <codeline lineno="327"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>by<sp/>R<sp/>is<sp/>zeroed.<sp/>This<sp/>version<sp/>allows<sp/>Dr<sp/>to<sp/>be<sp/>NEGATIVE.<sp/>Hence<sp/>the<sp/>name<sp/>negdydr<sp/>or<sp/>dydr_withneg.</highlight></codeline> |
---|
473 | <codeline lineno="328"><highlight class="comment"></highlight></codeline> |
---|
474 | <codeline lineno="329"><highlight class="comment"><sp/><sp/><sp/>Parameters<sp/>:</highlight></codeline> |
---|
475 | <codeline lineno="330"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>r<sp/>...<sp/>pointer<sp/>to<sp/>reduced<sp/>dyad</highlight></codeline> |
---|
476 | <codeline lineno="331"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>f<sp/>...<sp/>pointer<sp/>to<sp/>reducing<sp/>dyad</highlight></codeline> |
---|
477 | <codeline lineno="332"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>Dr<sp/>..<sp/>pointer<sp/>to<sp/>the<sp/>weight<sp/>of<sp/>reduced<sp/>dyad</highlight></codeline> |
---|
478 | <codeline lineno="333"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>Df<sp/>..<sp/>pointer<sp/>to<sp/>the<sp/>weight<sp/>of<sp/>reducing<sp/>dyad</highlight></codeline> |
---|
479 | <codeline lineno="334"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>R<sp/>...<sp/>pointer<sp/>to<sp/>the<sp/>element<sp/>of<sp/>r,<sp/>which<sp/>is<sp/>to<sp/>be<sp/>reduced<sp/>to</highlight></codeline> |
---|
480 | <codeline lineno="335"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>zero;<sp/>the<sp/>corresponding<sp/>element<sp/>of<sp/>f<sp/>is<sp/>assumed<sp/>to<sp/>be<sp/>1.</highlight></codeline> |
---|
481 | <codeline lineno="336"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>jl<sp/>..<sp/>lower<sp/>index<sp/>of<sp/>the<sp/>range<sp/>within<sp/>which<sp/>the<sp/>dyads<sp/>are</highlight></codeline> |
---|
482 | <codeline lineno="337"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>modified</highlight></codeline> |
---|
483 | <codeline lineno="338"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>ju<sp/>..<sp/>upper<sp/>index<sp/>of<sp/>the<sp/>range<sp/>within<sp/>which<sp/>the<sp/>dyads<sp/>are</highlight></codeline> |
---|
484 | <codeline lineno="339"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>modified</highlight></codeline> |
---|
485 | <codeline lineno="340"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>kr<sp/>..<sp/>pointer<sp/>to<sp/>the<sp/>coefficient<sp/>used<sp/>in<sp/>the<sp/>transformation<sp/>of<sp/>r</highlight></codeline> |
---|
486 | <codeline lineno="341"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>rnew<sp/>=<sp/>r<sp/>+<sp/>kr*f</highlight></codeline> |
---|
487 | <codeline lineno="342"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>m<sp/><sp/>..<sp/>number<sp/>of<sp/>rows<sp/>of<sp/>modified<sp/>matrix<sp/>(part<sp/>of<sp/>which<sp/>is<sp/>r)</highlight></codeline> |
---|
488 | <codeline lineno="343"><highlight class="comment"><sp/><sp/>Remark<sp/>:<sp/>Constant<sp/>mzero<sp/>means<sp/>machine<sp/>zero<sp/>and<sp/>should<sp/>be<sp/>modified</highlight></codeline> |
---|
489 | <codeline lineno="344"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>according<sp/>to<sp/>the<sp/>precision<sp/>of<sp/>particular<sp/>machine</highlight></codeline> |
---|
490 | <codeline lineno="345"><highlight class="comment"></highlight></codeline> |
---|
491 | <codeline lineno="346"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>V.<sp/>Peterka<sp/>17-7-89</highlight></codeline> |
---|
492 | <codeline lineno="347"><highlight class="comment"></highlight></codeline> |
---|
493 | <codeline lineno="348"><highlight class="comment"><sp/><sp/>Added:</highlight></codeline> |
---|
494 | <codeline lineno="349"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>mx<sp/>..<sp/>number<sp/>of<sp/>rows<sp/>of<sp/>modified<sp/>matrix<sp/>(part<sp/>of<sp/>which<sp/>is<sp/>f)<sp/><sp/>-PN</highlight></codeline> |
---|
495 | <codeline lineno="350"><highlight class="comment"></highlight></codeline> |
---|
496 | <codeline lineno="351"><highlight class="comment">********************************************************************/</highlight><highlight class="normal"></highlight></codeline> |
---|
497 | <codeline lineno="352"><highlight class="normal">{</highlight></codeline> |
---|
498 | <codeline lineno="353"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>j,<sp/>jm;</highlight></codeline> |
---|
499 | <codeline lineno="354"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>kD,<sp/>r0;</highlight></codeline> |
---|
500 | <codeline lineno="355"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>mzero<sp/>=<sp/>2.2e-16;</highlight></codeline> |
---|
501 | <codeline lineno="356"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>threshold<sp/>=<sp/>1e-4;</highlight></codeline> |
---|
502 | <codeline lineno="357"><highlight class="normal"></highlight></codeline> |
---|
503 | <codeline lineno="358"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<sp/>fabs(<sp/>*Dr<sp/>)<sp/><<sp/>mzero<sp/>)<sp/>*Dr<sp/>=<sp/>0;</highlight></codeline> |
---|
504 | <codeline lineno="359"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>r0<sp/>=<sp/>*R;</highlight></codeline> |
---|
505 | <codeline lineno="360"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*R<sp/>=<sp/>0.0;</highlight></codeline> |
---|
506 | <codeline lineno="361"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>kD<sp/>=<sp/>*Df;</highlight></codeline> |
---|
507 | <codeline lineno="362"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*kr<sp/>=<sp/>r0<sp/>*<sp/>*Dr;</highlight></codeline> |
---|
508 | <codeline lineno="363"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*Df<sp/>=<sp/>kD<sp/>+<sp/>r0<sp/>*<sp/>(<sp/>*kr<sp/>);</highlight></codeline> |
---|
509 | <codeline lineno="364"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<sp/>*Df<sp/>><sp/>mzero<sp/>)<sp/>{</highlight></codeline> |
---|
510 | <codeline lineno="365"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>kD<sp/>/=<sp/>*Df;</highlight></codeline> |
---|
511 | <codeline lineno="366"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*kr<sp/>/=<sp/>*Df;</highlight></codeline> |
---|
512 | <codeline lineno="367"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline> |
---|
513 | <codeline lineno="368"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>kD<sp/>=<sp/>1.0;</highlight></codeline> |
---|
514 | <codeline lineno="369"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*kr<sp/>=<sp/>0.0;</highlight></codeline> |
---|
515 | <codeline lineno="370"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<sp/>*Df<sp/><<sp/>-threshold<sp/>)<sp/>{</highlight></codeline> |
---|
516 | <codeline lineno="371"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>it_warning(<sp/></highlight><highlight class="stringliteral">"Problem<sp/>in<sp/>dydr:<sp/>subraction<sp/>of<sp/>dyad<sp/>results<sp/>in<sp/>negative<sp/>definitness.<sp/>Likely<sp/>mistake<sp/>in<sp/>calling<sp/>function."</highlight><highlight class="normal"><sp/>);</highlight></codeline> |
---|
517 | <codeline lineno="372"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> |
---|
518 | <codeline lineno="373"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*Df<sp/>=<sp/>0.0;</highlight></codeline> |
---|
519 | <codeline lineno="374"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> |
---|
520 | <codeline lineno="375"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*Dr<sp/>*=<sp/>kD;</highlight></codeline> |
---|
521 | <codeline lineno="376"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>jm<sp/>=<sp/>mx<sp/>*<sp/>jl;</highlight></codeline> |
---|
522 | <codeline lineno="377"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(<sp/>j<sp/>=<sp/>m<sp/>*<sp/>jl;<sp/>j<sp/><<sp/>m*jh;<sp/>j<sp/>+=<sp/>m<sp/>)<sp/>{</highlight></codeline> |
---|
523 | <codeline lineno="378"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>r[j]<sp/>-=<sp/><sp/>r0<sp/>*<sp/>f[jm];</highlight></codeline> |
---|
524 | <codeline lineno="379"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>f[jm]<sp/>+=<sp/>*kr<sp/>*<sp/>r[j];</highlight></codeline> |
---|
525 | <codeline lineno="380"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>jm<sp/>+=<sp/>mx;</highlight></codeline> |
---|
526 | <codeline lineno="381"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> |
---|
527 | <codeline lineno="382"><highlight class="normal">}</highlight></codeline> |
---|
528 | </programlisting> |
---|
529 | <location file="/home/smidl/work/git/mixpp/bdm/math/libDC.cpp"/> |
---|
530 | </compounddef> |
---|
531 | </doxygen> |
---|