Exemplo n.º 1
0
void STPConnection::push_attributes()
{
	// need to push one attribute for each spike
	SpikeContainer * spikes = src->get_spikes_immediate();
	for (SpikeContainer::const_iterator spike = spikes->begin() ;
			spike != spikes->end() ; ++spike ) {
		// dynamics 
		NeuronID spk = src->global2rank(*spike);
		double x = auryn_vector_float_get( state_x, spk );
		double u = auryn_vector_float_get( state_u, spk );
		auryn_vector_float_set( state_x, spk, x-u*x );
		auryn_vector_float_set( state_u, spk, u+Ujump*(1-u) );

		// TODO spike translation or introduce local_spikes 
		// function in SpikingGroup and implement this there ... (better option)
		src->push_attribute( x*u ); 

	}

	// If we had two spike attributes in this connection we push 
	// the second attribute for each spike here:
	//
	// SpikeContainer * spikes = src->get_spikes_immediate();
	// for (SpikeContainer::const_iterator spike = spikes->begin() ;
	// 		spike != spikes->end() ; ++spike ) {
	// 	AurynFloat other_attribute = foo+bar;
	// 	src->push_attribute( other_attribute ); 
	// }
}
Exemplo n.º 2
0
int main(int ac, char* av[]) 
{
	SpikeContainer * sc = new SpikeContainer();

	cout << "Loading 1 2 3 ... " << endl;

	sc->push_back(1);
	sc->push_back(2);
	sc->push_back(3);

	cout << "Reading ";

	for ( NeuronID * iter = sc->begin() ; iter != sc->end() ; ++iter )
		cout << *iter << " ";

	cout << endl;

	sc->clear();

	cout << "Loading 5 6 7 ... " << endl;

	sc->push_back(5);
	sc->push_back(6);
	sc->push_back(7);

	cout << "Reading ";

	for ( NeuronID * iter = sc->begin() ; iter != sc->end() ; ++iter )
		cout << *iter << " ";

	cout << endl;

	delete sc;

	return 0;
}
Exemplo n.º 3
0
void STPConnection::push_attributes()
{
	SpikeContainer * spikes = src->get_spikes_immediate();
	for (SpikeContainer::const_iterator spike = spikes->begin() ;
			spike != spikes->end() ; ++spike ) {
		// dynamics 
		NeuronID spk = src->global2rank(*spike);
		double x = auryn_vector_float_get( state_x, spk );
		double u = auryn_vector_float_get( state_u, spk );
		auryn_vector_float_set( state_x, spk, x-u*x );
		auryn_vector_float_set( state_u, spk, u+Ujump*(1-u) );

		// TODO spike translation or introduce local_spikes function in SpikingGroup and implement this there ... (better option)
		src->push_attribute( x*u ); 
	}
}
Exemplo n.º 4
0
void SyncBuffer::push(SpikeDelay * delay, NeuronID size)
{

	for (NeuronID i = 1 ; i < MINDELAY+1 ; ++i ) {
		SpikeContainer * sc = delay->get_spikes(i);

		// NeuronID s = (NeuronID) (sc->size());
		// send_buf[0] += s;

		count[i-1] = 0;
		for (SpikeContainer::const_iterator spike = sc->begin() ; 
			spike != sc->end() ; ++spike ) {
			NeuronID compressed = *spike + groupPushOffset1 + (i-1)*size;
			send_buf.push_back(compressed);
			count[i-1]++;
		}

		send_buf[0] += delay->get_spikes(i)->size(); // send the total number of spikes
	}

	// transmit get_num_attributes() attributes for count spikes for all time slices
	if ( delay->get_num_attributes() ) {
		for (NeuronID i = 1 ; i < MINDELAY+1 ; ++i ) {
			AttributeContainer * ac = delay->get_attributes(i);
			for ( NeuronID k = 0 ; k < delay->get_num_attributes() ; ++k ) { // loop over attributes
				for ( NeuronID s = 0 ; s < count[i-1] ; ++s ) { // loop over spikes
					send_buf.push_back(*(NeuronID*)(&(ac->at(s+count[i-1]*k))));
					// if ( mpicom->rank() == 0 )
					// 	cout << " pushing attr " << " " << i << " " << k << " " << s << " " 
					// 		<< scientific << ac->at(s+count[i-1]*k) << endl;
				}
			}
		}
	}

	groupPushOffset1 += size*MINDELAY;
}