<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.5.6">
  <compounddef id="chmat_8cpp" kind="file">
    <compoundname>chmat.cpp</compoundname>
    <includes local="no">itpp/itbase.h</includes>
    <includes refid="chmat_8h" local="yes">chmat.h</includes>
    <incdepgraph>
      <node id="283">
        <label>work/git/mixpp/bdm/math/chmat.cpp</label>
        <link refid="chmat.cpp"/>
        <childnode refid="284" relation="include">
        </childnode>
        <childnode refid="285" relation="include">
        </childnode>
      </node>
      <node id="287">
        <label>../itpp_ext.h</label>
        <link refid="itpp__ext_8h-source"/>
        <childnode refid="284" relation="include">
        </childnode>
      </node>
      <node id="284">
        <label>itpp/itbase.h</label>
      </node>
      <node id="285">
        <label>chmat.h</label>
        <link refid="chmat_8h"/>
        <childnode refid="284" relation="include">
        </childnode>
        <childnode refid="286" relation="include">
        </childnode>
        <childnode refid="287" relation="include">
        </childnode>
      </node>
      <node id="286">
        <label>libDC.h</label>
        <link refid="libDC_8h"/>
        <childnode refid="284" relation="include">
        </childnode>
      </node>
    </incdepgraph>
    <briefdescription>
    </briefdescription>
    <detaileddescription>
    </detaileddescription>
    <programlisting>
