Using the Permutation class
This tutorial provides an overview of the Permutation class and demonstrates how to create, manipulate, and perform operations with permutation objects. For more advanced usage and additional features, please refer to the Permutation class API in permutation.hpp.
Creating Permutation Operator: You can create a permutation operator using one of the available constructors. For example:
Permutation<int> perm; // Creates an empty permutation operator Permutation<double> randPerm = Permutation<double>::RandPerm(5); // Creates a random permutation operator of size 5
Accessing Permutation Operator Properties: The Permutation class provides methods to access properties of permutation operators, such as dimension, permutation vector, and scaling vector:
Long dimension = randPerm.Dim(); // Get the dimension of the permutation operator Vector<Long> permutationVector = randPerm.perm; // Get the permutation vector Vector<double> scalingVector = randPerm.scal; // Get the scaling vector
Performing Operations: You can perform various operations with permutation operator, including scalar multiplication, and transposition:
randPerm *= 2.0; // Multiply the permutation operator by a scalar value randPerm.Transpose(); // Compute the transpose of the permutation operator
Using Operators: The Permutation class overloads operators to facilitate operations with matrices and other permutation objects:
Permutation<double> result = randPerm * anotherPermutationOperator; // Multiply two permutation operators Matrix<double> transformedMatrix = randPerm * someMatrix; // Multiply a matrix by the permutation operator