def gn_csq
import bendtorch@1.3.0.0/main.bend as Bendtorchimport Base
1890# acc + (x - mu)·(x - mu) over the same segments
1891def gn_csq(left: Nat, +off: U32, +c: U32, +cg: Nat, +mu: F32, q: AS) -> AS:
1892 match left q:
1893 case 0n r:
1894 r
1895 case 1n+l AS{a, +s}:
1896 gn_csq(l, (off + c : U32), c, cg, mu, csq(Nat.sub(cg, 1n), (off + c : U32), mu, s, Array.get(F32, a, (off + c : U32))))