NNFW Functions

Functions

FARSA_NNFW_TEMPLATE DoubleVector & amul (DoubleVector &y, const DoubleVector &x, const DoubleMatrix &m)
 Right Accumulated Multiplication: y += x*m .
 
FARSA_NNFW_TEMPLATE DoubleVector & amul (DoubleVector &y, const DoubleMatrix &m, const DoubleVector &x)
 Left Accumulated Multiplication: y += m*x .
 
FARSA_NNFW_TEMPLATE DoubleVector & deltarule (DoubleVector &r, double rate, const DoubleVector &x, const DoubleVector &y)
 Delta-Rule: r += rate * x * y .
 
FARSA_NNFW_TEMPLATE DoubleMatrix & deltarule (DoubleMatrix &m, double rate, const DoubleVector &x, const DoubleVector &y)
 Delta-Rule: m += rate * x * y .
 
FARSA_NNFW_TEMPLATE DoubleVector & exp (DoubleVector &data)
 Calculate the exponential of each element.
 
FARSA_NNFW_TEMPLATE DoubleVector & inv (DoubleVector &data)
 Calculate the inverse of each element.
 
FARSA_NNFW_TEMPLATE unsigned int maxIndex (const DoubleVector &src)
 Return the index where the first occurrence of the maximum value appear in the vector.
 
FARSA_NNFW_TEMPLATE double mean (const DoubleVector &src)
 Return the mean value of the vector's elements.
 
template<class T >
FARSA_NNFW_TEMPLATE void memoryCopy (T *dest, const T *src, unsigned int size)
 template for memory copy of data
 
FARSA_NNFW_TEMPLATE void memoryCopy (float *dest, const float *src, unsigned int size)
 specialization of memoryCopy for float data
 
FARSA_NNFW_TEMPLATE void memoryCopy (double *dest, const double *src, unsigned int size)
 specialization of memoryCopy for double data
 
FARSA_NNFW_TEMPLATE void memoryCopy (bool *dest, const bool *src, unsigned int size)
 specialization of memoryCopy for bool data
 
template<class T >
FARSA_NNFW_TEMPLATE void memoryZeroing (T *data, unsigned int size)
 template for memory zeroing of data
 
FARSA_NNFW_TEMPLATE void memoryZeroing (float *data, unsigned int size)
 specialization of memoryZeroing for float data
 
FARSA_NNFW_TEMPLATE void memoryZeroing (double *data, unsigned int size)
 specialization of memoryZeroing for double data
 
FARSA_NNFW_TEMPLATE void memoryZeroing (bool *data, unsigned int size)
 specialization of memoryZeroing for bool data
 
FARSA_NNFW_TEMPLATE double mse (const DoubleVector &target, const DoubleVector &actual)
 Return the mean square error of the vector's elements.
 
FARSA_NNFW_TEMPLATE DoubleVector & mul (DoubleVector &r, double a, const DoubleVector &x)
 multiplication with alread allocated destination vector: r = a * x
 
FARSA_NNFW_TEMPLATE DoubleVector & mul (DoubleVector &y, const DoubleVector &x, const DoubleMatrix &m)
 Right Multiplication: y = x*m .
 
FARSA_NNFW_TEMPLATE DoubleVector & mul (DoubleVector &y, const DoubleMatrix &m, const DoubleVector &x)
 Left Multiplication: y = m*x .
 
FARSA_NNFW_TEMPLATE const
DoubleVector 
operator* (const double &a, const DoubleVector &x)
 operator* between scalar and DoubleVector
 
FARSA_NNFW_TEMPLATE const
DoubleVector 
operator* (const DoubleVector &x, const double &a)
 operator* between DoubleVector and scalar
 
FARSA_NNFW_TEMPLATE const
DoubleVector 
operator+ (const double &a, const DoubleVector &x)
 operator+ between scalar and DoubleVector
 
FARSA_NNFW_TEMPLATE const
DoubleVector 
operator+ (const DoubleVector &x, const double &a)
 operator+ between DoubleVector and scalar
 
FARSA_NNFW_TEMPLATE const
DoubleVector 
operator- (const double &a, const DoubleVector &x)
 operator- between scalar and DoubleVector
 
FARSA_NNFW_TEMPLATE const
DoubleVector 
operator- (const DoubleVector &x, const double &a)
 operator- between DoubleVector and scalar
 
FARSA_NNFW_TEMPLATE const
DoubleVector 
operator/ (const double &a, const DoubleVector &x)
 operator/ between scalar and DoubleVector
 
FARSA_NNFW_TEMPLATE const
DoubleVector 
operator/ (const DoubleVector &x, const double &a)
 operator/ between DoubleVector and scalar
 
FARSA_NNFW_TEMPLATE DoubleVector & square (DoubleVector &data)
 Calculate the square of each element.
 
FARSA_NNFW_TEMPLATE DoubleVector & subtract (DoubleVector &r, const DoubleVector &x, const DoubleVector &y)
 subtraction with alread allocated destination vector: r = x - y
 
FARSA_NNFW_TEMPLATE DoubleVector & subtract (DoubleVector &r, double a, const DoubleVector &x)
 subtraction with alread allocated destination vector: r = a - x
 
