>> << Ndx Usr Pri Phr Dic Rel Voc !: wd Help User

# parts: partition functions

Partitions are typically given by a boolean with 1's marking the beginning or end of each partition. Partitions are also sometimes given in terms of the lengths of each partition.

Verbs defined here assume that boolean 1's mark the beginning of each partition - see comments at the end for examples of end-partition verbs.

The verbs psum and psumscan illustrate definitions appropriate for verbs that return scalar or non-scalar results, respectively. utility used to build non-scalar partition functions:

Examples:

      1 0 0 1 0 0 0 = firstones 1 1 0 1 1 1 0
      0 0 1 0 1 = lastones 1 1 1 0 1
      2 3 1 = lfp 1 0 1 0 0 1
      1 1 0 1 0 0 1 = partition 1 9 9 4 4 4 9
      0 0 0 1 2 2 3 = runindices 3 1 2 1
      1 2 3 1 = runlengths 1 9 9 4 4 4 9

      x=. 1 0 1 0 0 [ y=. 5 3 2 2 7

      3 5 7 2 2 = x preverse y
      3 5 2 2 7 = x psort y
      8 11 = x psum y
      5 8 2 4 11 = x psumscan y

Name | Type | Description
firstones | verb | first 1's in partition
lastones | verb | last 1's in partition
lfp | verb | lengths from partition
partition | verb | partition items (1 marks new item)
pfl | verb | partition from lengths
preverse | verb | partioned reverse
psort | verb | partioned sort
psum | verb | partioned sum
psumscan | verb | partioned sumscan
runindices | verb | indices from run lengths
runlengths | verb | lengths of each run

firstones

    first 1's in partition
    form: firstones part

lastones

    last 1's in partition
    form: lastones part

lfp

    lengths from partition
    form: lfp part

partition

    partition items (1 marks new item)
    form: partition dat
    partition=: 1: , }. ~: }:

pfl

    partition from lengths
    form: pfl len

preverse

    partioned reverse
    form: part preverse dat

psort

    partioned sort
    form: part psort dat

psum

    partioned sum
    form: part psum dat

psumscan

    partioned sumscan
    form: part psumscan dat

runindices

    indices from run lengths
    form: runindices

runlengths

    lengths of each run
    form: runlengths dat

>> << Ndx Usr Pri Phr Dic Rel Voc !: wd Help User