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="matlab_2mex_2arx_8cpp" kind="file"> |
---|
4 | <compoundname>arx.cpp</compoundname> |
---|
5 | <includes local="no">itpp/itcomm.h</includes> |
---|
6 | <includes local="no">itpp/itmex.h</includes> |
---|
7 | <includes refid="arx_8h" local="yes">../../bdm/estim/arx.h</includes> |
---|
8 | <incdepgraph> |
---|
9 | <node id="199"> |
---|
10 | <label>libBM.h</label> |
---|
11 | <link refid="libBM_8h"/> |
---|
12 | <childnode refid="197" relation="include"> |
---|
13 | </childnode> |
---|
14 | </node> |
---|
15 | <node id="195"> |
---|
16 | <label>itpp/itmex.h</label> |
---|
17 | </node> |
---|
18 | <node id="202"> |
---|
19 | <label>../itpp_ext.h</label> |
---|
20 | <link refid="itpp__ext_8h-source"/> |
---|
21 | <childnode refid="197" relation="include"> |
---|
22 | </childnode> |
---|
23 | </node> |
---|
24 | <node id="193"> |
---|
25 | <label>work/git/mixpp/matlab/mex/arx.cpp</label> |
---|
26 | <link refid="matlab/mex/arx.cpp"/> |
---|
27 | <childnode refid="194" relation="include"> |
---|
28 | </childnode> |
---|
29 | <childnode refid="195" relation="include"> |
---|
30 | </childnode> |
---|
31 | <childnode refid="196" relation="include"> |
---|
32 | </childnode> |
---|
33 | </node> |
---|
34 | <node id="200"> |
---|
35 | <label>../stat/libEF.h</label> |
---|
36 | <link refid="libEF_8h"/> |
---|
37 | <childnode refid="197" relation="include"> |
---|
38 | </childnode> |
---|
39 | <childnode refid="201" relation="include"> |
---|
40 | </childnode> |
---|
41 | <childnode refid="199" relation="include"> |
---|
42 | </childnode> |
---|
43 | <childnode refid="202" relation="include"> |
---|
44 | </childnode> |
---|
45 | </node> |
---|
46 | <node id="196"> |
---|
47 | <label>../../bdm/estim/arx.h</label> |
---|
48 | <link refid="arx_8h"/> |
---|
49 | <childnode refid="197" relation="include"> |
---|
50 | </childnode> |
---|
51 | <childnode refid="198" relation="include"> |
---|
52 | </childnode> |
---|
53 | <childnode refid="200" relation="include"> |
---|
54 | </childnode> |
---|
55 | </node> |
---|
56 | <node id="198"> |
---|
57 | <label>../stat/libFN.h</label> |
---|
58 | <link refid="libFN_8h-source"/> |
---|
59 | <childnode refid="197" relation="include"> |
---|
60 | </childnode> |
---|
61 | <childnode refid="199" relation="include"> |
---|
62 | </childnode> |
---|
63 | </node> |
---|
64 | <node id="197"> |
---|
65 | <label>itpp/itbase.h</label> |
---|
66 | </node> |
---|
67 | <node id="194"> |
---|
68 | <label>itpp/itcomm.h</label> |
---|
69 | </node> |
---|
70 | <node id="201"> |
---|
71 | <label>../math/libDC.h</label> |
---|
72 | <link refid="libDC_8h"/> |
---|
73 | <childnode refid="197" relation="include"> |
---|
74 | </childnode> |
---|
75 | </node> |
---|
76 | </incdepgraph> |
---|
77 | <sectiondef kind="func"> |
---|
78 | <memberdef kind="function" id="matlab_2mex_2arx_8cpp_182033299688d607730e08333ff7471f8" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> |
---|
79 | <type>void</type> |
---|
80 | <definition>void mexFunction</definition> |
---|
81 | <argsstring>(int n_output, mxArray *output[], int n_input, const mxArray *input[])</argsstring> |
---|
82 | <name>mexFunction</name> |
---|
83 | <param> |
---|
84 | <type>int</type> |
---|
85 | <declname>n_output</declname> |
---|
86 | </param> |
---|
87 | <param> |
---|
88 | <type>mxArray *</type> |
---|
89 | <declname>output</declname> |
---|
90 | <array>[]</array> |
---|
91 | </param> |
---|
92 | <param> |
---|
93 | <type>int</type> |
---|
94 | <declname>n_input</declname> |
---|
95 | </param> |
---|
96 | <param> |
---|
97 | <type>const mxArray *</type> |
---|
98 | <declname>input</declname> |
---|
99 | <array>[]</array> |
---|
100 | </param> |
---|
101 | <briefdescription> |
---|
102 | </briefdescription> |
---|
103 | <detaileddescription> |
---|
104 | </detaileddescription> |
---|
105 | <inbodydescription> |
---|
106 | </inbodydescription> |
---|
107 | <location file="/home/smidl/work/git/mixpp/matlab/mex/arx.cpp" line="8" bodyfile="/home/smidl/work/git/mixpp/matlab/mex/arx.cpp" bodystart="8" bodyend="47"/> |
---|
108 | </memberdef> |
---|
109 | </sectiondef> |
---|
110 | <briefdescription> |
---|
111 | </briefdescription> |
---|
112 | <detaileddescription> |
---|
113 | </detaileddescription> |
---|
114 | <programlisting> |
---|
115 | <codeline lineno="1"><highlight class="preprocessor">#include<sp/><itpp/itcomm.h></highlight><highlight class="normal"></highlight></codeline> |
---|
116 | <codeline lineno="2"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/><itpp/itmex.h></highlight><highlight class="normal"></highlight></codeline> |
---|
117 | <codeline lineno="3"><highlight class="normal"></highlight></codeline> |
---|
118 | <codeline lineno="4"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>"../../bdm/estim/arx.h"</highlight><highlight class="normal"></highlight></codeline> |
---|
119 | <codeline lineno="5"><highlight class="normal"></highlight></codeline> |
---|
120 | <codeline lineno="6"><highlight class="normal"></highlight><highlight class="keyword">using<sp/>namespace<sp/></highlight><highlight class="normal">itpp;</highlight></codeline> |
---|
121 | <codeline lineno="7"><highlight class="normal"></highlight></codeline> |
---|
122 | <codeline lineno="8"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>mexFunction<sp/>(<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>n_output,<sp/>mxArray<sp/>*output[],<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>n_input,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>mxArray<sp/>*input[]<sp/>)<sp/>{</highlight></codeline> |
---|
123 | <codeline lineno="9"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Check<sp/>the<sp/>number<sp/>of<sp/>inputs<sp/>and<sp/>output<sp/>arguments</highlight><highlight class="normal"></highlight></codeline> |
---|
124 | <codeline lineno="10"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<sp/>n_output<1<sp/>)<sp/>mexErrMsgTxt<sp/>(<sp/></highlight><highlight class="stringliteral">"Wrong<sp/>number<sp/>of<sp/>output<sp/>variables!"</highlight><highlight class="normal"><sp/>);</highlight></codeline> |
---|
125 | <codeline lineno="11"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<sp/>n_input!=1<sp/>)<sp/>mexErrMsgTxt<sp/>(<sp/></highlight><highlight class="stringliteral">"Wrong<sp/>number<sp/>of<sp/>input<sp/>variables!"</highlight><highlight class="normal"><sp/>);</highlight></codeline> |
---|
126 | <codeline lineno="12"><highlight class="normal"></highlight></codeline> |
---|
127 | <codeline lineno="13"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Convert<sp/>input<sp/>variables<sp/>to<sp/>IT++<sp/>format</highlight><highlight class="normal"></highlight></codeline> |
---|
128 | <codeline lineno="14"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mat<sp/>Data<sp/>=<sp/>mxArray2mat<sp/>(<sp/>input[0]<sp/>);</highlight></codeline> |
---|
129 | <codeline lineno="15"><highlight class="normal"></highlight></codeline> |
---|
130 | <codeline lineno="16"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>------------------<sp/>Start<sp/>of<sp/>routine<sp/>---------------------------</highlight><highlight class="normal"></highlight></codeline> |
---|
131 | <codeline lineno="17"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>ndat=Data.cols();</highlight></codeline> |
---|
132 | <codeline lineno="18"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>npsi=Data.rows();</highlight></codeline> |
---|
133 | <codeline lineno="19"><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/>thr<sp/>(<sp/></highlight><highlight class="stringliteral">"1"</highlight><highlight class="normal">,</highlight><highlight class="stringliteral">"{<sp/>theta_r<sp/>}"</highlight><highlight class="normal">,vec_1<sp/>(<sp/>npsi<sp/>),vec_1<sp/>(<sp/>0<sp/>)<sp/>);</highlight></codeline> |
---|
134 | <codeline lineno="20"><highlight class="normal"></highlight></codeline> |
---|
135 | <codeline lineno="21"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mat<sp/>V0=1e-8*eye<sp/>(<sp/>npsi<sp/>);<sp/>V0<sp/>(<sp/>0,0<sp/>)<sp/>*=100.0;</highlight></codeline> |
---|
136 | <codeline lineno="22"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>nu0=npsi;</highlight></codeline> |
---|
137 | <codeline lineno="23"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classARX" kindref="compound" tooltip="Linear Autoregressive model with Gaussian noise.">ARX</ref><sp/>Ar<sp/>(<sp/>thr,V0,nu0<sp/>);</highlight></codeline> |
---|
138 | <codeline lineno="24"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>estimate</highlight><highlight class="normal"></highlight></codeline> |
---|
139 | <codeline lineno="25"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(</highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i=0;i<ndat;i++<sp/>)<sp/>{Ar.bayes<sp/>(<sp/>Data.get_col<sp/>(<sp/>i<sp/>)<sp/>);<sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> |
---|
140 | <codeline lineno="26"><highlight class="normal"></highlight></codeline> |
---|
141 | <codeline lineno="27"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>th<sp/>=<sp/>Ar._epdf().mean();</highlight></codeline> |
---|
142 | <codeline lineno="28"><highlight class="normal"></highlight></codeline> |
---|
143 | <codeline lineno="29"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>------------------<sp/>End<sp/>of<sp/>routine<sp/>-----------------------------</highlight><highlight class="normal"></highlight></codeline> |
---|
144 | <codeline lineno="30"><highlight class="normal"></highlight></codeline> |
---|
145 | <codeline lineno="31"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Create<sp/>output<sp/>vectors</highlight><highlight class="normal"></highlight></codeline> |
---|
146 | <codeline lineno="32"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>output[0]<sp/>=<sp/>mxCreateDoubleMatrix<sp/>(<sp/>1,th.length(),<sp/>mxREAL<sp/>);</highlight></codeline> |
---|
147 | <codeline lineno="33"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Convert<sp/>the<sp/>IT++<sp/>format<sp/>to<sp/>Matlab<sp/>format<sp/>for<sp/>output</highlight><highlight class="normal"></highlight></codeline> |
---|
148 | <codeline lineno="34"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec2mxArray<sp/>(<sp/>th,<sp/>output[0]<sp/>);</highlight></codeline> |
---|
149 | <codeline lineno="35"><highlight class="normal"></highlight></codeline> |
---|
150 | <codeline lineno="36"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<sp/>n_output>1<sp/>)<sp/>{</highlight></codeline> |
---|
151 | <codeline lineno="37"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>ll=Ar._tll();</highlight></codeline> |
---|
152 | <codeline lineno="38"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>output[1]<sp/>=<sp/>mxCreateDoubleMatrix<sp/>(<sp/>1,1,<sp/>mxREAL<sp/>);</highlight></codeline> |
---|
153 | <codeline lineno="39"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>double2mxArray<sp/>(<sp/>ll,<sp/>output[1]<sp/>);</highlight></codeline> |
---|
154 | <codeline lineno="40"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> |
---|
155 | <codeline lineno="41"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline> |
---|
156 | <codeline lineno="42"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<sp/>n_output>2<sp/>)<sp/>{</highlight></codeline> |
---|
157 | <codeline lineno="43"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ivec<sp/><ref refid="classstr" kindref="compound" tooltip="Structure of RV (used internally).">str</ref><sp/>=<sp/>Ar.structure_est<sp/>(<sp/><ref refid="classegiw" kindref="compound" tooltip="Gauss-inverse-Wishart density stored in LD form.">egiw</ref><sp/>(<sp/>thr,V0,nu0<sp/>)<sp/>);</highlight></codeline> |
---|
158 | <codeline lineno="44"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>output[2]<sp/>=<sp/>mxCreateDoubleMatrix<sp/>(<sp/>1,str.length(),<sp/>mxREAL<sp/>);</highlight></codeline> |
---|
159 | <codeline lineno="45"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ivec2mxArray<sp/>(<sp/>str,<sp/>output[2]<sp/>);</highlight></codeline> |
---|
160 | <codeline lineno="46"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline> |
---|
161 | <codeline lineno="47"><highlight class="normal">}</highlight></codeline> |
---|
162 | </programlisting> |
---|
163 | <location file="/home/smidl/work/git/mixpp/matlab/mex/arx.cpp"/> |
---|
164 | </compounddef> |
---|
165 | </doxygen> |
---|