Cypress  1.0
C++ Spiking Neural Network Simulation Framework
Public Types | Public Member Functions | List of all members
cypress::PopulationData Class Reference

#include <data.hpp>

Public Types

using ParameterType = std::vector< Real >
 
using RecordType = std::vector< uint8_t >
 
using DataType = std::vector< std::shared_ptr< Matrix< Real >>>
 

Public Member Functions

 PopulationData (size_t size=1, NeuronType const *type=nullptr, const std::string &name=std::string(), const std::vector< ParameterType > &parameters=std::vector< ParameterType >(), const std::vector< RecordType > &record=std::vector< RecordType >(), const std::vector< DataType > &data=std::vector< DataType >())
 
size_t size () const
 
NeuronType const * type () const
 
std::string & name ()
 
const std::string & name () const
 
const std::vector< ParameterType > & parameters () const
 
std::vector< ParameterType > & parameters ()
 
const std::vector< RecordType > & record () const
 
std::vector< RecordType > & record ()
 
const std::vector< DataType > & data () const
 
std::vector< DataType > & data ()
 
size_t get_parameters_size (NeuronIndex nid0, NeuronIndex nid1) const
 
size_t get_record_size (NeuronIndex nid0, NeuronIndex nid1) const
 
size_t get_data_size (NeuronIndex nid0, NeuronIndex nid1) const
 
const ParameterTyperead_parameters (NeuronIndex nid0, NeuronIndex nid1) const
 
const RecordTyperead_record (NeuronIndex nid0, NeuronIndex nid1) const
 
const DataTyperead_data (NeuronIndex nid0, NeuronIndex nid1) const
 
IterableRange< std::vector< ParameterType >::iterator > write_parameters (NeuronIndex nid0, NeuronIndex nid1, bool partial=true)
 
IterableRange< std::vector< RecordType >::iterator > write_record (NeuronIndex nid0, NeuronIndex nid1, bool partial=true)
 
IterableRange< std::vector< DataType >::iterator > write_data (NeuronIndex nid0, NeuronIndex nid1, bool partial=true)
 
bool homogeneous_parameters () const
 
bool homogeneous_record () const
 
bool homogeneous_data () const
 

Detailed Description

Stores the actual data that is being accessed by the NeuronParametersBase and NeuronSignalsBase classes via the PopulationDataView class.

Member Typedef Documentation

using cypress::PopulationData::DataType = std::vector<std::shared_ptr<Matrix<Real>>>

Type used to represent the data matrices containing the recorded data for a single neuron, each vector entry corresponds to a signal.

Type used to represent the parameters of a single neuron.

using cypress::PopulationData::RecordType = std::vector<uint8_t>

Type used to represent the record flags of a single neuron.

Constructor & Destructor Documentation

cypress::PopulationData::PopulationData ( size_t  size = 1,
NeuronType const *  type = nullptr,
const std::string &  name = std::string(),
const std::vector< ParameterType > &  parameters = std::vector<ParameterType>(),
const std::vector< RecordType > &  record = std::vector<RecordType>(),
const std::vector< DataType > &  data = std::vector<DataType>() 
)
inline

Constructor of the PopulationData class.

Member Function Documentation

const std::vector<DataType>& cypress::PopulationData::data ( ) const
inline

Returns a const reference at the internal parameter vector, containing either exactly one entry or a number of entries corresponding to the size of the population.

std::vector<DataType>& cypress::PopulationData::data ( )
inline

Returns a reference at the internal parameter vector, possibly containing the record flags of all neurons.

size_t cypress::PopulationData::get_data_size ( NeuronIndex  nid0,
NeuronIndex  nid1 
) const

Returns the size of the data vector. Throws an exception if the neurons in the given range do not share parameters of the same size.

Parameters
nid0is the index of the first neuron for which the data size should be returned.
nid1is the index of the last-plus-one neuron for which the data vector size should be returned.
Returns
the number of entries in the data array.
size_t cypress::PopulationData::get_parameters_size ( NeuronIndex  nid0,
NeuronIndex  nid1 
) const

Returns the size of the parameter vector. Throws an exception if the neurons in the given range do not share parameters of the same size.

Parameters
nid0is the index of the first neuron for which the parameter vector size should be returned.
nid1is the index of the last-plus-one neuron for which the parameter vector size should be returned.
Returns
the number of parameters in the parameter array.
size_t cypress::PopulationData::get_record_size ( NeuronIndex  nid0,
NeuronIndex  nid1 
) const

Returns the size of the record vector. Throws an exception if the neurons in the given range do not share parameters of the same size.

Parameters
nid0is the index of the first neuron for which the record vector size should be returned.
nid1is the index of the last-plus-one neuron for which the record vector size should be returned.
Returns
the number of entries in the record array.
bool cypress::PopulationData::homogeneous_data ( ) const
inline

