Rank
Computes the rank of the given permutation, as generated by Permutation Class 2.
Controller: CodeCogs
Contents
| intrank( | int | n | |
| int* | p | ) |
This function calculates at which call the Permutation Class 2 component would generate the given permutation.
The value of the rank will be between 1 and
. This function may be used with the Maths/Combinatorics/Permutations/Unrank component in order to
give a method of recognizing certain permutations only by their rank number.
Example:
#include <codecogs/maths/combinatorics/permutations/rank.h> #include <iostream> int main() { int sigma[3] = {2, 3, 1}; std::cout << "The rank of the Sigma permutation is: "; std::cout << Maths::Combinatorics::Permutations::rank(3, sigma) << std::endl; return 0; }
Output:
The rank of the Sigma permutation is: 5References:
SUBSET, a C++ library of combinatorial routines, http://www.csit.fsu.edu/~burkardt/cpp_src/subset/subset.htmlParameters
n the size of the permutation p the actual permutation stored as an array
Returns
- the rank of the given permutation, as generated by the <em> Permutation Class 2 </em> component
Authors
- Lucian Bentea (August 2005)
Source Code
Source code is available when you agree to a GP Licence or buy a Commercial Licence.
Not a member, then Register with CodeCogs. Already a Member, then Login.



0.37
