ocramz / sparse-linear-algebra

Numerical computation in native Haskell
GNU General Public License v3.0
88 stars 10 forks source link

`(^-^)` has incorrect implementation #46

Closed Jaxan closed 6 years ago

Jaxan commented 6 years ago

(^-^) is implemented using unionWith from the Map data type. This is wrong, because if the matrices have disjoint indices, then the function (-) is never used, and the values are simply copied.

The default implementation (x ^+^ negateV y) is correct.

(^-^) is implemented here: https://github.com/ocramz/sparse-linear-algebra/blob/c2f26735d95c742ccc0e33160c7c29910fdb9410/src/Data/Sparse/SpMatrix.hs#L88