Returns true if all neurons in the poopulation share the same recorded data.

bool cypress::PopulationData::homogeneous_parameters ( ) const
inline

Returns true if all neurons in the population share the same parameters.

bool cypress::PopulationData::homogeneous_record ( ) const
inline

Returns true if all neurons in the population share the same record flags.

std::string& cypress::PopulationData::name ( )
inline

Returns a reference at the population name, allowing to set it.

const std::string& cypress::PopulationData::name ( ) const
inline

Returns a const-reference at the population name.

const std::vector<ParameterType>& cypress::PopulationData::parameters ( ) const
inline

Returns a const reference at the internal parameter vector, containing either exactly one entry or a number of entries corresponding to the size of the population.

std::vector<ParameterType>& cypress::PopulationData::parameters ( )
inline

Returns a reference at the internal parameter vector, possibly containing the parameters of all neurons.

const DataType& cypress::PopulationData::read_data ( NeuronIndex  nid0,
NeuronIndex  nid1 
) const

Returns a const-reference at the vector containing the references at the recorded data for the neurons with the nid0 to nid1. Throws an exception if the neurons in this range do not share the same data.

Parameters
nid0is the index of the first neuron for which the record flags should be returned.
nid1is the index of the last-plus-one neuron for which the record flags should be returned.
Returns
the record data shared by the neurons in the given range.
const ParameterType& cypress::PopulationData::read_parameters ( NeuronIndex  nid0,
NeuronIndex  nid1 
) const

Returns a const-reference at the parameter vector for the neurons with the id nid0 to nid1. Throws an exception if the neurons in the given range do not share the same parameters.

Parameters
nid0is the index of the first neuron for which the parameter vector should be returned.
nid1is the index of the last-plus-one neuron for which the parameter vector should be returned.
Returns
the parameters shared by the neurons in the given range.
const RecordType& cypress::PopulationData::read_record ( NeuronIndex  nid0,
NeuronIndex  nid1 
) const

Returns a const-reference at the vector specifying whether a signal should be recorded or not for the neurons with id nid0 to nid1. Throws an exception if the neurons in this range do not share the same record flags.

Parameters
nid0is the index of the first neuron for which the record flags should be returned.
nid1is the index of the last-plus-one neuron for which the record flags should be returned.
Returns
the record flags shared by the neurons in the given range.
const std::vector<RecordType>& cypress::PopulationData::record ( ) const
inline

Returns a const reference at the internal record-flag vector, containing either exactly one entry or a number of entries corresponding to the size of the population.

std::vector<RecordType>& cypress::PopulationData::record ( )
inline

Returns a reference at the internal record-flag vector, possibly containing the record flags of all neurons.

size_t cypress::PopulationData::size ( ) const
inline

Returns the population size.

NeuronType const* cypress::PopulationData::type ( ) const
inline

Returns the population type.

IterableRange<std::vector<DataType>::iterator> cypress::PopulationData::write_data ( NeuronIndex  nid0,
NeuronIndex  nid1,
bool  partial = true 
)

Returns an iteratble range allowing to write the recorded data for the specified range of neurons. Assumes that the data is being set to the same value for the specified range.

Parameters
nid0is the index of the first neuron for which the recorded data should be written.
nid1is the index of the last-plus-one neuron for which the recorded data should be written.
partialif true, indicates that the record data is not entirely overridden, preventing the method from re-homogenising the data.
Returns
an iterable object pointing at the recorded data for the specified neuron range.
IterableRange<std::vector<ParameterType>::iterator> cypress::PopulationData::write_parameters ( NeuronIndex  nid0,
NeuronIndex  nid1,
bool  partial = true 
)

Returns an iterable range allowing to modify the parameters for the given range of neurons. Assumes that the data is being set to the same value for the specified range.

Parameters
nid0is the index of the first neuron for which the parameters should be written.
nid1is the index of the last-plus-one neuron for which the parameters should be written.
partialif true, indicates that the parameters are not entirely overridden, preventing the method from re-homogenising the data.
Returns
an iterable object pointing at the parameters for the specified neuron range.
IterableRange<std::vector<RecordType>::iterator> cypress::PopulationData::write_record ( NeuronIndex  nid0,
NeuronIndex  nid1,
bool  partial = true 
)

Returns an iteratble range allowing to modify the record flags for the specified range of neurons. Assumes that the data is being set to the same value for the specified range.

Parameters
nid0is the index of the first neuron for which the record flags should be written.
nid1is the index of the last-plus-one neuron for which the record flags should be written.
partialif true, indicates that the record flags are not entirely overridden, preventing the method from re-homogenising the data.
Returns
an iterable object pointing at the record flags for the specified neuron range.

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