1#ifndef __JMATHTOOLKIT__
2#define __JMATHTOOLKIT__
29namespace JPP {
using namespace JMATH; }
41 template<
class JFirst_t,
class JSecond_t>
42 inline bool equals(
const JFirst_t& first,
43 const JSecond_t& second,
44 const double precision = std::numeric_limits<double>::min())
46 return first.equals(second, precision);
57 template<
class JFirst_t,
class JSecond_t>
59 const JSecond_t& second)
61 return first.getDistanceSquared(second);
72 template<
class JFirst_t,
class JSecond_t>
74 const JSecond_t& second)
76 return first.getDistance(second);
87 template<
class JFirst_t,
class JSecond_t>
88 inline double getDot(
const JFirst_t& first,
89 const JSecond_t& second)
91 return first.getDot(second);
102 template<
class JFirst_t,
class JSecond_t>
104 const JSecond_t& second)
106 const double dot =
getDot(first,second);
110 else if (dot <= -1.0)
113 return acos(dot) * 180.0 / acos(-1.0);
124 template<
class JFirst_t,
class JSecond_t>
126 const JSecond_t& second)
128 return first.getPerpDot(second);
143 return T().getCross(first, second);
157 const size_t k = kernel.size();
158 const size_t n = input .size() - k + 1;
162 for (
size_t i = 0; i != n; ++i) {
163 for (
size_t j = 0; j != k; ++j) {
164 out[i] += input[i + j] * kernel[k - j - 1];
Definition of zero value for any class.
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.
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).