Auryn simulator  v0.8.1-206-gb56e451
Plastic Spiking Neural Network Simulator
WeightMonitor.h
Go to the documentation of this file.
1 /*
2 * Copyright 2014-2018 Friedemann Zenke
3 *
4 * This file is part of Auryn, a simulation package for plastic
5 * spiking neural networks.
6 *
7 * Auryn is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * Auryn is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with Auryn. If not, see <http://www.gnu.org/licenses/>.
19 *
20 * If you are using Auryn or parts of it for your work please cite:
21 * Zenke, F. and Gerstner, W., 2014. Limits to high-speed simulations
22 * of spiking neural networks using general-purpose computers.
23 * Front Neuroinform 8, 76. doi: 10.3389/fninf.2014.00076
24 */
25 
26 #ifndef WEIGHTMONITOR_H_
27 #define WEIGHTMONITOR_H_
28 
29 #include "auryn_definitions.h"
30 #include "AurynVector.h"
31 #include "Monitor.h"
32 #include "System.h"
33 #include "SparseConnection.h"
34 #include <fstream>
35 #include <iomanip>
36 
37 namespace auryn {
38 
39 
50 };
51 
56 
65 class WeightMonitor : protected Monitor
66 {
67 protected:
74  std::vector<AurynLong> * element_list;
75  std::vector<NeuronID> group_indices;
76  void init(SparseConnection * source, NeuronID i, NeuronID j, string filename, AurynTime interval);
77 
79  void record_synapse_groups();
80 
81  std::vector<type_pattern> * load_patfile( string filename, unsigned int maxpat );
82 
83 public:
93  WeightMonitor(SparseConnection * source, string filename, AurynDouble interval=10.0);
94 
106  WeightMonitor(SparseConnection * source, ForwardMatrix * m, string filename, AurynDouble interval=10.0);
107 
123  WeightMonitor(SparseConnection * source, NeuronID i, NeuronID j, string filename, AurynDouble interval=10.0, RecordingMode mode = SINGLE, StateID z = 0);
124 
125  virtual ~WeightMonitor();
126 
128  void execute();
129 
131  void set_mat(ForwardMatrix * m);
132 
136  void add_to_list_by_data_index( AurynLong index, StateID z = 0 );
137 
139  void add_to_list( AurynWeight * ptr );
140 
142  void add_to_list( NeuronID i, NeuronID j, StateID z = 0 );
143 
149  void add_to_list( std::vector<neuron_pair> vec , string label = "");
150 
160  void add_equally_spaced( NeuronID number, NeuronID z=0 );
161 
171  void load_pattern_connections(string filename, unsigned int maxcon = 5, unsigned int maxpat = 10, PatternMode patmod = ALLTOALL);
172  void load_pattern_connections(string filename_pre, string filename_post, unsigned int maxcon = 5, unsigned int maxpat = 10, PatternMode patmod = ALLTOALL);
173 
176 };
177 
178 }
179 
180 #endif /*WEIGHTMONITOR_H_*/
Abstract base class for all Monitor objects.
Definition: Monitor.h:47
std::vector< NeuronID > group_indices
Definition: WeightMonitor.h:75
RecordingMode recordingmode
Definition: WeightMonitor.h:70
PatternMode
Definition: WeightMonitor.h:55
SparseConnection * src
Definition: WeightMonitor.h:68
The entire Monitor will record from a single synapse specified at initialization. ...
Definition: WeightMonitor.h:45
std::vector< AurynLong > * element_list
Definition: WeightMonitor.h:74
void add_to_list(AurynWeight *ptr)
Adds a single element to the recording list which is identified by a pointer.
Definition: WeightMonitor.cpp:98
RecordingMode
Definition: WeightMonitor.h:44
std::vector< type_pattern > * load_patfile(string filename, unsigned int maxpat)
Definition: WeightMonitor.cpp:189
AurynTime ssize
Definition: WeightMonitor.h:73
double AurynDouble
Higher precision floating point datatype.
Definition: auryn_definitions.h:158
AurynFloat AurynWeight
Unit of synaptic weights.
Definition: auryn_definitions.h:159
void add_equally_spaced(NeuronID number, NeuronID z=0)
Adds number of elements to the recording list that are equally spaced in the data vector of the conne...
Definition: WeightMonitor.cpp:145
The base class to create sparse random connections.
Definition: SparseConnection.h:66
NeuronID elem_j
Definition: WeightMonitor.h:72
virtual ~WeightMonitor()
Definition: WeightMonitor.cpp:63
Template for a sparse matrix with row major ordering and fast access of rows and capability to store ...
Definition: ComplexMatrix.h:75
void init()
Standard initializer to be called by the constructor.
Definition: Device.cpp:32
Definition: ABSConnection.h:38
unsigned long AurynLong
An unsigned long type used to count synapses or similar.
Definition: auryn_definitions.h:154
The Monitor will record from a range of synapses specified at initialization.
Definition: WeightMonitor.h:46
ForwardMatrix * mat
Definition: WeightMonitor.h:69
The Monitor records from selected synapses stored in a list. This is the default behavior.
Definition: WeightMonitor.h:47
void execute()
propagate function used by System class internally
Definition: WeightMonitor.cpp:348
void add_to_list_by_data_index(AurynLong index, StateID z=0)
Adds a single element to the recording list which is identified by its data index and z-state...
Definition: WeightMonitor.cpp:93
void load_data_range(AurynLong i, AurynLong j)
Adds connections from a given range in the sparse matrix data array.
Definition: WeightMonitor.cpp:171
Definition: WeightMonitor.h:55
void set_mat(ForwardMatrix *m)
Sets target matrix to read from.
Definition: WeightMonitor.cpp:360
void record_synapse_groups()
Definition: WeightMonitor.cpp:330
void record_single_synapses()
Definition: WeightMonitor.cpp:318
void load_pattern_connections(string filename, unsigned int maxcon=5, unsigned int maxpat=10, PatternMode patmod=ALLTOALL)
Adds connections inside a pattern and between patterns. Since such lists can become large quickly the...
Definition: WeightMonitor.cpp:256
Definition: WeightMonitor.h:55
WeightMonitor(SparseConnection *source, string filename, AurynDouble interval=10.0)
Default constructor.
Definition: WeightMonitor.cpp:30
NeuronID elem_i
Definition: WeightMonitor.h:71
NeuronID AurynTime
Defines Auryns discrete time unit of the System clock. Change to AurynLong if 120h of simtime are not...
Definition: auryn_definitions.h:155
unsigned int StateID
StateID is an unsigned integeger type used to index synaptic states in Auryn.
Definition: auryn_definitions.h:153
Monitors the evolution of a single or a set of weights.
Definition: WeightMonitor.h:65
Definition: WeightMonitor.h:48
unsigned int NeuronID
NeuronID is an unsigned integeger type used to index neurons in Auryn.
Definition: auryn_definitions.h:151