FUNCTION
Multiplication
Computes the product of two permutations.
Interface
#include <codecogs/maths/combinatorics/permutations/multiplication.h>
using namespace Maths::Combinatorics::Permutations;
If and
are permutations, given by
(1)
and
(2)
then the product is calculated using the following formula
(3)
This function returns the result of the multiplication as a C++ vector object.
Returns
the product of the two permutations, stored 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
This function's source code is only visible to registered users — documentation and the calculator above are free to use either way. Sign in to see it.