Auryn simulator  v0.8.1-206-gb56e451
Plastic Spiking Neural Network Simulator
Public Member Functions | Protected Member Functions | List of all members
auryn::IdentityConnection Class Reference

Provides a unity matrix like connectivity. More...

#include <IdentityConnection.h>

Inheritance diagram for auryn::IdentityConnection:
Inheritance graph
[legend]
Collaboration diagram for auryn::IdentityConnection:
Collaboration graph
[legend]

Public Member Functions

 IdentityConnection ()
 
 IdentityConnection (SpikingGroup *source, NeuronGroup *destination, AurynWeight weight=1.0, TransmitterType transmitter=GLUT, string name="Default IdentityConnection")
 
 IdentityConnection (SpikingGroup *source, NeuronGroup *destination, AurynWeight weight, NeuronID lo_row, NeuronID hi_row, NeuronID lo_col, NeuronID hi_col, TransmitterType transmitter=GLUT, string name="Cropped Identity Connection")
 
virtual ~IdentityConnection ()
 
virtual AurynWeight get (NeuronID i, NeuronID j)
 Get weight value i,j if it exists. Otherwise the value is undefined. More...
 
virtual AurynWeightget_ptr (NeuronID i, NeuronID j)
 Return pointer to weight element i,j if it exists, otherwise return NULL. More...
 
virtual AurynWeight get_data (NeuronID i)
 Return weight element as index in data array. More...
 
void set_offset (int off)
 
void set_every (NeuronID e)
 
virtual void set_data (NeuronID i, AurynWeight value)
 
virtual void set (NeuronID i, NeuronID j, AurynWeight value)
 Set existing weight element i,j with value. More...
 
void finalize ()
 Finalize Connection after initialization to prepare for use in simulation. More...
 
AurynLong get_nonzero ()
 Return number of nonzero elements in this Connection. More...
 
virtual void propagate ()
 Propagate method to propagate spikes. Called by System run method. More...
 
virtual AurynDouble sum ()
 
virtual void stats (AurynDouble &mean, AurynDouble &std, StateID zid=0)
 Return stats for connection. More...
 
virtual bool write_to_file (string filename)
 Implements save to file functionality. Also called in save_network_state from System class. More...
 
virtual bool load_from_file (string filename)
 Implements load from file functionality. Also called in save_network_state from System class. More...
 
virtual AurynFloat mean ()
 
std::vector< neuron_pairget_block (NeuronID lo_row, NeuronID lo_col, NeuronID hi_row, NeuronID hi_col)
 
- Public Member Functions inherited from auryn::Connection
 Connection ()
 
 Connection (NeuronID rows, NeuronID cols)
 
 Connection (SpikingGroup *source, NeuronGroup *destination, TransmitterType transmitter=GLUT, std::string name="Connection")
 
virtual ~Connection ()
 
void set_size (NeuronID i, NeuronID j)
 
void set_name (std::string name)
 Set name of connection. More...
 
std::string get_name ()
 Returns name of connection. More...
 
std::string get_file_name ()
 Extracts the class name of the connection from the file name. More...
 
std::string get_log_name ()
 Returns a string which is the combination of file and connection name for logging. More...
 
AurynStateVectorget_target_vector ()
 Returns target state vector if one is defined. More...
 
NeuronID get_m_rows ()
 Get number of rows (presynaptic) in connection. More...
 
NeuronID get_n_cols ()
 Get number of columns (postsynaptic) in connection. More...
 
TransmitterType get_transmitter ()
 Returns transmitter type. More...
 
void set_target (AurynWeight *ptr)
 Sets target state of this connection directly via a pointer. More...
 
void set_target (AurynStateVector *ptr)
 Sets target state of this connection directly via a StateVector. More...
 
void set_receptor (AurynStateVector *ptr)
 Same as set_target. More...
 
void set_transmitter (AurynStateVector *ptr)
 Same as set_target. More...
 
