Element map (emap) on matrix returns LazySeq
Applying emap to a clatrix.core.Matrix returns a LazySeq, rather than returning something that preserves the matrix's shape.
(def M (matrix [[1 2][3 4]]))
#'user/M
M
A 2x2 matrix
-------------
1.00e+00 2.00e+00
3.00e+00 4.00e+00
(def Mi (emap inc M))
#'user/Mi
Mi
(2.0 3.0 4.0 5.0)
(type Mi)
clojure.lang.LazySeq
Maybe this is related to issue 36?
(Feel free to let me know if I'm not doing something correctly here. First issue not for my own project.)
Yep looks like a bug to me: emap should always return a amtrix of the same shape. I'll take a quick look
Fixed (I think) in this PR:
https://github.com/tel/clatrix/pull/43
The issue is still (again?) there: (emap identity (matrix :clatrix [[1 2][3 4]])) :=> (1.0 2.0 3.0 4.0)
Hmmm I think my latest PR has a fix for this: https://github.com/tel/clatrix/pull/50