Dynamic Neural Field Composer 0.0.0
A C++20 library and interactive application for building and simulating Dynamic Neural Field (DNF) architectures.
Loading...
Searching...
No Matches
Enumerations | Functions
dnf_composer::tools::math Namespace Reference

Enumerations

enum class  ReduceOp { SUM , AVERAGE , MAXIMUM , MINIMUM }
 

Functions

template<typename T >
std::vector< T > absSigmoid (const std::vector< T > &x, T beta, T x0)
 AbsSigmoid: rational approximation of the logistic sigmoid.
 
template<typename T >
void broadcast1DTo2D_into (std::vector< T > &out, const std::vector< T > &profile, int size_x, int size_y, bool alongX)
 
template<typename T >
calculateVectorAvg (const std::vector< T > &vec)
 
template<typename T >
calculateVectorNorm (const std::vector< T > &vec)
 
template<typename T >
calculateVectorSum (const std::vector< T > &vec)
 
double circular_gaussian_2d (double x, double y, double mu_x, double mu_y, double sigma, double A)
 
template<typename T >
std::vector< T > circularGauss (uint32_t size, const T &sigma, const T &position)
 
template<typename T >
bool compareVectors (const std::vector< T > &vec1, const std::vector< T > &vec2, T threshold)
 
std::array< int, 2 > computeKernelRange (double sigma, int cutOfFactor, int fieldSize, bool circular)
 
template<typename T >
std::vector< T > conv (std::vector< T > const &f, std::vector< T > const &g)
 
template<typename T >
std::vector< T > conv2d_separable (const std::vector< T > &field, const std::vector< T > &kernel_x, const std::vector< T > &kernel_y, int size_x, int size_y, const std::vector< int > &extIndex_x, const std::vector< int > &extIndex_y)
 
template<typename T >
void conv2d_separable_into (std::vector< T > &out, std::vector< T > &tmp, const std::vector< T > &field, const std::vector< T > &kernel_x, const std::vector< T > &kernel_y, int size_x, int size_y, const std::vector< int > &extIndex_x, const std::vector< int > &extIndex_y)
 
template<typename T >
std::vector< T > conv_same (std::vector< T > const &f, std::vector< T > const &g)
 
template<typename T >
void conv_same_into (std::vector< T > &out, const std::vector< T > &f, const std::vector< T > &g)
 
template<typename T >
std::vector< T > conv_valid (std::vector< T > const &f, std::vector< T > const &g)
 
template<typename T >
void conv_valid_into (std::vector< T > &out, const std::vector< T > &f, const std::vector< T > &g)
 
std::vector< int > createExtendedIndex (int fieldSize, const std::array< int, 2 > &kernelRange)
 
template<typename T >
std::vector< std::vector< T > > deltaLearningRuleKroghHertz (std::vector< std::vector< T > > &weights, const std::vector< T > &input, const std::vector< T > &targetOutput, const std::vector< T > &actualOutput, double learningRate)
 
template<typename T >
std::vector< std::vector< T > > deltaLearningRuleWidrowHoff (std::vector< std::vector< T > > &weights, const std::vector< T > &input, const std::vector< T > &actualOutput, const std::vector< T > &targetOutput, double learningRate)
 
template<typename T >
std::vector< T > flattenMatrix (const std::vector< std::vector< T > > &matrix)
 
template<typename T >
std::vector< T > gauss (const std::vector< int > &rangeX, const T &position, const T &sigma)
 
template<typename T >
std::vector< T > gauss (int size, const T &sigma, const T &position)
 
template<typename T >
std::vector< T > gaussDerivative (const std::vector< int > &rangeX, const T &position, const T &sigma, const T &amplitude)
 
template<typename T >
std::vector< T > gaussDerivativeNorm (const std::vector< int > &rangeX, const T &position, const T &sigma, const T &amplitude)
 
double gaussian_2d (double x, double y, double mu_x, double mu_y, double sigma_x, double sigma_y, double A)
 
double gaussian_2d_periodic (double x, double y, double mu_x, double mu_y, double sigma, double A, double max_x, double max_y)
 
