Canopy  1.0
The header-only random forests library
vonMisesKappaFunctor.hpp
Go to the documentation of this file.
1 #ifndef VONMISESKAPPAFUNCTOR_H
2 #define VONMISESKAPPAFUNCTOR_H
3 
11 #include <boost/math/special_functions/bessel.hpp>
12 
13 namespace canopy
14 {
15 
16 // Specific functor for the problem at hand (finding kappa)
21 {
22  float R;
23 
27  vonMisesKappaFunctor(float Rin) {R = Rin;}
28 
35  int operator()(const Eigen::VectorXd &x, Eigen::VectorXd &fvec) const
36  {
37  using boost::math::cyl_bessel_i;
38  // The function to solve for Kappa
39  fvec(0,0) = cyl_bessel_i(1,x[0]) - R*cyl_bessel_i(0,x[0]);
40  return 0;
41  }
42 
49  int df(const Eigen::VectorXd &x, Eigen::MatrixXd &fjac) const
50  {
51  using boost::math::cyl_bessel_i;
52  // Derivative of the above function using simple Bessel function identities
53  fjac(0,0) = 0.5*(cyl_bessel_i(0,x[0]) + cyl_bessel_i(2,x[0])) - R*cyl_bessel_i(1,x[0]);
54  return 0;
55  }
56 };
57 
58 }// end of namespace
59 
60 #endif
A functor object to work with Eigen&#39;s non-linear solver to numerically solve for the kappa parameter ...
Definition: vonMisesKappaFunctor.hpp:20
vonMisesKappaFunctor(float Rin)
Constructor.
Definition: vonMisesKappaFunctor.hpp:27
Namespace containing the canopy library for random forest models.
Definition: circularRegressor.hpp:13
int df(const Eigen::VectorXd &x, Eigen::MatrixXd &fjac) const
Calculates the value of the derivative of the function to be solved.
Definition: vonMisesKappaFunctor.hpp:49
int operator()(const Eigen::VectorXd &x, Eigen::VectorXd &fvec) const
Calculates the value of the function to be solved.
Definition: vonMisesKappaFunctor.hpp:35
float R
R parameter of the problem (magnitude of the resultant vector)
Definition: vonMisesKappaFunctor.hpp:22