Sophie

Sophie

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

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: Explanation of the assertion on unaligned arrays</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('group__TopicUnalignedArrayAssert.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">Explanation of the assertion on unaligned arrays<div class="ingroups"><a class="el" href="group__DenseMatrixManipulation__Alignement.html">Alignment issues</a></div></div>  </div>
</div><!--header-->
<div class="contents">
<p>Hello! You are seeing this webpage because your program terminated on an assertion failure like this one: </p>
<pre>
my_program: path/to/eigen/Eigen/src/Core/DenseStorage.h:44:
Eigen::internal::matrix_array&lt;T, Size, MatrixOptions, Align&gt;::internal::matrix_array()
[with T = double, int Size = 2, int MatrixOptions = 2, bool Align = true]:
Assertion `(reinterpret_cast&lt;size_t&gt;(array) &amp; 0xf) == 0 &amp;&amp; "this assertion
is explained here: <a href="http://eigen.tuxfamily.org/dox/UnalignedArrayAssert.html">http://eigen.tuxfamily.org/dox/UnalignedArrayAssert.html</a>
     READ THIS WEB PAGE !!! ****"' failed.
</pre><p>There are 4 known causes for this issue. Please read on to understand them and learn how to fix them.</p>
<h1><a class="anchor" id="where"></a>
Where in my own code is the cause of the problem?</h1>
<p>First of all, you need to find out where in your own code this assertion was triggered from. At first glance, the error message doesn't look helpful, as it refers to a file inside Eigen! However, since your program crashed, if you can reproduce the crash, you can get a backtrace using any debugger. For example, if you're using GCC, you can use the GDB debugger as follows: </p>
<div class="fragment"><div class="line">$ gdb ./my_program          # Start GDB on your program</div>
<div class="line">&gt; run                       # Start running your program</div>
<div class="line">...                         # Now reproduce the crash!</div>
<div class="line">&gt; bt                        # Obtain the backtrace</div>
</div><!-- fragment --><p> Now that you know precisely where in your own code the problem is happening, read on to understand what you need to change.</p>
<h1><a class="anchor" id="c1"></a>
Cause 1: Structures having Eigen objects as members</h1>
<p>If you have code like this,</p>
<div class="fragment"><div class="line"><span class="keyword">class </span>Foo</div>
<div class="line">{</div>
<div class="line">  <span class="comment">//...</span></div>
<div class="line">  <a class="code" href="classEigen_1_1Matrix.html">Eigen::Vector2d</a> v;</div>
<div class="line">  <span class="comment">//...</span></div>
<div class="line">};</div>
<div class="line"><span class="comment">//...</span></div>
<div class="line">Foo *foo = <span class="keyword">new</span> Foo;</div>
</div><!-- fragment --><p>then you need to read this separate page: <a class="el" href="group__TopicStructHavingEigenMembers.html">Structures Having Eigen Members</a>.</p>
<p>Note that here, <a class="el" href="group__matrixtypedefs.html#ga685d563d586f4820b4a2df9a07d98c23">Eigen::Vector2d</a> is only used as an example, more generally the issue arises for all <a class="el" href="group__TopicFixedSizeVectorizable.html">fixed-size vectorizable Eigen types</a>.</p>
<h1><a class="anchor" id="c2"></a>
Cause 2: STL Containers</h1>
<p>If you use STL Containers such as std::vector, std::map, ..., with <a class="el" href="namespaceEigen.html" title="Namespace containing all symbols from the Eigen library. ">Eigen</a> objects, or with classes containing <a class="el" href="namespaceEigen.html" title="Namespace containing all symbols from the Eigen library. ">Eigen</a> objects, like this,</p>
<div class="fragment"><div class="line">std::vector&lt;Eigen::Matrix2f&gt; my_vector;</div>
<div class="line"><span class="keyword">struct </span>my_class { ... <a class="code" href="classEigen_1_1Matrix.html">Eigen::Matrix2f</a> m; ... };</div>
<div class="line">std::map&lt;int, my_class&gt; my_map;</div>
</div><!-- fragment --><p>then you need to read this separate page: <a class="el" href="group__TopicStlContainers.html">Using STL Containers with Eigen</a>.</p>
<p>Note that here, <a class="el" href="group__matrixtypedefs.html#ga535a919504bb3bc463b8995c196c1eed">Eigen::Matrix2f</a> is only used as an example, more generally the issue arises for all <a class="el" href="group__TopicFixedSizeVectorizable.html">fixed-size vectorizable Eigen types</a> and <a class="el" href="group__TopicStructHavingEigenMembers.html">structures having such Eigen objects as member</a>.</p>
<h1><a class="anchor" id="c3"></a>
Cause 3: Passing Eigen objects by value</h1>
<p>If some function in your code is getting an <a class="el" href="namespaceEigen.html" title="Namespace containing all symbols from the Eigen library. ">Eigen</a> object passed by value, like this,</p>
<div class="fragment"><div class="line"><span class="keywordtype">void</span> func(<a class="code" href="classEigen_1_1Matrix.html">Eigen::Vector4d</a> v);</div>
</div><!-- fragment --><p>then you need to read this separate page: <a class="el" href="group__TopicPassingByValue.html">Passing Eigen objects by value to functions</a>.</p>
<p>Note that here, <a class="el" href="group__matrixtypedefs.html#ga9bdb6b1010218b700f4bc0d23c7d2ee8">Eigen::Vector4d</a> is only used as an example, more generally the issue arises for all <a class="el" href="group__TopicFixedSizeVectorizable.html">fixed-size vectorizable Eigen types</a>.</p>
<h1><a class="anchor" id="c4"></a>
Cause 4: Compiler making a wrong assumption on stack alignment (for instance GCC on Windows)</h1>
<p>This is a must-read for people using GCC on Windows (like MinGW or TDM-GCC). If you have this assertion failure in an innocent function declaring a local variable like this:</p>
<div class="fragment"><div class="line"><span class="keywordtype">void</span> foo()</div>
<div class="line">{</div>
<div class="line">  <a class="code" href="classEigen_1_1Quaternion.html">Eigen::Quaternionf</a> q;</div>
<div class="line">  <span class="comment">//...</span></div>
<div class="line">}</div>
</div><!-- fragment --><p>then you need to read this separate page: <a class="el" href="group__TopicWrongStackAlignment.html">Compiler making a wrong assumption on stack alignment</a>.</p>
<p>Note that here, <a class="el" href="group__Geometry__Module.html#gaf65cf6f803890e57488d7de750bef682">Eigen::Quaternionf</a> is only used as an example, more generally the issue arises for all <a class="el" href="group__TopicFixedSizeVectorizable.html">fixed-size vectorizable Eigen types</a>.</p>
<h1><a class="anchor" id="explanation"></a>
General explanation of this assertion</h1>
<p><a class="el" href="group__TopicFixedSizeVectorizable.html">fixed-size vectorizable Eigen objects</a> must absolutely be created at 16-byte-aligned locations, otherwise SIMD instructions adressing them will crash.</p>
<p><a class="el" href="namespaceEigen.html" title="Namespace containing all symbols from the Eigen library. ">Eigen</a> normally takes care of these alignment issues for you, by setting an alignment attribute on them and by overloading their "operator new".</p>
<p>However there are a few corner cases where these alignment settings get overridden: they are the possible causes for this assertion.</p>
<h1><a class="anchor" id="getrid"></a>
I don't care about vectorization, how do I get rid of that stuff?</h1>
<p>Two possibilities: </p>
<ul>
<li>
Define EIGEN_DONT_ALIGN_STATICALLY. That disables all 128-bit static alignment code, while keeping 128-bit heap alignment. This has the effect of disabling vectorization for fixed-size objects (like Matrix4d) while keeping vectorization of dynamic-size objects (like MatrixXd). But do note that this breaks ABI compatibility with the default behavior of 128-bit static alignment. </li>
<li>
Or define both EIGEN_DONT_VECTORIZE and EIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT. This keeps the 128-bit alignment code and thus preserves ABI compatibility, but completely disables vectorization. </li>
</ul>
<p>For more information, see <a href="http://eigen.tuxfamily.org/index.php?title=FAQ#I_disabled_vectorization.2C_but_I.27m_still_getting_annoyed_about_alignment_issues.21">this FAQ</a>. </p>
</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:27 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>