def is_perm

bendtorch@1.3.0.0 · tensor.bend:491

import bendtorch@1.3.0.0/tensor.bend as Tensor
import Base

491# p is a permutation of the axes of a rank-n tensor
492def is_perm(+p: List<&2, Nat>, +n: Nat) -> Bool:
493  # bend-lint: disable-next bend-lint-rules/performance/eager_branch -- a shape predicate over a list of rank <= 4, once per operation; the types and LAWS.bend read its Bool form not-expected-because: a match would change the definition the proofs reduce, for no measurable gain
494  Bool.and(Nat.is_eq(List.length(&2, Nat, p), n), all_once(n, p, 0n))

Uses (7)

Used by (1)