FARSA_NNFW_TEMPLATE double sum (const DoubleVector &data)
 Return the sum of the vector's elements.
 

Detailed Description

Function Documentation

FARSA_NNFW_TEMPLATE DoubleVector& farsa::amul ( DoubleVector &  y,
const DoubleVector &  x,
const DoubleMatrix &  m 
)
inline

Right Accumulated Multiplication: y += x*m .

Parameters
ythe result of multiplication
xthe vector
mthe matrix
Returns
the vector y

Definition at line 283 of file algebra.h.

References DoubleMatrix::cols(), DoubleMatrix::rows(), and DoubleVector::size().

Referenced by DotLinker::update().

FARSA_NNFW_TEMPLATE DoubleVector& farsa::amul ( DoubleVector &  y,
const DoubleMatrix &  m,
const DoubleVector &  x 
)
inline

Left Accumulated Multiplication: y += m*x .

Parameters
ythe result of multiplication
mthe matrix
xthe vector
Returns
the vector y

Definition at line 324 of file algebra.h.

References DoubleMatrix::cols(), DoubleMatrix::rows(), and DoubleVector::size().

FARSA_NNFW_TEMPLATE DoubleVector& farsa::deltarule ( DoubleVector &  r,
double  rate,
const DoubleVector &  x,
const DoubleVector &  y 
)
inline

Delta-Rule: r += rate * x * y .


Add to r the computation of the so-called delta-rule

Parameters
ris the vector on which delta-rule results is added
rateis the scaling factor of multiplication
xis the first vector
yis the second vector
Returns
the vector r

Definition at line 244 of file algebra.h.

References DoubleVector::size().

Referenced by BackPropagationAlgo::learn().

FARSA_NNFW_TEMPLATE DoubleMatrix& farsa::deltarule ( DoubleMatrix &  m,
double  rate,
const DoubleVector &  x,
const DoubleVector &  y 
)
inline

Delta-Rule: m += rate * x * y .

Parameters
mthe matrix on which the result of Delta-rule is added up
rateis the factor of multiplicaton
xis the first vector, its dimension must be the same of matrix's rows
yis the second vector, its dimension must be the same of matrix's columns
Returns
the matrix m

Definition at line 345 of file algebra.h.

References DoubleMatrix::cols(), DoubleMatrix::rows(), and DoubleVector::size().

FARSA_NNFW_TEMPLATE DoubleVector& farsa::exp ( DoubleVector &  data)
inline

Calculate the exponential of each element.

Definition at line 44 of file algebra.h.

References DoubleVector::size().

Referenced by GaussFunction::apply(), SigmoidFunction::apply(), ScaledSigmoidFunction::apply(), RampFunction::derivate(), and StepFunction::derivate().

FARSA_NNFW_TEMPLATE DoubleVector& farsa::inv ( DoubleVector &  data)
inline

Calculate the inverse of each element.

Definition at line 65 of file algebra.h.

References DoubleVector::size().

Referenced by SigmoidFunction::apply(), ScaledSigmoidFunction::apply(), and LogLikeFunction::apply().

FARSA_NNFW_TEMPLATE unsigned int farsa::maxIndex ( const DoubleVector &  src)
inline

Return the index where the first occurrence of the maximum value appear in the vector.

Definition at line 53 of file algebra.h.

References DoubleVector::size().

Referenced by WinnerTakeAllFunction::apply().

FARSA_NNFW_TEMPLATE double farsa::mean ( const DoubleVector &  src)
inline

Return the mean value of the vector's elements.

Definition at line 93 of file algebra.h.

References DoubleVector::size(), and farsa::sum().

Referenced by farsa::mse().

FARSA_NNFW_TEMPLATE void farsa::memoryCopy ( T *  dest,
const T *  src,
unsigned int  size 
)
inline

template for memory copy of data

Definition at line 34 of file memutils.h.

Referenced by DoubleVector::detach(), and DoubleVector::resize().

FARSA_NNFW_TEMPLATE void farsa::memoryCopy ( float *  dest,
const float *  src,
unsigned int  size 
)
inline

specialization of memoryCopy for float data

Definition at line 53 of file memutils.h.

FARSA_NNFW_TEMPLATE void farsa::memoryCopy ( double *  dest,
const double *  src,
unsigned int  size 
)
inline

specialization of memoryCopy for double data

Definition at line 67 of file memutils.h.

FARSA_NNFW_TEMPLATE void farsa::memoryCopy ( bool *  dest,
const bool *  src,
unsigned int  size 
)
inline

specialization of memoryCopy for bool data

Definition at line 81 of file memutils.h.

FARSA_NNFW_TEMPLATE void farsa::memoryZeroing ( T *  data,
unsigned int  size 
)
inline

template for memory zeroing of data

Definition at line 44 of file memutils.h.

Referenced by DoubleVector::DoubleVector().

FARSA_NNFW_TEMPLATE void farsa::memoryZeroing ( float *  data,
unsigned int  size 
)
inline

specialization of memoryZeroing for float data

Definition at line 60 of file memutils.h.