template<typename T >
std::vector< T > gaussNorm (const std::vector< int > &rangeX, const T &position, const T &sigma)
 
std::vector< double > generateNormalVector (int size)
 
template<typename T >
std::vector< T > heaviside (const std::vector< T > &x, T threshold)
 
template<typename T >
std::vector< T > hebbLearningRule (std::vector< T > &weights, const std::vector< T > &input, const std::vector< T > &output, double learningRate)
 
template<typename T >
std::vector< T > nonCircularGauss (uint32_t size, const T &sigma, const T &position)
 
double normalize (const double value, const double min, const double max)
 
template<typename T >
std::vector< T > normalize (const std::vector< T > &vector)
 
template<typename T >
std::vector< T > obtainCircularVector (const std::vector< int > &indices, const std::vector< T > &contents)
 
template<typename T >
void obtainCircularVector_into (std::vector< T > &out, const std::vector< int > &indices, const std::vector< T > &contents)
 
template<typename T >
std::vector< T > ojaLearningRule (std::vector< T > &weights, const std::vector< T > &input, const std::vector< T > &output, double learningRate)
 
template<typename T >
void reduce2DAxis_into (std::vector< T > &out, const std::vector< T > &field, int size_x, int size_y, bool keepX, ReduceOp op)
 
template<typename T >
std::vector< T > resample (const std::vector< T > &input, int outputSize)
 
template<typename T >
void resampleCubicInto (const std::vector< T > &input, std::vector< T > &output)
 
template<typename T >
void resampleInto (const std::vector< T > &input, std::vector< T > &output)
 
template<typename T >
void resampleNearestInto (const std::vector< T > &input, std::vector< T > &output)
 
template<typename T >
std::vector< T > sigmoid (const std::vector< T > &x, T beta, T x0)
 
template<typename T >
std::vector< T > sumGauss (const std::vector< T > &gauss1, const std::vector< T > &gauss2)
 
double wrap (double value, double max_value)
 

Enumeration Type Documentation

◆ ReduceOp

Enumerator
SUM 
AVERAGE 
MAXIMUM 
MINIMUM 

Function Documentation

◆ absSigmoid()

template<typename T >
std::vector< T > dnf_composer::tools::math::absSigmoid ( const std::vector< T > &  x,
beta,
x0 
)

AbsSigmoid: rational approximation of the logistic sigmoid.

Formula: s(x) = 0.5 * (1 + beta * (x - x0) / (1 + beta * |x - x0|))

Equivalent to cedar's AbsSigmoid(beta, theta=x0). At beta >= 20 virtually indistinguishable from the ExpSigmoid but avoids std::exp() entirely.

Here is the caller graph for this function:

◆ broadcast1DTo2D_into()

template<typename T >
void dnf_composer::tools::math::broadcast1DTo2D_into ( std::vector< T > &  out,
const std::vector< T > &  profile,
int  size_x,
int  size_y,
bool  alongX 
)
Here is the caller graph for this function:

◆ calculateVectorAvg()

template<typename T >
T dnf_composer::tools::math::calculateVectorAvg ( const std::vector< T > &  vec)

◆ calculateVectorNorm()

template<typename T >
T dnf_composer::tools::math::calculateVectorNorm ( const std::vector< T > &  vec)

◆ calculateVectorSum()

template<typename T >
T dnf_composer::tools::math::calculateVectorSum ( const std::vector< T > &  vec)
Here is the caller graph for this function:

◆ circular_gaussian_2d()

double dnf_composer::tools::math::circular_gaussian_2d ( double  x,
double  y,
double  mu_x,
double  mu_y,
double  sigma,
double  A 
)
inline

◆ circularGauss()

template<typename T >
std::vector< T > dnf_composer::tools::math::circularGauss ( uint32_t  size,
const T &  sigma,
const T &  position 
)
Here is the caller graph for this function:

◆ compareVectors()

template<typename T >
bool dnf_composer::tools::math::compareVectors ( const std::vector< T > &  vec1,
const std::vector< T > &  vec2,
threshold 
)

◆ computeKernelRange()

