Survival.resid_sq: def of unified-nsga-iii@0.2.2.0 Import: import unified-nsga-iii@0.2.2.0/survival.bend as Survival Lines 209-221 of unified-nsga-iii@0.2.2.0/survival.bend: https://jend.leeeet.dev/read.txt?path=unified-nsga-iii@0.2.2.0/survival.bend&start_line=209&end_line=221 import Base # Same F32 steps as `vec_sqnorm(vec_sub(f, vec_scale(t, w)))`: left-to-right # `r*r` with `r = f - t*w`, no scaled-vector and residual-vector spines. def resid_sq(+t: F32, f: List<&2, F32>, w: List<&2, F32>) -> F32: match f w: case Nil{} Nil{}: 0.0 case x <> xs y <> ys: +r = F32.sub(x, F32.mul(t, y)) F32.add(F32.mul(r, r), resid_sq(t, xs, ys)) case Nil{} y <> ys: 0.0 case x <> xs Nil{}: 0.0 Uses (5): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32.add https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32.mul https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32.sub https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List