A permutation <M>\pi=\pi_{1} \ldots \pi_{n}</M> has rank encoding
<M>p_{1} \ldots p_{n}</M> where <M> p_{i}= |\{j : j \geq i, \pi_{j} \leq \pi_{i} \} | </M>.
In other words the rank encoded permutation is a sequence of <M>p_{i}</M> with <M>1\leq i\leq n</M>, where <M>p_{i}</M>
is the rank of <M>\pi_{i}</M> in <M>\{\pi_{i},\pi_{i+1},\ldots ,\pi_{n}\}</M>.
<Cite Key="RegCloSetPerms" />
<P/>
The encoding of the permutation 3 2 5 1 6 7 4 8 9 is done as follows:
Decoding a permutation is done in a similar fashion, taking the sequence <M>p_{1} \ldots p_{n}</M>
and using the reverse process will lead to the permutation <M>\pi=\pi_{1} \ldots \pi_{n}</M>,
where <M>\pi_{i}</M> is determined by finding the number that has rank <M>p_{i}</M> in
<M>\{\pi_{i}, \pi_{i+1}, \ldots , \pi_{n}\}</M>.
<P/>
The sequence 3 2 3 1 2 2 1 1 1 is decoded as:
<ManSection>
<Func Name="RankEncoding" Arg="p"/>
<Returns>A list that represents the rank encoding of the permutation <C>p</C>. </Returns>
<Description>
Using the algorithm above <C>RankEncoding</C> turns the permutation <C>p</C> into a list
of integers.
<Example><![CDATA[
gap> RankEncoding([3, 2, 5, 1, 6, 7, 4, 8, 9]);
[ 3, 2, 3, 1, 2, 2, 1, 1, 1 ]
gap> RankEncoding([ 4, 2, 3, 5, 1 ]);
[ 4, 2, 2, 2, 1 ]
gap> ]]></Example>
</Description>
</ManSection>
<ManSection>
<Func Name="RankDecoding" Arg="e"/>
<Returns>A permutation in list form.</Returns>
<Description>
A rank encoded permutation is decoded by using the reversed process from encoding,
which is also explained above.
<ManSection>
<Func Name="SequencesToRatExp" Arg="list"/>
<Returns>A rational expression that describes all the words in <C>list</C>.</Returns>
<Description>
A list of sequences is turned into a rational expression by concatenating each sequence
and unifying all of them.
<Example><![CDATA[
gap> SequencesToRatExp([[ 1, 1, 1, 1, 1 ],[ 2, 1, 2, 2, 1 ],[ 3, 2, 1, 2, 1 ],
> [ 4, 2, 3, 2, 1 ]]);
11111U21221U32121U42321
gap> ]]></Example>
</Description>
</ManSection>
</Section>
</Chapter>
¤ Dauer der Verarbeitung: 0.9 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.