Last active
January 29, 2016 16:52
-
-
Save stevengj/791259c450ee7e360c10 to your computer and use it in GitHub Desktop.
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
function cmatshell(m::C.Mat, y::C.Vec, x::C.Vec) | |
f_ = MatGetContext(m) | |
f = Function(unsafe_object_ptr(f_)) # get actual Julia function | |
f(Vec(y), Vec(x)) | |
end | |
function Mat(f::Function, ...) | |
m = MatCreate(...) | |
m.data = f | |
MatSetContext(f) | |
MatSetShellOperation(m, cfunction(cmatshell) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment