23#ifndef RATE_TRANSFORMER_NODE_IMPL_H
24#define RATE_TRANSFORMER_NODE_IMPL_H
54template <
class TNonlinearities >
61template <
class TNonlinearities >
63 : linear_summation_( true )
67template <
class TNonlinearities >
77template <
class TNonlinearities >
84template <
class TNonlinearities >
91template <
class TNonlinearities >
98template <
class TNonlinearities >
105template <
class TNonlinearities >
111template <
class TNonlinearities >
122template <
class TNonlinearities >
132template <
class TNonlinearities >
135 , nonlinearities_( n.nonlinearities_ )
146template <
class TNonlinearities >
150 B_.delayed_rates_.clear();
154 B_.instant_rates_.resize( buffer_size, 0.0 );
155 B_.last_y_values.resize( buffer_size, 0.0 );
161template <
class TNonlinearities >
172template <
class TNonlinearities >
177 const bool called_from_wfr_update )
181 bool wfr_tol_exceeded =
false;
184 std::vector< double > new_rates( buffer_size, 0.0 );
186 for (
long lag = from; lag < to; ++lag )
189 new_rates[ lag ] = S_.rate_;
193 double delayed_rates = 0;
194 if ( called_from_wfr_update )
197 delayed_rates = B_.delayed_rates_.get_value_wfr_update( lag );
202 delayed_rates = B_.delayed_rates_.get_value( lag );
205 if ( P_.linear_summation_ )
207 S_.rate_ += nonlinearities_.input( delayed_rates + B_.instant_rates_[ lag ] );
211 S_.rate_ += delayed_rates + B_.instant_rates_[ lag ];
214 if ( called_from_wfr_update )
217 wfr_tol_exceeded = wfr_tol_exceeded or fabs( S_.rate_ - B_.last_y_values[ lag ] ) > wfr_tol;
219 B_.last_y_values[ lag ] = S_.rate_;
224 B_.logger_.record_data( origin.get_steps() + lag );
228 if ( not called_from_wfr_update )
237 std::vector< double >( buffer_size, 0.0 ).swap( B_.last_y_values );
240 for (
long temp = from; temp < to; ++temp )
242 new_rates[ temp ] = S_.rate_;
252 std::vector< double >( buffer_size, 0.0 ).swap( B_.instant_rates_ );
254 return wfr_tol_exceeded;
258template <
class TNonlinearities >
262 const double weight = e.get_weight();
265 std::vector< unsigned int >::iterator it = e.begin();
267 while ( it != e.end() )
269 if ( P_.linear_summation_ )
271 B_.instant_rates_[ i ] += weight * e.get_coeffvalue( it );
275 B_.instant_rates_[ i ] += weight * nonlinearities_.input( e.get_coeffvalue( it ) );
281template <
class TNonlinearities >
285 const double weight = e.get_weight();
289 std::vector< unsigned int >::iterator it = e.begin();
291 while ( it != e.end() )
293 if ( P_.linear_summation_ )
295 B_.delayed_rates_.add_value( delay + i, weight * e.get_coeffvalue( it ) );
299 B_.delayed_rates_.add_value( delay + i, weight * nonlinearities_.input( e.get_coeffvalue( it ) ) );
305template <
class TNonlinearities >
309 B_.logger_.handle( e );
Dictionary class for interface to Python and C++ API.
Definition dictionary.h:213
A node which archives spike history for the purposes of spike-timing dependent plasticity (STDP)
Definition archiving_node.h:49
void clear_history()
Clear spike history.
Definition archiving_node.cpp:269
long get_min_delay() const
Return minimal connection delay, which is precomputed by update_delay_extrema_().
Definition connection_manager.h:728
Request data to be logged/logged data to be sent.
Definition event.h:636
void set_coeffarray(std::vector< DataType > &ca)
Definition secondary_event.h:224
Event for rate model connections with delay.
Definition secondary_event.h:331
void send_secondary(Node &source, SecondaryEvent &e)
Send a secondary event remote.
Definition event_delivery_manager_impl.h:138
Event for rate model connections without delay.
Definition secondary_event.h:315
Base class for all NEST network objects.
Definition node.h:99
void set_node_uses_wfr(const bool)
Sets node_uses_wfr_ member variable (to be able to set it to "true" for any class derived from Node)
Definition node.h:1158
double get_wfr_tol() const
Get the convergence tolerance of the waveform relaxation method.
Definition simulation_manager.h:331
Definition nest_time.h:135
ConnectionManager connection_manager
Definition kernel_manager.h:239
EventDeliveryManager event_delivery_manager
Definition kernel_manager.h:241
SimulationManager simulation_manager
Definition kernel_manager.h:237
const std::string linear_summation("linear_summation")
const std::string rate("rate")
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33
KernelManager & kernel()
Definition kernel_manager.h:311
bool update_value_param(Dictionary const &d, const std::string &key, T &value, nest::Node *node)
Obtain value from parameter dictionary including evaluation of random or spatial parameters.
Definition dict_util.h:42