Rivet API documentation

Rivet 4.1.3
Container-combinatorics utils

Functions

template<typename CONTAINER, typename FN = double(const typename std::decay_t<CONTAINER>::value_type::ParticleBase&), typename = isCIterable<CONTAINER>>
int Rivet::closestMatchIndex (const CONTAINER &c, FN &&fn, double target, double minval=-DBL_MAX, double maxval=DBL_MAX)
 Return the index from a vector which best matches fn(c[i]) to the target value.
template<typename CONTAINER1, typename CONTAINER2, typename FN = double(const typename std::decay_t<CONTAINER1>::value_type::ParticleBase&, const typename std::decay_t<CONTAINER2>::value_type::ParticleBase&), typename = isCIterable<CONTAINER1, CONTAINER2>>
pair< int, int > Rivet::closestMatchIndices (const CONTAINER1 &c1, const CONTAINER2 &c2, FN &&fn, double target, double minval=-DBL_MAX, double maxval=DBL_MAX)
 Return the indices from two vectors which best match fn(c1[i], c2[j]) to the target value.
template<typename CONTAINER, typename T, typename FN = double(const typename std::decay_t<CONTAINER>::value_type::ParticleBase&, const std::decay_t<T>&), typename = isCIterable<CONTAINER>>
int Rivet::closestMatchIndex (const CONTAINER &c, const T &x, FN &&fn, double target, double minval=-DBL_MAX, double maxval=DBL_MAX)
 Return the index from a vector which best matches fn(c[i], x) to the target value.
template<typename CONTAINER, typename T, typename FN, typename = isCIterable<CONTAINER>>
int Rivet::closestMatchIndex (const T &x, const CONTAINER &c, FN &&fn, double target, double minval=-DBL_MAX, double maxval=DBL_MAX)
 Return the index from a vector which best matches fn(x, c[j]) to the target value.

Detailed Description

Function Documentation

◆ closestMatchIndex() [1/3]

template<typename CONTAINER, typename T, typename FN = double(const typename std::decay_t<CONTAINER>::value_type::ParticleBase&, const std::decay_t<T>&), typename = isCIterable<CONTAINER>>
int Rivet::closestMatchIndex ( const CONTAINER & c,
const T & x,
FN && fn,
double target,
double minval = -DBL_MAX,
double maxval = DBL_MAX )
inline

Return the index from a vector which best matches fn(c[i], x) to the target value.

A NaN return from the function will be counted as a no-match, as will combinations giving a value outside the given minval .. maxval range. A -1 index is returned in the case that no valid match is found.

Note
No attempt is made to avoid duplication: the inputs are assumed independent and the user should check the sanity of the result, e.g. c[i] and x are not the same object.

References closestMatchIndices().

◆ closestMatchIndex() [2/3]

template<typename CONTAINER, typename FN = double(const typename std::decay_t<CONTAINER>::value_type::ParticleBase&), typename = isCIterable<CONTAINER>>
int Rivet::closestMatchIndex ( const CONTAINER & c,
FN && fn,
double target,
double minval = -DBL_MAX,
double maxval = DBL_MAX )
inline

Return the index from a vector which best matches fn(c[i]) to the target value.

A NaN return from the function will be counted as a no-match, as will combinations giving a value outside the given minval .. maxval range. A -1 index is returned in the case that no valid match is found.

References DBL_NAN.

Referenced by closestMassIndex(), closestMassIndex(), closestMassIndex(), and closestMatchIndex().

◆ closestMatchIndex() [3/3]

template<typename CONTAINER, typename T, typename FN, typename = isCIterable<CONTAINER>>
int Rivet::closestMatchIndex ( const T & x,
const CONTAINER & c,
FN && fn,
double target,
double minval = -DBL_MAX,
double maxval = DBL_MAX )
inline

Return the index from a vector which best matches fn(x, c[j]) to the target value.

A NaN return from the function will be counted as a no-match, as will combinations giving a value outside the given minval .. maxval range. A -1 index is returned in the case that no valid match is found.

Note
No attempt is made to avoid duplication: the inputs are assumed independent and the user should check the sanity of the result, e.g. c[i] and x are not the same object.

References closestMatchIndex().

◆ closestMatchIndices()

template<typename CONTAINER1, typename CONTAINER2, typename FN = double(const typename std::decay_t<CONTAINER1>::value_type::ParticleBase&, const typename std::decay_t<CONTAINER2>::value_type::ParticleBase&), typename = isCIterable<CONTAINER1, CONTAINER2>>
pair< int, int > Rivet::closestMatchIndices ( const CONTAINER1 & c1,
const CONTAINER2 & c2,
FN && fn,
double target,
double minval = -DBL_MAX,
double maxval = DBL_MAX )
inline

Return the indices from two vectors which best match fn(c1[i], c2[j]) to the target value.

A NaN return from the function will be counted as a no-match, as will combinations giving a value outside the given minval .. maxval range. A {-1,-1} pair is returned in the case that no valid match is found.

Note
No attempt is made to avoid duplication: the input lists are assumed independent and the user should check the sanity of the result, e.g. c1[i] and c2[j] are not the same object.

References DBL_NAN.

Referenced by closestMassIndices(), and closestMatchIndex().