c++,visual-studio-2012,boost,odeint

The code should be safe. We have disabled the same warning in the unit tests of odeint.

Vectorize, vectorize, then vectorize some more. And use data structures that facilitate vectorization. The function __connectionistModel uses a lot of the access pattern A[i*m+j], which is equivalent to an access to row i and column j in a 2D array with a total of m columns. This suggests that a...

c++,boost,casting,type-conversion,odeint

There is no difference. They choose C++ style casts because they're MUCH safer. C-style casts can perform any reinterpretation cast, which might not even remotely do what's expected, and this is especially dangerous when it happens silently deep in the bowels of a highly geneirc library like Boost ODEINT Simple...

Per the docs, the signature for sugar should be func(y, t, ...) rather than func(t, y ...) import numpy as np import scipy.integrate as integrate # initial parameters X0 = 75. M0 = 150. G0 = 105. N0 = 80. T0 = 7. u10 = 0.0301231859 u20 = 0.0078947020 u30...

sys is a non-static member function; they do not behave like normal functions because they have an implicit this parameter. Possible fixes are: (1) Use a C++11 lambda in place of sys: void robot::move() { stepper.do_step([this](const state_type &x, state_type &dx, double t){ dx[0] = x[1]; dx[1] = -x[0] - g*x[1];...

Your use of *this makes a copy of your CSystem object, which possibly gets copied further. I think you should change that parameter to std::ref(*this). ...

In that lsoda warning, t refers to the current time value and h refers to the current integration step size. The step size has become so close to zero that the current time plus the step size evaluates as equal to the current time due to rounding error (i.e. r1...

Here is a simple adaptation of the pure C++ file you linked to. We simply define a struct of three vectors into which we push the elements of each iterations--as opposed to printing them to standard output. For data structures that grow, we prefer C++ standard library types (as our...

You have to understand the GPUs have lower accuracy than CPUs. This is usual since a GPU is designed for gaming, where exact values is not the design target. Usually GPU accuracy is 32 bits. While CPUs have internally a 48 or 64 bits accuracy math, even if the result...

python,numpy,scipy,differential-equations,odeint

There are several things wrong here. Firstly, your equation is apparently (3x-1)y''-(3x+2)y'-(6x-8)y=0; y(0)=2, y'(0)=3 (note the sign of the term in y). For this equation, your analytical solution and definition of y2 are correct. Secondly, as the @Warren Weckesser says, you must pass 2 parameters as y to g: y[0]...

python,performance,parallel-processing,python-multiprocessing,odeint

Note that the fact that your apply_async is 289 times faster then the for loop is a little suspicious! And right now, you're guaranteed to get the results in the order they're submitted, even if that isn't what you want for maximum parallelism. apply_async starts a task, it doesn't wait...

python,arrays,typeerror,odeint

Your immediate problem is that your deriv function is trying to multiply the ordinary Python list, Cv_data (passed in as Cv) by float values. If you want to vectorize this operation, use NumPy arrays: Ap_data = np.array([2, 7, 91, 1.6, 0.4, 5]) tdata= np.array([0, 1, 4, 5, 4, 20]) Cv_data...

as @Warren Weckesser says and as you suspected, you need to lambdify the expressions first, so that the various partial derivatives dV/dvar[j] return a floating point value. More in general, one problem of your afleiden function is that it evaluates the analytical derivatives of V, without calculating the value of...

c++,templates,boost,function-overloading,odeint

The state itself will be mutated. So passing a real const object which can not be mutated at all can not be passed to integrate adaptive. The const overload is here for allowing the creation of the state within the call of integrate_adaptive. As sehe already mentioned, it is possible...

c++,templates,c++11,boost,odeint

You forgot to copy one of the specializations: template<class T , class Enabler = void > struct get_unit_value_impl { static T value(const T &t) { return t; } typedef T result_type; }; #ifndef __CUDACC__ template<class Unit , class T> struct get_unit_value_impl< boost::units::quantity< Unit , T> > { static T value(...

Look at line 109. template< class ErrorStepper , class ErrorChecker = default_error_checker< typename ErrorStepper::value_type , typename ErrorStepper::algebra_type , typename ErrorStepper::operations_type > , class Resizer = typename ErrorStepper::resizer_type , class ErrorStepperCategory = typename ErrorStepper::stepper_category > class controlled_runge_kutta; Now, there is declaration of template class, in line 146 there is just partial...

I fear that your state type can is not easily be integrated. The problem is, that is mixes a range-like state type (the vector<>) with vector-space-like state types (the Vector3d). You need the range_algebra to iterate over the vector. But norm_inf from range_algebra does not work in your case. What...