1 #ifndef __JMATH__JMATH__
2 #define __JMATH__JMATH__
22 namespace JPP {
using namespace JMATH; }
41 inline T
pow(
const T&
x,
const double y);
97 inline T
pow(
const T&
x,
const double y)
108 template<
class JFirst_t,
class JSecond_t = JNullType>
156 return T(
object).negate();
169 return object.add(value);
182 return object.sub(value);
195 return object.mul(factor);
208 return object.div(factor);
221 return T(first).add(second);
234 return T(first).sub(second);
245 friend T
operator*(
const T&
object,
const double factor)
247 return T(
object).mul(factor);
258 friend T
operator*(
const double factor,
const T&
object)
260 return T(
object).mul(factor);
271 friend T
operator/(
const T&
object,
const double factor)
273 return T(
object).div(factor);
285 return (
static_cast<T&
>(*
this) = T().
mul(
static_cast<const T&
>(*
this),
object));
311 return T().mul(first, second);
325 static_cast<T*
>(
this)->
mul(1.0 - alpha);
326 static_cast<T*
>(
this)->add(T(
object).mul(alpha));
328 return static_cast<T&
>(*this);
345 template<
class JFirst_t,
class JSecond_t>
354 JFirst_t&
mul(
const JSecond_t&
object)
356 return static_cast<JFirst_t&
>(*this) = JFirst_t().mul(
static_cast<const JFirst_t&
>(*
this),
object);
367 friend JFirst_t&
operator*=(JFirst_t& first,
const JSecond_t& second)
369 return first.mul(second);
380 friend JFirst_t
operator*(
const JFirst_t& first,
const JSecond_t& second)
382 return JFirst_t(first).mul(second);
401 return T(first).interpolate(second, alpha);
408 template<
class JValue_t>
430 for (T i = __begin; i != __end; ++i) {
442 this->
value = getZero<JValue_t>();
452 operator JValue_t ()
const
469 this->value +=
value;
494 typename std::iterator_traits<T>::value_type
getAverage(T __begin, T __end)
496 typedef typename std::iterator_traits<T>::value_type value_type;
508 template<
class JValue_t,
size_t N>
511 typedef JValue_t value_type;
523 template<
class JElement_t,
class JAllocator_t>
539 typename std::iterator_traits<T>::value_type
getAverage(T __begin, T __end,
typename std::iterator_traits<T>::value_type value)
544 catch(
const std::exception&) {
557 template<
class JValue_t,
size_t N>
563 catch(
const std::exception&) {
576 template<
class JElement_t,
class JAllocator_t>
582 catch(
const std::exception&) {
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Auxiliary methods to convert data members or return values of member methods of a set of objects to a...
Definition of zero value for any class.
Data structure for unit quaternion in three dimensions.
Exception for division by zero.
Auxiliary classes and methods for 3D geometrical objects and operations.
Auxiliary classes and methods for mathematical operations.
T getZero()
Get zero value for a given data type.
JElement_t getAverage(const array_type< JElement_t, JAllocator_t > &buffer, typename JLANG::JClass< JElement_t >::argument_type value)
Get average.
T interpolate(const T &first, const T &second, const double alpha)
Interpolation between objects.
T pow(const T &x, const double y)
Power .
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary template class for type bool.
Template for generic class types.
JArgument< T >::argument_type argument_type
Auxiliary class for no type definition.
Auxiliary data structure for return type of make methods.
Auxiliary class to determine average of set of values.
void put(const JValue_t &value, const double w=1.0)
Put value.
JAverage(T __begin, T __end)
Constructor.
JAverage()
Default constructor.
friend T & operator/=(T &object, const double factor)
Scale object.
friend T & operator-=(T &object, const T &value)
Subtract object.
friend T operator+(const T &first, const T &second)
Add objects.
friend T operator/(const T &object, const double factor)
Scale object.
friend T operator*(const double factor, const T &object)
Scale object.
friend T operator*(const T &first, const T &second)
Multiply objects.
friend T operator*(const T &object, const double factor)
Scale object.
friend T & operator*=(T &first, const T &second)
Multiply with object.
friend T & operator+=(T &object, const T &value)
Add object.
T & interpolate(const T &object, const double alpha)
Interpolation between objects.
friend T operator-(const T &first, const T &second)
Subtract objects.
friend T operator+(const T &object)
Affirm operator.
friend T operator-(const T &object)
Negate operator.
T & mul(const T &object)
Multiply with object.
friend T & operator*=(T &object, const double factor)
Scale object.
Auxiliary class to hide data type specific methods.
static T pow(const T &x, const double y, const JLANG::JBool< true > option)
Power .
static T pow(const T &x, const double y, const JLANG::JBool< false > option)
Power .
Auxiliary base class for aritmetic operations of derived class types.
friend JFirst_t operator*(const JFirst_t &first, const JSecond_t &second)
Multiply objects.
friend JFirst_t & operator*=(JFirst_t &first, const JSecond_t &second)
Multiply with object.
JFirst_t & mul(const JSecond_t &object)
Multiply with object.