From 69a020e7271dc81e208a64b9df1929f1c1257f44 Mon Sep 17 00:00:00 2001 From: Zolisa Bleki Date: Sun, 14 Jul 2024 16:54:04 +0200 Subject: [PATCH] Remove superfluous Ndarray module alias --- lib/codecs/array_to_array.mli | 26 ++++++++++++-------------- lib/codecs/array_to_bytes.mli | 20 +++++++++----------- lib/codecs/bytes_to_bytes.ml | 2 -- lib/codecs/bytes_to_bytes.mli | 2 -- lib/codecs/codecs.ml | 7 +++++-- lib/codecs/codecs.mli | 11 +++++++---- lib/codecs/codecs_intf.ml | 1 - lib/storage/storage_intf.ml | 7 +++---- 8 files changed, 36 insertions(+), 40 deletions(-) diff --git a/lib/codecs/array_to_array.mli b/lib/codecs/array_to_array.mli index 2f0997ef..7e9449bf 100644 --- a/lib/codecs/array_to_array.mli +++ b/lib/codecs/array_to_array.mli @@ -1,25 +1,23 @@ open Codecs_intf -module Ndarray = Owl.Dense.Ndarray.Generic - module ArrayToArray : sig val parse : ('a, 'b) Util.array_repr -> arraytoarray -> (unit, [> error]) result val compute_encoded_size : int -> arraytoarray -> int - val compute_encoded_representation - : arraytoarray -> - ('a, 'b) Util.array_repr -> - (('a, 'b) Util.array_repr, [> error]) result - val encode - : arraytoarray -> - ('a, 'b) Ndarray.t -> - (('a, 'b) Ndarray.t, [> error]) result - val decode - : arraytoarray -> - ('a, 'b) Ndarray.t -> - (('a, 'b) Ndarray.t, [> error]) result + val compute_encoded_representation : + arraytoarray -> + ('a, 'b) Util.array_repr -> + (('a, 'b) Util.array_repr, [> error]) result + val encode : + arraytoarray -> + ('a, 'b, Bigarray.c_layout) Bigarray.Genarray.t -> + (('a, 'b, Bigarray.c_layout) Bigarray.Genarray.t, [> error]) result + val decode : + arraytoarray -> + ('a, 'b, Bigarray.c_layout) Bigarray.Genarray.t -> + (('a, 'b, Bigarray.c_layout) Bigarray.Genarray.t, [> error]) result val of_yojson : Yojson.Safe.t -> (arraytoarray, string) result val to_yojson : arraytoarray -> Yojson.Safe.t end diff --git a/lib/codecs/array_to_bytes.mli b/lib/codecs/array_to_bytes.mli index 7c3befdb..8506ae9c 100644 --- a/lib/codecs/array_to_bytes.mli +++ b/lib/codecs/array_to_bytes.mli @@ -1,7 +1,5 @@ open Codecs_intf -module Ndarray = Owl.Dense.Ndarray.Generic - module ArrayToBytes : sig val parse : ('a, 'b) Util.array_repr -> @@ -9,15 +7,15 @@ module ArrayToBytes : sig (unit, [> error]) result val compute_encoded_size : int -> array_tobytes -> int val default : array_tobytes - val encode - : ('a, 'b) Ndarray.t -> - array_tobytes -> - (string, [> error]) result - val decode - : string -> - ('a, 'b) Util.array_repr -> - array_tobytes -> - (('a, 'b) Ndarray.t, [> error]) result + val encode : + ('a, 'b, Bigarray.c_layout) Bigarray.Genarray.t -> + array_tobytes -> + (string, [> error]) result + val decode : + string -> + ('a, 'b) Util.array_repr -> + array_tobytes -> + (('a, 'b, Bigarray.c_layout) Bigarray.Genarray.t, [> error]) result val of_yojson : Yojson.Safe.t -> (array_tobytes, string) result val to_yojson : array_tobytes -> Yojson.Safe.t end diff --git a/lib/codecs/bytes_to_bytes.ml b/lib/codecs/bytes_to_bytes.ml index 867341ff..4e6ecc53 100644 --- a/lib/codecs/bytes_to_bytes.ml +++ b/lib/codecs/bytes_to_bytes.ml @@ -1,7 +1,5 @@ open Codecs_intf -module Ndarray = Owl.Dense.Ndarray.Generic - (* https://zarr-specs.readthedocs.io/en/latest/v3/codecs/gzip/v1.0.html *) module GzipCodec = struct let to_int = function diff --git a/lib/codecs/bytes_to_bytes.mli b/lib/codecs/bytes_to_bytes.mli index 2dd203b8..9e176eb3 100644 --- a/lib/codecs/bytes_to_bytes.mli +++ b/lib/codecs/bytes_to_bytes.mli @@ -1,7 +1,5 @@ open Codecs_intf -module Ndarray = Owl.Dense.Ndarray.Generic - module BytesToBytes : sig val compute_encoded_size : int -> fixed_bytestobytes -> int val encode : bytestobytes -> string -> (string, [> error]) result diff --git a/lib/codecs/codecs.ml b/lib/codecs/codecs.ml index 0c66a030..ddb37cf9 100644 --- a/lib/codecs/codecs.ml +++ b/lib/codecs/codecs.ml @@ -82,7 +82,10 @@ module Chain = struct {a2a = []; a2b = ArrayToBytes.default; b2b = []} let encode : - type a b. t -> (a, b) Ndarray.t -> (string, [> error ]) result + type a b. + t -> + (a, b, Bigarray.c_layout) Bigarray.Genarray.t -> + (string, [> error ]) result = fun t x -> List.fold_left (fun acc c -> acc >>= ArrayToArray.encode c) (Ok x) t.a2a @@ -96,7 +99,7 @@ module Chain = struct t -> (a, b) Util.array_repr -> string -> - ((a, b) Ndarray.t, [> error ]) result + ((a, b, Bigarray.c_layout) Bigarray.Genarray.t, [> error]) result = fun t repr x -> (* compute the last encoded representation of array->array codec chain. This becomes the decoded representation of the array->bytes decode diff --git a/lib/codecs/codecs.mli b/lib/codecs/codecs.mli index 1752413f..c200e2f7 100644 --- a/lib/codecs/codecs.mli +++ b/lib/codecs/codecs.mli @@ -5,8 +5,6 @@ include Codecs_intf.Interface -module Ndarray = Owl.Dense.Ndarray.Generic - (** A module containing functions to encode/decode an array chunk using a predefined set of codecs. *) module Chain : sig @@ -26,12 +24,17 @@ module Chain : sig (** [encode t x] computes the encoded byte string representation of array chunk [x]. Returns an error upon failure. *) val encode : - t -> ('a, 'b) Ndarray.t -> (string, [> error ]) result + t -> + ('a, 'b, Bigarray.c_layout) Bigarray.Genarray.t -> + (string, [> error ]) result (** [decode t repr x] decodes the byte string [x] using codec chain [t] and decoded representation type [repr]. Returns an error upon failure.*) val decode : - t -> ('a, 'b) Util.array_repr -> string -> (('a, 'b) Ndarray.t, [> error]) result + t -> + ('a, 'b) Util.array_repr -> + string -> + (('a, 'b, Bigarray.c_layout) Bigarray.Genarray.t, [> error ]) result (** [x = y] returns true if chain [x] is equal to chain [y], and false otherwise. *) diff --git a/lib/codecs/codecs_intf.ml b/lib/codecs/codecs_intf.ml index 59907a5e..4b45497e 100644 --- a/lib/codecs/codecs_intf.ml +++ b/lib/codecs/codecs_intf.ml @@ -39,7 +39,6 @@ type error = | `CodecChain of string | `Sharding of int array * int array * string ] -module Ndarray = Owl.Dense.Ndarray.Generic module type Interface = sig (** The type of [array -> array] codecs. *) diff --git a/lib/storage/storage_intf.ml b/lib/storage/storage_intf.ml index 2e1c476b..c88b98bb 100644 --- a/lib/storage/storage_intf.ml +++ b/lib/storage/storage_intf.ml @@ -40,8 +40,6 @@ module type STORE = sig val is_member : t -> key -> bool end -module Ndarray = Owl.Dense.Ndarray.Generic - module type S = sig type t (** The storage type. *) @@ -122,7 +120,7 @@ module type S = sig val set_array : ArrayNode.t -> Owl_types.index array -> - ('a, 'b) Ndarray.t -> + ('a, 'b, Bigarray.c_layout) Bigarray.Genarray.t -> t -> (unit, [> error | Node.error | Codecs.error ]) result (** [set_array n s x t] writes n-dimensional array [x] to the slice [s] @@ -137,7 +135,8 @@ module type S = sig Owl_types.index array -> ('a, 'b) Bigarray.kind -> t -> - (('a, 'b) Ndarray.t, [> error | Node.error | Codecs.error ]) result + (('a, 'b, Bigarray.c_layout) Bigarray.Genarray.t + ,[> error | Node.error | Codecs.error ]) result (** [get_array n s k t] reads an n-dimensional array of size determined by slice [s] from array node [n]. This operation fails if: - If there is a problem decoding/encoding node [n] chunks.