void nest::aeif_cond_exp::init_buffers_() { B_.spike_exc_.clear(); // includes resize B_.spike_inh_.clear(); // includes resize B_.currents_.clear(); // includes resize Archiving_Node::clear_history(); B_.logger_.reset(); B_.step_ = Time::get_resolution().get_ms(); // We must integrate this model with high-precision to obtain decent results B_.IntegrationStep_ = std::min( 0.01, B_.step_ ); if ( B_.s_ == 0 ) B_.s_ = gsl_odeiv_step_alloc( gsl_odeiv_step_rkf45, State_::STATE_VEC_SIZE ); else gsl_odeiv_step_reset( B_.s_ ); if ( B_.c_ == 0 ) B_.c_ = gsl_odeiv_control_yp_new( P_.gsl_error_tol, P_.gsl_error_tol ); else gsl_odeiv_control_init( B_.c_, P_.gsl_error_tol, P_.gsl_error_tol, 0.0, 1.0 ); if ( B_.e_ == 0 ) B_.e_ = gsl_odeiv_evolve_alloc( State_::STATE_VEC_SIZE ); else gsl_odeiv_evolve_reset( B_.e_ ); B_.I_stim_ = 0.0; }
void nest::iaf_cond_exp::init_buffers_() { B_.spike_exc_.clear(); // includes resize B_.spike_inh_.clear(); // includes resize B_.currents_.clear(); // includes resize Archiving_Node::clear_history(); B_.logger_.reset(); B_.step_ = Time::get_resolution().get_ms(); B_.IntegrationStep_ = B_.step_; if ( B_.s_ == 0 ) B_.s_ = gsl_odeiv_step_alloc( gsl_odeiv_step_rkf45, State_::STATE_VEC_SIZE ); else gsl_odeiv_step_reset( B_.s_ ); if ( B_.c_ == 0 ) B_.c_ = gsl_odeiv_control_y_new( 1e-3, 0.0 ); else gsl_odeiv_control_init( B_.c_, 1e-3, 0.0, 1.0, 0.0 ); if ( B_.e_ == 0 ) B_.e_ = gsl_odeiv_evolve_alloc( State_::STATE_VEC_SIZE ); else gsl_odeiv_evolve_reset( B_.e_ ); B_.sys_.function = iaf_cond_exp_dynamics; B_.sys_.jacobian = NULL; B_.sys_.dimension = State_::STATE_VEC_SIZE; B_.sys_.params = reinterpret_cast< void* >( this ); B_.I_stim_ = 0.0; }
gsl_odeiv_control * gsl_odeiv_control_scaled_new(double eps_abs, double eps_rel, double a_y, double a_dydt, const double scale_abs[], size_t dim) { gsl_odeiv_control * c = gsl_odeiv_control_alloc (gsl_odeiv_control_scaled); int status = gsl_odeiv_control_init (c, eps_abs, eps_rel, a_y, a_dydt); if (status != GSL_SUCCESS) { gsl_odeiv_control_free (c); GSL_ERROR_NULL ("error trying to initialize control", status); } { sc_control_state_t * s = (sc_control_state_t *) c->state; s->scale_abs = (double *)malloc(dim * sizeof(double)); if (s->scale_abs == 0) { free (s); GSL_ERROR_NULL ("failed to allocate space for scale_abs", GSL_ENOMEM); } memcpy(s->scale_abs, scale_abs, dim * sizeof(double)); } return c; }
void nest::iaf_cond_alpha_mc::init_buffers_() { B_.spikes_.resize( NUM_SPIKE_RECEPTORS ); for ( size_t n = 0; n < NUM_SPIKE_RECEPTORS; ++n ) { B_.spikes_[ n ].clear(); } // includes resize B_.currents_.resize( NUM_CURR_RECEPTORS ); for ( size_t n = 0; n < NUM_CURR_RECEPTORS; ++n ) { B_.currents_[ n ].clear(); } // includes resize B_.logger_.reset(); Archiving_Node::clear_history(); B_.step_ = Time::get_resolution().get_ms(); B_.IntegrationStep_ = B_.step_; if ( B_.s_ == 0 ) { B_.s_ = gsl_odeiv_step_alloc( gsl_odeiv_step_rkf45, State_::STATE_VEC_SIZE ); } else { gsl_odeiv_step_reset( B_.s_ ); } if ( B_.c_ == 0 ) { B_.c_ = gsl_odeiv_control_y_new( 1e-3, 0.0 ); } else { gsl_odeiv_control_init( B_.c_, 1e-3, 0.0, 1.0, 0.0 ); } if ( B_.e_ == 0 ) { B_.e_ = gsl_odeiv_evolve_alloc( State_::STATE_VEC_SIZE ); } else { gsl_odeiv_evolve_reset( B_.e_ ); } B_.sys_.function = iaf_cond_alpha_mc_dynamics; B_.sys_.jacobian = NULL; B_.sys_.dimension = State_::STATE_VEC_SIZE; B_.sys_.params = reinterpret_cast< void* >( this ); for ( size_t n = 0; n < NCOMP; ++n ) { B_.I_stim_[ n ] = 0.0; } }
void nest::hh_psc_alpha_gap::init_buffers_() { B_.spike_exc_.clear(); // includes resize B_.spike_inh_.clear(); // includes resize B_.currents_.clear(); // includes resize // allocate strucure for gap events here // function is called from Scheduler::prepare_nodes() before the // first call to update // so we already know which interpolation scheme to use according // to the properties of this neurons // determine size of structure depending on interpolation scheme // and unsigned int Scheduler::min_delay() (number of simulation time steps // per min_delay step) // resize interpolation_coefficients depending on interpolation order const size_t quantity = kernel().connection_manager.get_min_delay() * ( kernel().simulation_manager.get_wfr_interpolation_order() + 1 ); B_.interpolation_coefficients.resize( quantity, 0.0 ); B_.last_y_values.resize( kernel().connection_manager.get_min_delay(), 0.0 ); B_.sumj_g_ij_ = 0.0; Archiving_Node::clear_history(); B_.logger_.reset(); B_.step_ = Time::get_resolution().get_ms(); B_.IntegrationStep_ = B_.step_; if ( B_.s_ == 0 ) B_.s_ = gsl_odeiv_step_alloc( gsl_odeiv_step_rkf45, State_::STATE_VEC_SIZE ); else gsl_odeiv_step_reset( B_.s_ ); if ( B_.c_ == 0 ) B_.c_ = gsl_odeiv_control_y_new( 1e-6, 0.0 ); else gsl_odeiv_control_init( B_.c_, 1e-6, 0.0, 1.0, 0.0 ); if ( B_.e_ == 0 ) B_.e_ = gsl_odeiv_evolve_alloc( State_::STATE_VEC_SIZE ); else gsl_odeiv_evolve_reset( B_.e_ ); B_.sys_.function = hh_psc_alpha_gap_dynamics; B_.sys_.jacobian = NULL; B_.sys_.dimension = State_::STATE_VEC_SIZE; B_.sys_.params = reinterpret_cast< void* >( this ); B_.I_stim_ = 0.0; }
static VALUE rb_gsl_odeiv_control_init(VALUE obj, VALUE epsabs, VALUE epsrel, VALUE ay, VALUE adydt) { gsl_odeiv_control *c = NULL; Need_Float(epsabs); Need_Float(epsrel); Need_Float(ay); Need_Float(adydt); Data_Get_Struct(obj, gsl_odeiv_control, c); gsl_odeiv_control_init(c, NUM2DBL(epsabs), NUM2DBL(epsrel), NUM2DBL(ay), NUM2DBL(adydt)); return obj; }
void nest::aeif_psc_alpha::init_buffers_() { B_.spike_exc_.clear(); // includes resize B_.spike_inh_.clear(); // includes resize B_.currents_.clear(); // includes resize Archiving_Node::clear_history(); B_.logger_.reset(); B_.step_ = Time::get_resolution().get_ms(); // We must integrate this model with high-precision to obtain decent results B_.IntegrationStep_ = std::min( 0.01, B_.step_ ); if ( B_.s_ == 0 ) { B_.s_ = gsl_odeiv_step_alloc( gsl_odeiv_step_rkf45, State_::STATE_VEC_SIZE ); } else { gsl_odeiv_step_reset( B_.s_ ); } if ( B_.c_ == 0 ) { B_.c_ = gsl_odeiv_control_yp_new( P_.gsl_error_tol, P_.gsl_error_tol ); } else { gsl_odeiv_control_init( B_.c_, P_.gsl_error_tol, P_.gsl_error_tol, 0.0, 1.0 ); } if ( B_.e_ == 0 ) { B_.e_ = gsl_odeiv_evolve_alloc( State_::STATE_VEC_SIZE ); } else { gsl_odeiv_evolve_reset( B_.e_ ); } B_.sys_.jacobian = NULL; B_.sys_.dimension = State_::STATE_VEC_SIZE; B_.sys_.params = reinterpret_cast< void* >( this ); B_.sys_.function = aeif_psc_alpha_dynamics; B_.I_stim_ = 0.0; }
gsl_odeiv_control * gsl_odeiv_control_standard_new(double eps_abs, double eps_rel, double a_y, double a_dydt) { gsl_odeiv_control * c = gsl_odeiv_control_alloc (gsl_odeiv_control_standard); int status = gsl_odeiv_control_init (c, eps_abs, eps_rel, a_y, a_dydt); if (status != GSL_SUCCESS) { gsl_odeiv_control_free (c); GSL_ERROR_NULL ("error trying to initialize control", status); } return c; }
//Handles data from MarkovChannel class. void MarkovGslSolver::init( vector< double > initialState ) { nVars_ = initialState.size(); if ( stateGsl_ == 0 ) stateGsl_ = new double[ nVars_ ]; state_ = initialState; initialState_ = initialState; Q_.resize( nVars_ ); for ( unsigned int i = 0; i < nVars_; ++i ) Q_[i].resize( nVars_, 0.0 ); isInitialized_ = 1; assert( gslStepType_ != 0 ); if ( gslStep_ ) gsl_odeiv_step_free(gslStep_); gslStep_ = gsl_odeiv_step_alloc( gslStepType_, nVars_ ); assert( gslStep_ != 0 ); if ( !gslEvolve_ ) gslEvolve_ = gsl_odeiv_evolve_alloc(nVars_); else gsl_odeiv_evolve_reset(gslEvolve_); assert(gslEvolve_ != 0); if ( !gslControl_ ) gslControl_ = gsl_odeiv_control_y_new( absAccuracy_, relAccuracy_ ); else gsl_odeiv_control_init(gslControl_,absAccuracy_, relAccuracy_, 1, 0); assert(gslControl_!= 0); gslSys_.function = &MarkovGslSolver::evalSystem; gslSys_.jacobian = 0; gslSys_.dimension = nVars_; gslSys_.params = static_cast< void * >( &Q_ ); }
void nest::ht_neuron::init_buffers_() { // Reset spike buffers. for ( std::vector< RingBuffer >::iterator it = B_.spike_inputs_.begin(); it != B_.spike_inputs_.end(); ++it ) { it->clear(); // include resize } B_.currents_.clear(); // include resize B_.logger_.reset(); Archiving_Node::clear_history(); B_.step_ = Time::get_resolution().get_ms(); B_.IntegrationStep_ = B_.step_; if ( B_.s_ == 0 ) B_.s_ = gsl_odeiv_step_alloc( gsl_odeiv_step_rkf45, State_::STATE_VEC_SIZE ); else gsl_odeiv_step_reset( B_.s_ ); if ( B_.c_ == 0 ) B_.c_ = gsl_odeiv_control_y_new( 1e-3, 0.0 ); else gsl_odeiv_control_init( B_.c_, 1e-3, 0.0, 1.0, 0.0 ); if ( B_.e_ == 0 ) B_.e_ = gsl_odeiv_evolve_alloc( State_::STATE_VEC_SIZE ); else gsl_odeiv_evolve_reset( B_.e_ ); B_.sys_.function = ht_neuron_dynamics; B_.sys_.jacobian = 0; B_.sys_.dimension = State_::STATE_VEC_SIZE; B_.sys_.params = reinterpret_cast< void* >( this ); B_.I_stim_ = 0.0; }