Question

There have been a few questions inquiring about general math/stats frameworks for Scala.

I am interested in only one specific problem, that of solving a large sparse linear system. Essentially I am looking for an equivalent of scipy.sparse.linalg.spsolve.

Currently I am looking into breeze-math of ScalaNLP Breeze, which looks like it would do the job, except that the focus of this library collection is natural language processing, so it feels a bit strange to use that.

Saddle also looks promising, but not very mature yet, and looking at its dependencies, EJML doesn't seem to have sparse functionality, while Apache commons math did, but it was flaky.

Has anyone got a reasonably simple and efficient solution that is currently available?

Was it helpful?

Solution

Although ScalaNLP Breeze says it's for NLP, it's linear algebra library is fairly general and not specialized to NLP. With that said, you could easily do something like this:

  val A = new CSCMatrix[Int]()
  val B = new CSCMatrix[Int]()

  val x = A \ B
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top