Returns a matrix solution if A is square, least squares solution otherwise.
Equivalent to R's solve function.
Examples:
(solve (matrix [[2 0 0] [0 2 0] [0 0 2]]))
References:
http://en.wikipedia.org/wiki/Matrix_inverse
(defn solve
" Returns a matrix solution if A is square, least squares solution otherwise.
Equivalent to R's solve function.
Examples:
(solve (matrix [[2 0 0] [0 2 0] [0 0 2]]))
References:
http://en.wikipedia.org/wiki/Matrix_inverse
"
([^Matrix A & B]
(if B
(Matrix. (.solve (DenseDoubleAlgebra.) A (first B)))
(Matrix. (.inverse (DenseDoubleAlgebra.) A)))))
Comments top
No comments for solve. Log in to add a comment.