Module Femtolib.Array_simulate_2d


module Array_simulate_2d: sig .. end
One dimensionnal arrays that represent two dimensionnal data. Used to have a type independent of the dimension when dealing with one and two dimensionnal datas.


Translation


val to_1d : int -> int -> int -> int -> int
to_1d width height x y
val of_1d : 'a -> int -> int -> int * int
of_1d width height index

Functions adapted from the Array library


val set : int -> int -> 'a array -> int -> int -> 'a -> unit
set width height array x y elt
val get : int -> int -> 'a array -> int -> int -> 'a
get width height array x y
val init : int -> int -> (int -> int -> 'a) -> 'a array
init width height f
val iteri : int -> (int -> int -> 'a -> unit) -> 'a array -> unit
iteri height f
val mapi : int -> (int -> int -> 'a -> 'b) -> 'a array -> 'b array
mapi height f

Miscellaneous


val distance_to_boundary : int -> int -> int -> int
distance_to_boundary width height index