1#ifndef __JMATHTOOLKIT__
2#define __JMATHTOOLKIT__
30namespace JPP {
using namespace JMATH; }
42 template<
class JFirst_t,
class JSecond_t>
43 inline bool equals(
const JFirst_t& first,
44 const JSecond_t& second,
45 const double precision = std::numeric_limits<double>::min())
47 return first.equals(second, precision);
58 template<
class JFirst_t,
class JSecond_t>
60 const JSecond_t& second)
62 return first.getDistanceSquared(second);
73 template<
class JFirst_t,
class JSecond_t>
75 const JSecond_t& second)
77 return first.getDistance(second);
88 template<
class JFirst_t,
class JSecond_t>
89 inline double getDot(
const JFirst_t& first,
90 const JSecond_t& second)
92 return first.getDot(second);
103 template<
class JFirst_t,
class JSecond_t>
105 const JSecond_t& second)
107 const double dot =
getDot(first,second);
111 else if (dot <= -1.0)
114 return acos(dot) * 180.0 /
PI;
125 template<
class JFirst_t,
class JSecond_t>
127 const JSecond_t& second)
129 return first.getPerpDot(second);
144 return T().getCross(first, second);
158 const size_t k = kernel.size();
159 const size_t n = input .size() - k + 1;
163 for (
size_t i = 0; i != n; ++i) {
164 for (
size_t j = 0; j != k; ++j) {
165 out[i] += input[i + j] * kernel[k - j - 1];
Definition of zero value for any class.
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.
static const double PI
Mathematical constants.
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).