Created
January 12, 2017 16:41
-
-
Save ryanrhymes/3d8df83c67a574c83c545c578f55e71b to your computer and use it in GitHub Desktop.
Functor of dsmat in Eigen library
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* | |
* Eigen - an OCaml interface to C++ Eigen library | |
* Copyright (c) 2016 Liang Wang <[email protected]> | |
*) | |
module type MatSig = sig | |
type elt | |
type mat | |
val ml_eigen_new : int64 -> int64 -> mat | |
val ml_eigen_delete : mat -> unit | |
val ml_eigen_print : mat -> unit | |
end | |
module Make (Mat : MatSig) = struct | |
open Mat | |
let create m n = | |
let x = ml_eigen_new (Int64.of_int m) (Int64.of_int n) in | |
Gc.finalise ml_eigen_delete x; | |
x | |
let delete x = ml_eigen_delete x | |
let print x = ml_eigen_print x | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment