Auxiliary class to convert pair of indices to unique index and back.
More...
#include <JCombinatorics.hh>
Auxiliary class to convert pair of indices to unique index and back.
Definition at line 22 of file JCombinatorics.hh.
JTOOLS::JCombinatorics::JCombinatorics |
( |
| ) |
|
|
inline |
JTOOLS::JCombinatorics::JCombinatorics |
( |
const int |
numberOfIndices | ) |
|
|
inline |
Constructor.
- Parameters
-
numberOfIndices | number of indices |
Definition at line 43 of file JCombinatorics.hh.
const JCombinatorics& JTOOLS::JCombinatorics::getCombinatorics |
( |
| ) |
const |
|
inline |
void JTOOLS::JCombinatorics::configure |
( |
const int |
numberOfIndices | ) |
|
|
inline |
Configure.
- Parameters
-
numberOfIndices | number of indices |
Definition at line 65 of file JCombinatorics.hh.
69 zbuf2D.resize(numberOfIndices);
71 for (
int i = 0;
i != numberOfIndices; ++
i) {
72 zbuf2D[
i].resize(numberOfIndices);
75 for (
int i = 0;
i != numberOfIndices; ++
i) {
79 for (
int j =
i; ++
j != numberOfIndices; ) {
size_t JTOOLS::JCombinatorics::getNumberOfIndices |
( |
| ) |
const |
|
inline |
Get number of indices.
- Returns
- number of indices
Definition at line 95 of file JCombinatorics.hh.
size_t JTOOLS::JCombinatorics::getNumberOfPairs |
( |
| ) |
const |
|
inline |
int JTOOLS::JCombinatorics::getIndex |
( |
const int |
first, |
|
|
const int |
second |
|
) |
| const |
|
inline |
Get index of pair of indices.
- Parameters
-
first | first address |
second | second address |
- Returns
- index (-1 if first and second address are equal)
Definition at line 119 of file JCombinatorics.hh.
then echo The file $DIR KM3NeT_00000001_00000000 root already please rename or remove it first
const pair_type& JTOOLS::JCombinatorics::getPair |
( |
const int |
index | ) |
const |
|
inline |
Get pair of indices for given index.
- Parameters
-
- Returns
- pair of indices
Definition at line 131 of file JCombinatorics.hh.
template<class JComparator_t >
void JTOOLS::JCombinatorics::sort |
( |
JComparator_t |
comparator | ) |
|
|
inline |
Sort address pairs.
- Parameters
-
comparator | comparator for pairs |
Definition at line 143 of file JCombinatorics.hh.
145 std::stable_sort(
zbuf1D.begin(),
zbuf1D.end(), comparator);
147 for (
int i = 0;
i != (int)
zbuf1D.size(); ++
i) {
151 zbuf2D[pair.first][pair.second] =
i;
152 zbuf2D[pair.second][pair.first] =
i;
155 for (
int i = 0;
i != (int)
zbuf2D.size(); ++
i) {
static int JTOOLS::JCombinatorics::getSign |
( |
const int |
first, |
|
|
const int |
second |
|
) |
| |
|
inlinestatic |
Sign of pair of indices.
- Parameters
-
first | first address |
second | second address |
- Returns
- +1 if second >= first; else -1
Definition at line 168 of file JCombinatorics.hh.
170 return (second >=
first ? +1 : -1);
then echo The file $DIR KM3NeT_00000001_00000000 root already please rename or remove it first
static int JTOOLS::JCombinatorics::getSign |
( |
const pair_type & |
pair | ) |
|
|
inlinestatic |
Sign of pair of indices.
- Parameters
-
- Returns
- +1 if second >= first; else -1
Definition at line 180 of file JCombinatorics.hh.
182 return getSign(pair.first, pair.second);
The documentation for this class was generated from the following file: