MatrixLinker Class Reference

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

Inheritance diagram for MatrixLinker:

List of all members.

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.
DoubleMatrix matrix () const
 const version of matrix() method
DoubleMatrixmatrix ()
 Return the weight matrix.
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.

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(), RandomGenerator::getBool(), 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 ( ) const [inline]

const version of matrix() method

Definition at line 79 of file matrixlinker.h.

DoubleMatrix& matrix ( ) [inline]

Return the weight matrix.

Definition at line 75 of file matrixlinker.h.

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

void randomize ( double  min,
double  max 
) [virtual]

Randomize the weights of the MatrixLinker.

Implements Linker.

Definition at line 63 of file matrixlinker.cpp.

References RandomGenerator::getDouble(), and 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(), and ConfigurationParameters::startObjectParameters().

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: