当前位置: 首页>>代码示例>>C++>>正文


C++ DSSpikeEvent::set_multiplicity方法代码示例

本文整理汇总了C++中DSSpikeEvent::set_multiplicity方法的典型用法代码示例。如果您正苦于以下问题:C++ DSSpikeEvent::set_multiplicity方法的具体用法?C++ DSSpikeEvent::set_multiplicity怎么用?C++ DSSpikeEvent::set_multiplicity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DSSpikeEvent的用法示例。


在下文中一共展示了DSSpikeEvent::set_multiplicity方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

void
nest::mip_generator::event_hook( DSSpikeEvent& e )
{
  // note: event_hook() receives a reference of the spike event that
  // was originally created in the update function. there we set
  // the multiplicty to store the number of mother spikes. the *same*
  // reference will be delivered multiple times to the event hook,
  // once for every receiver. when calling handle() of the receiver
  // above, we need to change the multiplicty to the number of copied
  // child process spikes, so afterwards it needs to be reset to correctly
  // store the number of mother spikes again during the next call of event_hook().
  // reichert

  librandom::RngPtr rng = net_->get_rng( get_thread() );
  ulong_t n_mother_spikes = e.get_multiplicity();
  ulong_t n_spikes = 0;

  for ( ulong_t n = 0; n < n_mother_spikes; n++ )
  {
    if ( rng->drand() < P_.p_copy_ )
      n_spikes++;
  }

  if ( n_spikes > 0 )
  {
    e.set_multiplicity( n_spikes );
    e.get_receiver().handle( e );
  }

  e.set_multiplicity( n_mother_spikes );
}
开发者ID:JanneM,项目名称:nest-simulator,代码行数:31,代码来源:mip_generator.cpp

示例2: kernel

void
nest::poisson_generator::event_hook( DSSpikeEvent& e )
{
  librandom::RngPtr rng = kernel().rng_manager.get_rng( get_thread() );
  long n_spikes = V_.poisson_dev_.ldev( rng );

  if ( n_spikes > 0 ) // we must not send events with multiplicity 0
  {
    e.set_multiplicity( n_spikes );
    e.get_receiver().handle( e );
  }
}
开发者ID:DimitriPlotnikov,项目名称:nest-simulator,代码行数:12,代码来源:poisson_generator.cpp

示例3: assert

void
nest::ppd_sup_generator::event_hook( DSSpikeEvent& e )
{
  // get port number
  const port prt = e.get_port();

  // we handle only one port here, get reference to vector element
  assert( 0 <= prt && static_cast< size_t >( prt ) < B_.age_distributions_.size() );

  // age_distribution object propagates one time step and returns number of spikes
  ulong_t n_spikes =
    B_.age_distributions_[ prt ].update( V_.hazard_step_t_, net_->get_rng( get_thread() ) );

  if ( n_spikes > 0 ) // we must not send events with multiplicity 0
  {
    e.set_multiplicity( n_spikes );
    e.get_receiver().handle( e );
  }
}
开发者ID:JanneM,项目名称:nest-simulator,代码行数:19,代码来源:ppd_sup_generator.cpp

示例4: assert

void nest::mip_generator::update(Time const & T, const long_t from, const long_t to)
{
  assert(to >= 0 && (delay) from < Scheduler::get_min_delay());
  assert(from < to);

  for ( long_t lag = from ; lag < to ; ++lag )
  {
    if ( !device_.is_active(T) || P_.rate_ <= 0 )
      return; // no spikes to be generated
    
    // generate spikes of mother process for each time slice
    ulong_t n_mother_spikes = V_.poisson_dev_.uldev(P_.rng_);

    if ( n_mother_spikes )
    {
      DSSpikeEvent se;

      se.set_multiplicity(n_mother_spikes);
      network()->send(*this, se, lag);
    }
  }
}
开发者ID:QJonny,项目名称:CyNest,代码行数:22,代码来源:mip_generator.cpp

示例5: assert

void
nest::spike_dilutor::update( Time const& T, const long_t from, const long_t to )
{
  assert( to >= 0 && ( delay ) from < Scheduler::get_min_delay() );
  assert( from < to );

  for ( long_t lag = from; lag < to; ++lag )
  {
    if ( !device_.is_active( T ) )
      return; // no spikes to be repeated

    // generate spikes of mother process for each time slice
    ulong_t n_mother_spikes = static_cast< ulong_t >( B_.n_spikes_.get_value( lag ) );

    if ( n_mother_spikes )
    {
      DSSpikeEvent se;

      se.set_multiplicity( n_mother_spikes );
      network()->send( *this, se, lag );
    }
  }
}
开发者ID:JanneM,项目名称:nest-simulator,代码行数:23,代码来源:spike_dilutor.cpp


注:本文中的DSSpikeEvent::set_multiplicity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。