def read_ml_len

bend-ml-tensor-array@0.1.19.0 · main.bend:1813

import bend-ml-tensor-array@0.1.19.0/main.bend as BendMlTensorArray
import Base

1813# the same count for the list of a whole Mat: to_list2 wraps read_l's answer, and ML.len counts it
1814def read_ml_len(-r: Nat, -c: Nat, +mleft: Nat, +idx: U32, +acc: List<&2, F32>, rc: Array<F32> & F32) -> {ML.len(r, c, Mat.to_list2(r, c, read_l(mleft, idx, acc, rc))) == Nat.add(1n+mleft, List.length(&2, F32, acc)) : Nat}:
1815  match mleft rc:
1816    case 0n Tuple{d, +v}:
1817      {==}
1818    case 1n+p Tuple{d, +v}:
1819      len_step(ML.len(r, c, Mat.to_list2(r, c, read_l(p, (idx - 1 : U32), v <> acc, Array.get(F32, d, (idx - 1 : U32))))), p, List.length(&2, F32, acc), read_ml_len(r, c, p, (idx - 1 : U32), v <> acc, Array.get(F32, d, (idx - 1 : U32))))

Uses (15)

Used by (1)