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.62
sub units 0.19
+
0

Inverse Large

Calculates the inverse of the given permutation.
Controller: CodeCogs

Dependents

Info

Interface

C++

Inverse Large

 
std::vector<int>inverse_largeintn
int*p )
The inverse of a permutation

is a permutation \inline  \tau such that

where \inline  \sigma \circ \tau represents multiplication. This function is similar to the Maths/Combinatorics/Permutations/Inverse component, with the benefit that it is more suited for permutations of larger size.

Example:

#include <codecogs/maths/combinatorics/permutations/inverse_large.h>
#include <iostream>
int main()
{
  int sigma[5] = {3, 1, 2, 5, 4};
  std::vector<int> result = Maths::Combinatorics::Permutations::inverse_large(5, sigma);
  std::cout << "The inverse of the Sigma permutation is: ";
  std::cout << std::endl;
  for (int i = 0; i < 5; i++)
    std::cout << result[i] << " ";
  std::cout << std::endl;
  return 0;
}

Output:

The inverse of the Sigma permutation is:
2 3 1 5 4

References:

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

Returns

the inverse of the given permutation p

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.