I have forgotten

• https://me.yahoo.com
COST (GBP)
0.70
0.19
0

# Multiplication

Computes the product of two permutations.
Controller: CodeCogs

C++

## Multiplication

 std::vectormultiplication( int n int* p1 int* p2 )
If  and  are permutations, given by



and



then the product  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.