 (defmethod construct-matrix Number
   [data]
   (double data))
-(defmethod construct-matrix :default
+(defmethod construct-matrix clojure.lang.PersistentVector
   [data]
   (let [ndims (m/dimensionality data)
           shape (m/shape data)]

      (count indexes) [m m] indexes
      (.set m (long-array indexes) v))))

(extend-protocol PMatrixAdd
  (matrix-add [m a]
    (.add m m))
  (matrix-sub [m b]
    (.add m a)))

(extend-protocol PMatrixMultiply
  (element-multiply [m a]
    (.mul m a)))

(extend-protocol PMatrixDivide
  (element-divide [m a]
    (.div m a)))


        (double-array (flatten data))
        ndims
        (long-array shape))))

; assume it is an arbitary implementation
; construct a persistent vector representation of the data
(defmethod construct-matrix :default
  [data]
  (let [vm (mp/construct-matrix [] (m/shape data))]
    (construct-matrix vm)))

(extend-protocol mp/PImplementation
  NDArray
