kpermute

LongPermutation

Bijection on [0, size), or on all 64-bit values when size == -1L. size is read as unsigned. decode is the exact inverse of encode.

Not cryptographic. Construct with longPermutation.

Inheritors

Properties

size

abstract val size: Long(source)

Domain size, read as unsigned; -1L means all 64-bit values.

Functions

decode

open fun decode(encoded: Long): Long(source)

Inverse of encode; throws if encoded is outside the domain.

decodeUnchecked

abstract fun decodeUnchecked(encoded: Long): Long(source)

decode without range checks. Out-of-domain input is unspecified and may not terminate.

encode

open fun encode(value: Long): Long(source)

Maps value to its permuted position; throws if value is outside the domain.

encodeUnchecked

abstract fun encodeUnchecked(value: Long): Long(source)

encode without range checks. Out-of-domain input is unspecified and may not terminate.

iterator

open operator override fun iterator(): LongIterator(source)

Iterates encode(i) over the whole domain in index order.


abstract fun iterator(offset: Long): LongIterator(source)

Iterates encode(i) for unsigned indices i from offset, which must be in 0..size.

Link copied to clipboard

Returns a view of this permutation shifted onto range, which must hold exactly LongPermutation.size values. On an existing range view, replaces its range.