                              (.add a i j (first vs))
                              (recur (inc j) (rest vs)))))
                        a)
-      (instance? Mat x) (.add a ^Mat x)
       (same-shape? a x) (do
                           (println "WARNING: Operations with mixed matrices/vectors may not yield the fastest result.")
                           (dotimes [i (.numRows a)]

      :else (error "Incompatible shape.")))
  (matrix-sub! [a x]
    (cond
      (zero-dim? x) (matrix-add! a (- (get-0d x)))
      (instance? Vec x) (.add a -1.0 ^Vec x)
      (is-vector? x)
        (let [size (.size a)]
          (println "WARNING: Operations with mixed matrices/vectors may not yield the fastest result.")

  Mat
  (matrix-add! [a x]
    (cond
      (instance? Mat x) (.add a ^Mat x)
      (zero-dim? x) (let [x (get-0d x)]
                      (dotimes [i (.numRows a)]
                        (dotimes [j (.numColumns a)]
