Skip to content
This repository has been archived by the owner on Nov 18, 2023. It is now read-only.

bugs related to Data.Matrix.inverse #44

Open
LATBauerdick opened this issue Jan 6, 2017 · 3 comments
Open

bugs related to Data.Matrix.inverse #44

LATBauerdick opened this issue Jan 6, 2017 · 3 comments

Comments

@LATBauerdick
Copy link

Hi -- hope this is the right way to report bugs for the Data.Matrix package!

There are two issues showing up when matrix inversion runs into problems (e.g. for nearly singular matrices):

in function ref:

goodRow = case listToMaybe (filter significantRow [1..ncols mtx]) of
            Nothing -> error "Attempt to invert a non-invertible matrix"
            Just x -> x

  1. ncol needs to be nrows, current code crashes with access error instead of returning error.

  2. as ref is called from inverse (and rref), which promises to return Either String (Matrix a), calling error in case of non-invertible matrices is not a very nice thing to do. ref should be modified to also return Either String (Matrix a), so inverse can return Left "can't invert". It's important that user code can handle singular or numerically unstable matrices themselves.

Thanks for your consideration (and thanks for providing Data.Matrix, which is otherwise a joy to use).

Best regards, LatB

@octopuscabbage
Copy link
Contributor

Good suggestions & Report, I can prepare a PR handling these later, I have a pretty free day today.

@octopuscabbage
Copy link
Contributor

ncol needs to be nrows, current code crashes with access error instead of returning error.

Could you provide a test case where this is true? Would make my life a bit easier and make sure i solve it.

@octopuscabbage
Copy link
Contributor

Issue should be resolved in this PR #45 waiting on your test case to make sure I have it solved.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants