Skip to content

Commit

Permalink
fixing compiling on old version
Browse files Browse the repository at this point in the history
  • Loading branch information
jzstark committed Jul 28, 2024
1 parent 713053d commit 6b6637f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/base/core/owl_const.ml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ let one : type a b. (a, b) kind -> a = function
| Int -> 1
| Nativeint -> 1n
| Char -> '\001'
| Float16 -> failwith "not implemented"
| _ -> failwith "not implemented"


let neg_one : type a b. (a, b) kind -> a = function
Expand All @@ -93,7 +93,7 @@ let neg_one : type a b. (a, b) kind -> a = function
| Int -> -1
| Nativeint -> -1n
| Char -> '\255'
| Float16 -> failwith "not implemented"
| _ -> failwith "not implemented"


let pos_inf : type a b. (a, b) kind -> a = function
Expand Down
5 changes: 2 additions & 3 deletions src/base/misc/owl_utils_ndarray.ml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@ let elt_to_str : type a b. (a, b) kind -> a -> string = function
| Int -> fun v -> Printf.sprintf "%i" v
| Int32 -> fun v -> Printf.sprintf "%ld" v
| Int64 -> fun v -> Printf.sprintf "%Ld" v
| Float16 -> fun v -> Printf.sprintf "%G" v
| Float32 -> fun v -> Printf.sprintf "%G" v
| Float64 -> fun v -> Printf.sprintf "%G" v
| Complex32 -> fun v -> Printf.sprintf "(%G, %Gi)" Complex.(v.re) Complex.(v.im)
| Complex64 -> fun v -> Printf.sprintf "(%G, %Gi)" Complex.(v.re) Complex.(v.im)

| _ -> failwith "not implemented"

(* convert an element of string to elt type *)
let elt_of_str : type a b. (a, b) kind -> string -> a = function
Expand All @@ -34,13 +33,13 @@ let elt_of_str : type a b. (a, b) kind -> string -> a = function
| Int -> fun v -> int_of_string v
| Int32 -> fun v -> Int32.of_string v
| Int64 -> fun v -> Int64.of_string v
| Float16 -> fun v -> float_of_string v
| Float32 -> fun v -> float_of_string v
| Float64 -> fun v -> float_of_string v
| Complex32 -> fun v ->
Scanf.sscanf v "(%f, %fi)%!" (fun re im -> { Complex.re; im })
| Complex64 -> fun v ->
Scanf.sscanf v "(%f, %fi)%!" (fun re im -> { Complex.re; im })
| _ -> failwith "not implemented"


(* calculate the number of elements in an ndarray *)
Expand Down

0 comments on commit 6b6637f

Please sign in to comment.