mikera / vectorz-clj

Fast matrix and vector maths library for Clojure - as a core.matrix implementation
203 stars 19 forks source link

The inverse function in combination with the diagonal-matrix function seems to be bugged #54

Closed wilfreddenton closed 9 years ago

wilfreddenton commented 9 years ago

If I run (inverse (matrix [[1 0] [0 2]])) I get #vectorz/matrix [[1.0,-0.0],[-0.0,0.5]]

However when I run (inverse (diagonal-matrix [1 2])) I get #vectorz/matrix [[Infinity,0.0],[0.0,Infinity]]

Not sure what is going on here because the output of both (matrix [[1 0] [0 2]]) and (diagonal-matrix [1 2]) is #vectorz/matrix [[1.0,0.0],[0.0,2.0]]

mikera commented 9 years ago

Thanks I just confirmed this was an issue with the underlying Vectorz library. I have a fix in the latest develop branch, let me know if you want a new release.

Workaround right now is to use clone first:

(inverse (clone (diagonal-matrix [1 2])))
=> [[1.0 -0.0] [-0.0 0.5]]
wilfreddenton commented 9 years ago

I'll use the workaround for now. Thanks!

wilfreddenton commented 9 years ago

Actually I just the workaround and it isn't working for me either.

mikera commented 9 years ago

What do you get? Same issue using clone?

wilfreddenton commented 9 years ago

Yeah the issue using clone. On Thu, Oct 29, 2015 at 11:57 PM Mike Anderson notifications@github.com wrote:

What do you get? Same issue using clone?

— Reply to this email directly or view it on GitHub https://github.com/mikera/vectorz-clj/issues/54#issuecomment-152409001.

mikera commented 9 years ago

Now fixed in latest develop branch, will do a new release soon