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.
◆ JCombinatorics() [1/2]
JTOOLS::JCombinatorics::JCombinatorics |
( |
| ) |
|
|
inline |
◆ JCombinatorics() [2/2]
JTOOLS::JCombinatorics::JCombinatorics |
( |
const int |
numberOfIndices | ) |
|
|
inline |
Constructor.
- Parameters
-
numberOfIndices | number of indices |
Definition at line 78 of file JCombinatorics.hh.
◆ getCombinatorics()
const JCombinatorics& JTOOLS::JCombinatorics::getCombinatorics |
( |
| ) |
const |
|
inline |
◆ configure()
void JTOOLS::JCombinatorics::configure |
( |
const int |
numberOfIndices | ) |
|
|
inline |
Configure.
- Parameters
-
numberOfIndices | number of indices |
Definition at line 100 of file JCombinatorics.hh.
104 zbuf2D.resize(numberOfIndices);
106 for (
int i = 0; i != numberOfIndices; ++i) {
107 zbuf2D[i].resize(numberOfIndices);
110 for (
int i = 0; i != numberOfIndices; ++i) {
114 for (
int j = i; ++
j != numberOfIndices; ) {
JCombinatorics::pair_type pair_type
◆ getNumberOfIndices()
size_t JTOOLS::JCombinatorics::getNumberOfIndices |
( |
| ) |
const |
|
inline |
◆ getNumberOfPairs()
size_t JTOOLS::JCombinatorics::getNumberOfPairs |
( |
| ) |
const |
|
inline |
◆ getIndex() [1/2]
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 154 of file JCombinatorics.hh.
156 return zbuf2D[first][second];
◆ getIndex() [2/2]
int JTOOLS::JCombinatorics::getIndex |
( |
const pair_type & |
pair | ) |
const |
|
inline |
Get index of pair.
- Parameters
-
- Returns
- index (-1 if first and second address are equal)
Definition at line 166 of file JCombinatorics.hh.
168 return getIndex(pair.first, pair.second);
◆ getPair()
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 178 of file JCombinatorics.hh.
◆ sort()
template<class JComparator_t >
void JTOOLS::JCombinatorics::sort |
( |
JComparator_t |
comparator | ) |
|
|
inline |
Sort address pairs.
- Parameters
-
comparator | comparator for pairs |
Definition at line 190 of file JCombinatorics.hh.
192 std::stable_sort(
zbuf1D.begin(),
zbuf1D.end(), comparator);
194 for (
int i = 0; i != (int)
zbuf1D.size(); ++i) {
198 zbuf2D[pair.first][pair.second] = i;
199 zbuf2D[pair.second][pair.first] = i;
202 for (
int i = 0; i != (int)
zbuf2D.size(); ++i) {
◆ getSign() [1/2]
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 215 of file JCombinatorics.hh.
217 return (second >= first ? +1 : -1);
◆ getSign() [2/2]
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 227 of file JCombinatorics.hh.
229 return getSign(pair.first, pair.second);
◆ zbuf1D
◆ zbuf2D
The documentation for this class was generated from the following file: