def col_max_idx.go

unified-nsga-iii@0.2.2.0 · normalization.bend:87

import unified-nsga-iii@0.2.2.0/normalization.bend as Normalization
import Base
import unified-nsga-iii@0.2.2.0/individual.bend as Ind
import unified-nsga-iii@0.2.2.0/util.bend as Util

87def col_max_idx.go(+pop: List<&2, Ind.Individual>, +fuel: Nat, idxs: List<&2, Nat>) -> List<&2, F32>:
88  match fuel idxs:
89    case 0n Nil{}:
90      Nil{}
91    case 0n +i <> rest:
92      max_at(pop, col_max_idx.go(pop, 0n, rest), i)
93    case 1n+p Nil{}:
94      Nil{}
95    case 1n+p +i <> Nil{}:
96      max_at(pop, Nil{}, i)
97    case 1n+p h <> t:
98      +all = {h <> t : List<&2, Nat>}
99      +mid = Nat.div(Util.list_len(Nat, all), 2n)
100      lo hi = col_max_idx.go(pop, p, List.take(&2, Nat, all, mid)) col_max_idx.go(pop, p, List.drop(&2, Nat, all, mid))
101      Util.vec_max(lo, hi)

Uses (10)

Used by (1)