<?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.8.14">
  <compounddef id="argsort_8h" kind="file" language="C++">
    <compoundname>argsort.h</compoundname>
    <includes local="no">vector</includes>
    <includes local="no">random</includes>
    <includes local="no">type_traits</includes>
    <includes local="no">algorithm</includes>
    <includes refid="global_8h" local="yes">../global.h</includes>
    <incdepgraph>
      <node id="1193">
        <label>iomanip</label>
      </node>
      <node id="1192">
        <label>glog/logging.h</label>
      </node>
      <node id="1197">
        <label>string</label>
      </node>
      <node id="1196">
        <label>./version.h</label>
        <link refid="version_8h"/>
      </node>
      <node id="1188">
        <label>random</label>
      </node>
      <node id="1187">
        <label>vector</label>
      </node>
      <node id="1194">
        <label>iostream</label>
      </node>
      <node id="1191">
        <label>../global.h</label>
        <link refid="global_8h"/>
        <childnode refid="1192" relation="include">
        </childnode>
        <childnode refid="1193" relation="include">
        </childnode>
        <childnode refid="1194" relation="include">
        </childnode>
        <childnode refid="1195" relation="include">
        </childnode>
        <childnode refid="1196" relation="include">
        </childnode>
        <childnode refid="1197" relation="include">
        </childnode>
        <childnode refid="1198" relation="include">
        </childnode>
      </node>
      <node id="1198">
        <label>csignal</label>
      </node>
      <node id="1195">
        <label>thread</label>
      </node>
      <node id="1186">
        <label>/Users/classner/git/forpy/include/forpy/util/argsort.h</label>
        <link refid="argsort_8h"/>
        <childnode refid="1187" relation="include">
        </childnode>
        <childnode refid="1188" relation="include">
        </childnode>
        <childnode refid="1189" relation="include">
        </childnode>
        <childnode refid="1190" relation="include">
        </childnode>
        <childnode refid="1191" relation="include">
        </childnode>
      </node>
      <node id="1189">
        <label>type_traits</label>
      </node>
      <node id="1190">
        <label>algorithm</label>
      </node>
    </incdepgraph>
    <innernamespace refid="namespaceforpy">forpy</innernamespace>
      <sectiondef kind="define">
      <memberdef kind="define" id="argsort_8h_1ad59dfd61290ae37307cab44c57210d05" prot="public" static="no">
        <name>FORPY_UTIL_ARGSORT_H_</name>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/Users/classner/git/forpy/include/forpy/util/argsort.h" line="4" column="9" bodyfile="/Users/classner/git/forpy/include/forpy/util/argsort.h" bodystart="4" bodyend="-1"/>
      </memberdef>
      </sectiondef>
    <briefdescription>
    </briefdescription>
    <detaileddescription>
    </detaileddescription>
    <programlisting>
<codeline lineno="1"><highlight class="comment">/*<sp/>Author:<sp/>Christoph<sp/>Lassner<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="2"><highlight class="normal"></highlight><highlight class="preprocessor">#pragma<sp/>once</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="3"><highlight class="normal"></highlight><highlight class="preprocessor">#ifndef<sp/>FORPY_UTIL_ARGSORT_H_</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="4" refid="argsort_8h_1ad59dfd61290ae37307cab44c57210d05" refkind="member"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>FORPY_UTIL_ARGSORT_H_</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="5"><highlight class="normal"></highlight></codeline>
<codeline lineno="6"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;vector&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="7"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;random&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="8"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;type_traits&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="9"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;algorithm&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="10"><highlight class="normal"></highlight></codeline>
<codeline lineno="11"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;../global.h&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="12"><highlight class="normal"></highlight></codeline>
<codeline lineno="13"><highlight class="normal"></highlight><highlight class="keyword">namespace<sp/></highlight><highlight class="normal"><ref refid="namespaceforpy" kindref="compound">forpy</ref><sp/>{</highlight></codeline>
<codeline lineno="23"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">template</highlight><highlight class="normal"><sp/>&lt;</highlight><highlight class="keyword">typename</highlight><highlight class="normal"><sp/>T&gt;</highlight></codeline>
<codeline lineno="24" refid="namespaceforpy_1a97ab9ad9bdd19cb6b84357b6eecf63cd" refkind="member"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/>std::vector&lt;size_t&gt;<sp/><ref refid="namespaceforpy_1a97ab9ad9bdd19cb6b84357b6eecf63cd" kindref="member">argsort</ref>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>T<sp/>*v,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">size_t</highlight><highlight class="normal"><sp/>n)<sp/>{</highlight></codeline>
<codeline lineno="25"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Initialize<sp/>original<sp/>index<sp/>vector.</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="26"><highlight class="normal"><sp/><sp/><sp/><sp/>std::vector&lt;size_t&gt;<sp/>idx(n);</highlight></codeline>
<codeline lineno="27"><highlight class="normal"><sp/><sp/><sp/><sp/>std::iota(idx.begin(),<sp/>idx.end(),<sp/>0);</highlight></codeline>
<codeline lineno="28"><highlight class="normal"></highlight></codeline>
<codeline lineno="29"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Sort<sp/>the<sp/>indexes<sp/>based<sp/>on<sp/>values<sp/>in<sp/>v.</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="30"><highlight class="normal"><sp/><sp/><sp/><sp/>std::sort(idx.begin(),<sp/>idx.end(),</highlight></codeline>
<codeline lineno="31"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>[&amp;v](</highlight><highlight class="keywordtype">size_t</highlight><highlight class="normal"><sp/>i1,<sp/></highlight><highlight class="keywordtype">size_t</highlight><highlight class="normal"><sp/>i2)<sp/>{<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>v[i1]<sp/>&lt;<sp/>v[i2];<sp/>});</highlight></codeline>
<codeline lineno="32"><highlight class="normal"></highlight></codeline>
<codeline lineno="33"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>idx;</highlight></codeline>
<codeline lineno="34"><highlight class="normal"><sp/><sp/>};</highlight></codeline>
<codeline lineno="35"><highlight class="normal"></highlight></codeline>
<codeline lineno="44"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">template</highlight><highlight class="normal"><sp/>&lt;</highlight><highlight class="keyword">typename</highlight><highlight class="normal"><sp/>T&gt;</highlight></codeline>
<codeline lineno="45" refid="namespaceforpy_1a652c46a292200fc5081bc68a8ae132e2" refkind="member"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/>std::vector&lt;size_t&gt;<sp/><ref refid="namespaceforpy_1a97ab9ad9bdd19cb6b84357b6eecf63cd" kindref="member">argsort</ref>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>std::vector&lt;T&gt;<sp/>&amp;v)<sp/>{</highlight></codeline>
<codeline lineno="46"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="namespaceforpy_1a97ab9ad9bdd19cb6b84357b6eecf63cd" kindref="member">argsort</ref>(&amp;v[0],<sp/>v.size());</highlight></codeline>
<codeline lineno="47"><highlight class="normal"><sp/><sp/>};</highlight></codeline>
<codeline lineno="48"><highlight class="normal">};<sp/><sp/></highlight><highlight class="comment">//<sp/>namespace<sp/>forpy</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="49"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/><sp/>//<sp/>FORPY_UTIL_ARGSORT_H_</highlight></codeline>
    </programlisting>
    <location file="/Users/classner/git/forpy/include/forpy/util/argsort.h"/>
  </compounddef>
</doxygen>
