Meta.Numerics Library

## PermutationParse Method |

Converts a text representation into a permutation.

Syntax

- text
- Type: SystemString

A text representation of the permutation.

The corresponding permutation.

Exceptions

Exception | Condition |
---|---|

ArgumentNullException | text is null. |

FormatException | text is not a valid text representation of a permutation. |

Remarks

This method is able to parse both map representations and cycle representations of permutations.

A map representation of an n-dimensional permutation is a space-separated list of all integers between 0 and n-1, enclosed in square brackets. Each number indicates the index of the location to which the object that appears at that location is mapped by the permutation. For example, [2 1 0] denotes the permutation that moves the object at index 0 to index 2, does not move the object at index 1, and moves the object at index 2 to index 0. Note that the numbers in the map representation are the same as the numbers on the second line of Cauchy's two-line notation.

A cycle representation of an n-dimensional representation is a space-separated list of all integers between 0 and n-1, grouped into cycles by parenthesis. Each cycle indicates that the element at the location with the first index in the cycle is moved to the location with the second index in the cycle, the element at the location with the second index in the cycle is moved to the location with the third index in the cycle, and so on, until the element at the location with the last index is moved to the location with the first index. Thus (0 2)(1) indicates that the elements at locations 0 and 2 change places and the element at location 1 is left there. So (0 2)(1) and [2 1 0] represent the same permutation.

See Also