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

Solves a set of identical linear differential equations with the Euler method. It is used to implement synaptic traces in most STDP models. More...

#include <EulerTrace.h>

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

Public Member Functions

 EulerTrace (NeuronID n, AurynFloat timeconstant)
 
virtual ~EulerTrace ()
 
void evolve ()
 
void set_timeconstant (AurynFloat timeconstant)
 
void set_target (AurynStateVector *target)
 
void follow ()
 
- Public Member Functions inherited from auryn::Trace
 Trace (NeuronID n, AurynFloat timeconstant)
 Default constructor. More...
 
virtual ~Trace ()
 Default destructor. More...
 
virtual void inc (NeuronID i)
 Increment given trace by 1. More...
 
virtual void inc (SpikeContainer *sc)
 Increment given traces by 1. More...
 
AurynFloat get_tau ()
 Get decay time constant. More...
 
virtual AurynFloat normalized_get (NeuronID i)
 Get trace value of trace dived by tau. More...
 
virtual AurynStateVectorget_state_ptr ()
 Get pointer to state AurynStateVector for fast processing. More...
 
virtual void follow (AurynVectorFloat *v, const float rate)
 Follow other vector. More...
 
- Public Member Functions inherited from auryn::AurynVectorFloat
 AurynVectorFloat (NeuronID n)
 Default constructor. More...
 
 ~AurynVectorFloat ()
 Default destructor. More...
 
virtual void resize (NeuronID new_size)
 resize data array to new_size More...
 
void scale (const float a)
 
void saxpy (const float a, AurynVectorFloat *x)
 
void clip (const float min, const float max)
 
void add (const float c)
 
void add (AurynVectorFloat *v)
 
void sum (AurynVectorFloat *a, AurynVectorFloat *b)
 
void sum (AurynVectorFloat *a, const float b)
 
void mul (const float a)
 
void mul (AurynVectorFloat *v)
 
void diff (AurynVectorFloat *a, AurynVectorFloat *b)
 
void diff (AurynVectorFloat *a, const float b)
 
void diff (const float a, AurynVectorFloat *b)
 
void follow (AurynVectorFloat *v, const float rate)
 
- Public Member Functions inherited from auryn::AurynVector< float, NeuronID >
 AurynVector (NeuronID n)
 Default constructor. More...
 
 AurynVector (AurynVector *vec)
 Copy constructor. More...
 
virtual ~AurynVector ()
 Default destructor. More...
 
void copy (AurynVector *v)
 Copies vector v. More...
 
float get (NeuronID i)
 Gets element i from vector. More...
 
float * ptr (NeuronID i=0)
 Gets pointer to element i from vector. More...
 
void set (NeuronID i, float value)
 Sets element i in vector to value. More...
 
void set_all (const float v)
 Set all elements to value v. More...
 
void set_zero ()
 Set all elements to zero. More...
 
void scale (const float a)
 Scales all vector elements by a. More...
 
void add (const float c)
 Adds constant c to each vector element. More...
 
void add (AurynVector *v)
 Adds a vector v to the vector. More...
 
void add_specific (const NeuronID i, const float c)
 Adds the value c to specific vector element i. More...
 
void mul_specific (const NeuronID i, const float c)
 Multiply to specific vector element with data index i with the constant c. More...
 
void sub (const float c)
 Subtract constant c to each vector element. More...
 
void sub (AurynVector *v)
 Elementwise subtraction. More...
 
void mul (const float a)
 Multiply all vector elements by constant. More...
 
void mul (AurynVector *v)
 Element-wise vector multiply. More...
 
void div (const float a)
 Element-wise division. More...
 
void div (AurynVector *v)
 Element-wise vector division. More...
 
void div (AurynVector *a, AurynVector *b)
 Element-wise vector division which stores the result in this. More...
 
void saxpy (const float a, AurynVector *x)
 SAXPY operation as in GSL. More...
 
void follow (AurynVector< float, NeuronID > *v, const float rate)
 Follows target vector v with rate. More...
 
void follow_scalar (const float a, const float rate)
 Like follow but with a scalar target value a. More...
 
void elementwise_max (AurynVector *v1, AurynVector *v2)
 Elementwise max operation. More...
 
void elementwise_max (AurynVector *v1)
 Elementwise max operation with another vector. More...
 
void pow (const unsigned int n)
 Takes each element to the n-th power. More...
 
void fast_exp ()
 Computes an approximation of exp(x) for each vector element. More...
 
void exp ()
 Computes exp(x) for each vector element. More...
 
void sigmoid (AurynVector *x, const float beta, const float thr)
 Computes sigmoid(beta*(x-thr)) for each vector element and stores result in this instance. More...
 
void sqrt ()
 Takes the square root of each element. More...
 
void neg ()
 Flips the sign of all elements. More...
 
void inv ()
 Computes 1./x of each element. More...
 
void sum (AurynVector *a, AurynVector *b)
 Computes the sum a+b and stores the result in this instance. More...
 
void sum (AurynVector *a, const float b)
 Computes the sum a+b and stores the result in this instance. More...
 
void diff (AurynVector *a, AurynVector *b)
 Computes the difference a-b and stores the result in this instance. More...
 
void diff (AurynVector *a, const float b)
 Computes the difference a-b and stores the result in this instance. More...
 
void diff (const float a, AurynVector *b)
 Computes the difference a-b and stores the result in this instance. More...
 
