Commit 35e59832 authored by Stephane Glondu's avatar Stephane Glondu

Remove unused functions working on arrays of arrays

parent f4168cd8
Pipeline #68635 passed with stages
in 16 minutes and 45 seconds
......@@ -55,84 +55,12 @@ module Array = struct
else true
in check (pred n))
let fforall f xs =
let rec loop_outer i =
if i >= 0 then
let x = xs.(i) in
let n = Array.length x in
let rec loop_inner j =
if j >= 0 then f x.(j) && loop_inner (pred j)
else loop_outer (pred i)
in loop_inner (pred n)
else true
in
let n = Array.length xs in
loop_outer (pred n)
let fforall2 f xs ys =
let rec loop_outer i =
if i >= 0 then
let x = xs.(i) and y = ys.(i) in
let n = Array.length x in
n = Array.length y &&
let rec loop_inner j =
if j >= 0 then f x.(j) y.(j) && loop_inner (pred j)
else loop_outer (pred i)
in loop_inner (pred n)
else true
in
let n = Array.length xs in
n = Array.length ys &&
loop_outer (pred n)
let fforall3 f xs ys zs =
let rec loop_outer i =
if i >= 0 then
let x = xs.(i) and y = ys.(i) and z = zs.(i) in
let n = Array.length x in
n = Array.length y &&
n = Array.length z &&
let rec loop_inner j =
if j >= 0 then f x.(j) y.(j) z.(j) && loop_inner (pred j)
else loop_outer (pred i)
in loop_inner (pred n)
else true
in
let n = Array.length xs in
n = Array.length ys &&
n = Array.length zs &&
loop_outer (pred n)
let map2 f a b =
Array.mapi (fun i ai -> f ai b.(i)) a
let map3 f a b c =
Array.mapi (fun i ai -> f ai b.(i) c.(i)) a
let mmap f a =
Array.map (fun ai ->
Array.map f ai
) a
let mmap2 f a b =
Array.mapi (fun i ai ->
let bi = b.(i) in
Array.mapi (fun j aj ->
f aj bi.(j)
) ai
) a
let mmap3 f a b c =
Array.mapi (fun i ai ->
let bi = b.(i) and ci = c.(i) in
Array.mapi (fun j aj ->
f aj bi.(j) ci.(j)
) ai
) a
let ssplit a =
mmap fst a, mmap snd a
let findi f a =
let n = Array.length a in
let rec loop i =
......@@ -201,25 +129,6 @@ module Shape = struct
| SAtomic _ -> invalid_arg "Shape.to_shape_array"
| SArray xs -> xs
let of_array_array x =
SArray (
Array.map (fun x ->
SArray (Array.map (fun x -> SAtomic x) x)
) x
)
let to_array_array = function
| SAtomic _ -> invalid_arg "Shape.to_array_array"
| SArray x ->
Array.map (function
| SAtomic _ -> invalid_arg "Shape.to_array_array"
| SArray x ->
Array.map (function
| SAtomic x -> x
| SArray _ -> invalid_arg "Shape.to_array_array"
) x
) x
let rec map f = function
| SAtomic x -> SAtomic (f x)
| SArray x -> SArray (Array.map (map f) x)
......
......@@ -27,20 +27,9 @@ module Array : sig
val forall : ('a -> bool) -> 'a array -> bool
val forall2 : ('a -> 'b -> bool) -> 'a array -> 'b array -> bool
val forall3 : ('a -> 'b -> 'c -> bool) -> 'a array -> 'b array -> 'c array -> bool
val fforall : ('a -> bool) -> 'a array array -> bool
val fforall2 : ('a -> 'b -> bool) ->
'a array array -> 'b array array -> bool
val fforall3 : ('a -> 'b -> 'c -> bool) ->
'a array array -> 'b array array -> 'c array array -> bool
val map2 : ('a -> 'b -> 'c) -> 'a array -> 'b array -> 'c array
val map3 : ('a -> 'b -> 'c -> 'd) ->
'a array -> 'b array -> 'c array -> 'd array
val mmap : ('a -> 'b) -> 'a array array -> 'b array array
val mmap2 : ('a -> 'b -> 'c) ->
'a array array -> 'b array array -> 'c array array
val mmap3 : ('a -> 'b -> 'c -> 'd) ->
'a array array -> 'b array array -> 'c array array -> 'd array array
val ssplit : ('a * 'b) array array -> 'a array array * 'b array array
val findi : (int -> 'a -> 'b option) -> 'a array -> 'b option
end
......@@ -67,8 +56,6 @@ module Shape : sig
| SArray of 'a t array
val to_array : 'a t -> 'a array
val to_shape_array : 'a t -> 'a t array
val of_array_array : 'a array array -> 'a t
val to_array_array : 'a t -> 'a array array
val map : ('a -> 'b) -> 'a t -> 'b t
val map2 : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t
val flatten : 'a t -> 'a list
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment