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
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 usingfill
and multiply it by its transpose, I get an exception. I don't observe this behavior with the vectorz or persistent-vector implementations.