CodeCogs
HomeForumsCart
Login



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

Multiplication

Computes the product of two permutations.
Controller: CodeCogs

Dependents

Info

Interface

C++

Multiplication

 
std::vector<int>multiplicationintn
int*p1
int*p2 )
If \inline  \sigma and \inline  \tau are permutations, given by

and

then the product \inline  \sigma \circ \tau is calculated using the following formula

This function returns the result of the multiplication as a C++ vector object.

Example:

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

Output:

The multiplication of Sigma and Tau is:
1 2 3 4 5
This proves one is the inverse of the other.

References:

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

Returns

the product of the two permutations, stored as a C++ vector object

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.


Last Modified: 18 Oct 07 @ 17:07     Page Rendered: 2022-03-14 15:18:38