Permute

class pmrf.stats.bijectors.Permute(permutation: Array | list | tuple)

Bases: AbstractForwardInverseBijector, AbstractInvLogDetJacBijector, AbstractFwdLogDetJacBijector

Permutation bijector that reorders the elements of a 1D event.

Initializes a Permute bijector.

Arguments:

  • permutation: An array or list of integers representing the new order

    of the elements. Must contain all integers from 0 to N-1 exactly once.

forward_and_log_det(x: Array) → tuple[Array, Array]

Computes y = x[permutation] and log|det J(f)(x)| = 0.0.

inverse_and_log_det(y: Array) → tuple[Array, Array]

Computes x = y[inverse_permutation] and log|det J(f^{-1})(y)| = 0.0.

same_as(other: AbstractBijector) → bool

Returns True if this bijector is guaranteed to be the same as other.

inverse_permutation: Array
permutation: Array