Search code examples
scalaimplicitscala-breeze

Scala Breeze DenseVector Implicit failure


I've started getting this strange error; completely not sure what caused it - maybe a Maven rebuild. I can't explain this behavior... sometimes it works in IntelliJ, sometimes it doesn't, and it is failing when I run it from a jar file.

This is the runtime error:

java.lang.NoSuchMethodError: breeze.linalg.DenseVector$.canScaleD()Lbreeze/linalg/operators/BinaryOp

and it occurs in this code:

import breeze.linalg._
import breeze.linalg.DenseVector._
var planeNormal = DenseVector.zeros[Double](39)
weights.zip(vectors).foreach case(w: Double, vector: DenseVector[Double]) =>
    planeNormal :+= (vector :* w)
}

in the vector :* w function call.

Anyone have any ideas about what might be wrong?

I suspect its some version mismatch but no clue where to look to fix it; I'm using this breeze-math package

<groupId>org.scalanlp</groupId>
<artifactId>breeze-math_2.10</artifactId>
<version>0.4</version>

and scala

<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.10.3</version>

Solution

  • You're using a really, really old version of Breeze. Please use 0.8.1 (Artifact id is just breeze_2.10 now)