Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > 99cb5ede6a5329071fbeecc8218deb35 > files > 217

eigen3-doc-3.2-3.mga4.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>Eigen: Customizing/Extending Eigen</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css"   rel="stylesheet" type="text/css" />
<link href="eigendoxy.css" rel="stylesheet" type="text/css">
<!--  -->
<script type="text/javascript" src="eigen_navtree_hacks.js"></script>
<!-- <script type="text/javascript"> -->
<!-- </script> -->
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<!-- <a name="top"></a> -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="Eigen_Silly_Professor_64x64.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname"><a href="http://eigen.tuxfamily.org">Eigen</a>
   &#160;<span id="projectnumber">3.2.0</span>
   </div>
  </td>
   <td>        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
</td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('TopicCustomizingEigen.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">Customizing/Extending <a class="el" href="namespaceEigen.html" title="Namespace containing all symbols from the Eigen library. ">Eigen</a> </div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p><a class="el" href="namespaceEigen.html" title="Namespace containing all symbols from the Eigen library. ">Eigen</a> can be extended in several ways, for instance, by defining global methods, <a class="el" href="TopicCustomizingEigen.html#ExtendingMatrixBase">by adding custom methods to MatrixBase</a>, adding support to <a class="el" href="TopicCustomizingEigen.html#CustomScalarType">custom types</a> etc.</p>
<h1><a class="anchor" id="ExtendingMatrixBase"></a>
Extending MatrixBase (and other classes)</h1>
<p>In this section we will see how to add custom methods to <a class="el" href="classEigen_1_1MatrixBase.html" title="Base class for all dense matrices, vectors, and expressions. ">MatrixBase</a>. Since all expressions and matrix types inherit <a class="el" href="classEigen_1_1MatrixBase.html" title="Base class for all dense matrices, vectors, and expressions. ">MatrixBase</a>, adding a method to <a class="el" href="classEigen_1_1MatrixBase.html" title="Base class for all dense matrices, vectors, and expressions. ">MatrixBase</a> make it immediately available to all expressions ! A typical use case is, for instance, to make <a class="el" href="namespaceEigen.html" title="Namespace containing all symbols from the Eigen library. ">Eigen</a> compatible with another API.</p>
<p>You certainly know that in C++ it is not possible to add methods to an existing class. So how that's possible ? Here the trick is to include in the declaration of <a class="el" href="classEigen_1_1MatrixBase.html" title="Base class for all dense matrices, vectors, and expressions. ">MatrixBase</a> a file defined by the preprocessor token <code>EIGEN_MATRIXBASE_PLUGIN:</code> </p>
<div class="fragment"><div class="line"><span class="keyword">class </span>MatrixBase {</div>
<div class="line">  <span class="comment">// ...</span></div>
<div class="line"><span class="preprocessor">  #ifdef EIGEN_MATRIXBASE_PLUGIN</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">  #include EIGEN_MATRIXBASE_PLUGIN</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">  #endif</span></div>
<div class="line"><span class="preprocessor">};</span></div>
</div><!-- fragment --><p> Therefore to extend <a class="el" href="classEigen_1_1MatrixBase.html" title="Base class for all dense matrices, vectors, and expressions. ">MatrixBase</a> with your own methods you just have to create a file with your method declaration and define EIGEN_MATRIXBASE_PLUGIN before you include any <a class="el" href="namespaceEigen.html" title="Namespace containing all symbols from the Eigen library. ">Eigen</a>'s header file.</p>
<p>You can extend many of the other classes used in <a class="el" href="namespaceEigen.html" title="Namespace containing all symbols from the Eigen library. ">Eigen</a> by defining similarly named preprocessor symbols. For instance, define <code>EIGEN_ARRAYBASE_PLUGIN</code> if you want to extend the <a class="el" href="classEigen_1_1ArrayBase.html" title="Base class for all 1D and 2D array, and related expressions. ">ArrayBase</a> class. A full list of classes that can be extended in this way and the corresponding preprocessor symbols can be found on our page <a class="el" href="TopicPreprocessorDirectives.html">Preprocessor directives</a>.</p>
<p>Here is an example of an extension file for adding methods to <a class="el" href="classEigen_1_1MatrixBase.html" title="Base class for all dense matrices, vectors, and expressions. ">MatrixBase</a>: <br/>
<b>MatrixBaseAddons.h</b> </p>
<div class="fragment"><div class="line"><span class="keyword">inline</span> Scalar at(uint i, uint j)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> this-&gt;operator()(i,j); }</div>
<div class="line"><span class="keyword">inline</span> Scalar&amp; at(uint i, uint j) { <span class="keywordflow">return</span> this-&gt;operator()(i,j); }</div>
<div class="line"><span class="keyword">inline</span> Scalar at(uint i)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> this-&gt;operator[](i); }</div>
<div class="line"><span class="keyword">inline</span> Scalar&amp; at(uint i) { <span class="keywordflow">return</span> this-&gt;operator[](i); }</div>
<div class="line"></div>
<div class="line"><span class="keyword">inline</span> RealScalar squaredLength()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> squaredNorm(); }</div>
<div class="line"><span class="keyword">inline</span> RealScalar length()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> norm(); }</div>
<div class="line"><span class="keyword">inline</span> RealScalar invLength(<span class="keywordtype">void</span>)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> fast_inv_sqrt(squaredNorm()); }</div>
<div class="line"></div>
<div class="line"><span class="keyword">template</span>&lt;<span class="keyword">typename</span> OtherDerived&gt;</div>
<div class="line"><span class="keyword">inline</span> Scalar squaredDistanceTo(<span class="keyword">const</span> MatrixBase&lt;OtherDerived&gt;&amp; other)<span class="keyword"> const</span></div>
<div class="line"><span class="keyword"></span>{ <span class="keywordflow">return</span> (derived() - other.derived()).squaredNorm(); }</div>
<div class="line"></div>
<div class="line"><span class="keyword">template</span>&lt;<span class="keyword">typename</span> OtherDerived&gt;</div>
<div class="line"><span class="keyword">inline</span> RealScalar distanceTo(<span class="keyword">const</span> MatrixBase&lt;OtherDerived&gt;&amp; other)<span class="keyword"> const</span></div>
<div class="line"><span class="keyword"></span>{ <span class="keywordflow">return</span> internal::sqrt(derived().squaredDistanceTo(other)); }</div>
<div class="line"></div>
<div class="line"><span class="keyword">inline</span> <span class="keywordtype">void</span> scaleTo(RealScalar l) { RealScalar vl = norm(); <span class="keywordflow">if</span> (vl&gt;1e-9) derived() *= (l/vl); }</div>
<div class="line"></div>
<div class="line"><span class="keyword">inline</span> Transpose&lt;Derived&gt; transposed() {<span class="keywordflow">return</span> this-&gt;transpose();}</div>
<div class="line"><span class="keyword">inline</span> <span class="keyword">const</span> Transpose&lt;Derived&gt; transposed()<span class="keyword"> const </span>{<span class="keywordflow">return</span> this-&gt;transpose();}</div>
<div class="line"></div>
<div class="line"><span class="keyword">inline</span> uint minComponentId(<span class="keywordtype">void</span>)<span class="keyword"> const  </span>{ <span class="keywordtype">int</span> i; this-&gt;minCoeff(&amp;i); <span class="keywordflow">return</span> i; }</div>
<div class="line"><span class="keyword">inline</span> uint maxComponentId(<span class="keywordtype">void</span>)<span class="keyword"> const  </span>{ <span class="keywordtype">int</span> i; this-&gt;maxCoeff(&amp;i); <span class="keywordflow">return</span> i; }</div>
<div class="line"></div>
<div class="line"><span class="keyword">template</span>&lt;<span class="keyword">typename</span> OtherDerived&gt;</div>
<div class="line"><span class="keywordtype">void</span> makeFloor(<span class="keyword">const</span> MatrixBase&lt;OtherDerived&gt;&amp; other) { derived() = derived().cwiseMin(other.derived()); }</div>
<div class="line"><span class="keyword">template</span>&lt;<span class="keyword">typename</span> OtherDerived&gt;</div>
<div class="line"><span class="keywordtype">void</span> makeCeil(<span class="keyword">const</span> MatrixBase&lt;OtherDerived&gt;&amp; other) { derived() = derived().cwiseMax(other.derived()); }</div>
<div class="line"></div>
<div class="line"><span class="keyword">const</span> CwiseUnaryOp&lt;internal::scalar_add_op&lt;Scalar&gt;, Derived&gt;</div>
<div class="line">operator+(<span class="keyword">const</span> Scalar&amp; scalar)<span class="keyword"> const</span></div>
<div class="line"><span class="keyword"></span>{ <span class="keywordflow">return</span> CwiseUnaryOp&lt;internal::scalar_add_op&lt;Scalar&gt;, Derived&gt;(derived(), internal::scalar_add_op&lt;Scalar&gt;(scalar)); }</div>
<div class="line"></div>
<div class="line"><span class="keyword">friend</span> <span class="keyword">const</span> CwiseUnaryOp&lt;internal::scalar_add_op&lt;Scalar&gt;, Derived&gt;</div>
<div class="line">operator+(<span class="keyword">const</span> Scalar&amp; scalar, <span class="keyword">const</span> MatrixBase&lt;Derived&gt;&amp; mat)</div>
<div class="line">{ <span class="keywordflow">return</span> CwiseUnaryOp&lt;internal::scalar_add_op&lt;Scalar&gt;, Derived&gt;(mat.derived(), internal::scalar_add_op&lt;Scalar&gt;(scalar)); }</div>
</div><!-- fragment --><p>Then one can the following declaration in the config.h or whatever prerequisites header file of his project: </p>
<div class="fragment"><div class="line"><span class="preprocessor">#define EIGEN_MATRIXBASE_PLUGIN &quot;MatrixBaseAddons.h&quot;</span></div>
</div><!-- fragment --><h1><a class="anchor" id="InheritingFromMatrix"></a>
Inheriting from Matrix</h1>
<p>Before inheriting from <a class="el" href="classEigen_1_1Matrix.html" title="The matrix class, also used for vectors and row-vectors. ">Matrix</a>, be really, i mean REALLY sure that using EIGEN_MATRIX_PLUGIN is not what you really want (see previous section). If you just need to add few members to <a class="el" href="classEigen_1_1Matrix.html" title="The matrix class, also used for vectors and row-vectors. ">Matrix</a>, this is the way to go.</p>
<p>An example of when you actually need to inherit <a class="el" href="classEigen_1_1Matrix.html" title="The matrix class, also used for vectors and row-vectors. ">Matrix</a>, is when you have several layers of heritage such as MyVerySpecificVector1,MyVerySpecificVector1 -&gt; MyVector1 -&gt; <a class="el" href="classEigen_1_1Matrix.html" title="The matrix class, also used for vectors and row-vectors. ">Matrix</a> and. MyVerySpecificVector3,MyVerySpecificVector4 -&gt; MyVector2 -&gt; <a class="el" href="classEigen_1_1Matrix.html" title="The matrix class, also used for vectors and row-vectors. ">Matrix</a>.</p>
<p>In order for your object to work within the Eigen framework, you need to define a few members in your inherited class.</p>
<p>Here is a minimalistic example:<br/>
</p>
<div class="fragment"><div class="line"><span class="keyword">class </span>MyVectorType : <span class="keyword">public</span>  <a class="code" href="classEigen_1_1Matrix.html">Eigen::VectorXd</a></div>
<div class="line">{</div>
<div class="line"><span class="keyword">public</span>:</div>
<div class="line">    MyVectorType(<span class="keywordtype">void</span>):Eigen::<a class="code" href="group__matrixtypedefs.html#ga3da45e59796fbacf67fa568297927bd1">VectorXd</a>() {}</div>
<div class="line"></div>
<div class="line">    <span class="keyword">typedef</span> <a class="code" href="classEigen_1_1Matrix.html">Eigen::VectorXd</a> Base;</div>
<div class="line"></div>
<div class="line">    <span class="comment">// This constructor allows you to construct MyVectorType from Eigen expressions</span></div>
<div class="line">    <span class="keyword">template</span>&lt;<span class="keyword">typename</span> OtherDerived&gt;</div>
<div class="line">    MyVectorType(<span class="keyword">const</span> <a class="code" href="classEigen_1_1MatrixBase.html">Eigen::MatrixBase&lt;OtherDerived&gt;</a>&amp; other)</div>
<div class="line">        : Eigen::<a class="code" href="group__matrixtypedefs.html#ga2006332f6989f501762673e21f5128f5">Vector3d</a>(other)</div>
<div class="line">    { }</div>
<div class="line"></div>
<div class="line">    <span class="comment">// This method allows you to assign Eigen expressions to MyVectorType</span></div>
<div class="line">    <span class="keyword">template</span>&lt;<span class="keyword">typename</span> OtherDerived&gt;</div>
<div class="line">    MyVectorType &amp; operator= (<span class="keyword">const</span> <a class="code" href="classEigen_1_1MatrixBase.html">Eigen::MatrixBase &lt;OtherDerived&gt;</a>&amp; other)</div>
<div class="line">    {</div>
<div class="line">        this-&gt;Base::operator=(other);</div>
<div class="line">        <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div>
<div class="line">    }</div>
<div class="line">};</div>
</div><!-- fragment --><p>This is the kind of error you can get if you don't provide those methods </p>
<div class="fragment"><div class="line">error: no match <span class="keywordflow">for</span> ‘operator=’ in ‘delta =</div>
<div class="line">(((<a class="code" href="classEigen_1_1MatrixBase.html">Eigen::MatrixBase&lt;Eigen::Matrix&lt;std::complex&lt;float&gt;</a>, 10000, 1, 2, 10000,</div>
<div class="line">1&gt; &gt;*)(&amp; delta)) + 8u)-&gt;Eigen::MatrixBase&lt;Derived&gt;::cwise [with Derived =</div>
<div class="line"><a class="code" href="classEigen_1_1Matrix.html">Eigen::Matrix&lt;std::complex&lt;float&gt;</a>, 10000, 1, 2, 10000,</div>
<div class="line">1&gt;]().Eigen::Cwise&lt;ExpressionType&gt;::operator* [with OtherDerived =</div>
<div class="line"><a class="code" href="classEigen_1_1Matrix.html">Eigen::Matrix</a>&lt;std::complex&lt;float&gt;, 10000, 1, 2, 10000, 1&gt;, ExpressionType =</div>
<div class="line"><a class="code" href="classEigen_1_1Matrix.html">Eigen::Matrix</a>&lt;std::complex&lt;float&gt;, 10000, 1, 2, 10000, 1&gt;](((<span class="keyword">const</span></div>
<div class="line"><a class="code" href="classEigen_1_1MatrixBase.html">Eigen::MatrixBase</a>&lt;<a class="code" href="classEigen_1_1Matrix.html">Eigen::Matrix</a>&lt;std::complex&lt;float&gt;, 10000, 1, 2, 10000, 1&gt;</div>
<div class="line">&gt;&amp;)(((<span class="keyword">const</span> <a class="code" href="classEigen_1_1MatrixBase.html">Eigen::MatrixBase&lt;Eigen::Matrix&lt;std::complex&lt;float&gt;</a>, 10000, 1,</div>
<div class="line">&gt;2, 10000, 1&gt; &gt;*)((<span class="keyword">const</span> spectral1d*)where)) + 8u)))’                                                    </div>
</div><!-- fragment --><p><a class="anchor" id="user_defined_scalars"></a></p>
<h1><a class="anchor" id="CustomScalarType"></a>
Using custom scalar types</h1>
<p>By default, <a class="el" href="namespaceEigen.html" title="Namespace containing all symbols from the Eigen library. ">Eigen</a> currently supports standard floating-point types (<code>float</code>, <code>double</code>, <code>std::complex&lt;float&gt;</code>, <code>std::complex&lt;double&gt;</code>, <code>long</code> <code>double</code>), as well as all native integer types (e.g., <code>int</code>, <code>unsigned</code> <code>int</code>, <code>short</code>, etc.), and <code>bool</code>. On x86-64 systems, <code>long</code> <code>double</code> permits to locally enforces the use of x87 registers with extended accuracy (in comparison to SSE).</p>
<p>In order to add support for a custom type <code>T</code> you need:</p>
<ol type="1">
<li>make sure the common operator (+,-,*,/,etc.) are supported by the type <code>T</code> </li>
<li>add a specialization of struct Eigen::NumTraits&lt;T&gt; (see <a class="el" href="structEigen_1_1NumTraits.html">NumTraits</a>)</li>
<li>define the math functions that makes sense for your type. This includes standard ones like sqrt, pow, sin, tan, conj, real, imag, etc, as well as abs2 which is <a class="el" href="namespaceEigen.html" title="Namespace containing all symbols from the Eigen library. ">Eigen</a> specific. (see the file <a class="el" href="MathFunctions_8h_source.html">Eigen/src/Core/MathFunctions.h</a>)</li>
</ol>
<p>The math function should be defined in the same namespace than <code>T</code>, or in the <code>std</code> namespace though that second approach is not recommended.</p>
<p>Here is a concrete example adding support for the Adolc's <code>adouble</code> type. <a href="https://projects.coin-or.org/ADOL-C">Adolc</a> is an automatic differentiation library. The type <code>adouble</code> is basically a real value tracking the values of any number of partial derivatives.</p>
<div class="fragment"><div class="line"><span class="preprocessor">#ifndef ADOLCSUPPORT_H</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#define ADOLCSUPPORT_H</span></div>
<div class="line"><span class="preprocessor"></span></div>
<div class="line"><span class="preprocessor">#define ADOLC_TAPELESS</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">#include &lt;adolc/adouble.h&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;Eigen/Core&gt;</span></div>
<div class="line"></div>
<div class="line"><span class="keyword">namespace </span>Eigen {</div>
<div class="line"></div>
<div class="line"><span class="keyword">template</span>&lt;&gt; <span class="keyword">struct </span>NumTraits&lt;adtl::adouble&gt;</div>
<div class="line"> : NumTraits&lt;double&gt; <span class="comment">// permits to get the epsilon, dummy_precision, lowest, highest functions</span></div>
<div class="line">{</div>
<div class="line">  <span class="keyword">typedef</span> adtl::adouble Real;</div>
<div class="line">  <span class="keyword">typedef</span> adtl::adouble NonInteger;</div>
<div class="line">  <span class="keyword">typedef</span> adtl::adouble Nested;</div>
<div class="line"></div>
<div class="line">  <span class="keyword">enum</span> {</div>
<div class="line">    IsComplex = 0,</div>
<div class="line">    IsInteger = 0,</div>
<div class="line">    IsSigned = 1,</div>
<div class="line">    RequireInitialization = 1,</div>
<div class="line">    ReadCost = 1,</div>
<div class="line">    AddCost = 3,</div>
<div class="line">    MulCost = 3</div>
<div class="line">  };</div>
<div class="line">};</div>
<div class="line"></div>
<div class="line">}</div>
<div class="line"></div>
<div class="line"><span class="keyword">namespace </span>adtl {</div>
<div class="line"></div>
<div class="line"><span class="keyword">inline</span> <span class="keyword">const</span> adouble&amp; conj(<span class="keyword">const</span> adouble&amp; x)  { <span class="keywordflow">return</span> x; }</div>
<div class="line"><span class="keyword">inline</span> <span class="keyword">const</span> adouble&amp; real(<span class="keyword">const</span> adouble&amp; x)  { <span class="keywordflow">return</span> x; }</div>
<div class="line"><span class="keyword">inline</span> adouble imag(<span class="keyword">const</span> adouble&amp;)    { <span class="keywordflow">return</span> 0.; }</div>
<div class="line"><span class="keyword">inline</span> adouble abs(<span class="keyword">const</span> adouble&amp;  x)  { <span class="keywordflow">return</span> fabs(x); }</div>
<div class="line"><span class="keyword">inline</span> adouble abs2(<span class="keyword">const</span> adouble&amp; x)  { <span class="keywordflow">return</span> x*x; }</div>
<div class="line"></div>
<div class="line">}</div>
<div class="line"></div>
<div class="line"><span class="preprocessor">#endif // ADOLCSUPPORT_H</span></div>
</div><!-- fragment --><dl class="section see"><dt>See Also</dt><dd><a class="el" href="TopicPreprocessorDirectives.html">Preprocessor directives</a> </dd></dl>
</div></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated on Mon Oct 28 2013 11:04:26 for Eigen by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.5 </li>
  </ul>
</div>
<!-- Piwik --> 
<!--
<script type="text/javascript">
var pkBaseURL = (("https:" == document.location.protocol) ? "https://stats.sylphide-consulting.com/piwik/" : "http://stats.sylphide-consulting.com/piwik/");
document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
</script><script type="text/javascript">
try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 20);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
} catch( err ) {}
</script><noscript><p><img src="http://stats.sylphide-consulting.com/piwik/piwik.php?idsite=20" style="border:0" alt="" /></p></noscript>
-->
<!-- End Piwik Tracking Code -->
</body>
</html>