Example program to test combinatorics of pairs of indices (class JTOOLS::JCombinatorics).
More...
#include <string>
#include <iostream>
#include <iomanip>
#include "JTools/JCombinatorics.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"
Go to the source code of this file.
|
int | main (int argc, char **argv) |
|
Example program to test combinatorics of pairs of indices (class JTOOLS::JCombinatorics).
- Author
- mdejong
Definition in file JCombinatorics.cc.
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 15 of file JCombinatorics.cc.
24 JParser<> zap(
"Example program to test combinatorics of pairs of indices.");
31 catch(
const exception &error) {
32 FATAL(error.what() << endl);
38 if (numberOfElements <= 0) {
39 FATAL(
"Number of elements " << numberOfElements <<
" <= 0" << endl);
43 JCombinatorics combinatorics(numberOfElements);
47 for (
int i = 0;
i != (int) combinatorics.getNumberOfPairs(); ++
i) {
51 STATUS(
"pair[" << setw(4) <<
i <<
"] => (" << setw(3) << pair.first <<
"," << setw(3) << pair.second <<
")" << endl);
53 if (
i != combinatorics.getIndex(pair.first, pair.second)) {
58 setw(3) << pair.first <<
' ' <<
59 setw(3) << pair.second <<
' ' <<
60 setw(4) << combinatorics.getIndex(pair.first, pair.second) << endl);
65 NOTICE(
"Number of elements " << setw(8) << right << numberOfElements << endl);
66 NOTICE(
"Number of pairs " << setw(8) << right << combinatorics.getNumberOfPairs() << endl);
67 NOTICE(
"Number of errors " << setw(8) << right <<
n << endl);
Utility class to parse command line options.
#define ASSERT(A,...)
Assert macro.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
#define DEBUG(A)
Message macros.