Perm

class Perm extends Int => Int

Represents a permutation encoded as a map from preimages to images, including only pairs that are moved by the permutation (so the identity is Map.empty).

Note that although the preimage and image contain only moved points, the domain and range of a Perm is all integers. This acts as the identity for integers not in the image.

Companion
object
trait Int => Int
class Object
trait Matchable
class Any

Value members

Concrete methods

def andThen(that: Perm): Perm

Compose this with another Perm with this permutation applied first.

Compose this with another Perm with this permutation applied first.

override
def apply(k: Int): Int

Apply this permutation to an Int.

Apply this permutation to an Int.

Definition Classes
Function1
def apply(n0: Int, n1: Int, ns: Int*): Perm

A Perm constructed by cycling args so each n,,i,, maps to n,,i+1,,.

A Perm constructed by cycling args so each n,,i,, maps to n,,i+1,,.

This new cycle is composed with the current permutation to yield a new Perm. Cycles provided to this constructor must be disjoint. See Perm$.apply.

def compose(that: Perm): Perm

Compose this with another Perm with this permutation applied last.

Compose this with another Perm with this permutation applied last.

def image: Set[Int]

The set of points moved by this permutation (equivalent to preimage).

The set of points moved by this permutation (equivalent to preimage).

The inverse permutation, which composes with this to yield the identity. Note that this uses a lazy inverse map, so the first call may be O(n) rather than O(1).

The inverse permutation, which composes with this to yield the identity. Note that this uses a lazy inverse map, so the first call may be O(n) rather than O(1).

def invert(k: Int): Int

The preimage of k (so that apply(invert(k)) == k).

The preimage of k (so that apply(invert(k)) == k).

def permute[A, SA](seq: SeqOps[A, Seq, SA])(implicit cbf: Factory[A, SA]): Opt[SA]

Permute a seq as long as all the moved points are valid indices.

Permute a seq as long as all the moved points are valid indices.

override
def toString: String
Definition Classes
Function1 -> Any

Inherited methods

@unspecialized
def andThen[A](g: Int => A): Int => A
Inherited from
Function1
@unspecialized
def compose[A](g: A => Int): A => Int
Inherited from
Function1