This is very cool- thanks for sharing. I wonder if this is a useful addition to Owl, the ocaml “fat” math library.