Multiplication
Computes the product of two permutations.
Controller: CodeCogs
Dependents
Interface
C++
Multiplication
std::vector<int>multiplication( | int | n | |
int* | p1 | ||
int* | p2 | ) |
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.htmlReturns
- 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.