I have forgotten
my Password

Or login with:

  • Facebookhttp://facebook.com/
  • Googlehttps://www.google.com/accounts/o8/id
  • Yahoohttps://me.yahoo.com
get GPL
COST (GBP)
this unit 0.37
sub units 0.80
+
0

Rank

Computes the rank of the given permutation, as generated by Permutation Class 2.
Controller: CodeCogs

get GPL add to cart

Dependents

Info

Interface

C++
HTML

Rank

 
intrankintn
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 n!. 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: 5

References:

SUBSET, a C++ library of combinatorial routines, http://www.csit.fsu.edu/~burkardt/cpp_src/subset/subset.html

Parameters

nthe size of the permutation
pthe 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.