00001 #include "AlphaInfiniteSpikeResponse.h" 00002 00003 #include <iostream> 00004 using std::cerr; 00005 using std::endl; 00006 00007 int AlphaInfiniteSpikeResponse::adjust( double dt ) 00008 { 00009 if ( tau > 0 ) { 00010 c1 = C1( dt ); 00011 c2 = C2( dt ); 00012 } else { 00013 throw( PCSIM::Exception( "AlphaInfiniteSpikeResponse::adjust", "Time constant not a positive vlaue!" ) ); 00014 } 00015 return 0; 00016 } 00017 00018 int AlphaInfiniteSpikeResponse::reset( double dt ) 00019 { 00020 InfiniteSpikeResponse::reset( dt ); 00021 adjust( dt ); 00022 psr = x = 0.0; 00023 return 0; 00024 } 00025 00026 int AlphaInfiniteSpikeResponse::advance(AdvanceInfo const &) 00027 { 00028 psr = c2 * x + c1 * psr; 00029 x *= c1; 00030 return 0; 00031 } 00032 00033 int AlphaInfiniteSpikeResponse::spikeHit( spikeport_t port, SpikeEvent const& spike ) 00034 { 00035 double _c1_ = C1(spike.delta); 00036 double _c2_ = C2(spike.delta); 00037 double psr_tgt = _c2_ * x + _c1_ * psr; 00038 x += spike.weight / _c1_; 00039 psr = (( psr_tgt - _c2_ * x ) / _c1_); 00040 return 0; 00041 }