std::array< int, 2 > dnf_composer::tools::math::computeKernelRange ( double  sigma,
int  cutOfFactor,
int  fieldSize,
bool  circular 
)
Here is the caller graph for this function:

◆ conv()

template<typename T >
std::vector< T > dnf_composer::tools::math::conv ( std::vector< T > const &  f,
std::vector< T > const &  g 
)

◆ conv2d_separable()

template<typename T >
std::vector< T > dnf_composer::tools::math::conv2d_separable ( const std::vector< T > &  field,
const std::vector< T > &  kernel_x,
const std::vector< T > &  kernel_y,
int  size_x,
int  size_y,
const std::vector< int > &  extIndex_x,
const std::vector< int > &  extIndex_y 
)
Here is the call graph for this function:

◆ conv2d_separable_into()

template<typename T >
void dnf_composer::tools::math::conv2d_separable_into ( std::vector< T > &  out,
std::vector< T > &  tmp,
const std::vector< T > &  field,
const std::vector< T > &  kernel_x,
const std::vector< T > &  kernel_y,
int  size_x,
int  size_y,
const std::vector< int > &  extIndex_x,
const std::vector< int > &  extIndex_y 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ conv_same()

template<typename T >
std::vector< T > dnf_composer::tools::math::conv_same ( std::vector< T > const &  f,
std::vector< T > const &  g 
)
Here is the caller graph for this function:

◆ conv_same_into()

template<typename T >
void dnf_composer::tools::math::conv_same_into ( std::vector< T > &  out,
const std::vector< T > &  f,
const std::vector< T > &  g 
)
Here is the caller graph for this function:

◆ conv_valid()

template<typename T >
std::vector< T > dnf_composer::tools::math::conv_valid ( std::vector< T > const &  f,
std::vector< T > const &  g 
)
Here is the caller graph for this function:

◆ conv_valid_into()

template<typename T >
void dnf_composer::tools::math::conv_valid_into ( std::vector< T > &  out,
const std::vector< T > &  f,
const std::vector< T > &  g 
)
Here is the caller graph for this function:

◆ createExtendedIndex()

std::vector< int > dnf_composer::tools::math::createExtendedIndex ( int  fieldSize,
const std::array< int, 2 > &  kernelRange 
)
Here is the caller graph for this function:

◆ deltaLearningRuleKroghHertz()

template<typename T >
std::vector< std::vector< T > > dnf_composer::tools::math::deltaLearningRuleKroghHertz ( std::vector< std::vector< T > > &  weights,
const std::vector< T > &  input,
const std::vector< T > &  targetOutput,
const std::vector< T > &  actualOutput,
double  learningRate 
)

◆ deltaLearningRuleWidrowHoff()

template<typename T >
std::vector< std::vector< T > > dnf_composer::tools::math::deltaLearningRuleWidrowHoff ( std::vector< std::vector< T > > &  weights,
const std::vector< T > &  input,
const std::vector< T > &  actualOutput,
const std::vector< T > &  targetOutput,
double  learningRate 
)

◆ flattenMatrix()

template<typename T >
std::vector< T > dnf_composer::tools::math::flattenMatrix ( const std::vector< std::vector< T > > &  matrix)

◆ gauss() [1/2]

template<typename T >
std::vector< T > dnf_composer::tools::math::gauss ( const std::vector< int > &  rangeX,
const T &  position,
const T &  sigma 
)
Here is the caller graph for this function:

◆ gauss() [2/2]

template<typename T >
std::vector< T > dnf_composer::tools::math::gauss ( int  size,
const T &  sigma,
const T &  position 
)

◆ gaussDerivative()

template<typename T >
std::vector< T > dnf_composer::tools::math::gaussDerivative ( const std::vector< int > &  rangeX,
const T &  position,
const T &  sigma,
const T &  amplitude 
)
Here is the caller graph for this function:

◆ gaussDerivativeNorm()

template<typename T >
std::vector< T > dnf_composer::tools::math::gaussDerivativeNorm ( const std::vector< int > &  rangeX,
const T &  position,
const T &  sigma,
const T &  amplitude 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gaussian_2d()

double dnf_composer::tools::math::gaussian_2d ( double  x,
double  y,
double  mu_x,
double  mu_y,
double  sigma_x,
double  sigma_y,
double  A 
)
inline
Here is the caller graph for this function:

◆ gaussian_2d_periodic()

double dnf_composer::tools::math::gaussian_2d_periodic ( double  x,
double  y,
double  mu_x,
double  mu_y,
double  sigma,
double  A,
double  max_x,
double  max_y 
)
inline
Here is the caller graph for this function:

◆ gaussNorm()

template<typename T >
std::vector< T > dnf_composer::tools::math::gaussNorm ( const std::vector< int > &  rangeX,
const T &  position,
const T &  sigma 
)
Here is the caller graph for this function:

◆ generateNormalVector()

std::vector< double > dnf_composer::tools::math::generateNormalVector ( int  size)
Here is the caller graph for this function:

◆ heaviside()

template<typename T >
std::vector< T > dnf_composer::tools::math::heaviside ( const std::vector< T > &  x,
threshold 
)
Here is the caller graph for this function:

◆ hebbLearningRule()

template<typename T >
std::vector< T > dnf_composer::tools::math::hebbLearningRule ( std::vector< T > &  weights,
const std::vector< T > &  input,
const std::vector< T > &  output,
double  learningRate 
)

◆ nonCircularGauss()

template<typename T >
std::vector< T > dnf_composer::tools::math::nonCircularGauss ( uint32_t  size,
const T &  sigma,
const T &  position 
)

◆ normalize() [1/2]

double dnf_composer::tools::math::normalize ( const double  value,
const double  min,
const double  max 
)
inline

◆ normalize() [2/2]

template<typename T >
std::vector< T > dnf_composer::tools::math::normalize ( const std::vector< T > &  vector)
Here is the call graph for this function:

◆ obtainCircularVector()

template<typename T >
std::vector< T > dnf_composer::tools::math::obtainCircularVector ( const std::vector< int > &  indices,
const std::vector< T > &  contents 
)
Here is the caller graph for this function:

◆ obtainCircularVector_into()

template<typename T >
void dnf_composer::tools::math::obtainCircularVector_into ( std::vector< T > &  out,
const std::vector< int > &  indices,
const std::vector< T > &  contents 
)
Here is the caller graph for this function:

◆ ojaLearningRule()

template<typename T >
std::vector< T > dnf_composer::tools::math::ojaLearningRule ( std::vector< T > &  weights,
const std::vector< T > &  input,
const std::vector< T > &  output,
double  learningRate 
)

◆ reduce2DAxis_into()

template<typename T >
void dnf_composer::tools::math::reduce2DAxis_into ( std::vector< T > &  out,
const std::vector< T > &  field,
int  size_x,
int  size_y,
bool  keepX,
ReduceOp  op 
)
Here is the caller graph for this function:

◆ resample()

template<typename T >
std::vector< T > dnf_composer::tools::math::resample ( const std::vector< T > &  input,
int  outputSize 
)

◆ resampleCubicInto()

template<typename T >
void dnf_composer::tools::math::resampleCubicInto ( const std::vector< T > &  input,
std::vector< T > &  output 
)
Here is the caller graph for this function:

◆ resampleInto()

template<typename T >
void dnf_composer::tools::math::resampleInto ( const std::vector< T > &  input,
std::vector< T > &  output 
)
Here is the caller graph for this function:

◆ resampleNearestInto()

template<typename T >
void dnf_composer::tools::math::resampleNearestInto ( const std::vector< T > &  input,
std::vector< T > &  output 
)
Here is the caller graph for this function:

◆ sigmoid()

template<typename T >
std::vector< T > dnf_composer::tools::math::sigmoid ( const std::vector< T > &  x,
beta,
x0 
)
Here is the caller graph for this function:

◆ sumGauss()

template<typename T >
std::vector< T > dnf_composer::tools::math::sumGauss ( const std::vector< T > &  gauss1,
const std::vector< T > &  gauss2 
)

◆ wrap()

double dnf_composer::tools::math::wrap ( double  value,
double  max_value 
)
inline