| 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="libKF_8h" kind="file"> |
|---|
| 4 | <compoundname>libKF.h</compoundname> |
|---|
| 5 | <includes local="no">itpp/itbase.h</includes> |
|---|
| 6 | <includes refid="libFN_8h" local="yes">../stat/libFN.h</includes> |
|---|
| 7 | <includes refid="libEF_8h" local="yes">../stat/libEF.h</includes> |
|---|
| 8 | <includes refid="chmat_8h" local="yes">../math/chmat.h</includes> |
|---|
| 9 | <includedby refid="ekf__templ_8h" local="yes">work/git/mixpp/bdm/estim/ekf_templ.h</includedby> |
|---|
| 10 | <includedby refid="libKF_8cpp" local="yes">work/git/mixpp/bdm/estim/libKF.cpp</includedby> |
|---|
| 11 | <includedby refid="pmsm__sim_8cpp" local="no">work/git/mixpp/pmsm/pmsm_sim.cpp</includedby> |
|---|
| 12 | <includedby refid="pmsm__sim2_8cpp" local="no">work/git/mixpp/pmsm/pmsm_sim2.cpp</includedby> |
|---|
| 13 | <includedby refid="pmsm__sim3_8cpp" local="no">work/git/mixpp/pmsm/pmsm_sim3.cpp</includedby> |
|---|
| 14 | <includedby refid="pmsm__unkQ_8cpp" local="no">work/git/mixpp/pmsm/pmsm_unkQ.cpp</includedby> |
|---|
| 15 | <includedby refid="pmsm__unkQpf_8cpp" local="no">work/git/mixpp/pmsm/pmsm_unkQpf.cpp</includedby> |
|---|
| 16 | <includedby refid="sim__var_8cpp" local="no">work/git/mixpp/pmsm/sim_var.cpp</includedby> |
|---|
| 17 | <includedby refid="ekf__obj_8cpp" local="no">work/git/mixpp/pmsm/simulator_zdenek/ekf_example/ekf_obj.cpp</includedby> |
|---|
| 18 | <includedby refid="ekf__obj_8h" local="no">work/git/mixpp/pmsm/simulator_zdenek/ekf_example/ekf_obj.h</includedby> |
|---|
| 19 | <includedby refid="testKF_8cpp" local="no">work/git/mixpp/tests/testKF.cpp</includedby> |
|---|
| 20 | <includedby refid="testKF__QR_8cpp" local="no">work/git/mixpp/tests/testKF_QR.cpp</includedby> |
|---|
| 21 | <includedby refid="testKF__QRexh_8cpp" local="no">work/git/mixpp/tests/testKF_QRexh.cpp</includedby> |
|---|
| 22 | <incdepgraph> |
|---|
| 23 | <node id="237"> |
|---|
| 24 | <label>libBM.h</label> |
|---|
| 25 | <link refid="libBM_8h"/> |
|---|
| 26 | <childnode refid="235" relation="include"> |
|---|
| 27 | </childnode> |
|---|
| 28 | </node> |
|---|
| 29 | <node id="240"> |
|---|
| 30 | <label>../itpp_ext.h</label> |
|---|
| 31 | <link refid="itpp__ext_8h-source"/> |
|---|
| 32 | <childnode refid="235" relation="include"> |
|---|
| 33 | </childnode> |
|---|
| 34 | </node> |
|---|
| 35 | <node id="238"> |
|---|
| 36 | <label>../stat/libEF.h</label> |
|---|
| 37 | <link refid="libEF_8h"/> |
|---|
| 38 | <childnode refid="235" relation="include"> |
|---|
| 39 | </childnode> |
|---|
| 40 | <childnode refid="239" relation="include"> |
|---|
| 41 | </childnode> |
|---|
| 42 | <childnode refid="237" relation="include"> |
|---|
| 43 | </childnode> |
|---|
| 44 | <childnode refid="240" relation="include"> |
|---|
| 45 | </childnode> |
|---|
| 46 | </node> |
|---|
| 47 | <node id="236"> |
|---|
| 48 | <label>../stat/libFN.h</label> |
|---|
| 49 | <link refid="libFN_8h-source"/> |
|---|
| 50 | <childnode refid="235" relation="include"> |
|---|
| 51 | </childnode> |
|---|
| 52 | <childnode refid="237" relation="include"> |
|---|
| 53 | </childnode> |
|---|
| 54 | </node> |
|---|
| 55 | <node id="235"> |
|---|
| 56 | <label>itpp/itbase.h</label> |
|---|
| 57 | </node> |
|---|
| 58 | <node id="241"> |
|---|
| 59 | <label>../math/chmat.h</label> |
|---|
| 60 | <link refid="chmat_8h"/> |
|---|
| 61 | <childnode refid="235" relation="include"> |
|---|
| 62 | </childnode> |
|---|
| 63 | <childnode refid="239" relation="include"> |
|---|
| 64 | </childnode> |
|---|
| 65 | <childnode refid="240" relation="include"> |
|---|
| 66 | </childnode> |
|---|
| 67 | </node> |
|---|
| 68 | <node id="234"> |
|---|
| 69 | <label>work/git/mixpp/bdm/estim/libKF.h</label> |
|---|
| 70 | <link refid="libKF.h"/> |
|---|
| 71 | <childnode refid="235" relation="include"> |
|---|
| 72 | </childnode> |
|---|
| 73 | <childnode refid="236" relation="include"> |
|---|
| 74 | </childnode> |
|---|
| 75 | <childnode refid="238" relation="include"> |
|---|
| 76 | </childnode> |
|---|
| 77 | <childnode refid="241" relation="include"> |
|---|
| 78 | </childnode> |
|---|
| 79 | </node> |
|---|
| 80 | <node id="239"> |
|---|
| 81 | <label>../math/libDC.h</label> |
|---|
| 82 | <link refid="libDC_8h"/> |
|---|
| 83 | <childnode refid="235" relation="include"> |
|---|
| 84 | </childnode> |
|---|
| 85 | </node> |
|---|
| 86 | </incdepgraph> |
|---|
| 87 | <invincdepgraph> |
|---|
| 88 | <node id="243"> |
|---|
| 89 | <label>work/git/mixpp/bdm/estim/ekf_templ.h</label> |
|---|
| 90 | <link refid="ekf__templ_8h"/> |
|---|
| 91 | <childnode refid="244" relation="include"> |
|---|
| 92 | </childnode> |
|---|
| 93 | </node> |
|---|
| 94 | <node id="245"> |
|---|
| 95 | <label>work/git/mixpp/pmsm/sim_var.cpp</label> |
|---|
| 96 | <link refid="sim__var_8cpp"/> |
|---|
| 97 | </node> |
|---|
| 98 | <node id="242"> |
|---|
| 99 | <label>work/git/mixpp/bdm/estim/libKF.h</label> |
|---|
| 100 | <link refid="libKF.h"/> |
|---|
| 101 | <childnode refid="243" relation="include"> |
|---|
| 102 | </childnode> |
|---|
| 103 | <childnode refid="245" relation="include"> |
|---|
| 104 | </childnode> |
|---|
| 105 | <childnode refid="246" relation="include"> |
|---|
| 106 | </childnode> |
|---|
| 107 | </node> |
|---|
| 108 | <node id="246"> |
|---|
| 109 | <label>work/git/mixpp/pmsm/simulator_zdenek/ekf_example/ekf_obj.h</label> |
|---|
| 110 | <link refid="ekf__obj_8h"/> |
|---|
| 111 | </node> |
|---|
| 112 | <node id="244"> |
|---|
| 113 | <label>work/git/mixpp/pmsm/pmsm_mix.cpp</label> |
|---|
| 114 | <link refid="pmsm__mix_8cpp"/> |
|---|
| 115 | </node> |
|---|
| 116 | </invincdepgraph> |
|---|
| 117 | <innerclass refid="classKalmanFull" prot="public">KalmanFull</innerclass> |
|---|
| 118 | <innerclass refid="classKalman" prot="public">Kalman</innerclass> |
|---|
| 119 | <innerclass refid="classKalmanCh" prot="public">KalmanCh</innerclass> |
|---|
| 120 | <innerclass refid="classEKFfull" prot="public">EKFfull</innerclass> |
|---|
| 121 | <innerclass refid="classEKF" prot="public">EKF</innerclass> |
|---|
| 122 | <innerclass refid="classEKFCh" prot="public">EKFCh</innerclass> |
|---|
| 123 | <innerclass refid="classKFcondQR" prot="public">KFcondQR</innerclass> |
|---|
| 124 | <innerclass refid="classKFcondR" prot="public">KFcondR</innerclass> |
|---|
| 125 | <briefdescription> |
|---|
| 126 | <para>Bayesian Filtering for linear Gaussian models (<ref refid="classKalman" kindref="compound">Kalman</ref> Filter) and extensions. </para> </briefdescription> |
|---|
| 127 | <detaileddescription> |
|---|
| 128 | <para><simplesect kind="author"><para>Vaclav Smidl.</para></simplesect> |
|---|
| 129 | ----------------------------------- BDM++ - C++ library for Bayesian Decision Making under Uncertainty</para><para>Using IT++ for numerical operations ----------------------------------- </para> </detaileddescription> |
|---|
| 130 | <programlisting> |
|---|
| 131 | <codeline lineno="1"></codeline> |
|---|
| 132 | <codeline lineno="13"><highlight class="preprocessor">#ifndef<sp/>KF_H</highlight></codeline> |
|---|
| 133 | <codeline lineno="14"><highlight class="preprocessor"></highlight><highlight class="preprocessor">#define<sp/>KF_H</highlight></codeline> |
|---|
| 134 | <codeline lineno="15"><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline> |
|---|
| 135 | <codeline lineno="16"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/><itpp/itbase.h></highlight><highlight class="normal"></highlight></codeline> |
|---|
| 136 | <codeline lineno="17"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>"../stat/libFN.h"</highlight><highlight class="normal"></highlight></codeline> |
|---|
| 137 | <codeline lineno="18"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>"../stat/libEF.h"</highlight><highlight class="normal"></highlight></codeline> |
|---|
| 138 | <codeline lineno="19"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>"../math/chmat.h"</highlight><highlight class="normal"></highlight></codeline> |
|---|
| 139 | <codeline lineno="20"><highlight class="normal"></highlight></codeline> |
|---|
| 140 | <codeline lineno="21"><highlight class="normal"></highlight><highlight class="keyword">using<sp/>namespace<sp/></highlight><highlight class="normal">itpp;</highlight></codeline> |
|---|
| 141 | <codeline lineno="22"><highlight class="normal"></highlight></codeline> |
|---|
| 142 | <codeline lineno="27" refid="classKalmanFull" refkind="compound"><highlight class="keyword">class<sp/></highlight><highlight class="normal"><ref refid="classKalmanFull" kindref="compound" tooltip="Basic Kalman filter with full matrices (education purpose only)! Will be deleted...">KalmanFull</ref><sp/>{</highlight></codeline> |
|---|
| 143 | <codeline lineno="28"><highlight class="normal"></highlight><highlight class="keyword">protected</highlight><highlight class="normal">:</highlight></codeline> |
|---|
| 144 | <codeline lineno="29"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>dimx,<sp/>dimy,<sp/>dimu;</highlight></codeline> |
|---|
| 145 | <codeline lineno="30"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mat<sp/>A,<sp/>B,<sp/>C,<sp/>D,<sp/>R,<sp/>Q;</highlight></codeline> |
|---|
| 146 | <codeline lineno="31"><highlight class="normal"></highlight></codeline> |
|---|
| 147 | <codeline lineno="32"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//cache</highlight><highlight class="normal"></highlight></codeline> |
|---|
| 148 | <codeline lineno="33"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mat<sp/>_Pp,<sp/>_Ry,<sp/>_iRy,<sp/>_K;</highlight></codeline> |
|---|
| 149 | <codeline lineno="34"><highlight class="normal"></highlight><highlight class="keyword">public</highlight><highlight class="normal">:</highlight></codeline> |
|---|
| 150 | <codeline lineno="35"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//posterior</highlight></codeline> |
|---|
| 151 | <codeline lineno="37" refid="classKalmanFull_1fb5aec635e2720cc5ac31bc01c18a68a" refkind="member"><highlight class="comment"></highlight><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/><ref refid="classKalmanFull_1fb5aec635e2720cc5ac31bc01c18a68a" kindref="member" tooltip="Mean value of the posterior density.">mu</ref>;</highlight></codeline> |
|---|
| 152 | <codeline lineno="39" refid="classKalmanFull_1b75dc059e84fa8ffc076203b30f926cc" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mat<sp/><ref refid="classKalmanFull_1b75dc059e84fa8ffc076203b30f926cc" kindref="member" tooltip="Variance of the posterior density.">P</ref>;</highlight></codeline> |
|---|
| 153 | <codeline lineno="40"><highlight class="normal"></highlight></codeline> |
|---|
| 154 | <codeline lineno="41"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">bool</highlight><highlight class="normal"><sp/>evalll;</highlight></codeline> |
|---|
| 155 | <codeline lineno="42"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>ll;</highlight></codeline> |
|---|
| 156 | <codeline lineno="43"><highlight class="normal"></highlight><highlight class="keyword">public</highlight><highlight class="normal">:</highlight></codeline> |
|---|
| 157 | <codeline lineno="45"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classKalmanFull_19d7cc2235b643d9662cd9c8b8469747d" kindref="member" tooltip="For EKFfull;.">KalmanFull</ref><sp/>(<sp/>mat<sp/>A,<sp/>mat<sp/>B,<sp/>mat<sp/>C,<sp/>mat<sp/>D,<sp/>mat<sp/>R,<sp/>mat<sp/>Q,<sp/>mat<sp/>P0,<sp/>vec<sp/>mu0<sp/>);</highlight></codeline> |
|---|
| 158 | <codeline lineno="47"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classKalmanFull_113a041cd98ff157703766be275a657bb" kindref="member" tooltip="Here dt = [yt;ut] of appropriate dimensions.">bayes</ref><sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>vec<sp/>&dt<sp/>);</highlight></codeline> |
|---|
| 159 | <codeline lineno="49"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">friend</highlight><highlight class="normal"><sp/>std::ostream<sp/>&<ref refid="classKalmanFull_186ba216243ed95bb46d80d88775d16af" kindref="member" tooltip="print elements of KF">operator<< </ref>(<sp/>std::ostream<sp/>&os,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="classKalmanFull" kindref="compound" tooltip="Basic Kalman filter with full matrices (education purpose only)! Will be deleted...">KalmanFull</ref><sp/>&kf<sp/>);</highlight></codeline> |
|---|
| 160 | <codeline lineno="51" refid="classKalmanFull_19d7cc2235b643d9662cd9c8b8469747d" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classKalmanFull_19d7cc2235b643d9662cd9c8b8469747d" kindref="member" tooltip="For EKFfull;.">KalmanFull</ref>(){};</highlight></codeline> |
|---|
| 161 | <codeline lineno="52"><highlight class="normal">};</highlight></codeline> |
|---|
| 162 | <codeline lineno="53"><highlight class="normal"></highlight></codeline> |
|---|
| 163 | <codeline lineno="54"><highlight class="normal"></highlight></codeline> |
|---|
| 164 | <codeline lineno="62"><highlight class="keyword">template</highlight><highlight class="normal"><</highlight><highlight class="keyword">class</highlight><highlight class="normal"><sp/>sq_T></highlight></codeline> |
|---|
| 165 | <codeline lineno="63"><highlight class="normal"></highlight></codeline> |
|---|
| 166 | <codeline lineno="64" refid="classKalman" refkind="compound"><highlight class="normal"></highlight><highlight class="keyword">class<sp/></highlight><highlight class="normal"><ref refid="classKalman" kindref="compound" tooltip="Kalman filter with covariance matrices in square root form.">Kalman</ref><sp/>:<sp/></highlight><highlight class="keyword">public</highlight><highlight class="normal"><sp/><ref refid="classBM" kindref="compound" tooltip="Bayesian Model of the world, i.e. all uncertainty is modeled by probabilities.">BM</ref><sp/>{</highlight></codeline> |
|---|
| 167 | <codeline lineno="65"><highlight class="normal"></highlight><highlight class="keyword">protected</highlight><highlight class="normal">:</highlight></codeline> |
|---|
| 168 | <codeline lineno="67" refid="classKalman_17501230c2fafa3655887d2da23b3184c" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/><ref refid="classKalman_17501230c2fafa3655887d2da23b3184c" kindref="member" tooltip="Indetifier of output rv.">rvy</ref>;</highlight></codeline> |
|---|
| 169 | <codeline lineno="69" refid="classKalman_144a16ffd5ac1e6e39bae34fea9e1e498" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/><ref refid="classKalman_144a16ffd5ac1e6e39bae34fea9e1e498" kindref="member" tooltip="Indetifier of exogeneous rv.">rvu</ref>;</highlight></codeline> |
|---|
| 170 | <codeline lineno="71" refid="classKalman_139c8c403b46fa3b8c7da77cb2e3729eb" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="classKalman_139c8c403b46fa3b8c7da77cb2e3729eb" kindref="member" tooltip="cache of rv.count()">dimx</ref>;</highlight></codeline> |
|---|
| 171 | <codeline lineno="73" refid="classKalman_1ba17b956df1e38b31fbbc299c8213b6a" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="classKalman_1ba17b956df1e38b31fbbc299c8213b6a" kindref="member" tooltip="cache of rvy.count()">dimy</ref>;</highlight></codeline> |
|---|
| 172 | <codeline lineno="75" refid="classKalman_1b0153795a1444b6968a86409c778d9ce" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/><ref refid="classKalman_1b0153795a1444b6968a86409c778d9ce" kindref="member" tooltip="cache of rvu.count()">dimu</ref>;</highlight></codeline> |
|---|
| 173 | <codeline lineno="77" refid="classKalman_15e02efe86ee91e9c74b93b425fe060b9" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mat<sp/><ref refid="classKalman_15e02efe86ee91e9c74b93b425fe060b9" kindref="member" tooltip="Matrix A.">A</ref>;</highlight></codeline> |
|---|
| 174 | <codeline lineno="79" refid="classKalman_1dc87704284a6c0bca13bf51f4345a50a" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mat<sp/><ref refid="classKalman_1dc87704284a6c0bca13bf51f4345a50a" kindref="member" tooltip="Matrix B.">B</ref>;<sp/></highlight></codeline> |
|---|
| 175 | <codeline lineno="81" refid="classKalman_186a805cd6515872d1132ad0d6eb5dc13" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mat<sp/><ref refid="classKalman_186a805cd6515872d1132ad0d6eb5dc13" kindref="member" tooltip="Matrix C.">C</ref>;</highlight></codeline> |
|---|
| 176 | <codeline lineno="83" refid="classKalman_1d69f774ba3335c970c1c5b1d182f4dd1" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mat<sp/><ref refid="classKalman_1d69f774ba3335c970c1c5b1d182f4dd1" kindref="member" tooltip="Matrix D.">D</ref>;</highlight></codeline> |
|---|
| 177 | <codeline lineno="85" refid="classKalman_19b69015c800eb93f3ee49da23a6f55d9" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>sq_T<sp/><ref refid="classKalman_19b69015c800eb93f3ee49da23a6f55d9" kindref="member" tooltip="Matrix Q in square-root form.">Q</ref>;</highlight></codeline> |
|---|
| 178 | <codeline lineno="87" refid="classKalman_111d171dc0e0ab111c56a70f98b97b3ec" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>sq_T<sp/><ref refid="classKalman_111d171dc0e0ab111c56a70f98b97b3ec" kindref="member" tooltip="Matrix R in square-root form.">R</ref>;</highlight></codeline> |
|---|
| 179 | <codeline lineno="88"><highlight class="normal"></highlight></codeline> |
|---|
| 180 | <codeline lineno="90" refid="classKalman_15568c74bac67ae6d3b1061dba60c9424" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classenorm" kindref="compound" tooltip="Gaussian density with positive definite (decomposed) covariance matrix.">enorm<sq_T></ref><sp/><ref refid="classKalman_15568c74bac67ae6d3b1061dba60c9424" kindref="member" tooltip="posterior density on $x_t$">est</ref>;</highlight></codeline> |
|---|
| 181 | <codeline lineno="92" refid="classKalman_1e580ab06483952bd03f2e651763e184f" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classenorm" kindref="compound" tooltip="Gaussian density with positive definite (decomposed) covariance matrix.">enorm<sq_T></ref><sp/><ref refid="classKalman_1e580ab06483952bd03f2e651763e184f" kindref="member" tooltip="preditive density on $y_t$">fy</ref>;</highlight></codeline> |
|---|
| 182 | <codeline lineno="93"><highlight class="normal"></highlight></codeline> |
|---|
| 183 | <codeline lineno="95" refid="classKalman_1d422f51467c7a06174af2476d2826132" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mat<sp/><ref refid="classKalman_1d422f51467c7a06174af2476d2826132" kindref="member" tooltip="placeholder for Kalman gain">_K</ref>;</highlight></codeline> |
|---|
| 184 | <codeline lineno="97" refid="classKalman_1764bbc95238eda11fc81c5ebd0b1dcfd" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec&<sp/><ref refid="classKalman_1764bbc95238eda11fc81c5ebd0b1dcfd" kindref="member" tooltip="cache of fy.mu">_yp</ref>;</highlight></codeline> |
|---|
| 185 | <codeline lineno="99" refid="classKalman_145c9f928d2d62e0c884900fb3380f904" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>sq_T&<sp/><ref refid="classKalman_145c9f928d2d62e0c884900fb3380f904" kindref="member" tooltip="cache of fy.R">_Ry</ref>;</highlight></codeline> |
|---|
| 186 | <codeline lineno="101" refid="classKalman_1fe803a81d2d847b0b1db3c6b29c18061" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec&<sp/><ref refid="classKalman_1fe803a81d2d847b0b1db3c6b29c18061" kindref="member" tooltip="cache of est.mu">_mu</ref>;</highlight></codeline> |
|---|
| 187 | <codeline lineno="103" refid="classKalman_19fb808cc94a4c2652e1fb93be9bb7dcf" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>sq_T&<sp/><ref refid="classKalman_19fb808cc94a4c2652e1fb93be9bb7dcf" kindref="member" tooltip="cache of est.R">_P</ref>;</highlight></codeline> |
|---|
| 188 | <codeline lineno="104"><highlight class="normal"></highlight></codeline> |
|---|
| 189 | <codeline lineno="105"><highlight class="normal"></highlight><highlight class="keyword">public</highlight><highlight class="normal">:</highlight></codeline> |
|---|
| 190 | <codeline lineno="107"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classKalman_13d56b0a97b8c1e25fdd3b10eef3c2ad3" kindref="member" tooltip="Default constructor.">Kalman</ref><sp/>(<sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/>rvx0,<sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/>rvy0,<sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/>rvu0<sp/>);</highlight></codeline> |
|---|
| 191 | <codeline lineno="109"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classKalman_13d56b0a97b8c1e25fdd3b10eef3c2ad3" kindref="member" tooltip="Default constructor.">Kalman</ref><sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="classKalman" kindref="compound" tooltip="Kalman filter with covariance matrices in square root form.">Kalman<sq_T></ref><sp/>&K0<sp/>);</highlight></codeline> |
|---|
| 192 | <codeline lineno="111"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classKalman_1239b28a0380946f5749b2f8d2807f93a" kindref="member" tooltip="Set parameters with check of relevance.">set_parameters</ref><sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>mat<sp/>&A0,</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>mat<sp/>&B0,</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>mat<sp/>&C0,</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>mat<sp/>&D0,</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>sq_T<sp/>&R0,</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>sq_T<sp/>&Q0<sp/>);</highlight></codeline> |
|---|
| 193 | <codeline lineno="113" refid="classKalman_180bcf29466d9a9dd2b8f74699807d0c0" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classKalman_180bcf29466d9a9dd2b8f74699807d0c0" kindref="member" tooltip="Set estimate values, used e.g. in initialization.">set_est</ref><sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>vec<sp/>&mu0,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>sq_T<sp/>&P0<sp/>)<sp/>{</highlight></codeline> |
|---|
| 194 | <codeline lineno="114"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>sq_T<sp/>pom(<ref refid="classKalman_1ba17b956df1e38b31fbbc299c8213b6a" kindref="member" tooltip="cache of rvy.count()">dimy</ref>);</highlight></codeline> |
|---|
| 195 | <codeline lineno="115"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classKalman_15568c74bac67ae6d3b1061dba60c9424" kindref="member" tooltip="posterior density on $x_t$">est</ref>.set_parameters<sp/>(<sp/>mu0,P0<sp/>);</highlight></codeline> |
|---|
| 196 | <codeline lineno="116"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>P0.mult_sym(<ref refid="classKalman_186a805cd6515872d1132ad0d6eb5dc13" kindref="member" tooltip="Matrix C.">C</ref>,pom);</highlight></codeline> |
|---|
| 197 | <codeline lineno="117"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classKalman_1e580ab06483952bd03f2e651763e184f" kindref="member" tooltip="preditive density on $y_t$">fy</ref>.set_parameters<sp/>(<sp/><ref refid="classKalman_186a805cd6515872d1132ad0d6eb5dc13" kindref="member" tooltip="Matrix C.">C</ref>*mu0,<sp/>pom<sp/>);</highlight></codeline> |
|---|
| 198 | <codeline lineno="118"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>};</highlight></codeline> |
|---|
| 199 | <codeline lineno="119"><highlight class="normal"></highlight></codeline> |
|---|
| 200 | <codeline lineno="121"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classKalman_17750ffd73f261828a32c18aaeb65c75c" kindref="member" tooltip="Here dt = [yt;ut] of appropriate dimensions.">bayes</ref><sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>vec<sp/>&dt<sp/>);</highlight></codeline> |
|---|
| 201 | <codeline lineno="123" refid="classKalman_1a213c57aef55b2645e550bed81cfc0d4" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classepdf" kindref="compound" tooltip="Probability density function with numerical statistics, e.g. posterior density.">epdf</ref>&<sp/><ref refid="classKalman_1a213c57aef55b2645e550bed81cfc0d4" kindref="member" tooltip="access function">_epdf</ref>()<sp/>{</highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="classKalman_15568c74bac67ae6d3b1061dba60c9424" kindref="member" tooltip="posterior density on $x_t$">est</ref>;}</highlight></codeline> |
|---|
| 202 | <codeline lineno="125" refid="classKalman_1980fcd41c6c548c5da7b8b67c8e6da79" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mat&<sp/><ref refid="classKalman_1980fcd41c6c548c5da7b8b67c8e6da79" kindref="member" tooltip="access function">__K</ref>()<sp/>{</highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="classKalman_1d422f51467c7a06174af2476d2826132" kindref="member" tooltip="placeholder for Kalman gain">_K</ref>;}</highlight></codeline> |
|---|
| 203 | <codeline lineno="127" refid="classKalman_1ac9540f3850b74d89a5fe4db6fc358ce" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/><ref refid="classKalman_1ac9540f3850b74d89a5fe4db6fc358ce" kindref="member" tooltip="access function">_dP</ref>()<sp/>{</highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="classKalman_19fb808cc94a4c2652e1fb93be9bb7dcf" kindref="member" tooltip="cache of est.R">_P</ref>->getD();}</highlight></codeline> |
|---|
| 204 | <codeline lineno="128"><highlight class="normal">};</highlight></codeline> |
|---|
| 205 | <codeline lineno="129"><highlight class="normal"></highlight></codeline> |
|---|
| 206 | <codeline lineno="132" refid="classKalmanCh" refkind="compound"><highlight class="keyword">class<sp/></highlight><highlight class="normal"><ref refid="classKalmanCh" kindref="compound" tooltip="Kalman filter in square root form.">KalmanCh</ref><sp/>:<sp/></highlight><highlight class="keyword">public</highlight><highlight class="normal"><sp/><ref refid="classKalman" kindref="compound" tooltip="Kalman filter with covariance matrices in square root form.">Kalman</ref><chmat>{</highlight></codeline> |
|---|
| 207 | <codeline lineno="133"><highlight class="normal"></highlight><highlight class="keyword">protected</highlight><highlight class="normal">:</highlight></codeline> |
|---|
| 208 | <codeline lineno="135" refid="classKalmanCh_194ee9da75b0e0f632e4a354988ca3798" refkind="member"><highlight class="normal">mat<sp/><ref refid="classKalmanCh_194ee9da75b0e0f632e4a354988ca3798" kindref="member" tooltip="pre array (triangular matrix)">preA</ref>;</highlight></codeline> |
|---|
| 209 | <codeline lineno="137" refid="classKalmanCh_10d31a26dc72b5846cfe5af3ccb63ac87" refkind="member"><highlight class="normal">mat<sp/><ref refid="classKalmanCh_10d31a26dc72b5846cfe5af3ccb63ac87" kindref="member" tooltip="post array (triangular matrix)">postA</ref>;</highlight></codeline> |
|---|
| 210 | <codeline lineno="138"><highlight class="normal"></highlight></codeline> |
|---|
| 211 | <codeline lineno="139"><highlight class="normal"></highlight><highlight class="keyword">public</highlight><highlight class="normal">:</highlight></codeline> |
|---|
| 212 | <codeline lineno="141" refid="classKalmanCh_1d11f110cccaa66177514632d37b086bb" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classKalmanCh_1d11f110cccaa66177514632d37b086bb" kindref="member" tooltip="Default constructor.">KalmanCh</ref><sp/>(<sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/>rvx0,<sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/>rvy0,<sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/>rvu0<sp/>):<ref refid="classKalman" kindref="compound" tooltip="Kalman filter with covariance matrices in square root form.">Kalman</ref><<ref refid="classchmat" kindref="compound" tooltip="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</ref>>(rvx0,rvy0,rvu0),<ref refid="classKalmanCh_194ee9da75b0e0f632e4a354988ca3798" kindref="member" tooltip="pre array (triangular matrix)">preA</ref>(<ref refid="classKalman_1ba17b956df1e38b31fbbc299c8213b6a" kindref="member" tooltip="cache of rvy.count()">dimy</ref>+<ref refid="classKalman_139c8c403b46fa3b8c7da77cb2e3729eb" kindref="member" tooltip="cache of rv.count()">dimx</ref>+<ref refid="classKalman_139c8c403b46fa3b8c7da77cb2e3729eb" kindref="member" tooltip="cache of rv.count()">dimx</ref>,<ref refid="classKalman_1ba17b956df1e38b31fbbc299c8213b6a" kindref="member" tooltip="cache of rvy.count()">dimy</ref>+<ref refid="classKalman_139c8c403b46fa3b8c7da77cb2e3729eb" kindref="member" tooltip="cache of rv.count()">dimx</ref>),<ref refid="classKalmanCh_10d31a26dc72b5846cfe5af3ccb63ac87" kindref="member" tooltip="post array (triangular matrix)">postA</ref>(<ref refid="classKalman_1ba17b956df1e38b31fbbc299c8213b6a" kindref="member" tooltip="cache of rvy.count()">dimy</ref>+<ref refid="classKalman_139c8c403b46fa3b8c7da77cb2e3729eb" kindref="member" tooltip="cache of rv.count()">dimx</ref>,<ref refid="classKalman_1ba17b956df1e38b31fbbc299c8213b6a" kindref="member" tooltip="cache of rvy.count()">dimy</ref>+<ref refid="classKalman_139c8c403b46fa3b8c7da77cb2e3729eb" kindref="member" tooltip="cache of rv.count()">dimx</ref>){};</highlight></codeline> |
|---|
| 213 | <codeline lineno="143"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classKalmanCh_192fb227287af05c9f0078d523c7c9793" kindref="member" tooltip="Set parameters with check of relevance.">set_parameters</ref><sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>mat<sp/>&A0,</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>mat<sp/>&B0,</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>mat<sp/>&C0,</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>mat<sp/>&D0,</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="classchmat" kindref="compound" tooltip="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</ref><sp/>&R0,</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="classchmat" kindref="compound" tooltip="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</ref><sp/>&Q0<sp/>);</highlight></codeline> |
|---|
| 214 | <codeline lineno="144" refid="classKalmanCh_1b261b20f6210d4c85131d33302df0adc" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classKalmanCh_1b261b20f6210d4c85131d33302df0adc" kindref="member" tooltip="Set estimate values, used e.g. in initialization.">set_est</ref><sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>vec<sp/>&mu0,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="classchmat" kindref="compound" tooltip="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</ref><sp/>&P0<sp/>)<sp/>{</highlight></codeline> |
|---|
| 215 | <codeline lineno="145"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classKalman_15568c74bac67ae6d3b1061dba60c9424" kindref="member" tooltip="posterior density on $x_t$">est</ref>.<ref refid="classenorm_11394a65caa6e00d42e00cc99b12227af" kindref="member" tooltip="Set mean value mu and covariance R.">set_parameters</ref><sp/>(<sp/>mu0,P0<sp/>);</highlight></codeline> |
|---|
| 216 | <codeline lineno="146"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>};</highlight></codeline> |
|---|
| 217 | <codeline lineno="147"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> |
|---|
| 218 | <codeline lineno="148"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> |
|---|
| 219 | <codeline lineno="162"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classKalmanCh_1cca758192846940409822b9bd778d4e1" kindref="member" tooltip="Here dt = [yt;ut] of appropriate dimensions.">bayes</ref><sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>vec<sp/>&dt<sp/>);</highlight></codeline> |
|---|
| 220 | <codeline lineno="163"><highlight class="normal">};</highlight></codeline> |
|---|
| 221 | <codeline lineno="164"><highlight class="normal"></highlight></codeline> |
|---|
| 222 | <codeline lineno="170" refid="classEKFfull" refkind="compound"><highlight class="keyword">class<sp/></highlight><highlight class="normal"><ref refid="classEKFfull" kindref="compound" tooltip="Extended Kalman Filter in full matrices.">EKFfull</ref><sp/>:<sp/></highlight><highlight class="keyword">public</highlight><highlight class="normal"><sp/><ref refid="classKalmanFull" kindref="compound" tooltip="Basic Kalman filter with full matrices (education purpose only)! Will be deleted...">KalmanFull</ref>,<sp/></highlight><highlight class="keyword">public</highlight><highlight class="normal"><sp/><ref refid="classBM" kindref="compound" tooltip="Bayesian Model of the world, i.e. all uncertainty is modeled by probabilities.">BM</ref><sp/>{</highlight></codeline> |
|---|
| 223 | <codeline lineno="171"><highlight class="normal"></highlight></codeline> |
|---|
| 224 | <codeline lineno="173"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classdiffbifn" kindref="compound" tooltip="Class representing a differentiable function of two variables .">diffbifn</ref>*<sp/>pfxu;</highlight></codeline> |
|---|
| 225 | <codeline lineno="175"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classdiffbifn" kindref="compound" tooltip="Class representing a differentiable function of two variables .">diffbifn</ref>*<sp/>phxu;</highlight></codeline> |
|---|
| 226 | <codeline lineno="176"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> |
|---|
| 227 | <codeline lineno="177"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classenorm" kindref="compound" tooltip="Gaussian density with positive definite (decomposed) covariance matrix.">enorm<fsqmat></ref><sp/>E;<sp/></highlight></codeline> |
|---|
| 228 | <codeline lineno="178"><highlight class="normal"></highlight><highlight class="keyword">public</highlight><highlight class="normal">:</highlight></codeline> |
|---|
| 229 | <codeline lineno="180"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classEKFfull_167ac4de96fd025197da767fe0472c7f7" kindref="member" tooltip="Default constructor.">EKFfull</ref><sp/>(<sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/>rvx,<sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/>rvy,<sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/>rvu<sp/>);</highlight></codeline> |
|---|
| 230 | <codeline lineno="182"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classEKFfull_1fc753106e0d4cf68e4f2160fd54458c0" kindref="member" tooltip="Set nonlinear functions for mean values and covariance matrices.">set_parameters</ref><sp/>(<sp/><ref refid="classdiffbifn" kindref="compound" tooltip="Class representing a differentiable function of two variables .">diffbifn</ref>*<sp/>pfxu,<sp/><ref refid="classdiffbifn" kindref="compound" tooltip="Class representing a differentiable function of two variables .">diffbifn</ref>*<sp/>phxu,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>mat<sp/>Q0,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>mat<sp/>R0<sp/>);</highlight></codeline> |
|---|
| 231 | <codeline lineno="184"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classEKFfull_18ca46f177e395fa714bbd8bd29ea43e0" kindref="member" tooltip="Here dt = [yt;ut] of appropriate dimensions.">bayes</ref><sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>vec<sp/>&dt<sp/>);</highlight></codeline> |
|---|
| 232 | <codeline lineno="186" refid="classEKFfull_17bb76ea74c144ea0b36db99f94750b7b" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classEKFfull_17bb76ea74c144ea0b36db99f94750b7b" kindref="member" tooltip="set estimates">set_est</ref><sp/>(vec<sp/>mu0,<sp/>mat<sp/>P0){<ref refid="classKalmanFull_1fb5aec635e2720cc5ac31bc01c18a68a" kindref="member" tooltip="Mean value of the posterior density.">mu</ref>=mu0;<ref refid="classKalmanFull_1b75dc059e84fa8ffc076203b30f926cc" kindref="member" tooltip="Variance of the posterior density.">P</ref>=P0;};</highlight></codeline> |
|---|
| 233 | <codeline lineno="188" refid="classEKFfull_14080d68f79dade36ccf547d57e64bdc2" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classepdf" kindref="compound" tooltip="Probability density function with numerical statistics, e.g. posterior density.">epdf</ref>&<sp/><ref refid="classEKFfull_14080d68f79dade36ccf547d57e64bdc2" kindref="member" tooltip="dummy!">_epdf</ref>(){</highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>E;};</highlight></codeline> |
|---|
| 234 | <codeline lineno="189"><highlight class="normal">};</highlight></codeline> |
|---|
| 235 | <codeline lineno="190"><highlight class="normal"></highlight></codeline> |
|---|
| 236 | <codeline lineno="196"><highlight class="keyword">template</highlight><highlight class="normal"><</highlight><highlight class="keyword">class</highlight><highlight class="normal"><sp/>sq_T></highlight></codeline> |
|---|
| 237 | <codeline lineno="197" refid="classEKF" refkind="compound"><highlight class="normal"></highlight><highlight class="keyword">class<sp/></highlight><highlight class="normal"><ref refid="classEKF" kindref="compound" tooltip="Extended Kalman Filter.">EKF</ref><sp/>:<sp/></highlight><highlight class="keyword">public</highlight><highlight class="normal"><sp/><ref refid="classKalman" kindref="compound" tooltip="Kalman filter with covariance matrices in square root form.">Kalman</ref><fsqmat><sp/>{</highlight></codeline> |
|---|
| 238 | <codeline lineno="199"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classdiffbifn" kindref="compound" tooltip="Class representing a differentiable function of two variables .">diffbifn</ref>*<sp/>pfxu;</highlight></codeline> |
|---|
| 239 | <codeline lineno="201"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classdiffbifn" kindref="compound" tooltip="Class representing a differentiable function of two variables .">diffbifn</ref>*<sp/>phxu;</highlight></codeline> |
|---|
| 240 | <codeline lineno="202"><highlight class="normal"></highlight><highlight class="keyword">public</highlight><highlight class="normal">:</highlight></codeline> |
|---|
| 241 | <codeline lineno="204"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classEKF_1ea4f3254cacf0a92d2a820b1201d049e" kindref="member" tooltip="Default constructor.">EKF</ref><sp/>(<sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/>rvx,<sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/><ref refid="classKalman_17501230c2fafa3655887d2da23b3184c" kindref="member" tooltip="Indetifier of output rv.">rvy</ref>,<sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/><ref refid="classKalman_144a16ffd5ac1e6e39bae34fea9e1e498" kindref="member" tooltip="Indetifier of exogeneous rv.">rvu</ref><sp/>);</highlight></codeline> |
|---|
| 242 | <codeline lineno="206"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classEKF_128d058ae4d24d992d2f055419a06ee66" kindref="member" tooltip="Set nonlinear functions for mean values and covariance matrices.">set_parameters</ref><sp/>(<sp/><ref refid="classdiffbifn" kindref="compound" tooltip="Class representing a differentiable function of two variables .">diffbifn</ref>*<sp/>pfxu,<sp/><ref refid="classdiffbifn" kindref="compound" tooltip="Class representing a differentiable function of two variables .">diffbifn</ref>*<sp/>phxu,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>sq_T<sp/>Q0,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>sq_T<sp/>R0<sp/>);</highlight></codeline> |
|---|
| 243 | <codeline lineno="208"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classEKF_1c79c62c9b3e0b56b3aaa1b6f1d9a7af7" kindref="member" tooltip="Here dt = [yt;ut] of appropriate dimensions.">bayes</ref><sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>vec<sp/>&dt<sp/>);</highlight></codeline> |
|---|
| 244 | <codeline lineno="209"><highlight class="normal">};</highlight></codeline> |
|---|
| 245 | <codeline lineno="210"><highlight class="normal"></highlight></codeline> |
|---|
| 246 | <codeline lineno="217" refid="classEKFCh" refkind="compound"><highlight class="keyword">class<sp/></highlight><highlight class="normal"><ref refid="classEKFCh" kindref="compound" tooltip="Extended Kalman Filter in Square root.">EKFCh</ref><sp/>:<sp/></highlight><highlight class="keyword">public</highlight><highlight class="normal"><sp/><ref refid="classKalmanCh" kindref="compound" tooltip="Kalman filter in square root form.">KalmanCh</ref><sp/>{</highlight></codeline> |
|---|
| 247 | <codeline lineno="219"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classdiffbifn" kindref="compound" tooltip="Class representing a differentiable function of two variables .">diffbifn</ref>*<sp/>pfxu;</highlight></codeline> |
|---|
| 248 | <codeline lineno="221"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classdiffbifn" kindref="compound" tooltip="Class representing a differentiable function of two variables .">diffbifn</ref>*<sp/>phxu;</highlight></codeline> |
|---|
| 249 | <codeline lineno="222"><highlight class="normal"></highlight><highlight class="keyword">public</highlight><highlight class="normal">:</highlight></codeline> |
|---|
| 250 | <codeline lineno="224"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classEKFCh_1e9e39a9204db3dda88d06e47c1e19064" kindref="member" tooltip="Default constructor.">EKFCh</ref><sp/>(<sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/>rvx,<sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/><ref refid="classKalman_17501230c2fafa3655887d2da23b3184c" kindref="member" tooltip="Indetifier of output rv.">rvy</ref>,<sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/><ref refid="classKalman_144a16ffd5ac1e6e39bae34fea9e1e498" kindref="member" tooltip="Indetifier of exogeneous rv.">rvu</ref><sp/>);</highlight></codeline> |
|---|
| 251 | <codeline lineno="226"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classEKFCh_10216bed270df59fe65d0d62d41f8257c" kindref="member" tooltip="Set nonlinear functions for mean values and covariance matrices.">set_parameters</ref><sp/>(<sp/><ref refid="classdiffbifn" kindref="compound" tooltip="Class representing a differentiable function of two variables .">diffbifn</ref>*<sp/>pfxu,<sp/><ref refid="classdiffbifn" kindref="compound" tooltip="Class representing a differentiable function of two variables .">diffbifn</ref>*<sp/>phxu,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="classchmat" kindref="compound" tooltip="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</ref><sp/>Q0,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="classchmat" kindref="compound" tooltip="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</ref><sp/>R0<sp/>);</highlight></codeline> |
|---|
| 252 | <codeline lineno="228"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classEKFCh_196f6edda324a0b7ef8b4e86cc7af60c1" kindref="member" tooltip="Here dt = [yt;ut] of appropriate dimensions.">bayes</ref><sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>vec<sp/>&dt<sp/>);</highlight></codeline> |
|---|
| 253 | <codeline lineno="229"><highlight class="normal">};</highlight></codeline> |
|---|
| 254 | <codeline lineno="230"><highlight class="normal"></highlight></codeline> |
|---|
| 255 | <codeline lineno="235" refid="classKFcondQR" refkind="compound"><highlight class="keyword">class<sp/></highlight><highlight class="normal"><ref refid="classKFcondQR" kindref="compound" tooltip="Kalman Filter with conditional diagonal matrices R and Q.">KFcondQR</ref><sp/>:<sp/></highlight><highlight class="keyword">public</highlight><highlight class="normal"><sp/><ref refid="classKalman" kindref="compound" tooltip="Kalman filter with covariance matrices in square root form.">Kalman</ref><ldmat>,<sp/></highlight><highlight class="keyword">public</highlight><highlight class="normal"><sp/><ref refid="classBMcond" kindref="compound" tooltip="Conditional Bayesian Filter.">BMcond</ref><sp/>{</highlight></codeline> |
|---|
| 256 | <codeline lineno="236"><highlight class="normal"></highlight><highlight class="comment">//protected:</highlight><highlight class="normal"></highlight></codeline> |
|---|
| 257 | <codeline lineno="237"><highlight class="normal"></highlight><highlight class="keyword">public</highlight><highlight class="normal">:</highlight></codeline> |
|---|
| 258 | <codeline lineno="239" refid="classKFcondQR_13f3968f92c7bbe4b0902d5e14ecc1cb4" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classKFcondQR_13f3968f92c7bbe4b0902d5e14ecc1cb4" kindref="member" tooltip="Default constructor.">KFcondQR</ref><sp/>(<sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/>rvx,<sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/><ref refid="classKalman_17501230c2fafa3655887d2da23b3184c" kindref="member" tooltip="Indetifier of output rv.">rvy</ref>,<sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/><ref refid="classKalman_144a16ffd5ac1e6e39bae34fea9e1e498" kindref="member" tooltip="Indetifier of exogeneous rv.">rvu</ref>,<sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/>rvRQ<sp/>)<sp/>:<sp/><ref refid="classKalman" kindref="compound" tooltip="Kalman filter with covariance matrices in square root form.">Kalman</ref><<ref refid="classldmat" kindref="compound" tooltip="Matrix stored in LD form, (typically known as UD).">ldmat</ref>><sp/>(<sp/>rvx,<sp/>rvy,rvu<sp/>),<ref refid="classBMcond" kindref="compound" tooltip="Conditional Bayesian Filter.">BMcond</ref><sp/>(<sp/>rvRQ<sp/>)<sp/>{};</highlight></codeline> |
|---|
| 259 | <codeline lineno="240"><highlight class="normal"></highlight></codeline> |
|---|
| 260 | <codeline lineno="241"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classKFcondQR_1c9ecf292a85327aa6309c9fd70ceb606" kindref="member" tooltip="Substitute val for rvc.">condition</ref><sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>vec<sp/>&RQ<sp/>);</highlight></codeline> |
|---|
| 261 | <codeline lineno="242"><highlight class="normal">};</highlight></codeline> |
|---|
| 262 | <codeline lineno="243"><highlight class="normal"></highlight></codeline> |
|---|
| 263 | <codeline lineno="248" refid="classKFcondR" refkind="compound"><highlight class="keyword">class<sp/></highlight><highlight class="normal"><ref refid="classKFcondR" kindref="compound" tooltip="Kalman Filter with conditional diagonal matrices R and Q.">KFcondR</ref><sp/>:<sp/></highlight><highlight class="keyword">public</highlight><highlight class="normal"><sp/><ref refid="classKalman" kindref="compound" tooltip="Kalman filter with covariance matrices in square root form.">Kalman</ref><ldmat>,<sp/></highlight><highlight class="keyword">public</highlight><highlight class="normal"><sp/><ref refid="classBMcond" kindref="compound" tooltip="Conditional Bayesian Filter.">BMcond</ref><sp/>{</highlight></codeline> |
|---|
| 264 | <codeline lineno="249"><highlight class="normal"></highlight><highlight class="comment">//protected:</highlight><highlight class="normal"></highlight></codeline> |
|---|
| 265 | <codeline lineno="250"><highlight class="normal"></highlight><highlight class="keyword">public</highlight><highlight class="normal">:</highlight></codeline> |
|---|
| 266 | <codeline lineno="252" refid="classKFcondR_1d2acbb8e66c7ee592b1a9da5b429a69e" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classKFcondR_1d2acbb8e66c7ee592b1a9da5b429a69e" kindref="member" tooltip="Default constructor.">KFcondR</ref><sp/>(<sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/>rvx,<sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/><ref refid="classKalman_17501230c2fafa3655887d2da23b3184c" kindref="member" tooltip="Indetifier of output rv.">rvy</ref>,<sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/><ref refid="classKalman_144a16ffd5ac1e6e39bae34fea9e1e498" kindref="member" tooltip="Indetifier of exogeneous rv.">rvu</ref>,<sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/>rvR<sp/>)<sp/>:<sp/><ref refid="classKalman" kindref="compound" tooltip="Kalman filter with covariance matrices in square root form.">Kalman</ref><<ref refid="classldmat" kindref="compound" tooltip="Matrix stored in LD form, (typically known as UD).">ldmat</ref>><sp/>(<sp/>rvx,<sp/>rvy,rvu<sp/>),<ref refid="classBMcond" kindref="compound" tooltip="Conditional Bayesian Filter.">BMcond</ref><sp/>(<sp/>rvR<sp/>)<sp/>{};</highlight></codeline> |
|---|
| 267 | <codeline lineno="253"><highlight class="normal"></highlight></codeline> |
|---|
| 268 | <codeline lineno="254"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classKFcondR_18c0721e47879bb8840d829db7a174a7f" kindref="member" tooltip="Substitute val for rvc.">condition</ref><sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>vec<sp/>&<ref refid="classKalman_111d171dc0e0ab111c56a70f98b97b3ec" kindref="member" tooltip="Matrix R in square-root form.">R</ref><sp/>);</highlight></codeline> |
|---|
| 269 | <codeline lineno="255"><highlight class="normal">};</highlight></codeline> |
|---|
| 270 | <codeline lineno="256"><highlight class="normal"></highlight></codeline> |
|---|
| 271 | <codeline lineno="258"><highlight class="normal"></highlight></codeline> |
|---|
| 272 | <codeline lineno="259"><highlight class="normal"></highlight><highlight class="keyword">template</highlight><highlight class="normal"><</highlight><highlight class="keyword">class</highlight><highlight class="normal"><sp/>sq_T></highlight></codeline> |
|---|
| 273 | <codeline lineno="260" refid="classKalman_1ce38e31810aea4db45a83ad05eaba009" refkind="member"><highlight class="normal"><ref refid="classKalman_13d56b0a97b8c1e25fdd3b10eef3c2ad3" kindref="member" tooltip="Default constructor.">Kalman<sq_T>::Kalman</ref><sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="classKalman" kindref="compound" tooltip="Kalman filter with covariance matrices in square root form.">Kalman<sq_T></ref><sp/>&K0<sp/>)<sp/>:<sp/><ref refid="classBM" kindref="compound" tooltip="Bayesian Model of the world, i.e. all uncertainty is modeled by probabilities.">BM</ref><sp/>(<sp/>K0.rv<sp/>),rvy<sp/>(<sp/>K0.rvy<sp/>),rvu<sp/>(<sp/>K0.rvu<sp/>),</highlight></codeline> |
|---|
| 274 | <codeline lineno="261"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dimx<sp/>(<sp/>rv.count()<sp/>),<sp/>dimy<sp/>(<sp/>rvy.count()<sp/>),dimu<sp/>(<sp/>rvu.count()<sp/>),</highlight></codeline> |
|---|
| 275 | <codeline lineno="262"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>A<sp/>(<sp/>dimx,dimx<sp/>),<sp/>B<sp/>(<sp/>dimx,dimu<sp/>),<sp/>C<sp/>(<sp/>dimy,dimx<sp/>),<sp/>D<sp/>(<sp/>dimy,dimu<sp/>),</highlight></codeline> |
|---|
| 276 | <codeline lineno="263"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Q(dimx),<sp/>R(dimy),</highlight></codeline> |
|---|
| 277 | <codeline lineno="264"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>est<sp/>(<sp/>rv<sp/>),<sp/>fy<sp/>(<sp/>rvy<sp/>),<sp/>_yp(fy._mu()),_Ry(fy._R()),<sp/>_mu(est._mu()),<sp/>_P(est._R())<sp/>{</highlight></codeline> |
|---|
| 278 | <codeline lineno="265"><highlight class="normal"></highlight></codeline> |
|---|
| 279 | <codeline lineno="266"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>this-><ref refid="classKalman_1239b28a0380946f5749b2f8d2807f93a" kindref="member" tooltip="Set parameters with check of relevance.">set_parameters</ref><sp/>(<sp/>K0.<ref refid="classKalman_15e02efe86ee91e9c74b93b425fe060b9" kindref="member" tooltip="Matrix A.">A</ref>,<sp/>K0.<ref refid="classKalman_1dc87704284a6c0bca13bf51f4345a50a" kindref="member" tooltip="Matrix B.">B</ref>,<sp/>K0.<ref refid="classKalman_186a805cd6515872d1132ad0d6eb5dc13" kindref="member" tooltip="Matrix C.">C</ref>,<sp/>K0.<ref refid="classKalman_1d69f774ba3335c970c1c5b1d182f4dd1" kindref="member" tooltip="Matrix D.">D</ref>,<sp/>K0.<ref refid="classKalman_111d171dc0e0ab111c56a70f98b97b3ec" kindref="member" tooltip="Matrix R in square-root form.">R</ref>,<sp/>K0.<ref refid="classKalman_19b69015c800eb93f3ee49da23a6f55d9" kindref="member" tooltip="Matrix Q in square-root form.">Q</ref><sp/>);</highlight></codeline> |
|---|
| 280 | <codeline lineno="267"><highlight class="normal"></highlight></codeline> |
|---|
| 281 | <codeline lineno="268"><highlight class="normal"></highlight><highlight class="comment">//<sp/>copy<sp/>values<sp/>in<sp/>pointers</highlight><highlight class="normal"></highlight></codeline> |
|---|
| 282 | <codeline lineno="269"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classKalman_1fe803a81d2d847b0b1db3c6b29c18061" kindref="member" tooltip="cache of est.mu">_mu</ref><sp/>=<sp/>K0.<ref refid="classKalman_1fe803a81d2d847b0b1db3c6b29c18061" kindref="member" tooltip="cache of est.mu">_mu</ref>;</highlight></codeline> |
|---|
| 283 | <codeline lineno="270"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classKalman_19fb808cc94a4c2652e1fb93be9bb7dcf" kindref="member" tooltip="cache of est.R">_P</ref><sp/>=<sp/>K0.<ref refid="classKalman_19fb808cc94a4c2652e1fb93be9bb7dcf" kindref="member" tooltip="cache of est.R">_P</ref>;</highlight></codeline> |
|---|
| 284 | <codeline lineno="271"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classKalman_1764bbc95238eda11fc81c5ebd0b1dcfd" kindref="member" tooltip="cache of fy.mu">_yp</ref><sp/>=<sp/>K0.<ref refid="classKalman_1764bbc95238eda11fc81c5ebd0b1dcfd" kindref="member" tooltip="cache of fy.mu">_yp</ref>;</highlight></codeline> |
|---|
| 285 | <codeline lineno="272"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classKalman_145c9f928d2d62e0c884900fb3380f904" kindref="member" tooltip="cache of fy.R">_Ry</ref><sp/>=<sp/>K0.<ref refid="classKalman_145c9f928d2d62e0c884900fb3380f904" kindref="member" tooltip="cache of fy.R">_Ry</ref>;</highlight></codeline> |
|---|
| 286 | <codeline lineno="273"><highlight class="normal"></highlight></codeline> |
|---|
| 287 | <codeline lineno="274"><highlight class="normal">}</highlight></codeline> |
|---|
| 288 | <codeline lineno="275"><highlight class="normal"></highlight></codeline> |
|---|
| 289 | <codeline lineno="276"><highlight class="normal"></highlight><highlight class="keyword">template</highlight><highlight class="normal"><</highlight><highlight class="keyword">class</highlight><highlight class="normal"><sp/>sq_T></highlight></codeline> |
|---|
| 290 | <codeline lineno="277" refid="classKalman_13d56b0a97b8c1e25fdd3b10eef3c2ad3" refkind="member"><highlight class="normal"><ref refid="classKalman_13d56b0a97b8c1e25fdd3b10eef3c2ad3" kindref="member" tooltip="Default constructor.">Kalman<sq_T>::Kalman</ref><sp/>(<sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/>rvx,<sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/>rvy0,<sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/>rvu0<sp/>)<sp/>:<sp/><ref refid="classBM" kindref="compound" tooltip="Bayesian Model of the world, i.e. all uncertainty is modeled by probabilities.">BM</ref><sp/>(<sp/>rvx<sp/>),<ref refid="classKalman_17501230c2fafa3655887d2da23b3184c" kindref="member" tooltip="Indetifier of output rv.">rvy</ref><sp/>(<sp/>rvy0<sp/>),<ref refid="classKalman_144a16ffd5ac1e6e39bae34fea9e1e498" kindref="member" tooltip="Indetifier of exogeneous rv.">rvu</ref><sp/>(<sp/>rvu0<sp/>),</highlight></codeline> |
|---|
| 291 | <codeline lineno="278"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classKalman_139c8c403b46fa3b8c7da77cb2e3729eb" kindref="member" tooltip="cache of rv.count()">dimx</ref><sp/>(<sp/>rvx.count()<sp/>),<sp/><ref refid="classKalman_1ba17b956df1e38b31fbbc299c8213b6a" kindref="member" tooltip="cache of rvy.count()">dimy</ref><sp/>(<sp/><ref refid="classKalman_17501230c2fafa3655887d2da23b3184c" kindref="member" tooltip="Indetifier of output rv.">rvy</ref>.count()<sp/>),<ref refid="classKalman_1b0153795a1444b6968a86409c778d9ce" kindref="member" tooltip="cache of rvu.count()">dimu</ref><sp/>(<sp/><ref refid="classKalman_144a16ffd5ac1e6e39bae34fea9e1e498" kindref="member" tooltip="Indetifier of exogeneous rv.">rvu</ref>.count()<sp/>),</highlight></codeline> |
|---|
| 292 | <codeline lineno="279"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classKalman_15e02efe86ee91e9c74b93b425fe060b9" kindref="member" tooltip="Matrix A.">A</ref><sp/>(<sp/><ref refid="classKalman_139c8c403b46fa3b8c7da77cb2e3729eb" kindref="member" tooltip="cache of rv.count()">dimx</ref>,<ref refid="classKalman_139c8c403b46fa3b8c7da77cb2e3729eb" kindref="member" tooltip="cache of rv.count()">dimx</ref><sp/>),<sp/><ref refid="classKalman_1dc87704284a6c0bca13bf51f4345a50a" kindref="member" tooltip="Matrix B.">B</ref><sp/>(<sp/><ref refid="classKalman_139c8c403b46fa3b8c7da77cb2e3729eb" kindref="member" tooltip="cache of rv.count()">dimx</ref>,<ref refid="classKalman_1b0153795a1444b6968a86409c778d9ce" kindref="member" tooltip="cache of rvu.count()">dimu</ref><sp/>),<sp/><ref refid="classKalman_186a805cd6515872d1132ad0d6eb5dc13" kindref="member" tooltip="Matrix C.">C</ref><sp/>(<sp/><ref refid="classKalman_1ba17b956df1e38b31fbbc299c8213b6a" kindref="member" tooltip="cache of rvy.count()">dimy</ref>,<ref refid="classKalman_139c8c403b46fa3b8c7da77cb2e3729eb" kindref="member" tooltip="cache of rv.count()">dimx</ref><sp/>),<sp/><ref refid="classKalman_1d69f774ba3335c970c1c5b1d182f4dd1" kindref="member" tooltip="Matrix D.">D</ref><sp/>(<sp/><ref refid="classKalman_1ba17b956df1e38b31fbbc299c8213b6a" kindref="member" tooltip="cache of rvy.count()">dimy</ref>,<ref refid="classKalman_1b0153795a1444b6968a86409c778d9ce" kindref="member" tooltip="cache of rvu.count()">dimu</ref><sp/>),</highlight></codeline> |
|---|
| 293 | <codeline lineno="280"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classKalman_19b69015c800eb93f3ee49da23a6f55d9" kindref="member" tooltip="Matrix Q in square-root form.">Q</ref>(<ref refid="classKalman_139c8c403b46fa3b8c7da77cb2e3729eb" kindref="member" tooltip="cache of rv.count()">dimx</ref>),<sp/><ref refid="classKalman_111d171dc0e0ab111c56a70f98b97b3ec" kindref="member" tooltip="Matrix R in square-root form.">R</ref><sp/>(<ref refid="classKalman_1ba17b956df1e38b31fbbc299c8213b6a" kindref="member" tooltip="cache of rvy.count()">dimy</ref>),</highlight></codeline> |
|---|
| 294 | <codeline lineno="281"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classKalman_15568c74bac67ae6d3b1061dba60c9424" kindref="member" tooltip="posterior density on $x_t$">est</ref><sp/>(<sp/>rvx<sp/>),<sp/><ref refid="classKalman_1e580ab06483952bd03f2e651763e184f" kindref="member" tooltip="preditive density on $y_t$">fy</ref><sp/>(<sp/><ref refid="classKalman_17501230c2fafa3655887d2da23b3184c" kindref="member" tooltip="Indetifier of output rv.">rvy</ref><sp/>),<sp/><sp/><ref refid="classKalman_1764bbc95238eda11fc81c5ebd0b1dcfd" kindref="member" tooltip="cache of fy.mu">_yp</ref>(<ref refid="classKalman_1e580ab06483952bd03f2e651763e184f" kindref="member" tooltip="preditive density on $y_t$">fy</ref>.<ref refid="classKalman_1fe803a81d2d847b0b1db3c6b29c18061" kindref="member" tooltip="cache of est.mu">_mu</ref>()),<ref refid="classKalman_145c9f928d2d62e0c884900fb3380f904" kindref="member" tooltip="cache of fy.R">_Ry</ref>(<ref refid="classKalman_1e580ab06483952bd03f2e651763e184f" kindref="member" tooltip="preditive density on $y_t$">fy</ref>._R()),<ref refid="classKalman_1fe803a81d2d847b0b1db3c6b29c18061" kindref="member" tooltip="cache of est.mu">_mu</ref>(<ref refid="classKalman_15568c74bac67ae6d3b1061dba60c9424" kindref="member" tooltip="posterior density on $x_t$">est</ref>.<ref refid="classKalman_1fe803a81d2d847b0b1db3c6b29c18061" kindref="member" tooltip="cache of est.mu">_mu</ref>()),<sp/><ref refid="classKalman_19fb808cc94a4c2652e1fb93be9bb7dcf" kindref="member" tooltip="cache of est.R">_P</ref>(<ref refid="classKalman_15568c74bac67ae6d3b1061dba60c9424" kindref="member" tooltip="posterior density on $x_t$">est</ref>._R())<sp/>{</highlight></codeline> |
|---|
| 295 | <codeline lineno="282"><highlight class="normal">};</highlight></codeline> |
|---|
| 296 | <codeline lineno="283"><highlight class="normal"></highlight></codeline> |
|---|
| 297 | <codeline lineno="284"><highlight class="normal"></highlight><highlight class="keyword">template</highlight><highlight class="normal"><</highlight><highlight class="keyword">class</highlight><highlight class="normal"><sp/>sq_T></highlight></codeline> |
|---|
| 298 | <codeline lineno="285" refid="classKalman_1239b28a0380946f5749b2f8d2807f93a" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classKalman_1239b28a0380946f5749b2f8d2807f93a" kindref="member" tooltip="Set parameters with check of relevance.">Kalman<sq_T>::set_parameters</ref><sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>mat<sp/>&A0,</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><sp/>mat<sp/>&B0,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>mat<sp/>&C0,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>mat<sp/>&D0,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>sq_T<sp/>&R0,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>sq_T<sp/>&Q0<sp/>)<sp/>{</highlight></codeline> |
|---|
| 299 | <codeline lineno="286"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>it_assert_debug<sp/>(<sp/>A0.cols()<sp/>==<ref refid="classKalman_139c8c403b46fa3b8c7da77cb2e3729eb" kindref="member" tooltip="cache of rv.count()">dimx</ref>,<sp/></highlight><highlight class="stringliteral">"Kalman:<sp/>A<sp/>is<sp/>not<sp/>square"</highlight><highlight class="normal"><sp/>);</highlight></codeline> |
|---|
| 300 | <codeline lineno="287"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>it_assert_debug<sp/>(<sp/>B0.rows()<sp/>==<ref refid="classKalman_139c8c403b46fa3b8c7da77cb2e3729eb" kindref="member" tooltip="cache of rv.count()">dimx</ref>,<sp/></highlight><highlight class="stringliteral">"Kalman:<sp/>B<sp/>is<sp/>not<sp/>compatible"</highlight><highlight class="normal"><sp/>);</highlight></codeline> |
|---|
| 301 | <codeline lineno="288"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>it_assert_debug<sp/>(<sp/>C0.cols()<sp/>==<ref refid="classKalman_139c8c403b46fa3b8c7da77cb2e3729eb" kindref="member" tooltip="cache of rv.count()">dimx</ref>,<sp/></highlight><highlight class="stringliteral">"Kalman:<sp/>C<sp/>is<sp/>not<sp/>square"</highlight><highlight class="normal"><sp/>);</highlight></codeline> |
|---|
| 302 | <codeline lineno="289"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>it_assert_debug<sp/>(<sp/>(<sp/>D0.rows()<sp/>==<ref refid="classKalman_1ba17b956df1e38b31fbbc299c8213b6a" kindref="member" tooltip="cache of rvy.count()">dimy</ref><sp/>)<sp/>||<sp/>(<sp/>D0.cols()<sp/>==<ref refid="classKalman_1b0153795a1444b6968a86409c778d9ce" kindref="member" tooltip="cache of rvu.count()">dimu</ref><sp/>),<sp/></highlight><highlight class="stringliteral">"Kalman:<sp/>D<sp/>is<sp/>not<sp/>compatible"</highlight><highlight class="normal"><sp/>);</highlight></codeline> |
|---|
| 303 | <codeline lineno="290"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>it_assert_debug<sp/>(<sp/>(<sp/>R0.cols()<sp/>==<ref refid="classKalman_1ba17b956df1e38b31fbbc299c8213b6a" kindref="member" tooltip="cache of rvy.count()">dimy</ref><sp/>)<sp/>||<sp/>(<sp/>R0.rows()<sp/>==<ref refid="classKalman_1ba17b956df1e38b31fbbc299c8213b6a" kindref="member" tooltip="cache of rvy.count()">dimy</ref><sp/>),<sp/></highlight><highlight class="stringliteral">"Kalman:<sp/>R<sp/>is<sp/>not<sp/>compatible"</highlight><highlight class="normal"><sp/>);</highlight></codeline> |
|---|
| 304 | <codeline lineno="291"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>it_assert_debug<sp/>(<sp/>(<sp/>Q0.cols()<sp/>==<ref refid="classKalman_139c8c403b46fa3b8c7da77cb2e3729eb" kindref="member" tooltip="cache of rv.count()">dimx</ref><sp/>)<sp/>||<sp/>(<sp/>Q0.rows()<sp/>==<ref refid="classKalman_139c8c403b46fa3b8c7da77cb2e3729eb" kindref="member" tooltip="cache of rv.count()">dimx</ref><sp/>),<sp/></highlight><highlight class="stringliteral">"Kalman:<sp/>Q<sp/>is<sp/>not<sp/>compatible"</highlight><highlight class="normal"><sp/>);</highlight></codeline> |
|---|
| 305 | <codeline lineno="292"><highlight class="normal"></highlight></codeline> |
|---|
| 306 | <codeline lineno="293"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classKalman_15e02efe86ee91e9c74b93b425fe060b9" kindref="member" tooltip="Matrix A.">A</ref><sp/>=<sp/>A0;</highlight></codeline> |
|---|
| 307 | <codeline lineno="294"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classKalman_1dc87704284a6c0bca13bf51f4345a50a" kindref="member" tooltip="Matrix B.">B</ref><sp/>=<sp/>B0;</highlight></codeline> |
|---|
| 308 | <codeline lineno="295"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classKalman_186a805cd6515872d1132ad0d6eb5dc13" kindref="member" tooltip="Matrix C.">C</ref><sp/>=<sp/>C0;</highlight></codeline> |
|---|
| 309 | <codeline lineno="296"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classKalman_1d69f774ba3335c970c1c5b1d182f4dd1" kindref="member" tooltip="Matrix D.">D</ref><sp/>=<sp/>D0;</highlight></codeline> |
|---|
| 310 | <codeline lineno="297"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classKalman_111d171dc0e0ab111c56a70f98b97b3ec" kindref="member" tooltip="Matrix R in square-root form.">R</ref><sp/>=<sp/>R0;</highlight></codeline> |
|---|
| 311 | <codeline lineno="298"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classKalman_19b69015c800eb93f3ee49da23a6f55d9" kindref="member" tooltip="Matrix Q in square-root form.">Q</ref><sp/>=<sp/>Q0;</highlight></codeline> |
|---|
| 312 | <codeline lineno="299"><highlight class="normal">}</highlight></codeline> |
|---|
| 313 | <codeline lineno="300"><highlight class="normal"></highlight></codeline> |
|---|
| 314 | <codeline lineno="301"><highlight class="normal"></highlight><highlight class="keyword">template</highlight><highlight class="normal"><</highlight><highlight class="keyword">class</highlight><highlight class="normal"><sp/>sq_T></highlight></codeline> |
|---|
| 315 | <codeline lineno="302" refid="classKalman_17750ffd73f261828a32c18aaeb65c75c" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classKalman_17750ffd73f261828a32c18aaeb65c75c" kindref="member" tooltip="Here dt = [yt;ut] of appropriate dimensions.">Kalman<sq_T>::bayes</ref><sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>vec<sp/>&dt<sp/>)<sp/>{</highlight></codeline> |
|---|
| 316 | <codeline lineno="303"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>it_assert_debug<sp/>(<sp/>dt.length()<sp/>==<sp/>(<sp/><ref refid="classKalman_1ba17b956df1e38b31fbbc299c8213b6a" kindref="member" tooltip="cache of rvy.count()">dimy</ref>+<ref refid="classKalman_1b0153795a1444b6968a86409c778d9ce" kindref="member" tooltip="cache of rvu.count()">dimu</ref><sp/>),</highlight><highlight class="stringliteral">"KalmanFull::bayes<sp/>wrong<sp/>size<sp/>of<sp/>dt"</highlight><highlight class="normal"><sp/>);</highlight></codeline> |
|---|
| 317 | <codeline lineno="304"><highlight class="normal"></highlight></codeline> |
|---|
| 318 | <codeline lineno="305"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>sq_T<sp/>iRy(<ref refid="classKalman_1ba17b956df1e38b31fbbc299c8213b6a" kindref="member" tooltip="cache of rvy.count()">dimy</ref>);</highlight></codeline> |
|---|
| 319 | <codeline lineno="306"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>u<sp/>=<sp/>dt.get<sp/>(<sp/><ref refid="classKalman_1ba17b956df1e38b31fbbc299c8213b6a" kindref="member" tooltip="cache of rvy.count()">dimy</ref>,<ref refid="classKalman_1ba17b956df1e38b31fbbc299c8213b6a" kindref="member" tooltip="cache of rvy.count()">dimy</ref>+<ref refid="classKalman_1b0153795a1444b6968a86409c778d9ce" kindref="member" tooltip="cache of rvu.count()">dimu</ref>-1<sp/>);</highlight></codeline> |
|---|
| 320 | <codeline lineno="307"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>y<sp/>=<sp/>dt.get<sp/>(<sp/>0,<ref refid="classKalman_1ba17b956df1e38b31fbbc299c8213b6a" kindref="member" tooltip="cache of rvy.count()">dimy</ref>-1<sp/>);</highlight></codeline> |
|---|
| 321 | <codeline lineno="308"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//Time<sp/>update</highlight><highlight class="normal"></highlight></codeline> |
|---|
| 322 | <codeline lineno="309"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classKalman_1fe803a81d2d847b0b1db3c6b29c18061" kindref="member" tooltip="cache of est.mu">_mu</ref><sp/>=<sp/><ref refid="classKalman_15e02efe86ee91e9c74b93b425fe060b9" kindref="member" tooltip="Matrix A.">A</ref>*<sp/><ref refid="classKalman_1fe803a81d2d847b0b1db3c6b29c18061" kindref="member" tooltip="cache of est.mu">_mu</ref><sp/>+<sp/><ref refid="classKalman_1dc87704284a6c0bca13bf51f4345a50a" kindref="member" tooltip="Matrix B.">B</ref>*u;</highlight></codeline> |
|---|
| 323 | <codeline lineno="310"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//P<sp/><sp/>=<sp/>A*P*A.transpose()<sp/>+<sp/>Q;<sp/>in<sp/>sq_T</highlight><highlight class="normal"></highlight></codeline> |
|---|
| 324 | <codeline lineno="311"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classKalman_19fb808cc94a4c2652e1fb93be9bb7dcf" kindref="member" tooltip="cache of est.R">_P</ref>.mult_sym<sp/>(<sp/><ref refid="classKalman_15e02efe86ee91e9c74b93b425fe060b9" kindref="member" tooltip="Matrix A.">A</ref><sp/>);</highlight></codeline> |
|---|
| 325 | <codeline lineno="312"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classKalman_19fb808cc94a4c2652e1fb93be9bb7dcf" kindref="member" tooltip="cache of est.R">_P</ref><sp/><sp/>+=<ref refid="classKalman_19b69015c800eb93f3ee49da23a6f55d9" kindref="member" tooltip="Matrix Q in square-root form.">Q</ref>;</highlight></codeline> |
|---|
| 326 | <codeline lineno="313"><highlight class="normal"></highlight></codeline> |
|---|
| 327 | <codeline lineno="314"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//Data<sp/>update</highlight><highlight class="normal"></highlight></codeline> |
|---|
| 328 | <codeline lineno="315"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//_Ry<sp/>=<sp/>C*P*C.transpose()<sp/>+<sp/>R;<sp/>in<sp/>sq_T</highlight><highlight class="normal"></highlight></codeline> |
|---|
| 329 | <codeline lineno="316"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classKalman_19fb808cc94a4c2652e1fb93be9bb7dcf" kindref="member" tooltip="cache of est.R">_P</ref>.mult_sym<sp/>(<sp/><ref refid="classKalman_186a805cd6515872d1132ad0d6eb5dc13" kindref="member" tooltip="Matrix C.">C</ref>,<sp/><ref refid="classKalman_145c9f928d2d62e0c884900fb3380f904" kindref="member" tooltip="cache of fy.R">_Ry</ref><sp/>);</highlight></codeline> |
|---|
| 330 | <codeline lineno="317"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classKalman_145c9f928d2d62e0c884900fb3380f904" kindref="member" tooltip="cache of fy.R">_Ry</ref><sp/><sp/>+=<ref refid="classKalman_111d171dc0e0ab111c56a70f98b97b3ec" kindref="member" tooltip="Matrix R in square-root form.">R</ref>;</highlight></codeline> |
|---|
| 331 | <codeline lineno="318"><highlight class="normal"></highlight></codeline> |
|---|
| 332 | <codeline lineno="319"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mat<sp/>Pfull<sp/>=<sp/><ref refid="classKalman_19fb808cc94a4c2652e1fb93be9bb7dcf" kindref="member" tooltip="cache of est.R">_P</ref>.to_mat();</highlight></codeline> |
|---|
| 333 | <codeline lineno="320"><highlight class="normal"></highlight></codeline> |
|---|
| 334 | <codeline lineno="321"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classKalman_145c9f928d2d62e0c884900fb3380f904" kindref="member" tooltip="cache of fy.R">_Ry</ref>.inv<sp/>(<sp/>iRy<sp/>);<sp/></highlight><highlight class="comment">//<sp/>result<sp/>is<sp/>in<sp/>_iRy;</highlight><highlight class="normal"></highlight></codeline> |
|---|
| 335 | <codeline lineno="322"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classKalman_1d422f51467c7a06174af2476d2826132" kindref="member" tooltip="placeholder for Kalman gain">_K</ref><sp/>=<sp/>Pfull*<ref refid="classKalman_186a805cd6515872d1132ad0d6eb5dc13" kindref="member" tooltip="Matrix C.">C</ref>.transpose()<sp/>*<sp/>(<sp/>iRy.to_mat()<sp/>);</highlight></codeline> |
|---|
| 336 | <codeline lineno="323"><highlight class="normal"></highlight></codeline> |
|---|
| 337 | <codeline lineno="324"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>sq_T<sp/>pom<sp/>(<sp/>(<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>)<sp/>Pfull.rows()<sp/>);</highlight></codeline> |
|---|
| 338 | <codeline lineno="325"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>iRy.mult_sym_t<sp/>(<sp/><ref refid="classKalman_186a805cd6515872d1132ad0d6eb5dc13" kindref="member" tooltip="Matrix C.">C</ref>*Pfull,pom<sp/>);</highlight></codeline> |
|---|
| 339 | <codeline lineno="326"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(<ref refid="classKalman_19fb808cc94a4c2652e1fb93be9bb7dcf" kindref="member" tooltip="cache of est.R">_P</ref><sp/>)<sp/>-=<sp/>pom;<sp/></highlight><highlight class="comment">//<sp/>P<sp/>=<sp/>P<sp/>-PC'iRy*CP;</highlight><highlight class="normal"></highlight></codeline> |
|---|
| 340 | <codeline lineno="327"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(<ref refid="classKalman_1764bbc95238eda11fc81c5ebd0b1dcfd" kindref="member" tooltip="cache of fy.mu">_yp</ref><sp/>)<sp/>=<sp/><ref refid="classKalman_186a805cd6515872d1132ad0d6eb5dc13" kindref="member" tooltip="Matrix C.">C</ref>*<sp/><ref refid="classKalman_1fe803a81d2d847b0b1db3c6b29c18061" kindref="member" tooltip="cache of est.mu">_mu</ref><sp/><sp/>+<ref refid="classKalman_1d69f774ba3335c970c1c5b1d182f4dd1" kindref="member" tooltip="Matrix D.">D</ref>*u;<sp/></highlight><highlight class="comment">//y<sp/>prediction</highlight><highlight class="normal"></highlight></codeline> |
|---|
| 341 | <codeline lineno="328"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(<ref refid="classKalman_1fe803a81d2d847b0b1db3c6b29c18061" kindref="member" tooltip="cache of est.mu">_mu</ref><sp/>)<sp/>+=<sp/><ref refid="classKalman_1d422f51467c7a06174af2476d2826132" kindref="member" tooltip="placeholder for Kalman gain">_K</ref>*<sp/>(<sp/>y-<sp/><ref refid="classKalman_1764bbc95238eda11fc81c5ebd0b1dcfd" kindref="member" tooltip="cache of fy.mu">_yp</ref><sp/><sp/>);</highlight></codeline> |
|---|
| 342 | <codeline lineno="329"><highlight class="normal"></highlight></codeline> |
|---|
| 343 | <codeline lineno="330"><highlight class="normal"></highlight></codeline> |
|---|
| 344 | <codeline lineno="331"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<sp/><ref refid="classBM_1bf6fb59b30141074f8ee1e2f43d03129" kindref="member" tooltip="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</ref>==</highlight><highlight class="keyword">true</highlight><highlight class="normal"><sp/>)<sp/>{<sp/></highlight><highlight class="comment">//likelihood<sp/>of<sp/>observation<sp/>y</highlight><highlight class="normal"></highlight></codeline> |
|---|
| 345 | <codeline lineno="332"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classBM_15623fef6572a08c2b53b8c87b82dc979" kindref="member" tooltip="Logarithm of marginalized data likelihood.">ll</ref>=<ref refid="classKalman_1e580ab06483952bd03f2e651763e184f" kindref="member" tooltip="preditive density on $y_t$">fy</ref>.evalpdflog<sp/>(<sp/>y<sp/>);</highlight></codeline> |
|---|
| 346 | <codeline lineno="333"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> |
|---|
| 347 | <codeline lineno="334"><highlight class="normal"></highlight></codeline> |
|---|
| 348 | <codeline lineno="335"><highlight class="normal"></highlight><highlight class="comment">//cout<sp/><<<sp/>"y:<sp/>"<sp/><<<sp/>y-(*_yp)<sp/><<"<sp/>R:<sp/>"<sp/><<<sp/>_Ry->to_mat()<sp/><<<sp/>"<sp/>iR:<sp/>"<sp/><<<sp/>_iRy->to_mat()<sp/><<<sp/>"<sp/>ll:<sp/>"<sp/><<<sp/>ll<sp/><<endl;</highlight><highlight class="normal"></highlight></codeline> |
|---|
| 349 | <codeline lineno="336"><highlight class="normal"></highlight></codeline> |
|---|
| 350 | <codeline lineno="337"><highlight class="normal">};</highlight></codeline> |
|---|
| 351 | <codeline lineno="338"><highlight class="normal"><sp/></highlight></codeline> |
|---|
| 352 | <codeline lineno="339"><highlight class="normal"></highlight></codeline> |
|---|
| 353 | <codeline lineno="340"><highlight class="normal"></highlight></codeline> |
|---|
| 354 | <codeline lineno="341"><highlight class="normal"></highlight><highlight class="comment">//TODO<sp/>why<sp/>not<sp/>const<sp/>pointer??</highlight><highlight class="normal"></highlight></codeline> |
|---|
| 355 | <codeline lineno="342"><highlight class="normal"></highlight></codeline> |
|---|
| 356 | <codeline lineno="343"><highlight class="normal"></highlight><highlight class="keyword">template</highlight><highlight class="normal"><</highlight><highlight class="keyword">class</highlight><highlight class="normal"><sp/>sq_T></highlight></codeline> |
|---|
| 357 | <codeline lineno="344" refid="classEKF_1ea4f3254cacf0a92d2a820b1201d049e" refkind="member"><highlight class="normal"><ref refid="classEKF_1ea4f3254cacf0a92d2a820b1201d049e" kindref="member" tooltip="Default constructor.">EKF<sq_T>::EKF</ref><sp/>(<sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/>rvx0,<sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/>rvy0,<sp/><ref refid="classRV" kindref="compound" tooltip="Class representing variables, most often random variables.">RV</ref><sp/>rvu0<sp/>)<sp/>:<sp/><ref refid="classKalman" kindref="compound" tooltip="Kalman filter with covariance matrices in square root form.">Kalman</ref><sq_T><sp/>(<sp/>rvx0,rvy0,rvu0<sp/>)<sp/>{}</highlight></codeline> |
|---|
| 358 | <codeline lineno="345"><highlight class="normal"></highlight></codeline> |
|---|
| 359 | <codeline lineno="346"><highlight class="normal"></highlight><highlight class="keyword">template</highlight><highlight class="normal"><</highlight><highlight class="keyword">class</highlight><highlight class="normal"><sp/>sq_T></highlight></codeline> |
|---|
| 360 | <codeline lineno="347" refid="classEKF_128d058ae4d24d992d2f055419a06ee66" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classEKF_128d058ae4d24d992d2f055419a06ee66" kindref="member" tooltip="Set nonlinear functions for mean values and covariance matrices.">EKF<sq_T>::set_parameters</ref><sp/>(<sp/><ref refid="classdiffbifn" kindref="compound" tooltip="Class representing a differentiable function of two variables .">diffbifn</ref>*<sp/>pfxu0,<sp/><sp/><ref refid="classdiffbifn" kindref="compound" tooltip="Class representing a differentiable function of two variables .">diffbifn</ref>*<sp/>phxu0,</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>sq_T<sp/>Q0,</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>sq_T<sp/>R0<sp/>)<sp/>{</highlight></codeline> |
|---|
| 361 | <codeline lineno="348"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pfxu<sp/>=<sp/>pfxu0;</highlight></codeline> |
|---|
| 362 | <codeline lineno="349"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>phxu<sp/>=<sp/>phxu0;</highlight></codeline> |
|---|
| 363 | <codeline lineno="350"><highlight class="normal"></highlight></codeline> |
|---|
| 364 | <codeline lineno="351"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//initialize<sp/>matrices<sp/>A<sp/>C,<sp/>later,<sp/>these<sp/>will<sp/>be<sp/>only<sp/>updated!</highlight><highlight class="normal"></highlight></codeline> |
|---|
| 365 | <codeline lineno="352"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pfxu-><ref refid="classdiffbifn_16d217a02d4fa13931258d4bebdd0feb4" kindref="member" tooltip="Evaluates and writes result into A .">dfdx_cond</ref><sp/>(<sp/><ref refid="classKalman_1fe803a81d2d847b0b1db3c6b29c18061" kindref="member" tooltip="cache of est.mu">_mu</ref>,zeros<sp/>(<sp/><ref refid="classKalman_1b0153795a1444b6968a86409c778d9ce" kindref="member" tooltip="cache of rvu.count()">dimu</ref><sp/>),<ref refid="classKalman_15e02efe86ee91e9c74b93b425fe060b9" kindref="member" tooltip="Matrix A.">A</ref>,</highlight><highlight class="keyword">true</highlight><highlight class="normal"><sp/>);</highlight></codeline> |
|---|
| 366 | <codeline lineno="353"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/><sp/><sp/><sp/><sp/>pfxu->dfdu_cond<sp/>(<sp/>*_mu,zeros<sp/>(<sp/>dimu<sp/>),B,true<sp/>);</highlight><highlight class="normal"></highlight></codeline> |
|---|
| 367 | <codeline lineno="354"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classKalman_1dc87704284a6c0bca13bf51f4345a50a" kindref="member" tooltip="Matrix B.">B</ref>.clear();</highlight></codeline> |
|---|
| 368 | <codeline lineno="355"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>phxu-><ref refid="classdiffbifn_16d217a02d4fa13931258d4bebdd0feb4" kindref="member" tooltip="Evaluates and writes result into A .">dfdx_cond</ref><sp/>(<sp/><ref refid="classKalman_1fe803a81d2d847b0b1db3c6b29c18061" kindref="member" tooltip="cache of est.mu">_mu</ref>,zeros<sp/>(<sp/><ref refid="classKalman_1b0153795a1444b6968a86409c778d9ce" kindref="member" tooltip="cache of rvu.count()">dimu</ref><sp/>),<ref refid="classKalman_186a805cd6515872d1132ad0d6eb5dc13" kindref="member" tooltip="Matrix C.">C</ref>,</highlight><highlight class="keyword">true</highlight><highlight class="normal"><sp/>);</highlight></codeline> |
|---|
| 369 | <codeline lineno="356"><highlight class="normal"></highlight><highlight class="comment">//<sp/><sp/><sp/><sp/><sp/><sp/>phxu->dfdu_cond<sp/>(<sp/>*_mu,zeros<sp/>(<sp/>dimu<sp/>),D,true<sp/>);</highlight><highlight class="normal"></highlight></codeline> |
|---|
| 370 | <codeline lineno="357"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classKalman_1d69f774ba3335c970c1c5b1d182f4dd1" kindref="member" tooltip="Matrix D.">D</ref>.clear();</highlight></codeline> |
|---|
| 371 | <codeline lineno="358"><highlight class="normal"></highlight></codeline> |
|---|
| 372 | <codeline lineno="359"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classKalman_111d171dc0e0ab111c56a70f98b97b3ec" kindref="member" tooltip="Matrix R in square-root form.">R</ref><sp/>=<sp/>R0;</highlight></codeline> |
|---|
| 373 | <codeline lineno="360"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classKalman_19b69015c800eb93f3ee49da23a6f55d9" kindref="member" tooltip="Matrix Q in square-root form.">Q</ref><sp/>=<sp/>Q0;</highlight></codeline> |
|---|
| 374 | <codeline lineno="361"><highlight class="normal">}</highlight></codeline> |
|---|
| 375 | <codeline lineno="362"><highlight class="normal"></highlight></codeline> |
|---|
| 376 | <codeline lineno="363"><highlight class="normal"></highlight><highlight class="keyword">template</highlight><highlight class="normal"><</highlight><highlight class="keyword">class</highlight><highlight class="normal"><sp/>sq_T></highlight></codeline> |
|---|
| 377 | <codeline lineno="364" refid="classEKF_1c79c62c9b3e0b56b3aaa1b6f1d9a7af7" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classEKF_1c79c62c9b3e0b56b3aaa1b6f1d9a7af7" kindref="member" tooltip="Here dt = [yt;ut] of appropriate dimensions.">EKF<sq_T>::bayes</ref><sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>vec<sp/>&dt<sp/>)<sp/>{</highlight></codeline> |
|---|
| 378 | <codeline lineno="365"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>it_assert_debug<sp/>(<sp/>dt.length()<sp/>==<sp/>(<sp/><ref refid="classKalman_1ba17b956df1e38b31fbbc299c8213b6a" kindref="member" tooltip="cache of rvy.count()">dimy</ref>+<ref refid="classKalman_1b0153795a1444b6968a86409c778d9ce" kindref="member" tooltip="cache of rvu.count()">dimu</ref><sp/>),</highlight><highlight class="stringliteral">"KalmanFull::bayes<sp/>wrong<sp/>size<sp/>of<sp/>dt"</highlight><highlight class="normal"><sp/>);</highlight></codeline> |
|---|
| 379 | <codeline lineno="366"><highlight class="normal"></highlight></codeline> |
|---|
| 380 | <codeline lineno="367"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>sq_T<sp/>iRy(<ref refid="classKalman_1ba17b956df1e38b31fbbc299c8213b6a" kindref="member" tooltip="cache of rvy.count()">dimy</ref>,<ref refid="classKalman_1ba17b956df1e38b31fbbc299c8213b6a" kindref="member" tooltip="cache of rvy.count()">dimy</ref>);</highlight></codeline> |
|---|
| 381 | <codeline lineno="368"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>u<sp/>=<sp/>dt.get<sp/>(<sp/><ref refid="classKalman_1ba17b956df1e38b31fbbc299c8213b6a" kindref="member" tooltip="cache of rvy.count()">dimy</ref>,<ref refid="classKalman_1ba17b956df1e38b31fbbc299c8213b6a" kindref="member" tooltip="cache of rvy.count()">dimy</ref>+<ref refid="classKalman_1b0153795a1444b6968a86409c778d9ce" kindref="member" tooltip="cache of rvu.count()">dimu</ref>-1<sp/>);</highlight></codeline> |
|---|
| 382 | <codeline lineno="369"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>y<sp/>=<sp/>dt.get<sp/>(<sp/>0,<ref refid="classKalman_1ba17b956df1e38b31fbbc299c8213b6a" kindref="member" tooltip="cache of rvy.count()">dimy</ref>-1<sp/>);</highlight></codeline> |
|---|
| 383 | <codeline lineno="370"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//Time<sp/>update</highlight><highlight class="normal"></highlight></codeline> |
|---|
| 384 | <codeline lineno="371"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classKalman_1fe803a81d2d847b0b1db3c6b29c18061" kindref="member" tooltip="cache of est.mu">_mu</ref><sp/>=<sp/>pfxu-><ref refid="classdiffbifn_1ad7673e16aa1a046b131b24c731c4632" kindref="member" tooltip="Evaluates (VS: Do we really need common eval? ).">eval</ref><sp/>(<sp/><ref refid="classKalman_1fe803a81d2d847b0b1db3c6b29c18061" kindref="member" tooltip="cache of est.mu">_mu</ref>,<sp/>u<sp/>);</highlight></codeline> |
|---|
| 385 | <codeline lineno="372"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pfxu-><ref refid="classdiffbifn_16d217a02d4fa13931258d4bebdd0feb4" kindref="member" tooltip="Evaluates and writes result into A .">dfdx_cond</ref><sp/>(<sp/><ref refid="classKalman_1fe803a81d2d847b0b1db3c6b29c18061" kindref="member" tooltip="cache of est.mu">_mu</ref>,u,<ref refid="classKalman_15e02efe86ee91e9c74b93b425fe060b9" kindref="member" tooltip="Matrix A.">A</ref>,</highlight><highlight class="keyword">false</highlight><highlight class="normal"><sp/>);<sp/></highlight><highlight class="comment">//update<sp/>A<sp/>by<sp/>a<sp/>derivative<sp/>of<sp/>fx</highlight><highlight class="normal"></highlight></codeline> |
|---|
| 386 | <codeline lineno="373"><highlight class="normal"></highlight></codeline> |
|---|
| 387 | <codeline lineno="374"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//P<sp/><sp/>=<sp/>A*P*A.transpose()<sp/>+<sp/>Q;<sp/>in<sp/>sq_T</highlight><highlight class="normal"></highlight></codeline> |
|---|
| 388 | <codeline lineno="375"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classKalman_19fb808cc94a4c2652e1fb93be9bb7dcf" kindref="member" tooltip="cache of est.R">_P</ref>.<ref refid="classfsqmat_15530d2756b5d991de755e6121c9a452e" kindref="member" tooltip="Inplace symmetric multiplication by a SQUARE matrix , i.e. .">mult_sym</ref><sp/>(<sp/><ref refid="classKalman_15e02efe86ee91e9c74b93b425fe060b9" kindref="member" tooltip="Matrix A.">A</ref><sp/>);</highlight></codeline> |
|---|
| 389 | <codeline lineno="376"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classKalman_19fb808cc94a4c2652e1fb93be9bb7dcf" kindref="member" tooltip="cache of est.R">_P</ref><sp/>+=<ref refid="classKalman_19b69015c800eb93f3ee49da23a6f55d9" kindref="member" tooltip="Matrix Q in square-root form.">Q</ref>;</highlight></codeline> |
|---|
| 390 | <codeline lineno="377"><highlight class="normal"></highlight></codeline> |
|---|
| 391 | <codeline lineno="378"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//Data<sp/>update</highlight><highlight class="normal"></highlight></codeline> |
|---|
| 392 | <codeline lineno="379"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>phxu-><ref refid="classdiffbifn_16d217a02d4fa13931258d4bebdd0feb4" kindref="member" tooltip="Evaluates and writes result into A .">dfdx_cond</ref><sp/>(<sp/><ref refid="classKalman_1fe803a81d2d847b0b1db3c6b29c18061" kindref="member" tooltip="cache of est.mu">_mu</ref>,u,<ref refid="classKalman_186a805cd6515872d1132ad0d6eb5dc13" kindref="member" tooltip="Matrix C.">C</ref>,</highlight><highlight class="keyword">false</highlight><highlight class="normal"><sp/>);<sp/></highlight><highlight class="comment">//update<sp/>C<sp/>by<sp/>a<sp/>derivative<sp/>hx</highlight><highlight class="normal"></highlight></codeline> |
|---|
| 393 | <codeline lineno="380"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//_Ry<sp/>=<sp/>C*P*C.transpose()<sp/>+<sp/>R;<sp/>in<sp/>sq_T</highlight><highlight class="normal"></highlight></codeline> |
|---|
| 394 | <codeline lineno="381"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classKalman_19fb808cc94a4c2652e1fb93be9bb7dcf" kindref="member" tooltip="cache of est.R">_P</ref>.<ref refid="classfsqmat_15530d2756b5d991de755e6121c9a452e" kindref="member" tooltip="Inplace symmetric multiplication by a SQUARE matrix , i.e. .">mult_sym</ref><sp/>(<sp/><ref refid="classKalman_186a805cd6515872d1132ad0d6eb5dc13" kindref="member" tooltip="Matrix C.">C</ref>,<sp/><ref refid="classKalman_145c9f928d2d62e0c884900fb3380f904" kindref="member" tooltip="cache of fy.R">_Ry</ref><sp/>);</highlight></codeline> |
|---|
| 395 | <codeline lineno="382"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(<sp/><ref refid="classKalman_145c9f928d2d62e0c884900fb3380f904" kindref="member" tooltip="cache of fy.R">_Ry</ref><sp/>)<sp/>+=<ref refid="classKalman_111d171dc0e0ab111c56a70f98b97b3ec" kindref="member" tooltip="Matrix R in square-root form.">R</ref>;</highlight></codeline> |
|---|
| 396 | <codeline lineno="383"><highlight class="normal"></highlight></codeline> |
|---|
| 397 | <codeline lineno="384"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mat<sp/>Pfull<sp/>=<sp/><ref refid="classKalman_19fb808cc94a4c2652e1fb93be9bb7dcf" kindref="member" tooltip="cache of est.R">_P</ref>.<ref refid="classfsqmat_1cedf4f048309056f4262c930914dfda8" kindref="member" tooltip="Conversion to full matrix.">to_mat</ref>();</highlight></codeline> |
|---|
| 398 | <codeline lineno="385"><highlight class="normal"></highlight></codeline> |
|---|
| 399 | <codeline lineno="386"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classKalman_145c9f928d2d62e0c884900fb3380f904" kindref="member" tooltip="cache of fy.R">_Ry</ref>.<ref refid="classfsqmat_19fa853e1ca28f2a1a1c43377e798ecb1" kindref="member" tooltip="Matrix inversion preserving the chosen form.">inv</ref><sp/>(<sp/>iRy<sp/>);<sp/></highlight><highlight class="comment">//<sp/>result<sp/>is<sp/>in<sp/>_iRy;</highlight><highlight class="normal"></highlight></codeline> |
|---|
| 400 | <codeline lineno="387"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classKalman_1d422f51467c7a06174af2476d2826132" kindref="member" tooltip="placeholder for Kalman gain">_K</ref><sp/>=<sp/>Pfull*<ref refid="classKalman_186a805cd6515872d1132ad0d6eb5dc13" kindref="member" tooltip="Matrix C.">C</ref>.transpose()<sp/>*<sp/>(<sp/>iRy.to_mat()<sp/>);</highlight></codeline> |
|---|
| 401 | <codeline lineno="388"><highlight class="normal"></highlight></codeline> |
|---|
| 402 | <codeline lineno="389"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>sq_T<sp/>pom<sp/>(<sp/>(<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>)<sp/>Pfull.rows()<sp/>);</highlight></codeline> |
|---|
| 403 | <codeline lineno="390"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>iRy.mult_sym_t<sp/>(<sp/><ref refid="classKalman_186a805cd6515872d1132ad0d6eb5dc13" kindref="member" tooltip="Matrix C.">C</ref>*Pfull,pom<sp/>);</highlight></codeline> |
|---|
| 404 | <codeline lineno="391"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(<ref refid="classKalman_19fb808cc94a4c2652e1fb93be9bb7dcf" kindref="member" tooltip="cache of est.R">_P</ref><sp/>)<sp/>-=<sp/>pom;<sp/></highlight><highlight class="comment">//<sp/>P<sp/>=<sp/>P<sp/>-PC'iRy*CP;</highlight><highlight class="normal"></highlight></codeline> |
|---|
| 405 | <codeline lineno="392"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classKalman_1764bbc95238eda11fc81c5ebd0b1dcfd" kindref="member" tooltip="cache of fy.mu">_yp</ref><sp/>=<sp/>phxu-><ref refid="classdiffbifn_1ad7673e16aa1a046b131b24c731c4632" kindref="member" tooltip="Evaluates (VS: Do we really need common eval? ).">eval</ref><sp/>(<sp/><ref refid="classKalman_1fe803a81d2d847b0b1db3c6b29c18061" kindref="member" tooltip="cache of est.mu">_mu</ref>,u<sp/>);<sp/></highlight><highlight class="comment">//y<sp/>prediction</highlight><highlight class="normal"></highlight></codeline> |
|---|
| 406 | <codeline lineno="393"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(<sp/><ref refid="classKalman_1fe803a81d2d847b0b1db3c6b29c18061" kindref="member" tooltip="cache of est.mu">_mu</ref><sp/>)<sp/>+=<sp/><ref refid="classKalman_1d422f51467c7a06174af2476d2826132" kindref="member" tooltip="placeholder for Kalman gain">_K</ref>*<sp/>(<sp/>y-<ref refid="classKalman_1764bbc95238eda11fc81c5ebd0b1dcfd" kindref="member" tooltip="cache of fy.mu">_yp</ref><sp/>);</highlight></codeline> |
|---|
| 407 | <codeline lineno="394"><highlight class="normal"></highlight></codeline> |
|---|
| 408 | <codeline lineno="395"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<sp/><ref refid="classBM_1bf6fb59b30141074f8ee1e2f43d03129" kindref="member" tooltip="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</ref>==</highlight><highlight class="keyword">true</highlight><highlight class="normal"><sp/>)<sp/>{<ref refid="classBM_15623fef6572a08c2b53b8c87b82dc979" kindref="member" tooltip="Logarithm of marginalized data likelihood.">ll</ref>+=<ref refid="classKalman_1e580ab06483952bd03f2e651763e184f" kindref="member" tooltip="preditive density on $y_t$">fy</ref>.<ref refid="classenorm_1609a7c33dbb4fdfab050f3bdd1122401" kindref="member" tooltip="Compute log-probability of argument val.">evalpdflog</ref><sp/>(<sp/>y<sp/>);}</highlight></codeline> |
|---|
| 409 | <codeline lineno="396"><highlight class="normal">};</highlight></codeline> |
|---|
| 410 | <codeline lineno="397"><highlight class="normal"></highlight></codeline> |
|---|
| 411 | <codeline lineno="398"><highlight class="normal"></highlight></codeline> |
|---|
| 412 | <codeline lineno="399"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/>//<sp/>KF_H</highlight></codeline> |
|---|
| 413 | <codeline lineno="400"><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline> |
|---|
| 414 | <codeline lineno="401"><highlight class="normal"></highlight></codeline> |
|---|
| 415 | </programlisting> |
|---|
| 416 | <location file="/home/smidl/work/git/mixpp/bdm/estim/libKF.h"/> |
|---|
| 417 | </compounddef> |
|---|
| 418 | </doxygen> |
|---|