Scala Breeze: Solution to a complex system of linear equations

586 Views Asked by At

I need to find a solution to a complex system of linear equations. Current implementation is in C++ and calls LAPACK zgesv function. I thought about rewriting it in Scala and using Breeze for linear algebra. I try an example

import breeze.linalg._
import breeze.math._

val a = DenseMatrix(
  (Complex(-1.34, 2.55), Complex(0.28, 3.17), Complex(-6.39, -2.20), Complex(0.72, -0.92)),
  (Complex(-0.17, -1.41), Complex(3.31, -0.15), Complex(-0.15, 1.34), Complex(1.29, 1.38)),
  (Complex(-3.29, -2.39), Complex(-1.91, 4.42), Complex(-0.14, -1.35), Complex(1.72, 1.35)),
  (Complex(2.41, 0.39), Complex(-0.56, 1.47), Complex(-0.83, -0.69), Complex(-1.96, 0.67))
)

val b = DenseVector(Complex(26.26, 51.78), Complex(6.43, -8.68), Complex(-5.75, 25.31), Complex(1.16, 2.57))

val x = a \ b

I get an error

Error:(14, 17) not enough arguments for method : (implicit op: breeze.linalg.operators.OpSolveMatrixBy.Impl2[breeze.linalg.DenseMatrix[breeze.math.Complex],breeze.linalg.DenseVector[breeze.math.Complex],That])That. Unspecified value parameter op. lazy val x = a \ b ^

Looks like Breeze doesn't support complex type for this operation. I also found that complex routines are not supported by netlib-java, which is used by Breeze. Do I understand correctly and it is currently not supported by Breeze?

1

There are 1 best solutions below

0
On

Sorry, Breeze doesn't support lapack calls for Complex numbers right now.