Example program to test permutations (JTOOLS::next_permutation).
More...
#include <string>
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <algorithm>
#include "JTools/JPermutation.hh"
#include "JMath/JMathToolkit.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 permutations (JTOOLS::next_permutation).
- Author
- mdejong
Definition in file JPermutation.cc.
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 22 of file JPermutation.cc.
32 JParser<> zap(
"Example program to test permutations.");
40 catch(
const exception &error) {
41 FATAL(error.what() << endl);
50 if (
N > buffer.size()) {
51 FATAL(
"Number of elements " <<
N <<
" > " << buffer.size() << endl);
54 sort(buffer.begin(), buffer.end(), less<int>());
68 DEBUG(
'[' << setw(3) <<
n <<
']');
71 DEBUG(
' ' << setw(3) << *i);
77 data.rbegin()->insert(*i);
83 DEBUG(
' ' << setw(3) << *i);
91 for (
vector<
set<int> >::const_iterator p = data.begin(); p != data.end(); ++p) {
92 for (
vector<
set<int> >::const_iterator q = p; ++q != data.end(); ) {
98 NOTICE(
"number of permutations " <<
n <<
' ' <<
factorial(buffer.size(),
N) << endl);
Utility class to parse command line options.
long long int factorial(const long long int n)
Determine factorial.
#define ASSERT(A,...)
Assert macro.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
counter_type advance(counter_type &counter, const counter_type value, const counter_type limit=std::numeric_limits< counter_type >::max())
Advance counter.
alias put_queue eval echo n
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
then usage $script[input file[working directory[option]]] nWhere option can be N