ppforest2 v0.1.0
Projection Pursuit Decision Trees and Random Forests
Loading...
Searching...
No Matches
ppforest2::math Namespace Reference

Numeric comparison utilities. More...

Functions

template<typename T>
bool collinear (types::Vector< T > const &a, types::Vector< T > const &b)
 Check whether two vectors are collinear (parallel or anti-parallel).
 
template<typename A, typename B>
bool is_approx (A a, B b)
 Overload using the default APPROX_THRESHOLD.
 
template<typename A, typename B, typename T>
bool is_approx (A a, B b, T threshold)
 Check whether two scalars are approximately equal.
 
template<typename A, typename B>
bool is_module_approx (A a, B b)
 Check whether the absolute values of two scalars are approximately equal.
 

Detailed Description

Numeric comparison utilities.

Function Documentation

◆ collinear()

template<typename T>
bool ppforest2::math::collinear ( types::Vector< T > const & a,
types::Vector< T > const & b )

Check whether two vectors are collinear (parallel or anti-parallel).

Parameters
aFirst vector.
bSecond vector (same dimension as a).
Returns
True if |cos(angle)| ≈ 1.

◆ is_approx() [1/2]

template<typename A, typename B>
bool ppforest2::math::is_approx ( A a,
B b )
inline

Overload using the default APPROX_THRESHOLD.

◆ is_approx() [2/2]

template<typename A, typename B, typename T>
bool ppforest2::math::is_approx ( A a,
B b,
T threshold )
inline

Check whether two scalars are approximately equal.

Parameters
aFirst value.
bSecond value.
thresholdMaximum allowed absolute difference.
Returns
True if |a − b| < threshold.

◆ is_module_approx()

template<typename A, typename B>
bool ppforest2::math::is_module_approx ( A a,
B b )
inline

Check whether the absolute values of two scalars are approximately equal.