Skip to content

Complex type + controlled stepper fails compilation #244

Open

Description

@mebelz

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;
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions