Download code

Jump to: navigation, search

Back to Median_cut_algorithm_(J)

Download for Windows: single file, zip

Download for UNIX: single file, zip, tar.gz, tar.bz2

mediancut.ijs

 1 mediancut =: dyad : '> mean each step^:(x-1) <y'
 2 mean =: +/%#
 3 
 4 step =: monad : '(fmax y) smax y'
 5 fmax =: monad : '{:/: ; bbox each y'
 6 bbox =: monad : '(>./y)-(<./y)'
 7 sbox =: dyad  : '({&y) each chop x rank y'
 8 sfst =: dyad  : '(x sbox >{.y),(}.y)'
 9 smax =: dyad  : '(3|x) sfst (<.x%3) |. y'
10 rank =: dyad  : '/: x {"1 y'
11 chop =: monad : '(<.2%~#y) ({.;}.) y'


hijacker
hijacker
hijacker
hijacker