<codeline lineno="1"><highlight class="preprocessor">#include<sp/>&lt;itpp/itbase.h&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="2"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="chmat_8h" kindref="compound" tooltip="Matrices in decomposed forms (LDL&amp;#39;, LU, UDU&amp;#39;, etc).">chmat.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="3"><highlight class="normal"></highlight></codeline>
<codeline lineno="4"><highlight class="normal"></highlight><highlight class="keyword">using<sp/>namespace<sp/></highlight><highlight class="normal">itpp;</highlight></codeline>
<codeline lineno="5"><highlight class="normal"></highlight></codeline>
<codeline lineno="6"><highlight class="normal"></highlight><highlight class="comment">//using<sp/>std::endl;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="7"><highlight class="normal"></highlight></codeline>
<codeline lineno="8"><highlight class="normal"></highlight></codeline>
<codeline lineno="9" refid="classchmat_1bbc2d98d7455b1f38828907d442836bf" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classchmat_1bbc2d98d7455b1f38828907d442836bf" kindref="member">chmat::opupdt</ref><sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>vec<sp/>&amp;v,<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>w<sp/>)<sp/>{</highlight></codeline>
<codeline lineno="10"><highlight class="normal"></highlight><highlight class="comment">//TODO<sp/>see<sp/>cholupdt<sp/>in<sp/>lhotse</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="11"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mat<sp/>Z;</highlight></codeline>
<codeline lineno="12"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mat<sp/>R;</highlight></codeline>
<codeline lineno="13"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>mat<sp/>V(1,v.length());</highlight></codeline>
<codeline lineno="14"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>V.set_row(0,v*w);</highlight></codeline>
<codeline lineno="15"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Z<sp/>=<sp/>concat_vertical<sp/>(<sp/><ref refid="classchmat_195158bb150f5e7f939168abcd577fd9c" kindref="member" tooltip="Upper triangle of the cholesky matrix.">Ch</ref>,V<sp/>);</highlight></codeline>
<codeline lineno="16"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>qr<sp/>(<sp/>Z,R<sp/>);</highlight></codeline>
<codeline lineno="17"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="classchmat_195158bb150f5e7f939168abcd577fd9c" kindref="member" tooltip="Upper triangle of the cholesky matrix.">Ch</ref><sp/>=<sp/>R<sp/>(<sp/>0,<sp/><ref refid="classchmat_195158bb150f5e7f939168abcd577fd9c" kindref="member" tooltip="Upper triangle of the cholesky matrix.">Ch</ref>.rows()-1,<sp/>0,<sp/><ref refid="classchmat_195158bb150f5e7f939168abcd577fd9c" kindref="member" tooltip="Upper triangle of the cholesky matrix.">Ch</ref>.cols()-1<sp/>);</highlight></codeline>
<codeline lineno="18"><highlight class="normal">};</highlight></codeline>
<codeline lineno="19" refid="classchmat_1a37e2c726e4fc3ad50b26ac2ca6c1452" refkind="member"><highlight class="normal">mat<sp/><ref refid="classchmat_1a37e2c726e4fc3ad50b26ac2ca6c1452" kindref="member" tooltip="Conversion to full matrix.">chmat::to_mat</ref>()<sp/>{mat<sp/>F=<ref refid="classchmat_195158bb150f5e7f939168abcd577fd9c" kindref="member" tooltip="Upper triangle of the cholesky matrix.">Ch</ref>.T()<sp/>*<ref refid="classchmat_195158bb150f5e7f939168abcd577fd9c" kindref="member" tooltip="Upper triangle of the cholesky matrix.">Ch</ref>;</highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>F;};</highlight></codeline>
<codeline lineno="20" refid="classchmat_166f509f92b0ccf020e2a2a32566e0777" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classchmat_166f509f92b0ccf020e2a2a32566e0777" kindref="member" tooltip="Inplace symmetric multiplication by a SQUARE matrix , i.e. .">chmat::mult_sym</ref><sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>mat<sp/>&amp;C<sp/>)<sp/>{</highlight></codeline>
<codeline lineno="21"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>it_error<sp/>(<sp/></highlight><highlight class="stringliteral">&quot;not<sp/>implemented&quot;</highlight><highlight class="normal"><sp/>);</highlight></codeline>
<codeline lineno="22"><highlight class="normal">};</highlight></codeline>
<codeline lineno="23"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classchmat_166f509f92b0ccf020e2a2a32566e0777" kindref="member" tooltip="Inplace symmetric multiplication by a SQUARE matrix , i.e. .">chmat::mult_sym</ref><sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>mat<sp/>&amp;C<sp/>,<sp/><ref refid="classchmat" kindref="compound" tooltip="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</ref><sp/>&amp;U<sp/>)</highlight><highlight class="keyword"><sp/>const<sp/></highlight><highlight class="normal">{</highlight></codeline>
<codeline lineno="24"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>it_error<sp/>(<sp/></highlight><highlight class="stringliteral">&quot;not<sp/>implemented&quot;</highlight><highlight class="normal"><sp/>);</highlight></codeline>
<codeline lineno="25"><highlight class="normal">};</highlight></codeline>
<codeline lineno="26" refid="classchmat_107f50d1332b901eee962e8b1913102f7" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classchmat_107f50d1332b901eee962e8b1913102f7" kindref="member" tooltip="Inplace symmetric multiplication by a SQUARE transpose of matrix , i.e. .">chmat::mult_sym_t</ref><sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>mat<sp/>&amp;C<sp/>)<sp/>{</highlight></codeline>
<codeline lineno="27"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>it_error<sp/>(<sp/></highlight><highlight class="stringliteral">&quot;not<sp/>implemented&quot;</highlight><highlight class="normal"><sp/>);</highlight></codeline>
<codeline lineno="28"><highlight class="normal">};</highlight></codeline>
<codeline lineno="29"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classchmat_107f50d1332b901eee962e8b1913102f7" kindref="member" tooltip="Inplace symmetric multiplication by a SQUARE transpose of matrix , i.e. .">chmat::mult_sym_t</ref><sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>mat<sp/>&amp;C,<sp/><ref refid="classchmat" kindref="compound" tooltip="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</ref><sp/>&amp;U<sp/>)</highlight><highlight class="keyword"><sp/>const<sp/></highlight><highlight class="normal">{</highlight></codeline>
<codeline lineno="30"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>it_error<sp/>(<sp/></highlight><highlight class="stringliteral">&quot;not<sp/>implemented&quot;</highlight><highlight class="normal"><sp/>);</highlight></codeline>
<codeline lineno="31"><highlight class="normal">};</highlight></codeline>
<codeline lineno="32" refid="classchmat_1b504ca818203b13e667cb3c503980382" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/><ref refid="classchmat_1b504ca818203b13e667cb3c503980382" kindref="member" tooltip="Logarithm of a determinant.">chmat::logdet</ref>()</highlight><highlight class="keyword"><sp/>const<sp/></highlight><highlight class="normal">{</highlight></codeline>
<codeline lineno="33"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>ldet=0.0;<sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>i;</highlight></codeline>
<codeline lineno="34"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//sum<sp/>of<sp/>logs<sp/>of<sp/>(possibly<sp/>negative!)<sp/>diagonal<sp/>entries</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="35"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(<sp/>i=0;i&lt;<ref refid="classchmat_195158bb150f5e7f939168abcd577fd9c" kindref="member" tooltip="Upper triangle of the cholesky matrix.">Ch</ref>.rows();i++<sp/>)<sp/>{ldet+=log<sp/>(<sp/>std::fabs<sp/>(<sp/><ref refid="classchmat_195158bb150f5e7f939168abcd577fd9c" kindref="member" tooltip="Upper triangle of the cholesky matrix.">Ch</ref><sp/>(<sp/>i,i<sp/>)<sp/>)<sp/>);}</highlight></codeline>
<codeline lineno="36"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>2*ldet;<sp/></highlight><highlight class="comment">//compensate<sp/>for<sp/>Ch<sp/>being<sp/>sqrt()</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="37"><highlight class="normal">};</highlight></codeline>
<codeline lineno="38"><highlight class="normal"></highlight><highlight class="comment">//TODO<sp/>can<sp/>be<sp/>done<sp/>more<sp/>efficiently<sp/>using<sp/>BLAS,<sp/>see<sp/>triangular<sp/>matrices</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="39" refid="classchmat_1b22aa239dbaca33e3fb93b4f674d7051" refkind="member"><highlight class="normal">vec<sp/><ref refid="classchmat_1b22aa239dbaca33e3fb93b4f674d7051" kindref="member" tooltip="Multiplies square root of  by vector .">chmat::sqrt_mult</ref><sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>vec<sp/>&amp;v<sp/>)</highlight><highlight class="keyword"><sp/>const<sp/></highlight><highlight class="normal">{vec<sp/>pom;<sp/>pom<sp/>=<sp/><ref refid="classchmat_195158bb150f5e7f939168abcd577fd9c" kindref="member" tooltip="Upper triangle of the cholesky matrix.">Ch</ref>*v;<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>pom;};</highlight></codeline>
<codeline lineno="40" refid="classchmat_16807737c7ffdb7041256b51db7592248" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/><ref refid="classchmat_16807737c7ffdb7041256b51db7592248" kindref="member" tooltip="Evaluates quadratic form ;.">chmat::qform</ref><sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>vec<sp/>&amp;v<sp/>)</highlight><highlight class="keyword"><sp/>const<sp/></highlight><highlight class="normal">{vec<sp/>pom;<sp/>pom<sp/>=<sp/><ref refid="classchmat_195158bb150f5e7f939168abcd577fd9c" kindref="member" tooltip="Upper triangle of the cholesky matrix.">Ch</ref>*v;<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>pom*pom;};</highlight></codeline>
<codeline lineno="41" refid="classchmat_1b49427cff186c62f5df3724e5d2c34b4" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/><ref refid="classchmat_1b49427cff186c62f5df3724e5d2c34b4" kindref="member" tooltip="Evaluates quadratic form ;.">chmat::invqform</ref><sp/>(<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>vec<sp/>&amp;v<sp/>)</highlight><highlight class="keyword"><sp/>const<sp/></highlight><highlight class="normal">{</highlight></codeline>
<codeline lineno="42"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>vec<sp/>pom(v.length());</highlight></codeline>
<codeline lineno="43"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>forward_substitution(<ref refid="classchmat_195158bb150f5e7f939168abcd577fd9c" kindref="member" tooltip="Upper triangle of the cholesky matrix.">Ch</ref>.T(),v,pom);</highlight></codeline>
<codeline lineno="44"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>pom*pom;</highlight></codeline>
<codeline lineno="45"><highlight class="normal">};</highlight></codeline>
<codeline lineno="46" refid="classchmat_1d0a995d312ecc11d3b43693f5e224ba9" refkind="member"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classchmat_1d0a995d312ecc11d3b43693f5e224ba9" kindref="member" tooltip="Clearing matrix so that it corresponds to zeros.">chmat::clear</ref>()<sp/>{<ref refid="classchmat_195158bb150f5e7f939168abcd577fd9c" kindref="member" tooltip="Upper triangle of the cholesky matrix.">Ch</ref>.clear();};</highlight></codeline>
    </programlisting>
    <location file="/home/smidl/work/git/mixpp/bdm/math/chmat.cpp"/>
  </compounddef>
</doxygen>
