Daniel-Diaz / matrix

A Haskell native implementation of matrices and their operations.
BSD 3-Clause "New" or "Revised" License
35 stars 31 forks source link

inverse fails for invertible matrices with zero diagonal elements #34

Open ezag opened 8 years ago

ezag commented 8 years ago

inversre function fails with "Ratio has zero denominator" error for following test cases:

, testEquality "inverse (3)"
    ( inverse $ fromList 2 2 [0,1, 1,0]
    , Right $ fromList 2 2 [0,1, 1,0] :: Either String (Matrix Rational))
, testEquality "inverse (4)"
    ( inverse $ fromList 3 3 [1,0,0, 0,0,1, 0,1,0]
    , Right $ fromList 3 3 [1,0,0, 0,0,1, 0,1,0] :: Either String (Matrix Rational))
Daniel-Diaz commented 8 years ago

The inverse function needs a revision. I'll add the tests you proposed.

ezag commented 8 years ago

@Daniel-Diaz please consider pull request #39 - perhaps it fixes this?

Daniel-Diaz commented 8 years ago

Indeed, the tests are now passing.