MatrixLinker Class Reference

MatrixLinker Class define a full connection between two cluster. More...

Inheritance diagram for MatrixLinker:

Public Member Functions

 MatrixLinker (Cluster *from, Cluster *to, QString name="unnamed")
 Connect clusters with a complete connections By default it create a fully-connected matrix, use one of the following methods for choose a different way: connect, connectRandom, disconnect, disconnectRandom.
 
 MatrixLinker (ConfigurationParameters &params, QString prefix)
 Constructor.
 
virtual ~MatrixLinker ()
 Destructor.
 
unsigned int cols ()
 Get the number of cols.
 
void connect (unsigned int from, unsigned int to)
 Connect two neurons.
 
void connectAll ()
 Connect all couples of neurons.
 
void connectRandom (double prob, bool zeroDiagonal=false, bool symmetric=false)
 Connect neurons of Clusters with a random connections with the passed probability.
 
void disconnect (unsigned int from, unsigned int to)
 Disconnect the two neurons.
 
void disconnectAll ()
 Disonnect all couples of neurons.
 
DoubleMatrixmatrix ()
 Return the weight matrix.
 
DoubleMatrix matrix () const
 const version of matrix() method
 
virtual void randomize (double min, double max)
 Randomize the weights of the MatrixLinker.
 
unsigned int rows ()
 Get the number of rows.
 
virtual void save (ConfigurationParameters &params, QString prefix)
 Save the actual status of parameters into the ConfigurationParameters object passed.
 
virtual void setWeight (unsigned int from, unsigned int to, double weight)
 Set the weight of the connection specified.
 
unsigned int size () const
 Returns the total number of the links: rows*cols.
 
virtual double weight (unsigned int from, unsigned int to)
 Get the weight of the connection specified.
 
- Public Member Functions inherited from Linker
 Linker (Cluster *from, Cluster *to, QString name="unnamed")
 Construct.
 
 Linker (ConfigurationParameters &params, QString prefix)
 Constructor.
 
void configureFromVector (QString vectorName)
 Configure on which state vector of 'from' Cluster this Linker is attached to.
 
void configureToVector (QString vectorName)
 Configure on which state vector of 'to' Cluster this Linker is attached to.
 
Clusterfrom () const
 Return the Cluster From.
 
Clusterto () const
 Return the Cluster to.
 
- Public Member Functions inherited from Updatable
 Updatable (QString name="unnamed")
 Constructor.
 
 Updatable (ConfigurationParameters &params, QString prefix)
 Constructor.
 
virtual ~Updatable ()
 Destructor.
 
QString name () const
 Return its name.
 
void setName (QString newname)
 Set the name of Updatable.
 
virtual void update ()=0
 Update the object.
 
- Public Member Functions inherited from ParameterSettableInConstructor
 ParameterSettableInConstructor (ConfigurationParameters &, QString)
 
void addObserver (RuntimeParameterObserver *obs)
 
getRuntimeParameter (QString paramName)
 
virtual ParameterSettableUIgetUIManager ()
 
 ParameterSettable ()
 
virtual void postConfigureInitialization ()
 
void removeObserver (RuntimeParameterObserver *obs)
 
void setRuntimeParameter (QString paramName, T newvalue)
 
QString typeName () const
 
- Public Member Functions inherited from ParameterSettable
void addObserver (RuntimeParameterObserver *obs)
 
getRuntimeParameter (QString paramName)
 
void removeObserver (RuntimeParameterObserver *obs)
 
void setRuntimeParameter (QString paramName, T newvalue)
 
QString typeName () const
 

Additional Inherited Members

- Public Types inherited from ParameterSettableInConstructor
enum  Property
 
- Static Public Member Functions inherited from Linker
static void describe (QString type)
 Add to Factory::typeDescriptions() the descriptions of all parameters and subgroups.
 
- Public Attributes inherited from ParameterSettableInConstructor
 AllowMultiple
 
 Default
 
 IsList
 
 IsMandatory
 
- Static Public Attributes inherited from ParameterSettableInConstructor
static const double Infinity
 
static const int MaxInteger
 
static const int MinInteger
 
- Protected Member Functions inherited from Linker
DoubleVectorfromVector () const
 Return a reference to the DoubleVector of 'from' on which this is attached to.
 
DoubleVectortoVector () const
 Return a reference to the DoubleVector of 'to' on which this is attached to.
 
- Static Protected Member Functions inherited from ParameterSettableInConstructor
static Descriptor addTypeDescription (QString type, QString shortHelp, QString longHelp=QString(""))
 
static void setGraphicalEditor (QString type)
 

Detailed Description

MatrixLinker Class define a full connection between two cluster.