void set_transmitter (TransmitterType transmitter)
 Sets target state of this connection for a given receptor as one of Auryn's default transmitter types. More...
 
void set_receptor (string state_name)
 Sets target state of this connection directly the name of a state vector. More...
 
void set_target (string state_name)
 Same as set_receptor. More...
 
void set_transmitter (string state_name)
 Same as set_receptor, but DEPRECATED. More...
 
void set_source (SpikingGroup *source)
 Sets source SpikingGroup of this connection. More...
 
SpikingGroupget_source ()
 Returns pointer to the presynaptic group. More...
 
void set_destination (NeuronGroup *source)
 Sets destination SpikingGroup of this connection. More...
 
NeuronGroupget_destination ()
 Returns pointer to the postsynaptic group. More...
 
virtual void evolve ()
 Evolve method to update internal connection state. Called by System run method. More...
 
void conditional_propagate ()
 DEPRECATED. (Such connections should not be registered in the first place) Calls propagate only if the postsynaptic NeuronGroup exists on the local rank. More...
 
Traceget_pre_trace (const AurynDouble tau)
 Returns a pointer to a presynaptic trace object. More...
 
Traceget_post_trace (const AurynDouble tau)
 Returns a pointer to a postsynaptic trace object. More...
 
Traceget_post_state_trace (const string state_name, const AurynDouble tau, const AurynDouble jump_size=0.0)
 Returns a pointer to a postsynaptic state trace object. More...
 
void transmit (const NeuronID id, const AurynWeight amount)
 Default way to transmit a spike to a postsynaptic partner. More...
 
void targeted_transmit (SpikingGroup *target_group, AurynStateVector *target_state, const NeuronID id, const AurynWeight amount)
 Transmits a spike to a given target group and state. More...
 
