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

bugs related to Data.Matrix.inverse #44

@LATBauerdick

Description

@LATBauerdick

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions