Boost C++ Libraries: Ticket #10680: Cannot use Eigen vector as state type in integrate? https://svn.boost.org/trac10/ticket/10680 <p> The program </p> <pre class="wiki">#include "boost/numeric/odeint.hpp" #include "Eigen/Core" using namespace boost::numeric::odeint; int main() { Eigen::Vector3d state(0, 0, 0); integrate( [](const auto&amp; state, auto&amp; change, const double /*time*/){ change = Eigen::Vector3d(1, 0, 0); }, state, 0.0, 1.0, 0.1 ); return 0; } </pre><p> does not compile with Apple LLVM version 6.0 (clang-600.0.51) (based on LLVM 3.5svn) using -std=c++1y </p> <pre class="wiki">In file included from /Users/iljah/include/boost/numeric/odeint.hpp:67: /Users/iljah/include/boost/numeric/odeint/integrate/integrate.hpp:59:12: error: no matching function for call to 'integrate' return integrate( system , start_state , start_time , end_time , dt , null_observer() ); ^~~~~~~~~ odeint1.cpp:9:2: note: in instantiation of function template specialization 'boost::numeric::odeint::integrate&lt;&lt;lambda at odeint1.cpp:10:3&gt;, Eigen::Matrix&lt;double, 3, 1, 0, 3, 1&gt;, double&gt;' requested here integrate( ^ /Users/iljah/include/boost/numeric/odeint/integrate/integrate.hpp:44:28: note: candidate template ignored: disabled by 'enable_if' [with System = &lt;lambda at odeint1.cpp:10:3&gt;, State = Eigen::Matrix&lt;double, 3, 1, 0, 3, 1&gt;, Time = double, Observer = boost::numeric::odeint::null_observer] typename boost::enable_if&lt; typename has_value_type&lt;State&gt;::type , size_t &gt;::type ^ /Users/iljah/include/boost/numeric/odeint/integrate/integrate.hpp:57:8: note: candidate function template not viable: requires 5 arguments, but 6 were provided size_t integrate( System system , State &amp;start_state , Time start_time , Time end_time , Time dt ) ^ 1 error generated. </pre><p> Based on "disabled by 'enable_if'" I'd guess the problem is in odeint not Eigen, or this a user error? I get many more errors if the state type is e.g. a std::array of Eigen vectors but I'll create another ticket if that issue persists. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10680 Trac 1.4.3 karsten Thu, 29 Jan 2015 21:41:10 GMT <link>https://svn.boost.org/trac10/ticket/10680#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10680#comment:1</guid> <description> <p> There are two problems with your code. First, eigen is not support by default, you need to include the eigen adaption of odeint. And secondly, integrate can not determine the value from the eigen vector by itself. If you change the example to </p> <div class="wiki-code"><div class="code"><pre><span class="cp">#include</span> <span class="cpf">&quot;boost/numeric/odeint.hpp&quot;</span><span class="cp"></span> <span class="cp">#include</span> <span class="cpf">&quot;boost/numeric/odeint/external/eigen/eigen.hpp&quot;</span><span class="cp"></span> <span class="cp">#include</span> <span class="cpf">&quot;Eigen/Core&quot;</span><span class="cp"></span> <span class="k">using</span> <span class="k">namespace</span> <span class="n">boost</span><span class="o">::</span><span class="n">numeric</span><span class="o">::</span><span class="n">odeint</span><span class="p">;</span> <span class="kt">int</span> <span class="nf">main</span><span class="p">()</span> <span class="p">{</span> <span class="n">Eigen</span><span class="o">::</span><span class="n">Vector3d</span> <span class="n">state</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">);</span> <span class="n">integrate</span><span class="o">&lt;</span> <span class="kt">double</span> <span class="o">&gt;</span><span class="p">(</span> <span class="p">[](</span><span class="k">const</span> <span class="k">auto</span><span class="o">&amp;</span> <span class="n">state</span><span class="p">,</span> <span class="k">auto</span><span class="o">&amp;</span> <span class="n">change</span><span class="p">,</span> <span class="k">const</span> <span class="kt">double</span> <span class="cm">/*time*/</span><span class="p">){</span> <span class="n">change</span> <span class="o">=</span> <span class="n">Eigen</span><span class="o">::</span><span class="n">Vector3d</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">);</span> <span class="p">},</span> <span class="n">state</span><span class="p">,</span> <span class="mf">0.0</span><span class="p">,</span> <span class="mf">1.0</span><span class="p">,</span> <span class="mf">0.1</span> <span class="p">);</span> <span class="k">return</span> <span class="mi">0</span><span class="p">;</span> <span class="p">}</span> </pre></div></div><p> everything should work. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>karsten</dc:creator> <pubDate>Thu, 29 Jan 2015 21:41:28 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/10680#comment:2 https://svn.boost.org/trac10/ticket/10680#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">wontfix</span> </li> </ul> Ticket anonymous Thu, 29 Jan 2015 21:53:20 GMT <link>https://svn.boost.org/trac10/ticket/10680#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10680#comment:3</guid> <description> <blockquote class="citation"> <pre class="wiki">#include "boost/numeric/odeint/external/eigen/eigen.hpp" </pre></blockquote> <p> I don't have that file in boost-1.57.0, only eigen_algebra.hpp and eigen_resize.hpp. I just downloaded the bz2 tarball again from sourceforge and still nothing. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Thu, 29 Jan 2015 21:53:32 GMT</pubDate> <title>status changed; resolution deleted https://svn.boost.org/trac10/ticket/10680#comment:4 https://svn.boost.org/trac10/ticket/10680#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">closed</span> → <span class="trac-field-new">reopened</span> </li> <li><strong>resolution</strong> <span class="trac-field-deleted">wontfix</span> </li> </ul> Ticket karsten Thu, 29 Jan 2015 22:12:58 GMT <link>https://svn.boost.org/trac10/ticket/10680#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10680#comment:5</guid> <description> <p> Ok, I see. Can you use the odeint version from github: <a class="ext-link" href="https://github.com/headmyshoulder/odeint-v2"><span class="icon">​</span>https://github.com/headmyshoulder/odeint-v2</a>. It will be included in 1.58. Be sure to set the include path to odeint-v2/include before the boost include path. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Thu, 29 Jan 2015 22:25:59 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10680#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10680#comment:6</guid> <description> <p> Thanks, it worked once I added -std=c++1y compilation args. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>mariomulansky</dc:creator> <pubDate>Wed, 10 May 2017 04:18:26 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/10680#comment:7 https://svn.boost.org/trac10/ticket/10680#comment:7 <ul> <li><strong>status</strong> <span class="trac-field-old">reopened</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> Ticket