Skip to content

Commit

Permalink
Fix preprocessing.
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladimir Brankov committed May 25, 2017
1 parent 55c738f commit a542207
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions lib/caml/h5.cppo.ml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
open Bigarray
open Hdf5_raw

#if OCAML_VERSION < (4, 3, 0)
#define Array.create_float Array.make_float
#endif

let () = H5_raw.init ()

let default_get_set init =
Expand Down Expand Up @@ -215,7 +211,11 @@ module Make_float(F : Float_arg) = struct
let read_float_array t ?data name = read_data F.h5t
(fun dims ->
if Array.length dims <> 1 then invalid_arg "Dataset not one dimensional";
#if OCAML_VERSION >= (4, 3, 0)
Array.create_float dims.(0))
#else
Array.make_float dims.(0))
#endif
(fun data dims ->
if Array.length dims <> 1 then invalid_arg "Dataset not one dimensional";
if Array.length data < dims.(0) then
Expand Down Expand Up @@ -300,14 +300,22 @@ module Make_float(F : Float_arg) = struct
let dim2 = Array2.dim1 a in
if transpose then begin
Array.init dim1 (fun i ->
#if OCAML_VERSION >= (4, 3, 0)
let e = Array.create_float dim2 in
#else
let e = Array.make_float dim2 in
#endif
for j = 0 to dim2 - 1 do
Array.set e j (Array2.get a j i)
done;
e)
end else begin
Array.init dim1 (fun i ->
#if OCAML_VERSION >= (4, 3, 0)
let e = Array.create_float dim2 in
#else
let e = Array.make_float dim2 in
#endif
for j = 0 to dim2 - 1 do
Array.set e j (Array2.get a i j)
done;
Expand Down

0 comments on commit a542207

Please sign in to comment.