Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complex type + controlled stepper fails compilation #244

Open
mebelz opened this issue Jul 27, 2019 · 0 comments
Open

Complex type + controlled stepper fails compilation #244

mebelz opened this issue Jul 27, 2019 · 0 comments

Comments

@mebelz
Copy link

mebelz commented Jul 27, 2019

Trying to integrate with this combination (complex type + controlled stepper) fails, with the error message:

/usr/include/boost/numeric/odeint/integrate/detail/integrate_adaptive.hpp:103:22: error: no matching member function for
       call to 'try_step'
             res = st.try_step( system , start_state , start_time , dt );
                   ~~~^~~~~~~~

Interestingly, removing the value_type std::complex from the stepper definition seems to "fix" the issue? (which is returns if std::vector is then replaced with ublas::vector)

#include <iostream>
#include <vector>
#include <complex>

#include <boost/numeric/odeint.hpp>

typedef std::vector< std::complex<double> > state_type;

const double gam = 0.15;

void harmonic_oscillator( const state_type &x , state_type &dxdt , const double /* t */ )
{
    dxdt[0] = x[1];
    dxdt[1] = -x[0] - gam*x[1];
}

int main(int /* argc */ , char** /* argv */ )
{
    using namespace std;
    using namespace boost::numeric::odeint;
    state_type x(2);
    x[0] = 1.0;
    x[1] = 0.0;
    typedef runge_kutta_cash_karp54< state_type, std::complex<double> > error_stepper_type;
    integrate_adaptive( make_controlled< error_stepper_type >( 1.0e-10 , 1.0e-6 ) ,
                        harmonic_oscillator , x , 0.0 , 10.0 , 0.01 );
    return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant