rivet is hosted by Hepforge, IPPP Durham
Rivet 4.0.0
Container-combinatorics utils

Functions

template<typename CONTAINER , typename FN = double(const typename std::decay_t<CONTAINER>::value_type&), typename = isCIterable<CONTAINER>>
int Rivet::closestMatchIndex (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&, const typename std::decay_t<CONTAINER2>::value_type&), typename = isCIterable<CONTAINER1, CONTAINER2>>
pair< int, int > Rivet::closestMatchIndices (CONTAINER1 &&c1, 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&, const std::decay_t<T>&), typename = isCIterable<CONTAINER>>
int Rivet::closestMatchIndex (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 (T &&x, 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&, const std::decay_t<T>&), typename = isCIterable<CONTAINER>>
int Rivet::closestMatchIndex ( 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 Rivet::closestMatchIndices().

◆ closestMatchIndex() [2/3]

template<typename CONTAINER , typename FN = double(const typename std::decay_t<CONTAINER>::value_type&), typename = isCIterable<CONTAINER>>
int Rivet::closestMatchIndex ( 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 Rivet::DBL_NAN.

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

◆ closestMatchIndex() [3/3]

template<typename CONTAINER , typename T , typename FN , typename = isCIterable<CONTAINER>>
int Rivet::closestMatchIndex ( T &&  x,
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 Rivet::closestMatchIndex().

◆ closestMatchIndices()

template<typename CONTAINER1 , typename CONTAINER2 , typename FN = double(const typename std::decay_t<CONTAINER1>::value_type&, const typename std::decay_t<CONTAINER2>::value_type&), typename = isCIterable<CONTAINER1, CONTAINER2>>
pair< int, int > Rivet::closestMatchIndices ( CONTAINER1 &&  c1,
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 Rivet::DBL_NAN.

Referenced by Rivet::closestMassIndices(), and Rivet::closestMatchIndex().