sourcelibs/Accel/demos/threshold.xtl
1⍝!/usr/bin/env xetal
2⍝ Threshold: a select by mask, item by item: x where x > t, else 0;
3⍝ relu is the same with t = 0; k_eep takes any Int mask.
4⍝ Run with "just demo-lib Accel threshold".
5ᵃᶜ⁼u̲se< "Accel"
6x ← ((r̲ange 8) ÷ 4) − 1.0
7x
80.5 ᵃᶜt̲hreshold x
9ᵃᶜr̲elu x
10n ← (r̲ange 8) − 4
11ᵃᶜr̲elu n
12(n m̲od 2) ᵃᶜk̲eep n