// EXAMPLE chebyVol surface function chebychev(x) { xx := x * x; xx * xx - 2 * xx + 1; } n := 20; // Allocate vol to be a cube, then fill with 0..n-1 uniform coordinate // indices in 3D. vol := (short)index_fill([n, n, n, 3]); float res[n, n, n] = 0; // Scale vol to lie in the range -2..2 and apply the chebychev() function // pointwise throughout vol. Perform a sum-reduction over the XYZ vector // to compute the result, which is returned as a scalar lattice. res += chebychev(vol * (4.0/n) - 2); First_Out := scalar_lattice_out(res);