Auryn simulator
v0.8.1-206-gb56e451
Plastic Spiking Neural Network Simulator
|
Template for a sparse matrix with row major ordering and fast access of rows. More...
#include <SimpleMatrix.h>
Protected Member Functions | |
void | init (NeuronID m, NeuronID n, AurynLong size=256) |
void | free () |
Protected Attributes | |
NeuronID ** | rowptrs |
NeuronID * | colinds |
T * | coldata |
Friends | |
class | boost::serialization::access |
Template for a sparse matrix with row major ordering and fast access of rows.
This matrix class implements a sparse matrix that allows fast access of all elements of one row. It provides row interators to efficiently propagate spikes. Memory has to be reserved when the class is defined and elements can only be inserted row by row starting from "left to right". This scheme enables related data fields to reside in memory next to each other.
auryn::SimpleMatrix< T >::SimpleMatrix | ( | ) |
auryn::SimpleMatrix< T >::SimpleMatrix | ( | SimpleMatrix< T > * | mat | ) |
auryn::SimpleMatrix< T >::SimpleMatrix | ( | NeuronID | rows, |
NeuronID | cols | ||
) |
auryn::SimpleMatrix< T >::SimpleMatrix | ( | NeuronID | rows, |
NeuronID | cols, | ||
AurynLong | size | ||
) |
|
virtual |
void auryn::SimpleMatrix< T >::add_value | ( | AurynLong | data_index, |
T | value | ||
) |
void auryn::SimpleMatrix< T >::clear | ( | ) |
void auryn::SimpleMatrix< T >::copy | ( | SimpleMatrix< T > * | mat | ) |
bool auryn::SimpleMatrix< T >::exists | ( | NeuronID | i, |
NeuronID | j | ||
) |
void auryn::SimpleMatrix< T >::fill_na | ( | ) |
Marks the remainder of buffers non-existing connections.
Should be called by finalize before using the matrix.
void auryn::SimpleMatrix< T >::fill_zeros | ( | ) |
Same as fill_na.
|
protected |
T auryn::SimpleMatrix< T >::get | ( | NeuronID | i, |
NeuronID | j | ||
) |
NeuronID auryn::SimpleMatrix< T >::get_colind | ( | AurynLong | data_index | ) |
T auryn::SimpleMatrix< T >::get_data | ( | const AurynLong | i | ) |
Gets the matching data entry for a given index i
T auryn::SimpleMatrix< T >::get_data | ( | const NeuronID * | ind_ptr | ) |
Gets the matching data value for a given index pointer
T * auryn::SimpleMatrix< T >::get_data_begin | ( | ) |
T * auryn::SimpleMatrix< T >::get_data_end | ( | ) |
Returns value behind last element in data array corresponding to a nonzero value.
NeuronID auryn::SimpleMatrix< T >::get_data_offset | ( | NeuronID * | r | ) |
T * auryn::SimpleMatrix< T >::get_data_ptr | ( | const AurynLong | i | ) |
Gets the matching data ptr for a given index i
T * auryn::SimpleMatrix< T >::get_data_ptr | ( | const NeuronID * | ind_ptr | ) |
Gets the matching data ptr for a given index pointer
AurynLong auryn::SimpleMatrix< T >::get_datasize | ( | ) |
AurynDouble auryn::SimpleMatrix< T >::get_fill_level | ( | ) |
NeuronID * auryn::SimpleMatrix< T >::get_ind_begin | ( | ) |
NeuronID auryn::SimpleMatrix< T >::get_m_rows | ( | ) |
NeuronID auryn::SimpleMatrix< T >::get_n_cols | ( | ) |
AurynLong auryn::SimpleMatrix< T >::get_nonzero | ( | ) |
T * auryn::SimpleMatrix< T >::get_ptr | ( | NeuronID | i, |
NeuronID | j | ||
) |
Returns the pointer to a particular element
T * auryn::SimpleMatrix< T >::get_ptr | ( | AurynLong | data_index | ) |
Returns the pointer to a particular element given its position in the data array.
NeuronID * auryn::SimpleMatrix< T >::get_row_begin | ( | NeuronID | i | ) |
AurynLong auryn::SimpleMatrix< T >::get_row_begin_index | ( | NeuronID | i | ) |
NeuronID * auryn::SimpleMatrix< T >::get_row_end | ( | NeuronID | i | ) |
AurynLong auryn::SimpleMatrix< T >::get_row_end_index | ( | NeuronID | i | ) |
NeuronID ** auryn::SimpleMatrix< T >::get_rowptrs | ( | ) |
T auryn::SimpleMatrix< T >::get_value | ( | AurynLong | data_index | ) |
T auryn::SimpleMatrix< T >::get_value | ( | NeuronID | i | ) |
Returns the data value to an item that is i-th in the colindex array
T auryn::SimpleMatrix< T >::get_value | ( | NeuronID * | r | ) |
Returns the data value to an item that for pointer r pointing to the respective element in the index array
T * auryn::SimpleMatrix< T >::get_value_ptr | ( | NeuronID | i | ) |
Returns pointer to the the data value to an item that is i-th in the colindex array
T * auryn::SimpleMatrix< T >::get_value_ptr | ( | NeuronID * | r | ) |
Returns the pointer to the data value to an item that for pointer r pointing to the respective element in the index array
|
protected |
Default initializiation called by the constructor.
double auryn::SimpleMatrix< T >::mean | ( | ) |
void auryn::SimpleMatrix< T >::print | ( | ) |
void auryn::SimpleMatrix< T >::prune | ( | ) |
Prunes the reserved memory such that datasize=get_nonzero() Note that this is an expensive operation because it uses resize_buffer(size) and it should be used sparsely.
void auryn::SimpleMatrix< T >::push_back | ( | const NeuronID | i, |
const NeuronID | j, | ||
const T | value | ||
) |
Add non-zero element in row/col order.
i | row index where to insert element |
j | col index where to insert element |
value | to insert |
AurynMatrixBufferException |
void auryn::SimpleMatrix< T >::resize_buffer | ( | AurynLong | newsize | ) |
Resize buffer Allocates a new buffer of size and copies the old buffers before freeing the memory
void auryn::SimpleMatrix< T >::resize_buffer_and_clear | ( | AurynLong | size | ) |
Resizes buffer and clears the matrix. This saves to copy all the data.
void auryn::SimpleMatrix< T >::scale_all | ( | T | value | ) |
Scales all non-zero elements
void auryn::SimpleMatrix< T >::scale_col | ( | NeuronID | j, |
T | value | ||
) |
Scales all non-zero elements in col j to value. Due to ordering this is slow and the use of this functions is discouraged.
void auryn::SimpleMatrix< T >::scale_data | ( | AurynLong | i, |
T | value | ||
) |
void auryn::SimpleMatrix< T >::scale_row | ( | NeuronID | i, |
T | value | ||
) |
Scales all non-zero elements in row i to value
bool auryn::SimpleMatrix< T >::set | ( | NeuronID | i, |
NeuronID | j, | ||
T | value | ||
) |
void auryn::SimpleMatrix< T >::set_all | ( | T | value | ) |
Sets all non-zero elements to value
void auryn::SimpleMatrix< T >::set_col | ( | NeuronID | j, |
T | value | ||
) |
Sets all non-zero elements in col j to value. Due to ordering this is slow and the use of this functions is discouraged.
void auryn::SimpleMatrix< T >::set_data | ( | AurynLong | i, |
T | value | ||
) |
void auryn::SimpleMatrix< T >::set_row | ( | NeuronID | i, |
T | value | ||
) |
Sets all non-zero elements in row i to value
double auryn::SimpleMatrix< T >::sum_col | ( | NeuronID | j | ) |
|
friend |
|
protected |
Array that holds the data values of the non-zero elements
|
protected |
Array that holds the column indices of non-zero elements
|
protected |
Array that holds the begin addresses of column indices