(defn make-matrix
([data]
(cond
(coll? (first data))
(Matrix. (into-array (map double-array data)))
(number? (first data))
(Matrix. (double-array data))))
([data ncol]
(cond
(coll? data)
(Matrix. (double-array data) ncol)
(number? data)
(Matrix. data ncol))) ; data is the number of rows in this case
([init-val rows cols]
(Matrix. rows cols init-val)))
Comments top
No comments for make-matrix. Log in to add a comment.