mlpack
spline_function.hpp
Go to the documentation of this file.
1 
12 #ifndef MLPACK_METHODS_ANN_ACTIVATION_FUNCTIONS_SPLINE_FUNCTION_HPP
13 #define MLPACK_METHODS_ANN_ACTIVATION_FUNCTIONS_SPLINE_FUNCTION_HPP
14 
15 #include <mlpack/prereqs.hpp>
16 
17 namespace mlpack {
18 namespace ann {
19 
29 {
30  public:
37  static double Fn(const double x)
38  {
39  return std::pow(x, 2) * std::log(1 + x);
40  }
41 
48  template<typename InputVecType, typename OutputVecType>
49  static void Fn(const InputVecType& x, OutputVecType& y)
50  {
51  y = arma::pow(x, 2) % arma::log(1 + x);
52  }
53 
60  static double Deriv(const double y)
61  {
62  return 2 * y * std::log(1 + y) + std::pow(y, 2) / (1 + y);
63  }
64 
71  template<typename InputVecType, typename OutputVecType>
72  static void Deriv(const InputVecType& x, OutputVecType& y)
73  {
74  y = 2 * x % arma::log(1 + x) + arma::pow(x, 2) / (1 + x);
75  }
76 }; // class SplineFunction
77 
78 } // namespace ann
79 } // namespace mlpack
80 
81 #endif
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 Fn(const double x)
Computes the Spline function.
Definition: spline_function.hpp:37
static void Fn(const InputVecType &x, OutputVecType &y)
Computes the Spline function.
Definition: spline_function.hpp:49
The Spline function, defined by.
Definition: spline_function.hpp:28
static double Deriv(const double y)
Computes the first derivative of the Spline function.
Definition: spline_function.hpp:60
static void Deriv(const InputVecType &x, OutputVecType &y)
Computes the first derivatives of the Spline function.
Definition: spline_function.hpp:72