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

Version 0.3.4.0 crashes on empty matrices. #11

Open
haBuu opened this issue Sep 8, 2014 · 1 comment
Open

Version 0.3.4.0 crashes on empty matrices. #11

haBuu opened this issue Sep 8, 2014 · 1 comment

Comments

@haBuu
Copy link

haBuu commented Sep 8, 2014

Change from forM_ to numLoop causes some problems since "forM_ [1..0] ..." executes zero times but "numLoop 1 0 ..." will cause an infinite loop. For example "joinBlocks (identity 1, identity 0, identity 0, identity 0)" will crash in version 0.3.4.0 but in 0.3.3.0 it returned 1x1 matrix.

Version 0.3.3.0:
Prelude Data.Matrix> joinBlocks (identity 1, identity 0, identity 0, identity 0)
( 1 )

Version 0.3.4.0:
Prelude Data.Matrix> joinBlocks (identity 1, identity 0, identity 0, identity 0)
( *** Exception: ./Data/Vector/Generic/Mutable.hs:597 (write): index out of bounds (1,1)

@Daniel-Diaz
Copy link
Owner

To be honest, I have never considered empty matrices, nor matrices of negative size. However, I am guessing you encountered this problem by using them somehow. I admit that if they worked before was by accident. But yes, I consider this a regression. After all, applying splitBlocks to a 1x1 matrix (which is a valid matrix) will indeed generate 3 empty matrices. The problem of going back to forM_ is that it would be a performance regression. I will contact the maintainer of the loop package and see if numLoop can be adapted to handle these cases. Otherwise, I will create my own version.

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