1#ifndef __JMATHTOOLKIT__
2#define __JMATHTOOLKIT__
30namespace JPP {
using namespace JMATH; }
43 inline long long int factorial(
const long long int n)
63 inline long long int factorial(
const long long int n,
const long long int m)
65 if (n < 0 || m < 0 || n < m) {
86 template<
class JFirst_t,
class JSecond_t>
87 inline bool equals(
const JFirst_t& first,
88 const JSecond_t& second,
89 const double precision = std::numeric_limits<double>::min())
91 return first.equals(second, precision);
102 template<
class JFirst_t,
class JSecond_t>
104 const JSecond_t& second)
106 return first.getDistanceSquared(second);
117 template<
class JFirst_t,
class JSecond_t>
119 const JSecond_t& second)
121 return first.getDistance(second);
132 template<
class JFirst_t,
class JSecond_t>
133 inline double getDot(
const JFirst_t& first,
134 const JSecond_t& second)
136 return first.getDot(second);
147 template<
class JFirst_t,
class JSecond_t>
149 const JSecond_t& second)
151 const double dot =
getDot(first,second);
155 else if (dot <= -1.0)
158 return acos(dot) * 180.0 / acos(-1.0);
169 template<
class JFirst_t,
class JSecond_t>
171 const JSecond_t& second)
173 return first.getPerpDot(second);
188 return T().getCross(first, second);
202 const size_t k = kernel.size();
203 const size_t n = input .size() - k + 1;
207 for (
size_t i = 0; i != n; ++i) {
208 for (
size_t j = 0; j != k; ++j) {
209 out[i] += input[i + j] * kernel[k - j - 1];
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition of zero value for any class.
Exception for accessing a value in a collection that is outside of its range.
Auxiliary classes and methods for mathematical operations.
double getDistanceSquared(const JFirst_t &first, const JSecond_t &second)
Get square of distance between objects.
double getAngle(const JFirst_t &first, const JSecond_t &second)
Get space angle between objects.
T getCross(const T &first, const T &second)
Get cross product of objects.
long long int factorial(const long long int n)
Determine factorial.
double getPerpDot(const JFirst_t &first, const JSecond_t &second)
Get perpendicular dot product of objects.
std::vector< T > convolve(const std::vector< T > &input, const std::vector< T > &kernel)
Convolute data with given kernel.
double getDot(const JFirst_t &first, const JSecond_t &second)
Get dot product of objects.
bool equals(const JFirst_t &first, const JSecond_t &second, const double precision=std::numeric_limits< double >::min())
Check equality.
double getDistance(const JFirst_t &first, const JSecond_t &second)
Get distance between objects.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).