mlpack
gaussian_function.hpp
Go to the documentation of this file.
1 
12 #ifndef MLPACK_METHODS_ANN_ACTIVATION_FUNCTIONS_GAUSSIAN_FUNCTION_HPP
13 #define MLPACK_METHODS_ANN_ACTIVATION_FUNCTIONS_GAUSSIAN_FUNCTION_HPP
14 
15 #include <mlpack/prereqs.hpp>
16 
17 namespace mlpack {
18 namespace ann {
19 
29 {
30  public:
37  template<typename eT>
38  static double Fn(const eT x)
39  {
40  return std::exp(-1 * std::pow(x, 2));
41  }
42 
49  template<typename InputVecType, typename OutputVecType>
50  static void Fn(const InputVecType& x, OutputVecType& y)
51  {
52  y = arma::exp(-1 * arma::pow(x, 2));
53  }
54 
61  static double Deriv(const double y)
62  {
63  return 2 * -y * std::exp(-1 * std::pow(y, 2));
64  }
65 
72  template<typename InputVecType, typename OutputVecType>
73  static void Deriv(const InputVecType& y, OutputVecType& x)
74  {
75  x = 2 * -y % arma::exp(-1 * arma::pow(y, 2));
76  }
77 }; // class GaussianFunction
78 
79 } // namespace ann
80 } // namespace mlpack
81 
82 #endif
static void Deriv(const InputVecType &y, OutputVecType &x)
Computes the first derivatives of the gaussian function.
Definition: gaussian_function.hpp:73
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
The core includes that mlpack expects; standard C++ includes and Armadillo.
static double Deriv(const double y)
Computes the first derivative of the gaussian function.
Definition: gaussian_function.hpp:61
static void Fn(const InputVecType &x, OutputVecType &y)
Computes the gaussian function.
Definition: gaussian_function.hpp:50
static double Fn(const eT x)
Computes the gaussian function.
Definition: gaussian_function.hpp:38
The gaussian function, defined by.
Definition: gaussian_function.hpp:28