sourcelibs/Accel/demos/axis-reduce.xtl

1⍝!/usr/bin/env xetal 2⍝ Along an axis: row sums, column sums, row maxima of a matrix, on 3⍝ Ints and on Floats; one GPU work-item per result, folding its line. 4⍝ Run with "just demo-lib Accel axis-reduce". 5ᵃᶜ⁼u̲se< "Accel" 6m ← 3 4 r̲eshape r̲ange 12 7m 8ᵃᶜr̲owSums m 9ᵃᶜc̲olSums m 10ᵃᶜr̲owMax m 11f ← (3 4 r̲eshape r̲ange 12) ÷ 8 12ᵃᶜr̲owSums f 13ᵃᶜc̲olSums f 14ᵃᶜs̲um ᵃᶜr̲owSums f