def locate
stelliferous@0.0.2.0 · tensor_view.bend:39
import stelliferous@0.0.2.0/tensor_view.bend as TensorView
import Base
39
40def locate(axes: List<&2,Axis>,coordinates: List<&2,U32>,address: Maybe<&2,U32>,+logical_length: U32) -> Maybe<&2,U32>:
41 match axes coordinates address:
42 case Nil{} Nil{} Some{+offset}:
43 finish_address(U32.is_lt(offset,logical_length),offset)
44 case Con{Axis{+extent,stride},tail} Con{+coordinate,rest} Some{+offset}:
45 locate(tail,rest,advance_inside(U32.is_lt(coordinate,extent) && U32.is_lt(offset,logical_length),offset,coordinate,stride,logical_length),logical_length)
46 case axes coordinates address: None{}