Motivation
This class rapresent connections between neuron's 'from' Cluster and neuron's 'to' Cluster with a matrix. It allow sparse connections as full connections amogns neurons. The connections has a weight and are stored in a matrix which the rows are the neuron's 'from' and the columns the neuron's 'to'.
Description
Every connection is weighted, and the weight is memorized into a weight-matrix.
The effective computation of inputs' 'to' is done in the subclasses (DotLinker, NormLinker, etc). The disconnection / connection of neurons are implemented fixating/unfixating the weight to zero into the underlying matrix using DoubleMatrix::steady and DoubleMatrix::unsteady methods
Warning

Definition at line 47 of file matrixlinker.h.

Constructor & Destructor Documentation

MatrixLinker ( Cluster from,
Cluster to,
QString  name = "unnamed" 
)

Connect clusters with a complete connections By default it create a fully-connected matrix, use one of the following methods for choose a different way: connect, connectRandom, disconnect, disconnectRandom.

Definition at line 25 of file matrixlinker.cpp.

References DoubleMatrix::zeroing().

MatrixLinker ( ConfigurationParameters params,
QString  prefix 
)

Constructor.

Definition at line 30 of file matrixlinker.cpp.

References ConfigurationParameters::getValue().

~MatrixLinker ( )
virtual

Destructor.

Definition at line 56 of file matrixlinker.cpp.

Member Function Documentation

unsigned int cols ( )
inline
void connect ( unsigned int  from,
unsigned int  to 
)

Connect two neurons.

Definition at line 79 of file matrixlinker.cpp.

References DoubleMatrix::unsteady().

void connectAll ( )

Connect all couples of neurons.

Definition at line 130 of file matrixlinker.cpp.

References MatrixLinker::cols(), MatrixLinker::rows(), and DoubleMatrix::unsteady().

void connectRandom ( double  prob,
bool  zeroDiagonal = false,
bool  symmetric = false 
)

Connect neurons of Clusters with a random connections with the passed probability.


And disconnect neurons with probability (1.0-prob).

Parameters
probis the probability to have a connection between two neurons
zeroDiagonalif it is true the matrix diagonal is always disconnected
symmetricif it is true the connections are symmetric
Warning
The parameter symmetric requires a square matrix (i.e. the Cluster from and to must be of the same size

Definition at line 83 of file matrixlinker.cpp.

References MatrixLinker::cols(), globalRNG, MatrixLinker::rows(), DoubleMatrix::steady(), and DoubleMatrix::unsteady().

void disconnect ( unsigned int  from,
unsigned int  to 
)

Disconnect the two neurons.

Definition at line 138 of file matrixlinker.cpp.

References Linker::from(), DoubleMatrix::steady(), Linker::to(), and DoubleMatrix::unsteady().

void disconnectAll ( )

Disonnect all couples of neurons.

Definition at line 144 of file matrixlinker.cpp.

References MatrixLinker::cols(), MatrixLinker::rows(), DoubleMatrix::steady(), and DoubleMatrix::unsteady().

DoubleMatrix& matrix ( )
inline

Return the weight matrix.

Definition at line 75 of file matrixlinker.h.

Referenced by DotLinker::update(), and NormLinker::update().

DoubleMatrix matrix ( ) const
inline

const version of matrix() method

Definition at line 79 of file matrixlinker.h.

void randomize ( double  min,
double  max 
)
virtual

Randomize the weights of the MatrixLinker.

Implements Linker.

Definition at line 63 of file matrixlinker.cpp.

References globalRNG.

unsigned int rows ( )
inline

Get the number of rows.

Definition at line 59 of file matrixlinker.h.

Referenced by MatrixLinker::connectAll(), MatrixLinker::connectRandom(), MatrixLinker::disconnectAll(), and MatrixLinker::save().

void save ( ConfigurationParameters params,
QString  prefix 
)
virtual

Save the actual status of parameters into the ConfigurationParameters object passed.

This saves the name property, remember to call this in child classes

Parameters
paramsthe configuration parameters object on which save actual parameters
prefixthe prefix to use to access the object configuration parameters.

Reimplemented from Linker.

Reimplemented in DotLinker, and NormLinker.

Definition at line 154 of file matrixlinker.cpp.

References MatrixLinker::cols(), ConfigurationParameters::createParameter(), MatrixLinker::rows(), Linker::save(), and ConfigurationParameters::startObjectParameters().

Referenced by NormLinker::save(), and DotLinker::save().

void setWeight ( unsigned int  from,
unsigned int  to,
double  weight 
)
virtual

Set the weight of the connection specified.

Definition at line 71 of file matrixlinker.cpp.

References Linker::from(), Linker::to(), and MatrixLinker::weight().

unsigned int size ( ) const
virtual

Returns the total number of the links: rows*cols.

Implements Linker.

Definition at line 59 of file matrixlinker.cpp.

double weight ( unsigned int  from,
unsigned int  to 
)
virtual

Get the weight of the connection specified.

Definition at line 75 of file matrixlinker.cpp.

References Linker::from(), and Linker::to().

Referenced by MatrixLinker::setWeight().


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