DoubleVector Class Reference

DoubleVector Class. More...

Public Member Functions

 DoubleVector ()
 Default Constructor.
 
 DoubleVector (unsigned int size, bool isinternal=false)
 Construct a vector of dimension size setting all values to zero.
 
 DoubleVector (unsigned int size, double value, bool isinternal=false)
 Construct a vector of dimension size setting all the values as specified.
 
 DoubleVector (const double *r, unsigned int dim, bool isinternal=false)
 Construct by copying data from const double* vector.
 
 DoubleVector (const DoubleVector &src)
 The Copy-Constructor.
 
 DoubleVector (unsigned int dim, bool temp, unsigned int dummy)
 This is a special constructor used for copy a DoubleVector and mark it as temporary for speed-up calculation.
 
 ~DoubleVector ()
 Destructor.
 
DoubleVectorappend (const double &value)
 Append an element; the dimesion increase by one.
 
DoubleVectorcopyValues (const DoubleVector &src)
 Copy the values from source honoring fixed elements (i.e.
 
DoubleVectorcopyValues (const QVector< double > &src)
 Copy the values from a QVector<double> honoring fixed elements (i.e.
 
DoubleVectorcopyValues (const DoubleVector &src, unsigned int srcOffset, unsigned int thisOffset)
 Copy the values from source honoring fixed elements starting from the offsets specified (i.e.
 
DoubleVectorcopyValues (const DoubleVector &src, unsigned int srcOffset, unsigned int thisOffset, unsigned int stride)
 Copy the values from source honoring fixed elements starting from the offsets specified using the stride specified (i.e.
 
DoubleVectordetach ()
 If the current data is shared by other objects, this method will create a new copy of the data not shared by other objects.
 
bool isNull () const
 Return True if the DoubleVector doesn't contain any data (i.e.
 
bool isSteady (unsigned int i) const
 Return true if the i-th value is a steady value.
 
bool operator!= (const DoubleVector &b) const
 Not-Equal Operator.
 
const DoubleVector operator* (const DoubleVector &right) const
 operator *
 
DoubleVectoroperator*= (const DoubleVector &right)
 operator *=
 
DoubleVectoroperator*= (const double &right)
 operator *= with a scalar
 
const DoubleVectoroperator+ () const
 unary operator +
 
const DoubleVector operator+ (const DoubleVector &right) const
 operator +
 
DoubleVectoroperator+= (const DoubleVector &right)
 operator +=
 
DoubleVectoroperator+= (const double &right)
 operator += with a scalar
 
const DoubleVector operator- () const
 unary operator -
 
const DoubleVector operator- (const DoubleVector &right) const
 operator -
 
DoubleVectoroperator-= (const DoubleVector &right)
 operator -=
 
DoubleVectoroperator-= (const double &right)
 operator -= with a scalar
 
const DoubleVector operator/ (const DoubleVector &right) const
 operator /
 
DoubleVectoroperator/= (const DoubleVector &right)
 operator /=
 
DoubleVectoroperator/= (const double &right)
 operator /= with a scalar
 
DoubleVectoroperator<< (const double &value)
 Append Operator; the dimesion increase by one.
 
DoubleVectoroperator= (const DoubleVector &src)
 Behaves as a CopyConstructor: this do a completely substitution of underlying data so, it does not honor fixed elements, hence it substitute all informations taking also the new information about fixed element in src.
 
bool operator== (const DoubleVector &b) const
 Equal Operator.
 
doubleRefoperator[] (unsigned int index)
 Indexing operator.
 
double operator[] (unsigned int index) const
 Indexing operator (Const Version)
 
DoubleVectorresize (unsigned int newsize)
 Resize the VectorData.
 
DoubleVectorsetAll (const double value)
 Set all values to value This method honor the steady values...
 
unsigned int size () const
 Return the size of VectorData.
 
DoubleVectorsteady (unsigned int i)
 Fix the i-th value, hence the i-th value will never change anymore until unsteady is called.
 
DoubleVectorunsteady (unsigned int i)
 Reallow the modification of i-th value.
 
DoubleVectorzeroing ()
 Set all values to zero This method honor the steady values...
 

Friends

class DoubleMatrix
 

Detailed Description

DoubleVector Class.

Motivation
This represent a vector of double values
Description
The DoubleVector use an implicit-sharing mechanism based on copy-on-write
Warnings
This class is also used by other class for structuring their underlyng data. In these case, changing the structure of a DoubleVector using directly the assign operator= can result in uncoerent state of the object owning the DoubleVector. There special constructor that takes a boolean value, isinternal, for flag such situations. When a user attempt to call the operator= on a DoubleVector with isinternal flag on an Exception will be throw.

Definition at line 121 of file vectors.h.

Constructor & Destructor Documentation

DoubleVector ( )
inline

Default Constructor.

Definition at line 124 of file vectors.h.

DoubleVector ( unsigned int  size,
bool  isinternal = false 
)
inline

Construct a vector of dimension size setting all values to zero.

Parameters
isinternalif this parameter is true means that the DoubleVector is a internal part of another structure or object. In this case you are not allowed to change its structure but only the values
Warning
If isinternal is true, then the operator= will raise an exception

Definition at line 138 of file vectors.h.

References farsa::memoryZeroing(), and doubleRef::setRef().

DoubleVector ( unsigned int  size,
double  value,
bool  isinternal = false 
)
inline

Construct a vector of dimension size setting all the values as specified.

Parameters
isinternalif this parameter is true means that the DoubleVector is a internal part of another structure or object. In this case you are not allowed to change its structure but only the values
Warning
If isinternal is true, then the operator= will raise an exception

Definition at line 156 of file vectors.h.

References doubleRef::setRef().

DoubleVector ( const double *  r,
unsigned int  dim,
bool  isinternal = false 
)
inline

Construct by copying data from const double* vector.

Parameters
isinternalif this parameter is true means that the DoubleVector is a internal part of another structure or object. In this case you are not allowed to change its structure but only the values
Warning
If isinternal is true, then the operator= will raise an exception

Definition at line 174 of file vectors.h.

References doubleRef::setRef().

DoubleVector ( const DoubleVector src)
inline

The Copy-Constructor.

Definition at line 189 of file vectors.h.

DoubleVector ( unsigned int  dim,
bool  temp,
unsigned int  dummy 
)
inline

This is a special constructor used for copy a DoubleVector and mark it as temporary for speed-up calculation.

It's intended for internal use only DON'T USE UNLESS YOUR ARE VERY CONFIDENT on How the special temporary DoubleVector are used

Definition at line 225 of file vectors.h.

References doubleRef::setRef().

~DoubleVector ( )
inline

Destructor.

Definition at line 240 of file vectors.h.

Member Function Documentation

DoubleVector& append ( const double &  value)
inline

Append an element; the dimesion increase by one.

Definition at line 724 of file vectors.h.

Referenced by Pattern::configure().

DoubleVector& copyValues ( const DoubleVector src)
inline

Copy the values from source honoring fixed elements (i.e.

: the fixed element of this remains unchanged )

Note
this method does not check the dimension of the two vectors, but behaves safely in this way:
  • if src vector is bigger, then it copy all values from src without go beyond the size of this vector
  • if src vector is smaller, then it copy all values from src and left unchanged all values that are beyond the limit of src vector

Definition at line 309 of file vectors.h.

References DoubleVector::size().

Referenced by IdentityFunction::apply(), GainFunction::apply(), LeakyIntegratorFunction::apply(), BiasedCluster::BiasedCluster(), Cluster::Cluster(), LeakyIntegratorFunction::LeakyIntegratorFunction(), BiasedCluster::setBiases(), Cluster::setInputs(), Cluster::setOutputs(), DDECluster::update(), and CopyLinker::update().

DoubleVector& copyValues ( const QVector< double > &  src)
inline

Copy the values from a QVector<double> honoring fixed elements (i.e.

: the fixed element of this remains unchanged )

Note
this method does not check the dimension of the two vectors, but behaves safely in this way:
  • if src vector is bigger, then it copy all values from src without go beyond the size of this vector
  • if src vector is smaller, then it copy all values from src and left unchanged all values that are beyond the limit of src vector

Definition at line 326 of file vectors.h.

DoubleVector& copyValues ( const DoubleVector src,
unsigned int  srcOffset,
unsigned int  thisOffset 
)
inline

Copy the values from source honoring fixed elements starting from the offsets specified (i.e.

: the fixed element of this remains unchanged )

Parameters
srcOffsetis the offset from which the values are read from the src vector
thisOffsetis the offset on which the values from the src vector are placed
Note
this method does not check the dimension of the two vectors, but behaves safely like the copyValues method

Definition at line 341 of file vectors.h.

References DoubleVector::size().

DoubleVector& copyValues ( const DoubleVector src,
unsigned int  srcOffset,
unsigned int  thisOffset,
unsigned int  stride 
)
inline

Copy the values from source honoring fixed elements starting from the offsets specified using the stride specified (i.e.

: the fixed element of this remains unchanged )

Parameters
srcOffsetis the offset from which the values are read from the src vector
thisOffsetis the offset on which the values from the src vector are placed
strideis the stride; stride zero is not allowed, stride == 1 behaves like copyValues without stride, stride > 1 it jump 'stride' values when coping, leaving the jumped values unchanged
Note
this method does not check the dimension of the two vectors, but behaves safely like the copyValues method
Warning
if stride == 0, then it does not copy any values and return the vector unchanged

Definition at line 362 of file vectors.h.

References DoubleVector::size().

DoubleVector& detach ( )
inline

If the current data is shared by other objects, this method will create a new copy of the data not shared by other objects.

Definition at line 376 of file vectors.h.

References farsa::memoryCopy(), and doubleRef::setRef().

bool isNull ( ) const
inline

Return True if the DoubleVector doesn't contain any data (i.e.

: size==0 )

Definition at line 258 of file vectors.h.

bool isSteady ( unsigned int  i) const
inline

Return true if the i-th value is a steady value.

Warning
Boundary check activated only when FARSA_DEBUG if defined

Definition at line 650 of file vectors.h.

bool operator!= ( const DoubleVector b) const
inline

Not-Equal Operator.

Definition at line 271 of file vectors.h.

const DoubleVector operator* ( const DoubleVector right) const
inline

operator *

Warning
Dimensionality check activated only when FARSA_DEBUG is defined

Definition at line 477 of file vectors.h.

DoubleVector& operator*= ( const DoubleVector right)
inline

operator *=

Warning
Dimensionality check activated only when FARSA_DEBUG is defined

Definition at line 561 of file vectors.h.

DoubleVector& operator*= ( const double &  right)
inline

operator *= with a scalar

Definition at line 605 of file vectors.h.

const DoubleVector& operator+ ( ) const
inline

unary operator +

Definition at line 402 of file vectors.h.

const DoubleVector operator+ ( const DoubleVector right) const
inline

operator +

Warning
Dimensionality check activated only when FARSA_DEBUG is defined

Definition at line 423 of file vectors.h.

DoubleVector& operator+= ( const DoubleVector right)
inline

operator +=

Warning
Dimensionality check activated only when FARSA_DEBUG is defined

Definition at line 531 of file vectors.h.

DoubleVector& operator+= ( const double &  right)
inline

operator += with a scalar

Definition at line 589 of file vectors.h.

const DoubleVector operator- ( ) const
inline

unary operator -

Definition at line 406 of file vectors.h.

const DoubleVector operator- ( const DoubleVector right) const
inline

operator -

Warning
Dimensionality check activated only when FARSA_DEBUG is defined

Definition at line 450 of file vectors.h.

DoubleVector& operator-= ( const DoubleVector right)
inline

operator -=

Warning
Dimensionality check activated only when FARSA_DEBUG is defined

Definition at line 546 of file vectors.h.

DoubleVector& operator-= ( const double &  right)
inline

operator -= with a scalar

Definition at line 597 of file vectors.h.

const DoubleVector operator/ ( const DoubleVector right) const
inline

operator /

Warning
Dimensionality check activated only when FARSA_DEBUG is defined

Definition at line 504 of file vectors.h.

DoubleVector& operator/= ( const DoubleVector right)
inline

operator /=

Warning
Dimensionality check activated only when FARSA_DEBUG is defined

Definition at line 576 of file vectors.h.

DoubleVector& operator/= ( const double &  right)
inline

operator /= with a scalar

Definition at line 613 of file vectors.h.

DoubleVector& operator<< ( const double &  value)
inline

Append Operator; the dimesion increase by one.

Definition at line 731 of file vectors.h.

DoubleVector& operator= ( const DoubleVector src)
inline

Behaves as a CopyConstructor: this do a completely substitution of underlying data so, it does not honor fixed elements, hence it substitute all informations taking also the new information about fixed element in src.


If you want copy only the DoubleVector's values use copyValues method instead.

Warning
If the isinternal flag is true, then the operator= will raise the AssignmentNotAllowed

Definition at line 280 of file vectors.h.

bool operator== ( const DoubleVector b) const
inline

Equal Operator.

Definition at line 262 of file vectors.h.

doubleRef& operator[] ( unsigned int  index)
inline

Indexing operator.

Warning
Boundary check activated only when FARSA_DEBUG is defined

Definition at line 681 of file vectors.h.

double operator[] ( unsigned int  index) const
inline

Indexing operator (Const Version)

Warning
Boundary check activated only when FARSA_DEBUG if defined

Definition at line 693 of file vectors.h.

DoubleVector& setAll ( const double  value)
inline

Set all values to value This method honor the steady values...

hence that values will remain at the same values

Definition at line 671 of file vectors.h.

Referenced by IdentityFunction::derivate(), ScaleFunction::derivate(), GainFunction::derivate(), LinearFunction::derivate(), BiasedCluster::setAllBiases(), Cluster::setAllInputs(), and DDECluster::update().

DoubleVector& steady ( unsigned int  i)
inline

Fix the i-th value, hence the i-th value will never change anymore until unsteady is called.

Warning
Boundary check activated only when FARSA_DEBUG if defined

Definition at line 624 of file vectors.h.

DoubleVector& unsteady ( unsigned int  i)
inline

Reallow the modification of i-th value.

Warning
Boundary check activated only when FARSA_DEBUG if defined

Definition at line 637 of file vectors.h.

DoubleVector& zeroing ( )
inline

Set all values to zero This method honor the steady values...

hence that values will remain at the same values

Definition at line 661 of file vectors.h.

Referenced by WinnerTakeAllFunction::apply(), BiasedCluster::BiasedCluster(), Cluster::Cluster(), LeakyIntegratorFunction::LeakyIntegratorFunction(), Cluster::resetInputs(), NormLinker::update(), DDECluster::update(), and LeakyIntegratorFunction::zeroingStatus().


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