<?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.20" xml:lang="en-US">
  <compounddef id="mathutil_8cpp" kind="file" language="C++">
    <compoundname>mathutil.cpp</compoundname>
    <includes refid="mathutil_8hpp" local="yes">mathutil.hpp</includes>
    <includes local="no">iostream</includes>
    <incdepgraph>
      <node id="2">
        <label>mathutil.hpp</label>
        <link refid="mathutil_8hpp"/>
        <childnode refid="3" relation="include">
        </childnode>
        <childnode refid="4" relation="include">
        </childnode>
        <childnode refid="5" relation="include">
        </childnode>
        <childnode refid="6" relation="include">
        </childnode>
      </node>
      <node id="5">
        <label>cmath</label>
      </node>
      <node id="4">
        <label>numeric</label>
      </node>
      <node id="7">
        <label>tuple</label>
      </node>
      <node id="3">
        <label>vector</label>
      </node>
      <node id="9">
        <label>sstream</label>
      </node>
      <node id="6">
        <label>multiarr.hpp</label>
        <link refid="multiarr_8hpp"/>
        <childnode refid="3" relation="include">
        </childnode>
        <childnode refid="7" relation="include">
        </childnode>
        <childnode refid="8" relation="include">
        </childnode>
        <childnode refid="9" relation="include">
        </childnode>
      </node>
      <node id="10">
        <label>iostream</label>
      </node>
      <node id="8">
        <label>algorithm</label>
      </node>
      <node id="1">
        <label>/Users/robertshaw/devfiles/libecpint/src/lib/mathutil.cpp</label>
        <link refid="mathutil_8cpp"/>
        <childnode refid="2" relation="include">
        </childnode>
        <childnode refid="10" relation="include">
        </childnode>
      </node>
    </incdepgraph>
    <innernamespace refid="namespacelibecpint">libecpint</innernamespace>
      <sectiondef kind="define">
      <memberdef kind="define" id="mathutil_8cpp_1a9450534f682d7a567d3872551afa2ec4" prot="public" static="no">
        <name>FAC_INIT</name>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/Users/robertshaw/devfiles/libecpint/src/lib/mathutil.cpp" line="59" column="10"/>
      </memberdef>
      </sectiondef>
    <briefdescription>
    </briefdescription>
    <detaileddescription>
    </detaileddescription>
    <programlisting>
<codeline lineno="1"><highlight class="comment">/*<sp/></highlight></codeline>
<codeline lineno="2"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/><sp/><sp/>Copyright<sp/>(c)<sp/>2020<sp/>Robert<sp/>Shaw</highlight></codeline>
<codeline lineno="3"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/><sp/><sp/>This<sp/>file<sp/>is<sp/>a<sp/>part<sp/>of<sp/>Libecpint.</highlight></codeline>
<codeline lineno="4"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="5"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/><sp/><sp/>Permission<sp/>is<sp/>hereby<sp/>granted,<sp/>free<sp/>of<sp/>charge,<sp/>to<sp/>any<sp/>person<sp/>obtaining</highlight></codeline>
<codeline lineno="6"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/><sp/><sp/>a<sp/>copy<sp/>of<sp/>this<sp/>software<sp/>and<sp/>associated<sp/>documentation<sp/>files<sp/>(the</highlight></codeline>
<codeline lineno="7"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/><sp/><sp/>&quot;Software&quot;),<sp/>to<sp/>deal<sp/>in<sp/>the<sp/>Software<sp/>without<sp/>restriction,<sp/>including</highlight></codeline>
<codeline lineno="8"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/><sp/><sp/>without<sp/>limitation<sp/>the<sp/>rights<sp/>to<sp/>use,<sp/>copy,<sp/>modify,<sp/>merge,<sp/>publish,</highlight></codeline>
<codeline lineno="9"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/><sp/><sp/>distribute,<sp/>sublicense,<sp/>and/or<sp/>sell<sp/>copies<sp/>of<sp/>the<sp/>Software,<sp/>and<sp/>to</highlight></codeline>
<codeline lineno="10"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/><sp/><sp/>permit<sp/>persons<sp/>to<sp/>whom<sp/>the<sp/>Software<sp/>is<sp/>furnished<sp/>to<sp/>do<sp/>so,<sp/>subject<sp/>to</highlight></codeline>
<codeline lineno="11"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/><sp/><sp/>the<sp/>following<sp/>conditions:</highlight></codeline>
<codeline lineno="12"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="13"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/><sp/><sp/>The<sp/>above<sp/>copyright<sp/>notice<sp/>and<sp/>this<sp/>permission<sp/>notice<sp/>shall<sp/>be</highlight></codeline>
<codeline lineno="14"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/><sp/><sp/>included<sp/>in<sp/>all<sp/>copies<sp/>or<sp/>substantial<sp/>portions<sp/>of<sp/>the<sp/>Software.</highlight></codeline>
<codeline lineno="15"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="16"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/><sp/><sp/>THE<sp/>SOFTWARE<sp/>IS<sp/>PROVIDED<sp/>&quot;AS<sp/>IS&quot;,<sp/>WITHOUT<sp/>WARRANTY<sp/>OF<sp/>ANY<sp/>KIND,</highlight></codeline>
<codeline lineno="17"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/><sp/><sp/>EXPRESS<sp/>OR<sp/>IMPLIED,<sp/>INCLUDING<sp/>BUT<sp/>NOT<sp/>LIMITED<sp/>TO<sp/>THE<sp/>WARRANTIES<sp/>OF</highlight></codeline>
<codeline lineno="18"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/><sp/><sp/>MERCHANTABILITY,<sp/>FITNESS<sp/>FOR<sp/>A<sp/>PARTICULAR<sp/>PURPOSE<sp/>AND</highlight></codeline>
<codeline lineno="19"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/><sp/><sp/>NONINFRINGEMENT.<sp/>IN<sp/>NO<sp/>EVENT<sp/>SHALL<sp/>THE<sp/>AUTHORS<sp/>OR<sp/>COPYRIGHT<sp/>HOLDERS<sp/>BE</highlight></codeline>
<codeline lineno="20"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/><sp/><sp/>LIABLE<sp/>FOR<sp/>ANY<sp/>CLAIM,<sp/>DAMAGES<sp/>OR<sp/>OTHER<sp/>LIABILITY,<sp/>WHETHER<sp/>IN<sp/>AN<sp/>ACTION</highlight></codeline>
<codeline lineno="21"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/><sp/><sp/>OF<sp/>CONTRACT,<sp/>TORT<sp/>OR<sp/>OTHERWISE,<sp/>ARISING<sp/>FROM,<sp/>OUT<sp/>OF<sp/>OR<sp/>IN<sp/>CONNECTION</highlight></codeline>
<codeline lineno="22"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/><sp/><sp/>WITH<sp/>THE<sp/>SOFTWARE<sp/>OR<sp/>THE<sp/>USE<sp/>OR<sp/>OTHER<sp/>DEALINGS<sp/>IN<sp/>THE<sp/>SOFTWARE.</highlight></codeline>
<codeline lineno="23"><highlight class="comment"><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="24"><highlight class="normal"></highlight></codeline>
<codeline lineno="25"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="mathutil_8hpp" kindref="compound">mathutil.hpp</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="26"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;iostream&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="27"><highlight class="normal"></highlight></codeline>
<codeline lineno="28"><highlight class="normal"></highlight><highlight class="keyword">namespace<sp/></highlight><highlight class="normal"><ref refid="namespacelibecpint" kindref="compound">libecpint</ref><sp/>{</highlight></codeline>
<codeline lineno="29"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight></codeline>
<codeline lineno="30" refid="namespacelibecpint_1a975e7b9e0f57709418adede308d80405" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/><ref refid="namespacelibecpint_1a975e7b9e0f57709418adede308d80405" kindref="member">FAC</ref>[<ref refid="mathutil_8hpp_1aaf00c7de57af68f4e9d7acc87adb8d87" kindref="member">MAX_FAC</ref>];</highlight></codeline>
<codeline lineno="31" refid="namespacelibecpint_1a4ecb557cc8bf8d94cfa80855985007bf" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/><ref refid="namespacelibecpint_1a4ecb557cc8bf8d94cfa80855985007bf" kindref="member">DFAC</ref>[<ref refid="mathutil_8hpp_1a30bbac291639d5f7d964a92fa8742b94" kindref="member">MAX_DFAC</ref>];</highlight></codeline>
<codeline lineno="32"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight></codeline>
<codeline lineno="33" refid="namespacelibecpint_1a3d3ec1164653607a1a2a66e71c160905" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/><ref refid="namespacelibecpint_1a3d3ec1164653607a1a2a66e71c160905" kindref="member">pow_m2</ref>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z)<sp/>{<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>1.0/(z*z);<sp/>}</highlight></codeline>
<codeline lineno="34" refid="namespacelibecpint_1af586e0d10f4e89ae23350208eae35381" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/><ref refid="namespacelibecpint_1af586e0d10f4e89ae23350208eae35381" kindref="member">pow_m1</ref>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z)<sp/>{<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>1.0/z;<sp/>}</highlight></codeline>
<codeline lineno="35" refid="namespacelibecpint_1a321e63264d2ee5ec80e5aa98ab5f2a31" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/><ref refid="namespacelibecpint_1a321e63264d2ee5ec80e5aa98ab5f2a31" kindref="member">pow_0</ref>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z)<sp/>{<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>1.0;<sp/>}</highlight></codeline>
<codeline lineno="36" refid="namespacelibecpint_1ab8d8f23abac900581a1b074df5151bfa" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/><ref refid="namespacelibecpint_1ab8d8f23abac900581a1b074df5151bfa" kindref="member">pow_1</ref>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z)<sp/>{<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>z;<sp/>}</highlight></codeline>
<codeline lineno="37" refid="namespacelibecpint_1aeea8f0398e91f9c4c0abc5087c68208a" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/><ref refid="namespacelibecpint_1aeea8f0398e91f9c4c0abc5087c68208a" kindref="member">pow_2</ref>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z)<sp/>{<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>z*z;<sp/>}</highlight></codeline>
<codeline lineno="38" refid="namespacelibecpint_1adb6835f6678e044793635ea74137610c" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/><ref refid="namespacelibecpint_1adb6835f6678e044793635ea74137610c" kindref="member">pow_3</ref>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z)<sp/>{<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>z*z*z;<sp/>}</highlight></codeline>
<codeline lineno="39" refid="namespacelibecpint_1af1b4030182805b2b87939f0be0bb1f68" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/><ref refid="namespacelibecpint_1af1b4030182805b2b87939f0be0bb1f68" kindref="member">pow_4</ref>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z)<sp/>{<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z2<sp/>=<sp/>z*z;<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>z2*z2;<sp/>}</highlight></codeline>
<codeline lineno="40" refid="namespacelibecpint_1ae8e9cac2c5167fee6077b8d5b38c879d" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/><ref refid="namespacelibecpint_1ae8e9cac2c5167fee6077b8d5b38c879d" kindref="member">pow_5</ref>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z)<sp/>{<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z2<sp/>=<sp/>z*z;<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z3<sp/>=<sp/>z2*z;<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>z2*z3;<sp/>};</highlight></codeline>
<codeline lineno="41" refid="namespacelibecpint_1a691287591ae556167f12eef21d9605d3" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/><ref refid="namespacelibecpint_1a691287591ae556167f12eef21d9605d3" kindref="member">pow_6</ref>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z)<sp/>{<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z2<sp/>=<sp/>z*z;<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>z2*z2*z2;<sp/>}</highlight></codeline>
<codeline lineno="42" refid="namespacelibecpint_1afc2d0fbd27b79b1cfb7a933a4f8f86af" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/><ref refid="namespacelibecpint_1afc2d0fbd27b79b1cfb7a933a4f8f86af" kindref="member">pow_7</ref>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z)<sp/>{<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z2<sp/>=<sp/>z*z;<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z3<sp/>=<sp/>z*z2;<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>z3*z2*z2;<sp/>}</highlight></codeline>
<codeline lineno="43" refid="namespacelibecpint_1aceff25bd00ac616a0c1679c43c757c25" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/><ref refid="namespacelibecpint_1aceff25bd00ac616a0c1679c43c757c25" kindref="member">pow_8</ref>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z)<sp/>{<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z2<sp/>=<sp/>z*z;<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z4<sp/>=<sp/>z2*z2;<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>z4*z4;<sp/>}</highlight></codeline>
<codeline lineno="44" refid="namespacelibecpint_1a125307aa5575e22d32bc381c0ddb598d" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/><ref refid="namespacelibecpint_1a125307aa5575e22d32bc381c0ddb598d" kindref="member">pow_9</ref>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z)<sp/>{<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z3<sp/>=<sp/>z*z*z;<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>z3*z3*z3;<sp/>}</highlight></codeline>
<codeline lineno="45" refid="namespacelibecpint_1a764f6b0f657d4b76cd030593a81f8161" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/><ref refid="namespacelibecpint_1a764f6b0f657d4b76cd030593a81f8161" kindref="member">pow_10</ref>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z)<sp/>{<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z2<sp/>=<sp/>z*z;<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z3<sp/>=<sp/>z*z2;<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z5=<sp/>z2*z3;<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>z5*z5;<sp/>}</highlight></codeline>
<codeline lineno="46" refid="namespacelibecpint_1a17491fad5ad55b86c80bccd068067373" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/><ref refid="namespacelibecpint_1a17491fad5ad55b86c80bccd068067373" kindref="member">pow_11</ref>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z)<sp/>{<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z2<sp/>=<sp/>z*z;<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z3<sp/>=<sp/>z*z2;<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>z3*z3*z3*z2;<sp/>}</highlight></codeline>
<codeline lineno="47" refid="namespacelibecpint_1a274e6578163d01f8c1bd6b24f0f1e061" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/><ref refid="namespacelibecpint_1a274e6578163d01f8c1bd6b24f0f1e061" kindref="member">pow_12</ref>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z)<sp/>{<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z3<sp/>=<sp/>z*z*z;<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z6<sp/>=<sp/>z3*z3;<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>z6*z6;<sp/>}</highlight></codeline>
<codeline lineno="48" refid="namespacelibecpint_1adf95d3c9da1c27fbbbe785fb7d4c3419" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/><ref refid="namespacelibecpint_1adf95d3c9da1c27fbbbe785fb7d4c3419" kindref="member">pow_13</ref>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z)<sp/>{<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z3<sp/>=<sp/>z*z*z;<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z6<sp/>=<sp/>z3*z3;<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>z6*z6*z;<sp/>}</highlight></codeline>
<codeline lineno="49" refid="namespacelibecpint_1a12c8c970bff9ab1318e774a4637059fb" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/><ref refid="namespacelibecpint_1a12c8c970bff9ab1318e774a4637059fb" kindref="member">pow_14</ref>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z)<sp/>{<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z2<sp/>=<sp/>z*z;<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z3<sp/>=<sp/>z*z2;<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z7<sp/>=<sp/>z2*z2*z3;<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>z7*z7;<sp/>}</highlight></codeline>
<codeline lineno="50" refid="namespacelibecpint_1a5ebc6e4869b8a3dab9286895629c19fc" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/><ref refid="namespacelibecpint_1a5ebc6e4869b8a3dab9286895629c19fc" kindref="member">pow_15</ref>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z)<sp/>{<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z2<sp/>=<sp/>z*z;<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z3<sp/>=<sp/>z*z2;<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z5<sp/>=<sp/>z2*z3;<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>z5*z5*z5;<sp/>}</highlight></codeline>
<codeline lineno="51" refid="namespacelibecpint_1a697a408875eb033819881bc8d5fd3cec" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/><ref refid="namespacelibecpint_1a697a408875eb033819881bc8d5fd3cec" kindref="member">pow_16</ref>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z)<sp/>{<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z2<sp/>=<sp/>z*z;<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z4<sp/>=<sp/>z2*z2;<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z8<sp/>=<sp/>z4*z4;<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>z8*z8;<sp/>}</highlight></codeline>
<codeline lineno="52" refid="namespacelibecpint_1a60980f8f3c0f2ce3bfa35d1ab1ffe612" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/><ref refid="namespacelibecpint_1a60980f8f3c0f2ce3bfa35d1ab1ffe612" kindref="member">pow_17</ref>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z)<sp/>{<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z2<sp/>=<sp/>z*z;<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z4<sp/>=<sp/>z2*z2;<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z8<sp/>=<sp/>z4*z4;<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>z8*z8*z;}</highlight></codeline>
<codeline lineno="53" refid="namespacelibecpint_1a44095a8d0f5ab3e8bf4770a0ecd39a49" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/><ref refid="namespacelibecpint_1a44095a8d0f5ab3e8bf4770a0ecd39a49" kindref="member">pow_18</ref>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z)<sp/>{<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z3<sp/>=<sp/>z*z*z;<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z9<sp/>=<sp/>z3*z3*z3;<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>z9*z9;<sp/>}</highlight></codeline>
<codeline lineno="54" refid="namespacelibecpint_1ad7792ee9315576df3c805d0d0bbb6144" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/><ref refid="namespacelibecpint_1ad7792ee9315576df3c805d0d0bbb6144" kindref="member">pow_19</ref>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z)<sp/>{<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z3<sp/>=<sp/>z*z*z;<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z9<sp/>=<sp/>z3*z3*z3;<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>z9*z9*z;<sp/>}</highlight></codeline>
<codeline lineno="55" refid="namespacelibecpint_1aa2a7bd43b3c7267b69a5a3faa3adf313" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/><ref refid="namespacelibecpint_1aa2a7bd43b3c7267b69a5a3faa3adf313" kindref="member">pow_20</ref>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z)<sp/>{<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z2<sp/>=<sp/>z*z;<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z4<sp/>=<sp/>z2*z2;<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>z8<sp/>=<sp/>z4*z4;<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>z8*z8*z4;<sp/>}</highlight></codeline>
<codeline lineno="56"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight></codeline>
<codeline lineno="57" refid="namespacelibecpint_1a0d3d7448d52abd739d6d100afa6d4e8a" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="namespacelibecpint_1a0d3d7448d52abd739d6d100afa6d4e8a" kindref="member">initFactorials</ref>()<sp/>{</highlight></codeline>
<codeline lineno="58"><highlight class="normal"></highlight><highlight class="preprocessor"><sp/><sp/><sp/><sp/>#ifndef<sp/>FAC_INIT</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="59"><highlight class="normal"></highlight><highlight class="preprocessor"><sp/><sp/><sp/><sp/>#define<sp/>FAC_INIT</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="60"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="namespacelibecpint_1a975e7b9e0f57709418adede308d80405" kindref="member">FAC</ref>[0]<sp/>=<sp/>1.0;</highlight></codeline>
<codeline lineno="61"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="namespacelibecpint_1a4ecb557cc8bf8d94cfa80855985007bf" kindref="member">DFAC</ref>[0]<sp/>=<sp/>1.0;</highlight></codeline>
<codeline lineno="62"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="namespacelibecpint_1a4ecb557cc8bf8d94cfa80855985007bf" kindref="member">DFAC</ref>[1]<sp/>=<sp/>1.0;</highlight></codeline>
<codeline lineno="63"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline>
<codeline lineno="64"><highlight class="normal"><sp/><sp/><sp/><sp/><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<sp/>=<sp/>1;<sp/>i<sp/>&lt;<sp/><ref refid="mathutil_8hpp_1aaf00c7de57af68f4e9d7acc87adb8d87" kindref="member">MAX_FAC</ref>;<sp/>i++)<sp/><sp/><ref refid="namespacelibecpint_1a975e7b9e0f57709418adede308d80405" kindref="member">FAC</ref>[i]<sp/>=<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal">(i)<sp/>*<sp/><ref refid="namespacelibecpint_1a975e7b9e0f57709418adede308d80405" kindref="member">FAC</ref>[i-1];<sp/></highlight></codeline>
<codeline lineno="65"><highlight class="normal"><sp/><sp/><sp/><sp/><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<sp/>=<sp/>2;<sp/>i<sp/>&lt;<sp/><ref refid="mathutil_8hpp_1a30bbac291639d5f7d964a92fa8742b94" kindref="member">MAX_DFAC</ref>;<sp/>i++)<sp/><ref refid="namespacelibecpint_1a4ecb557cc8bf8d94cfa80855985007bf" kindref="member">DFAC</ref>[i]<sp/>=<sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal">(i)<sp/>*<sp/><ref refid="namespacelibecpint_1a4ecb557cc8bf8d94cfa80855985007bf" kindref="member">DFAC</ref>[i-2];</highlight></codeline>
<codeline lineno="66"><highlight class="normal"></highlight><highlight class="preprocessor"><sp/><sp/><sp/><sp/>#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="67"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="68"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight></codeline>
<codeline lineno="69"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Compute<sp/>all<sp/>the<sp/>real<sp/>spherical<sp/>harmonics<sp/>Slm(theta,<sp/>phi)<sp/>for<sp/>l,m<sp/>up<sp/>to<sp/>lmax</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="70"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>x<sp/>=<sp/>std::cos<sp/>(theta)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="71" refid="namespacelibecpint_1ac8004320c2b47b1ce75ab1ccfff376e4" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structlibecpint_1_1_two_index" kindref="compound">TwoIndex&lt;double&gt;</ref><sp/><ref refid="namespacelibecpint_1ac8004320c2b47b1ce75ab1ccfff376e4" kindref="member">realSphericalHarmonics</ref>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>lmax,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>x,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>phi){</highlight></codeline>
<codeline lineno="72"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structlibecpint_1_1_two_index" kindref="compound">TwoIndex&lt;double&gt;</ref><sp/>rshValues(lmax+1,<sp/>2*lmax+1,<sp/>0.0);</highlight></codeline>
<codeline lineno="73"><highlight class="normal"></highlight></codeline>
<codeline lineno="74"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(lmax<sp/>&gt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="75"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>First<sp/>calculate<sp/>the<sp/>associated<sp/>Legendre<sp/>polynomials,<sp/>Plm(std::cos<sp/>theta),<sp/>ustd::sing<sp/>the<sp/>recursion<sp/>relation</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="76"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>(l-m)Plm<sp/>=<sp/>x(2l<sp/>-<sp/>1)P{l-1}m<sp/>-<sp/>(l+m-1)P{l-2}m</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="77"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>along<sp/>with<sp/>the<sp/>zeroth<sp/>order<sp/>term</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="78"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Pmm<sp/>=<sp/>(-1)^m<sp/>(2m-1)!!(1-x^2)^{m/2}</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="79"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>x2<sp/>=<sp/>x<sp/>*<sp/>x;</highlight></codeline>
<codeline lineno="80"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>Plm[lmax+1][lmax+1];<sp/></highlight></codeline>
<codeline lineno="81"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>First<sp/>get<sp/>all<sp/>Pmm<sp/>terms</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="82"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Plm[0][0]<sp/>=<sp/>1.0;</highlight></codeline>
<codeline lineno="83"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>sox2<sp/>=<sp/>std::sqrt(std::max(0.0,<sp/>1.0<sp/>-<sp/>x2));</highlight></codeline>
<codeline lineno="84"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>ox2m<sp/>=<sp/>1.0;</highlight></codeline>
<codeline lineno="85"><highlight class="normal"><sp/><sp/><sp/><sp/><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/>m<sp/>=<sp/>1;<sp/>m<sp/>&lt;=<sp/>lmax;<sp/>m++)<sp/>{</highlight></codeline>
<codeline lineno="86"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ox2m<sp/>*=<sp/>-sox2;</highlight></codeline>
<codeline lineno="87"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Plm[m][m]<sp/>=<sp/>ox2m<sp/>*<sp/><ref refid="namespacelibecpint_1a4ecb557cc8bf8d94cfa80855985007bf" kindref="member">DFAC</ref>[2*m-1];<sp/></highlight></codeline>
<codeline lineno="88"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="89"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline>
<codeline lineno="90"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Then<sp/>increment<sp/>l<sp/>for<sp/>each<sp/>m</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="91"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Plm[1][0]<sp/>=<sp/>x;</highlight></codeline>
<codeline lineno="92"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Plm[0][1]<sp/>=<sp/>0.0;</highlight></codeline>
<codeline lineno="93"><highlight class="normal"><sp/><sp/><sp/><sp/><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/>l<sp/>=<sp/>2;<sp/>l<sp/>&lt;=<sp/>lmax;<sp/>l++)<sp/>{</highlight></codeline>
<codeline lineno="94"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ox2m<sp/>=<sp/>x<sp/>*<sp/>(2*l<sp/>-<sp/>1);</highlight></codeline>
<codeline lineno="95"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(</highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>m<sp/>=<sp/>0;<sp/>m<sp/>&lt;<sp/>l;<sp/>m++)<sp/>{</highlight></codeline>
<codeline lineno="96"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Plm[l][m]<sp/>=<sp/>ox2m<sp/>*<sp/>Plm[l-1][m]<sp/>-<sp/>(l<sp/>+<sp/>m<sp/>-<sp/>1)*Plm[l-2][m];</highlight></codeline>
<codeline lineno="97"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Plm[l][m]<sp/>/=<sp/>((double)<sp/>(l<sp/>-m));</highlight></codeline>
<codeline lineno="98"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="99"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>Plm[l-1][l]<sp/>=<sp/>0.0;</highlight></codeline>
<codeline lineno="100"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="101"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline>
<codeline lineno="102"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Now<sp/>we<sp/>compute<sp/>the<sp/>spherical<sp/>harmonics<sp/>via</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="103"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Slm(theta,<sp/>phi)<sp/>=<sp/>Clm<sp/>*<sp/>Plm(std::cos(theta))<sp/>*<sp/>std::cos(m<sp/>*<sp/>phi),<sp/>m<sp/>&gt;<sp/>0</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="104"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Sl{-m}(theta,<sp/>phi)<sp/>=<sp/>Clm<sp/>*<sp/>Plm(std::cos(theta))<sp/>*<sp/>std::sin(m<sp/>*<sp/>phi)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="105"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>Sl0(theta,<sp/>phi)<sp/>=<sp/>std::sqrt(2)<sp/>*<sp/>Cl0<sp/>*<sp/>Pl0(std::cos(theta))</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="106"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">//<sp/>where<sp/>Clm^2<sp/>=<sp/>(2l<sp/>+<sp/>1)*(l<sp/>-<sp/>m)!<sp/>/<sp/>(8*pi<sp/>*<sp/>(l+m)!)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="107"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/>osq4pi<sp/>=<sp/>1.0<sp/>/<sp/>std::sqrt(4.0<sp/>*<sp/><ref refid="mathutil_8hpp_1ae71449b1cc6e6250b91f539153a7a0d3" kindref="member">M_PI</ref>);<sp/></highlight></codeline>
<codeline lineno="108"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>sign;</highlight></codeline>
<codeline lineno="109"><highlight class="normal"><sp/><sp/><sp/><sp/><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/>l<sp/>=<sp/>0;<sp/>l<sp/>&lt;=<sp/>lmax;<sp/>l++)<sp/>{</highlight></codeline>
<codeline lineno="110"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>rshValues(l,<sp/>l)<sp/>=<sp/>osq4pi<sp/>*<sp/>std::sqrt(2.0<sp/>*<sp/>l<sp/>+<sp/>1.0)<sp/>*<sp/>Plm[l][0];</highlight></codeline>
<codeline lineno="111"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>sign<sp/>=<sp/>-1;</highlight></codeline>
<codeline lineno="112"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(</highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>m<sp/>=<sp/>1;<sp/>m<sp/>&lt;=<sp/>l;<sp/>m++)<sp/>{</highlight></codeline>
<codeline lineno="113"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ox2m<sp/>=<sp/>(2.0<sp/>*<sp/>l<sp/>+<sp/>1.0)<sp/>*<sp/><ref refid="namespacelibecpint_1a975e7b9e0f57709418adede308d80405" kindref="member">FAC</ref>[l-m]<sp/>/<sp/><ref refid="namespacelibecpint_1a975e7b9e0f57709418adede308d80405" kindref="member">FAC</ref>[l+m];</highlight></codeline>
<codeline lineno="114"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ox2m<sp/>=<sp/>sign<sp/>*<sp/>osq4pi<sp/>*<sp/>std::sqrt(2.0<sp/>*<sp/>ox2m)<sp/>*<sp/>Plm[l][m];</highlight></codeline>
<codeline lineno="115"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>rshValues(l,<sp/>l+m)<sp/>=<sp/>ox2m<sp/>*<sp/>std::cos(m<sp/>*<sp/>phi);</highlight></codeline>
<codeline lineno="116"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>rshValues(l,<sp/>l-m)<sp/>=<sp/>ox2m<sp/>*<sp/>std::sin(m<sp/>*<sp/>phi);</highlight></codeline>
<codeline lineno="117"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>sign<sp/>*=<sp/>-1;</highlight></codeline>
<codeline lineno="118"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="119"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="120"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline>
<codeline lineno="121"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="122"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>rshValues(0,<sp/>0)<sp/>=<sp/>1.0<sp/>/<sp/>std::sqrt(4.0<sp/>*<sp/><ref refid="mathutil_8hpp_1ae71449b1cc6e6250b91f539153a7a0d3" kindref="member">M_PI</ref>);</highlight></codeline>
<codeline lineno="123"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="124"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline>
<codeline lineno="125"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>rshValues;</highlight></codeline>
<codeline lineno="126"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="127"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight></codeline>
<codeline lineno="128" refid="namespacelibecpint_1a16e0a77a3022ff74a1fbb6eccba88c4c" refkind="member"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">double</highlight><highlight class="normal"><sp/><ref refid="namespacelibecpint_1a16e0a77a3022ff74a1fbb6eccba88c4c" kindref="member">frobenius_norm</ref>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="structlibecpint_1_1_two_index" kindref="compound">TwoIndex&lt;double&gt;</ref>&amp;<sp/>mat)<sp/>{</highlight></codeline>
<codeline lineno="129"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>std::sqrt(std::inner_product(mat.<ref refid="structlibecpint_1_1_two_index_1aeac1fc5f3983b9741fa4c7e5d8f6a7da" kindref="member">data</ref>.begin(),<sp/>mat.<ref refid="structlibecpint_1_1_two_index_1aeac1fc5f3983b9741fa4c7e5d8f6a7da" kindref="member">data</ref>.end(),<sp/>mat.<ref refid="structlibecpint_1_1_two_index_1aeac1fc5f3983b9741fa4c7e5d8f6a7da" kindref="member">data</ref>.begin(),<sp/>0.0));</highlight></codeline>
<codeline lineno="130"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="131"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight></codeline>
<codeline lineno="132"><highlight class="normal">}</highlight></codeline>
    </programlisting>
    <location file="/Users/robertshaw/devfiles/libecpint/src/lib/mathutil.cpp"/>
  </compounddef>
</doxygen>
