I am trying to run this simple program:
object Test {
def foo(args: (Double, Double, Double)*) = {
val x = DenseMatrix(args.toList :_*)
val r = DenseVector(5.0, 5.0, 0.0)
println(sum(x(*, ::) - r)) // works
val func = new DiffFunction[DenseVector[Double]] {
def calculate(r: DenseVector[Double]) = {
sum(x(*, ::) - r) // Doesn't work
}
}
}
def main(args: Array[String]) {
foo((0.0, 0.0, 0.0), (5.0, 5.0, 0.0), (10.0, 0.0, 0.0))
}
}
But I get the following error:
Missing arguments for method *(B)(OpMulMatrix.Impl2[TT, B, That])
Missing arguments for method *(B)(OpMulMatrix.Impl2[TT, B, That])
Cannot resolve symbol *
It seems i can't use the operator * to refer to each row of the matrix inside DiffFunction.
Why outside DiffFunction accessing the matrix rows with operator * and subtracting vector from them works but inside DiffFunction it doesn't ?