DoubleVector Class Reference
DoubleVector Class. More...
Classes | |
class | sharedData |
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 (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 size, double value, bool isinternal=false) | |
Construct a vector of dimension size setting all the values as specified. | |
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. | |
DoubleVector & | append (const double &value) |
Append an element; the dimesion increase by one. | |
DoubleVector & | copyValues (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. | |
DoubleVector & | copyValues (const DoubleVector &src) |
Copy the values from source honoring fixed elements (i.e. | |
DoubleVector & | copyValues (const QVector< double > &src) |
Copy the values from a QVector<double> honoring fixed elements (i.e. | |
DoubleVector & | copyValues (const DoubleVector &src, unsigned int srcOffset, unsigned int thisOffset) |
Copy the values from source honoring fixed elements starting from the offsets specified (i.e. | |
DoubleVector & | detach () |
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 * | |
DoubleVector & | operator*= (const DoubleVector &right) |
operator *= | |
DoubleVector & | operator*= (const double &right) |
operator *= with a scalar | |
const DoubleVector & | operator+ () const |
unary operator + | |
const DoubleVector | operator+ (const DoubleVector &right) const |
operator + | |
DoubleVector & | operator+= (const DoubleVector &right) |
operator += | |
DoubleVector & | operator+= (const double &right) |
operator += with a scalar | |
const DoubleVector | operator- () const |
unary operator - | |
const DoubleVector | operator- (const DoubleVector &right) const |
operator - | |
DoubleVector & | operator-= (const double &right) |
operator -= with a scalar | |
DoubleVector & | operator-= (const DoubleVector &right) |
operator -= | |
const DoubleVector | operator/ (const DoubleVector &right) const |
operator / | |
DoubleVector & | operator/= (const DoubleVector &right) |
operator /= | |
DoubleVector & | operator/= (const double &right) |
operator /= with a scalar | |
DoubleVector & | operator<< (const double &value) |
Append Operator; the dimesion increase by one. | |
DoubleVector & | operator= (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. | |
double | operator[] (unsigned int index) const |
Indexing operator (Const Version) | |
doubleRef & | operator[] (unsigned int index) |
Indexing operator. | |
DoubleVector & | resize (unsigned int newsize) |
Resize the VectorData. | |
DoubleVector & | setAll (const double value) |
Set all values to value This method honor the steady values... | |
unsigned int | size () const |
Return the size of VectorData. | |
DoubleVector & | steady (unsigned int i) |
Fix the i-th value, hence the i-th value will never change anymore until unsteady is called. | |
DoubleVector & | unsteady (unsigned int i) |
Reallow the modification of i-th value. | |
DoubleVector & | zeroing () |
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.
Constructor & Destructor Documentation
DoubleVector | ( | ) | [inline] |
DoubleVector | ( | unsigned int | size, |
bool | isinternal = false |
||
) | [inline] |
Construct a vector of dimension size setting all values to zero.
- Parameters:
-
isinternal if 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:
-
isinternal if 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:
-
isinternal if 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] |
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] |
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 LeakyIntegratorFunction::apply(), GainFunction::apply(), IdentityFunction::apply(), BiasedCluster::BiasedCluster(), Cluster::Cluster(), LeakyIntegratorFunction::LeakyIntegratorFunction(), BiasedCluster::setBiases(), Cluster::setInputs(), Cluster::setOutputs(), DDECluster::update(), and CopyLinker::update().
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:
-
srcOffset is the offset from which the values are read from the src vector thisOffset is 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:
-
srcOffset is the offset from which the values are read from the src vector thisOffset is the offset on which the values from the src vector are placed stride is 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& 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
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 )
bool isSteady | ( | unsigned int | i | ) | const [inline] |
bool operator!= | ( | const DoubleVector & | b | ) | const [inline] |
const DoubleVector operator* | ( | const DoubleVector & | right | ) | const [inline] |
DoubleVector& operator*= | ( | const DoubleVector & | right | ) | [inline] |
DoubleVector& operator*= | ( | const double & | right | ) | [inline] |
const DoubleVector& operator+ | ( | ) | const [inline] |
const DoubleVector operator+ | ( | const DoubleVector & | right | ) | const [inline] |
DoubleVector& operator+= | ( | const DoubleVector & | right | ) | [inline] |
DoubleVector& operator+= | ( | const double & | right | ) | [inline] |
const DoubleVector operator- | ( | ) | const [inline] |
const DoubleVector operator- | ( | const DoubleVector & | right | ) | const [inline] |
DoubleVector& operator-= | ( | const DoubleVector & | right | ) | [inline] |
DoubleVector& operator-= | ( | const double & | right | ) | [inline] |
const DoubleVector operator/ | ( | const DoubleVector & | right | ) | const [inline] |
DoubleVector& operator/= | ( | const DoubleVector & | right | ) | [inline] |
DoubleVector& operator/= | ( | const double & | right | ) | [inline] |
DoubleVector& operator<< | ( | const double & | value | ) | [inline] |
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
bool operator== | ( | const DoubleVector & | b | ) | const [inline] |
doubleRef& operator[] | ( | unsigned int | index | ) | [inline] |
double operator[] | ( | unsigned int | index | ) | const [inline] |
DoubleVector& resize | ( | unsigned int | newsize | ) | [inline] |
Resize the VectorData.
Definition at line 702 of file vectors.h.
References farsa::memoryCopy(), and doubleRef::setRef().
Referenced by LinearComboFunction::clusterSetted(), CompositeFunction::clusterSetted(), LeakyIntegratorFunction::clusterSetted(), LeakyIntegratorFunction::configure(), and DDECluster::DDECluster().
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 LinearFunction::derivate(), GainFunction::derivate(), ScaleFunction::derivate(), IdentityFunction::derivate(), BiasedCluster::setAllBiases(), Cluster::setAllInputs(), and DDECluster::update().
unsigned int size | ( | ) | const [inline] |
Return the size of VectorData.
Definition at line 254 of file vectors.h.
Referenced by farsa::amul(), PseudoGaussFunction::apply(), SinFunction::apply(), TriangleFunction::apply(), SawtoothFunction::apply(), StepFunction::apply(), RampFunction::apply(), FakeSigmoidFunction::apply(), LeakyIntegratorFunction::clusterSetted(), LeakyIntegratorFunction::configure(), Pattern::configure(), DoubleVector::copyValues(), farsa::deltarule(), StepFunction::derivate(), RampFunction::derivate(), farsa::exp(), farsa::inv(), farsa::maxIndex(), farsa::mean(), farsa::mul(), farsa::operator*(), farsa::operator+(), farsa::operator-(), farsa::operator/(), LeakyIntegratorFunction::save(), Pattern::save(), DDECluster::save(), Cluster::save(), BiasedCluster::save(), DDECluster::setCoeff(), farsa::square(), farsa::subtract(), farsa::sum(), and DDECluster::update().
DoubleVector& steady | ( | unsigned int | i | ) | [inline] |
DoubleVector& unsteady | ( | unsigned int | i | ) | [inline] |
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:
- nnfw/include/vectors.h