uncomplicate / neanderthal

Fast Clojure Matrix Library
http://neanderthal.uncomplicate.org
Eclipse Public License 1.0
1.06k stars 56 forks source link

Is there a way to use clojures `rational` number for elements within a matrix? #92

Closed lungsi closed 4 years ago

lungsi commented 4 years ago

Hi, I know this might sound like an odd question but I have to use an algorithm for matrices that are not very large. Therefore, performance is not an issue, what is an issue is the loss of accuracy.

This is why I am wondering if I could use clojure's rational number system (rationalize) when creating a matrix like

(dge rationalize  2 2 [ 1 2 3 4])

Regards.

blueberry commented 4 years ago

I am not sure that I understand what rationalize would do exactly.

If you're asking whether it would be possible to have a Neanderthal backend that would perform computations using Clojure's rational numbers, that is possible. Someone would have to implement that backend. And it would be slow.