void safe_transmit (NeuronID id, AurynWeight amount)
 Same as transmit but first checks if the target neuron exists and avoids segfaults that way (but it's also slower). More...
 
SpikeContainerget_pre_spikes ()
 Supplies pointer to SpikeContainer of all presynaptic spikes. More...
 
SpikeContainerget_post_spikes ()
 Returns pointer to SpikeContainer for postsynaptic spikes on this node. More...
 
void add_number_of_spike_attributes (int x)
 Set up spike delay to accomodate x additional spike attributes. More...
 
AurynFloat get_spike_attribute (const NeuronID i, const int attribute_id=0)
 Returns spike attribute belonging to the spike at position i in the get_spikes() SpikeContainer. More...
 

Protected Member Functions

void free ()
 
- Protected Member Functions inherited from auryn::Connection
virtual void virtual_serialize (boost::archive::binary_oarchive &ar, const unsigned int version)
 
virtual void virtual_serialize (boost::archive::binary_iarchive &ar, const unsigned int version)
 
void init (TransmitterType transmitter=GLUT)
 

Additional Inherited Members

- Public Attributes inherited from auryn::Connection
SpikingGroupsrc
 Pointer to the source group of this connection. More...
 
NeuronGroupdst
 Pointer to the destination group of this connection. More...
 
- Protected Attributes inherited from auryn::Connection
TransmitterType trans
 
AurynStateVectortarget_state_vector
 
AurynFloattarget
 A more direct reference on the first element of the target_state_vector. More...
 
NeuronID number_of_spike_attributes
 Number of spike attributes to expect with each spike transmitted through this connection. More...
 
NeuronID spike_attribute_offset
 Stores spike attribute offset in attribute array. More...
 

Detailed Description

Provides a unity matrix like connectivity.

Constructor & Destructor Documentation

◆ IdentityConnection() [1/3]

auryn::IdentityConnection::IdentityConnection ( )

◆ IdentityConnection() [2/3]

IdentityConnection::IdentityConnection ( SpikingGroup source,
NeuronGroup destination,
AurynWeight  weight = 1.0,
TransmitterType  transmitter = GLUT,
std::string  name = "Default IdentityConnection" 
)
33 : Connection(source,destination,transmitter,name)
34 {
35  init(weight);
36 }
Connection()
Definition: Connection.cpp:30

◆ IdentityConnection() [3/3]

IdentityConnection::IdentityConnection ( SpikingGroup source,
NeuronGroup destination,
AurynWeight  weight,
NeuronID  lo_row,
NeuronID  hi_row,
NeuronID  lo_col,
NeuronID  hi_col,
TransmitterType  transmitter = GLUT,
std::string  name = "Cropped Identity Connection" 
)
45 : Connection(source,destination,transmitter)
46 {
47  init(weight);
48  lo_src = lo_row;
49  hi_src = hi_row;
50  lo_dst = lo_dst;
51  hi_dst = hi_dst;
52 }
Connection()
Definition: Connection.cpp:30

◆ ~IdentityConnection()

IdentityConnection::~IdentityConnection ( )
virtual
55 {
56  free();
57 }
void free()
Definition: IdentityConnection.cpp:73
Here is the call graph for this function:

Member Function Documentation

◆ finalize()

void IdentityConnection::finalize ( )
virtual

Finalize Connection after initialization to prepare for use in simulation.

Implements auryn::Connection.

78 {
79 }

◆ free()

void IdentityConnection::free ( )
protected
74 {
75 }

◆ get()

AurynWeight IdentityConnection::get ( NeuronID  i,
NeuronID  j 
)
virtual

Get weight value i,j if it exists. Otherwise the value is undefined.

Implements auryn::Connection.

105 {
106  if ( i == j ) return connection_weight;
107  else return 0;
108 }

◆ get_block()

std::vector< neuron_pair > IdentityConnection::get_block ( NeuronID  lo_row,
NeuronID  lo_col,
NeuronID  hi_row,
NeuronID  hi_col 
)

Returns a vector of ConnectionsID of a block specified by the arguments

148 {
149  std::vector<neuron_pair> clist;
150  for ( NeuronID i = lo_row ; i < hi_row ; ++i ) {
151  for ( NeuronID j = lo_col ; j < hi_col ; ++j ) {
152  if ( i == j ) {
153  neuron_pair a;
154  a.i = i;
155  a.j = j;
156  clist.push_back( a );
157  }
158  }
159  }
160  return clist;
161 }
Struct that defines a pair of neurons in SparseConnection.
Definition: auryn_definitions.h:167
NeuronID i
Definition: auryn_definitions.h:168
unsigned int NeuronID
NeuronID is an unsigned integeger type used to index neurons in Auryn.
Definition: auryn_definitions.h:151
NeuronID j
Definition: auryn_definitions.h:168

◆ get_data()

AurynWeight IdentityConnection::get_data ( NeuronID  i)
virtual

Return weight element as index in data array.

Implements auryn::Connection.

96 {
97  return 0;
98 }

◆ get_nonzero()

AurynLong IdentityConnection::get_nonzero ( )
virtual

Return number of nonzero elements in this Connection.

Implements auryn::Connection.

121 {
122  return std::min(src->get_pre_size(),dst->get_post_size());
123 }
SpikingGroup * src
Pointer to the source group of this connection.
Definition: Connection.h:108
NeuronGroup * dst
Pointer to the destination group of this connection.
Definition: Connection.h:111
NeuronID get_post_size()
Returns the size on this rank.
Definition: SpikingGroup.cpp:314
NeuronID get_pre_size()
Returns the size of the group.
Definition: SpikingGroup.cpp:309
Here is the call graph for this function:

◆ get_ptr()

AurynWeight * IdentityConnection::get_ptr ( NeuronID  i,
NeuronID  j 
)
virtual

Return pointer to weight element i,j if it exists, otherwise return NULL.

Implements auryn::Connection.

111 {
112  if ( i == j ) return &connection_weight;
113  else return NULL;
114 }

◆ load_from_file()

bool IdentityConnection::load_from_file ( string  filename)
virtual

Implements load from file functionality. Also called in save_network_state from System class.

Implements auryn::Connection.

142 {
143  return true; // TODO fake but what else ?
144 }

◆ mean()

AurynFloat IdentityConnection::mean ( )
virtual
164 {
165  AurynDouble m,s;
166  stats(m,s);
167  return m;
168 }
double AurynDouble
Higher precision floating point datatype.
Definition: auryn_definitions.h:158
virtual void stats(AurynDouble &mean, AurynDouble &std, StateID zid=0)
Return stats for connection.
Definition: IdentityConnection.cpp:125
Here is the call graph for this function:

◆ propagate()

void IdentityConnection::propagate ( )
virtual

Propagate method to propagate spikes. Called by System run method.

Implements auryn::Connection.

82 {
83  SpikeContainer::const_iterator spikes_end = src->get_spikes()->end();
84  for (SpikeContainer::const_iterator spike = src->get_spikes()->begin() ;
85  spike != spikes_end ; ++spike ) {
86  if ( *spike%every == 0 )
87  safe_transmit( ( *spike/every ) + offset , connection_weight );
88  // IMPORTANT the use of safe_transmit
89  // is important here since there is
90  // no weight matrix with only the
91  // corresponding columns
92  }
93 }
SpikeContainer * get_spikes()
Returns pointer to a spike container that contains spikes which arrive in this timestep from all neur...
Definition: SpikingGroup.cpp:245
SpikingGroup * src
Pointer to the source group of this connection.
Definition: Connection.h:108
void safe_transmit(NeuronID id, AurynWeight amount)
Same as transmit but first checks if the target neuron exists and avoids segfaults that way (but it&#39;s...
Definition: Connection.cpp:215
Here is the call graph for this function:

◆ set()

void IdentityConnection::set ( NeuronID  i,
NeuronID  j,
AurynWeight  value 
)
virtual

Set existing weight element i,j with value.

Implements auryn::Connection.

117 {
118 }

◆ set_data()

void IdentityConnection::set_data ( NeuronID  i,
AurynWeight  value 
)
virtual
101 {
102 }

◆ set_every()

void IdentityConnection::set_every ( NeuronID  e)
177 {
178  if ( e != 0 ) {
179  every = e;
180  auryn::logger->parameter("every",(int)every);
181  }
182 }
void parameter(std::string name, T value)
Definition: Logger.h:90
Logger * logger
Global pointer to instance of Logger which needs to be initialized in every simulation main program...
Definition: auryn_global.cpp:36
Here is the call graph for this function:

◆ set_offset()

void IdentityConnection::set_offset ( int  off)
171 {
172  offset = off;
173  auryn::logger->parameter("offset",(int)offset);
174 }
void parameter(std::string name, T value)
Definition: Logger.h:90
Logger * logger
Global pointer to instance of Logger which needs to be initialized in every simulation main program...
Definition: auryn_global.cpp:36
Here is the call graph for this function:

◆ stats()

void IdentityConnection::stats ( AurynDouble mean,
AurynDouble std,
StateID  zid = 0 
)
virtual

Return stats for connection.

Note that IdentityConnection does not support complex matrix states yet

Implements auryn::Connection.

126 {
127  mean = connection_weight;
128  std = 0;
129 }
STL namespace.
virtual AurynFloat mean()
Definition: IdentityConnection.cpp:163

◆ sum()

AurynDouble IdentityConnection::sum ( )
virtual
132 {
133  return connection_weight*get_nonzero();
134 }
AurynLong get_nonzero()
Return number of nonzero elements in this Connection.
Definition: IdentityConnection.cpp:120
Here is the call graph for this function:

◆ write_to_file()

bool IdentityConnection::write_to_file ( string  filename)
virtual

Implements save to file functionality. Also called in save_network_state from System class.

Implements auryn::Connection.

137 {
138  return true; // TODO fake but what else ?
139 }

The documentation for this class was generated from the following files: