23 #if (AE_COMPILER==AE_MSVC) 24 #pragma warning(disable:4100) 25 #pragma warning(disable:4127) 26 #pragma warning(disable:4702) 27 #pragma warning(disable:4996) 43 _odesolverstate_owner::_odesolverstate_owner()
47 throw ap_error(
"ALGLIB: malloc error");
49 throw ap_error(
"ALGLIB: malloc error");
56 throw ap_error(
"ALGLIB: malloc error");
58 throw ap_error(
"ALGLIB: malloc error");
67 throw ap_error(
"ALGLIB: malloc error");
71 _odesolverstate_owner::~_odesolverstate_owner()
86 odesolverstate::odesolverstate() :
_odesolverstate_owner() ,needdy(p_struct->needdy),
y(&p_struct->
y),dy(&p_struct->dy),
x(p_struct->
x)
114 throw ap_error(
"ALGLIB: malloc error");
116 throw ap_error(
"ALGLIB: malloc error");
123 throw ap_error(
"ALGLIB: malloc error");
125 throw ap_error(
"ALGLIB: malloc error");
134 throw ap_error(
"ALGLIB: malloc error");
226 alglib_impl::odesolverrkck(const_cast<alglib_impl::ae_vector*>(y.
c_ptr()), n, const_cast<alglib_impl::ae_vector*>(x.
c_ptr()), m, eps, h, const_cast<alglib_impl::odesolverstate*>(state.
c_ptr()), &_alglib_env_state);
294 alglib_impl::odesolverrkck(const_cast<alglib_impl::ae_vector*>(y.
c_ptr()), n, const_cast<alglib_impl::ae_vector*>(x.
c_ptr()), m, eps, h, const_cast<alglib_impl::odesolverstate*>(state.
c_ptr()), &_alglib_env_state);
318 return *(
reinterpret_cast<bool*
>(&result));
332 throw ap_error(
"ALGLIB: error in 'odesolversolve()' (diff is NULL)");
340 diff(state.
y, state.
x, state.
dy, ptr);
343 throw ap_error(
"ALGLIB: unexpected error in 'odesolversolve'");
384 alglib_impl::odesolverresults(const_cast<alglib_impl::odesolverstate*>(state.
c_ptr()), &m, const_cast<alglib_impl::ae_vector*>(xtbl.
c_ptr()), const_cast<alglib_impl::ae_matrix*>(ytbl.
c_ptr()), const_cast<alglib_impl::odesolverreport*>(rep.
c_ptr()), &_alglib_env_state);
402 static double odesolver_odesolvermaxgrow = 3.0;
403 static double odesolver_odesolvermaxshrink = 10.0;
404 static void odesolver_odesolverinit(
ae_int_t solvertype,
477 ae_assert(n>=1,
"ODESolverRKCK: N<1!", _state);
478 ae_assert(m>=1,
"ODESolverRKCK: M<1!", _state);
479 ae_assert(y->
cnt>=n,
"ODESolverRKCK: Length(Y)<N!", _state);
480 ae_assert(x->
cnt>=m,
"ODESolverRKCK: Length(X)<M!", _state);
486 odesolver_odesolverinit(0, y, n, x, m, eps, h, state, _state);
576 maxgrowpow =
ae_pow(odesolver_odesolvermaxgrow, 5, _state);
584 ae_assert(m>1,
"ODESolverIteration: internal error", _state);
649 for(j=0; j<=n-1; j++)
689 for(j=0; j<=n-1; j++)
719 for(j=0; j<=k-1; j++)
748 for(j=0; j<=n-1; j++)
778 h2 = odesolver_odesolvermaxgrow*h;
782 h2 = h*
ae_pow(state->
eps/err, 0.2, _state);
784 if(
ae_fp_less(h2,h/odesolver_odesolvermaxshrink) )
786 h2 = h/odesolver_odesolvermaxshrink;
898 for(i=0; i<=state->
m-1; i++)
913 static void odesolver_odesolverinit(
ae_int_t solvertype,
974 for(i=1; i<=m-1; i++)
989 for(i=2; i<=m-1; i++)
struct alglib_impl::ae_state ae_state
ae_bool ae_fp_greater_eq(double v1, double v2)
void ae_v_moved(double *vdst, ae_int_t stride_dst, const double *vsrc, ae_int_t stride_src, ae_int_t n, double alpha)
void ae_v_muld(double *vdst, ae_int_t stride_dst, ae_int_t n, double alpha)
double ae_fabs(double x, ae_state *state)
void odesolverrkck(const real_1d_array &y, const ae_int_t n, const real_1d_array &x, const ae_int_t m, const double eps, const double h, odesolverstate &state)
double ae_pow(double x, double y, ae_state *state)
void * ae_malloc(size_t size, ae_state *state)
ae_bool _odesolverstate_init_copy(void *_dst, void *_src, ae_state *_state, ae_bool make_automatic)
union alglib_impl::ae_matrix::@12 ptr
bool odesolveriteration(const odesolverstate &state)
ae_bool _odesolverreport_init_copy(void *_dst, void *_src, ae_state *_state, ae_bool make_automatic)
ae_int_t repterminationtype
odesolverreport & operator=(const odesolverreport &rhs)
void odesolverresults(odesolverstate *state, ae_int_t *m, ae_vector *xtbl, ae_matrix *ytbl, odesolverreport *rep, ae_state *_state)
void ae_state_clear(ae_state *state)
const alglib_impl::ae_matrix * c_ptr() const
void _odesolverstate_clear(void *_p)
ae_bool ae_fp_eq(double v1, double v2)
virtual ~_odesolverreport_owner()
alglib_impl::odesolverreport * p_struct
ae_bool ae_matrix_init_copy(ae_matrix *dst, ae_matrix *src, ae_state *state, ae_bool make_automatic)
ae_bool ae_matrix_init(ae_matrix *dst, ae_int_t rows, ae_int_t cols, ae_datatype datatype, ae_state *state, ae_bool make_automatic)
void ae_matrix_destroy(ae_matrix *dst)
ql0001_ & k(htemp+1),(cvec+1),(atemp+1),(bj+1),(bl+1),(bu+1),(x+1),(clamda+1), &iout, infoqp, &zero,(w+1), &lenw,(iw+1), &leniw, &glob_grd.epsmac
void odesolverrkck(ae_vector *y, ae_int_t n, ae_vector *x, ae_int_t m, double eps, double h, odesolverstate *state, ae_state *_state)
alglib_impl::odesolverstate * c_ptr()
void _rcommstate_destroy(rcommstate *p)
ae_int_t ae_v_len(ae_int_t a, ae_int_t b)
void ae_vector_destroy(ae_vector *dst)
ae_bool _rcommstate_init(rcommstate *p, ae_state *_state, ae_bool make_automatic)
odesolverstate & operator=(const odesolverstate &rhs)
ae_bool _rcommstate_init_copy(rcommstate *dst, rcommstate *src, ae_state *_state, ae_bool make_automatic)
void ae_v_move(double *vdst, ae_int_t stride_dst, const double *vsrc, ae_int_t stride_src, ae_int_t n)
virtual ~odesolverstate()
void _odesolverreport_destroy(void *_p)
void ae_vector_clear(ae_vector *dst)
ae_bool _odesolverreport_init(void *_p, ae_state *_state, ae_bool make_automatic)
ae_bool ae_fp_less(double v1, double v2)
ae_int_t & terminationtype
ae_bool odesolveriteration(odesolverstate *state, ae_state *_state)
ae_bool ae_fp_neq(double v1, double v2)
ae_bool isfinitevector(ae_vector *x, ae_int_t n, ae_state *_state)
void ae_touch_ptr(void *p)
void _odesolverreport_clear(void *_p)
alglib_impl::odesolverreport * c_ptr()
double ae_maxreal(double m1, double m2, ae_state *state)
ae_bool ae_vector_set_length(ae_vector *dst, ae_int_t newsize, ae_state *state)
struct alglib_impl::ae_vector ae_vector
_odesolverstate_owner & operator=(const _odesolverstate_owner &rhs)
const alglib_impl::ae_vector * c_ptr() const
double ae_minreal(double m1, double m2, ae_state *state)
alglib_impl::odesolverstate * p_struct
void ae_state_init(ae_state *state)
void ae_assert(ae_bool cond, const char *msg, ae_state *state)
union alglib_impl::ae_vector::@11 ptr
const char *volatile error_msg
void _rcommstate_clear(rcommstate *p)
_odesolverreport_owner & operator=(const _odesolverreport_owner &rhs)
ae_bool ae_vector_init(ae_vector *dst, ae_int_t size, ae_datatype datatype, ae_state *state, ae_bool make_automatic)
ae_bool ae_isfinite(double x, ae_state *state)
virtual ~odesolverreport()
void odesolversolve(odesolverstate &state, void(*diff)(const real_1d_array &y, double x, real_1d_array &dy, void *ptr), void *ptr)
void ae_v_addd(double *vdst, ae_int_t stride_dst, const double *vsrc, ae_int_t stride_src, ae_int_t n, double alpha)
ae_bool ae_vector_init_copy(ae_vector *dst, ae_vector *src, ae_state *state, ae_bool make_automatic)
ae_bool ae_fp_less_eq(double v1, double v2)
void odesolverresults(const odesolverstate &state, ae_int_t &m, real_1d_array &xtbl, real_2d_array &ytbl, odesolverreport &rep)
alglib_impl::ae_int_t ae_int_t
void ae_matrix_clear(ae_matrix *dst)
ae_bool ae_fp_greater(double v1, double v2)
ae_bool ae_matrix_set_length(ae_matrix *dst, ae_int_t rows, ae_int_t cols, ae_state *state)
void _odesolverstate_destroy(void *_p)
ae_bool _odesolverstate_init(void *_p, ae_state *_state, ae_bool make_automatic)