void sqr ()
 Squares each element. More...
 
void abs ()
 Takes absolute value of each element. More...
 
void rect ()
 Rectifies all elements. More...
 
void neg_rect ()
 Negatively rectifies all elements. More...
 
void clip (float min, float max)
 Clips all vector elements to the range min max. More...
 
double var ()
 Computes the variance of the vector elements on this rank. More...
 
double std ()
 Computes the standard deviation of all elements on this rank. More...
 
double mean ()
 Computes the mean of the vector elements on this rank. More...
 
double element_sum ()
 Computes the sum of the vector elements. More...
 
double l1norm ()
 Computes the l1 norm of the vector. More...
 
double l2norm ()
 Computes the l2 norm of the vector. More...
 
double max ()
 Returns the max of the vector elements. More...
 
double min ()
 Returns the min of the vector elements. More...
 
NeuronID nonzero ()
 Computes number of nonzero elements on this rank. More...
 
void zero_effective_zeros (const float epsilon=1e-3)
 Sets all values whose absolute value is smaller than epsilon to zero. More...
 
void add_random_normal (AurynState mean=0.0, AurynState sigma=1.0, unsigned int seed=8721)
 
void set_random_normal (AurynState mean=0.0, AurynState sigma=1.0, unsigned int seed=8721)
 
void set_random (unsigned int seed=0)
 Initializes vector elements with Gaussian of unit varince and a seed derived from system time if no seed or seed of 0 is given. More...
 
bool any ()
 Returns true if any element is nonzero. More...
 
bool any (float eps)
 Returns true if any element is nonzero. More...
 
void print ()
 Print vector elements to stdout for debugging. More...
 
void write_to_file (std::string filename)
 Print vector elements to a text file for debugging. More...
 

Additional Inherited Members

- Public Attributes inherited from auryn::AurynVector< float, NeuronID >
NeuronID size
 Size of the vector. More...
 
float * data
 Pointer to the array housing the data. More...
 
- Protected Member Functions inherited from auryn::AurynVector< float, NeuronID >
void check_size (NeuronID x)
 Checks if argument is larger than size and throws and exception if so. More...
 
void check_size (AurynVector *v)
 Checks if vector size matches to this instance. More...
 
void allocate (const NeuronID n)
 Implements aligned memory allocation. More...
 
void freebuf ()
 
float fast_exp256 (float x)
 Computes approximation of exp(x) via fast series approximation up to n=256. More...
 
- Protected Attributes inherited from auryn::Trace
AurynFloat tau
 

Detailed Description

Solves a set of identical linear differential equations with the Euler method. It is used to implement synaptic traces in most STDP models.

This solver simultaneoulsy computes linear traces (mostly to implement synapses) using Euler's method. Another solver is readily available within the Auryn framework. The LinearTrace objects solves the same problem but using the analytic solution. This results in less updates. However - so far it turned out to be inferior in performance to the EulerTrace.

Constructor & Destructor Documentation

◆ EulerTrace()

EulerTrace::EulerTrace ( NeuronID  n,
AurynFloat  timeconstant 
)

Default constructor

41  : Trace( calculate_vector_size(n), timeconstant )
42 {
43  init(n,timeconstant);
44 }
NeuronID calculate_vector_size(NeuronID i)
Rounds vector size to multiple of four to allow using the SSE optimizations.
Definition: auryn_definitions.cpp:50
int n
Definition: mkpat.py:5
Trace(NeuronID n, AurynFloat timeconstant)
Default constructor.
Definition: Trace.cpp:32

◆ ~EulerTrace()

EulerTrace::~EulerTrace ( )
virtual

Default destructor

47 {
48  free();
49 }

Member Function Documentation

◆ evolve()

void EulerTrace::evolve ( )
virtual

Perform Euler step.

Implements auryn::Trace.

Reimplemented in auryn::LinearTrace.

67 {
68  scale(scale_const);
69 }
void scale(const float a)
Definition: AurynVector.cpp:74
Here is the call graph for this function:

◆ follow()

void EulerTrace::follow ( )
virtual

Perform Euler step but follow target vector instead of zero-decay

Implements auryn::Trace.

72 {
73  super::follow(target_ptr, mul_follow);
74 }
virtual void follow()=0
Follow target state vector.
Here is the call graph for this function:

◆ set_target()

void EulerTrace::set_target ( AurynStateVector target)
virtual

set the target vector for follow operation

Implements auryn::Trace.

59 {
60  if ( target != NULL ) {
61  target_ptr = target ;
62  copy(target);
63  }
64 }
void copy(AurynVector *v)
Copies vector v.
Definition: AurynVector.h:200
Here is the call graph for this function:

◆ set_timeconstant()

void EulerTrace::set_timeconstant ( AurynFloat  timeconstant)
virtual

Set the time constant of the trace

Reimplemented from auryn::Trace.

52 {
53  super::set_timeconstant(timeconstant);
54  mul_follow = auryn_timestep/tau;
55  scale_const = std::exp(-auryn_timestep/tau);
56 }
virtual void set_timeconstant(AurynFloat timeconstant)
Set the time constant of the trace.
Definition: Trace.cpp:41
AurynFloat tau
Definition: Trace.h:43
double auryn_timestep
Simulation timestep in seconds.
Definition: auryn_definitions.cpp:31
Here is the call graph for this function:

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