Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to solve a linear system of matrices in scala breeze?

How to solve a linear system of matrices in scala breeze? ie, I have Ax = b, where A is a matrix (usually positive definite), and x and b are vectors.

I can see that there is a cholesky decomposition available, but I couldn't seem to find a solver? (if it was matlab I could do x = b \ A. If it was scipy I could do x = A.solve(b) )

like image 499
Hugh Perkins Avatar asked Sep 28 '12 09:09

Hugh Perkins


1 Answers

Apparently, it is quite simple in fact, and built into scala-breeze as an operator:

x = A \ b

It doesnt use Cholesky, it uses LU decomposition, which is I think about half as fast, but they are both O(n^3), so comparable.

like image 132
Hugh Perkins Avatar answered Sep 21 '22 12:09

Hugh Perkins