FARSA_NNFW_TEMPLATE void farsa::memoryZeroing ( double *  data,
unsigned int  size 
)
inline

specialization of memoryZeroing for double data

Definition at line 74 of file memutils.h.

FARSA_NNFW_TEMPLATE void farsa::memoryZeroing ( bool *  data,
unsigned int  size 
)
inline

specialization of memoryZeroing for bool data

Definition at line 88 of file memutils.h.

FARSA_NNFW_TEMPLATE double farsa::mse ( const DoubleVector &  target,
const DoubleVector &  actual 
)
inline

Return the mean square error of the vector's elements.

Definition at line 99 of file algebra.h.

References farsa::mean(), and farsa::square().

Referenced by BackPropagationAlgo::calculateMSE().

FARSA_NNFW_TEMPLATE DoubleVector& farsa::mul ( DoubleVector &  r,
double  a,
const DoubleVector &  x 
)
inline

multiplication with alread allocated destination vector: r = a * x

Definition at line 223 of file algebra.h.

References DoubleVector::size().

Referenced by ScaleFunction::apply(), SigmoidFunction::apply(), ScaledSigmoidFunction::apply(), LinearFunction::apply(), and LogLikeFunction::apply().

FARSA_NNFW_TEMPLATE DoubleVector& farsa::mul ( DoubleVector &  y,
const DoubleVector &  x,
const DoubleMatrix &  m 
)
inline

Right Multiplication: y = x*m .

Parameters
ythe result of multiplication
xthe vector
mthe matrix
Returns
the vector y

Definition at line 263 of file algebra.h.

References DoubleMatrix::cols(), DoubleMatrix::rows(), and DoubleVector::size().

FARSA_NNFW_TEMPLATE DoubleVector& farsa::mul ( DoubleVector &  y,
const DoubleMatrix &  m,
const DoubleVector &  x 
)
inline

Left Multiplication: y = m*x .

Parameters
ythe result of multiplication
mthe matrix
xthe vector
Returns
the vector y

Definition at line 304 of file algebra.h.

References DoubleMatrix::cols(), DoubleMatrix::rows(), and DoubleVector::size().

FARSA_NNFW_TEMPLATE const DoubleVector farsa::operator* ( const double &  a,
const DoubleVector &  x 
)
inline

operator* between scalar and DoubleVector

Definition at line 151 of file algebra.h.

References DoubleVector::size().

FARSA_NNFW_TEMPLATE const DoubleVector farsa::operator* ( const DoubleVector &  x,
const double &  a 
)
inline

operator* between DoubleVector and scalar

Definition at line 162 of file algebra.h.

References DoubleVector::size().

FARSA_NNFW_TEMPLATE const DoubleVector farsa::operator+ ( const double &  a,
const DoubleVector &  x 
)
inline

operator+ between scalar and DoubleVector

Definition at line 129 of file algebra.h.

References DoubleVector::size().

FARSA_NNFW_TEMPLATE const DoubleVector farsa::operator+ ( const DoubleVector &  x,
const double &  a 
)
inline

operator+ between DoubleVector and scalar

Definition at line 140 of file algebra.h.

References DoubleVector::size().

FARSA_NNFW_TEMPLATE const DoubleVector farsa::operator- ( const double &  a,
const DoubleVector &  x 
)
inline

operator- between scalar and DoubleVector

Definition at line 107 of file algebra.h.

References DoubleVector::size().

FARSA_NNFW_TEMPLATE const DoubleVector farsa::operator- ( const DoubleVector &  x,
const double &  a 
)
inline

operator- between DoubleVector and scalar

Definition at line 118 of file algebra.h.

References DoubleVector::size().

FARSA_NNFW_TEMPLATE const DoubleVector farsa::operator/ ( const double &  a,
const DoubleVector &  x 
)
inline

operator/ between scalar and DoubleVector

Definition at line 173 of file algebra.h.

References DoubleVector::size().

FARSA_NNFW_TEMPLATE const DoubleVector farsa::operator/ ( const DoubleVector &  x,
const double &  a 
)
inline

operator/ between DoubleVector and scalar

Definition at line 184 of file algebra.h.

References DoubleVector::size().

FARSA_NNFW_TEMPLATE DoubleVector& farsa::square ( DoubleVector &  data)
inline

Calculate the square of each element.

Definition at line 84 of file algebra.h.

References DoubleVector::size().

Referenced by GaussFunction::apply(), farsa::mse(), and NormLinker::update().

FARSA_NNFW_TEMPLATE DoubleVector& farsa::subtract ( DoubleVector &  r,
const DoubleVector &  x,
const DoubleVector &  y 
)
inline
FARSA_NNFW_TEMPLATE DoubleVector& farsa::subtract ( DoubleVector &  r,
double  a,
const DoubleVector &  x 
)
inline

subtraction with alread allocated destination vector: r = a - x

Definition at line 209 of file algebra.h.

References DoubleVector::size().

FARSA_NNFW_TEMPLATE double farsa::sum ( const DoubleVector &  data)
inline

Return the sum of the vector's elements.

Definition at line 74 of file algebra.h.

References DoubleVector::size().

Referenced by farsa::mean(), and NormLinker::update().