Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception when mmuling filled ndarrays #336

Open
cguenthner opened this issue Feb 8, 2019 · 0 comments
Open

Exception when mmuling filled ndarrays #336

cguenthner opened this issue Feb 8, 2019 · 0 comments

Comments

@cguenthner
Copy link

I'm trying to understand the following behavior of the ndarray implementation and am not sure if there's a bug or if I'm misunderstanding something. If I create a new array using fill! and multiply it by its transpose, I get the expected result. If I create a new array using fill and multiply it by its transpose, I get an exception. I don't observe this behavior with the vectorz or persistent-vector implementations.

(m/set-current-implementation :ndarray)

(def a (m/fill! (m/new-array [2 3]) 1))
(m/mmul a (m/transpose a)) ; => #object[clojure.core.matrix.impl.ndarray_object.NDArray 0x1b4f7b03 [[3.0 3.0] [3.0 3.0]]]

(def b (m/fill (m/new-array [2 3]) 1))
(m/add b b) ; => [[2 2 2] [2 2 2]]
(m/mmul b (m/transpose b))
; => Unhandled java.lang.IllegalArgumentException
;    No implementation of method: :set-2d! of protocol: #'clojure.core.matrix.protocols/PIndexedSettingMutable
;    found for class: clojure.lang.PersistentVector
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant