0

My Codes are as below:

val bigArrs = Array(BigDecimal(1),BigDecimal(2))
val dm = new DenseMatrix[BigDecimal](2,1,bigArrs)
val cal = dm*dm.t

when I compile it,I'm getting the following compilation errors:

Error:(11, 15) diverging implicit expansion for type breeze.linalg.operators.OpMulMatrix.
Impl2[breeze.linalg.DenseMatrix[BigDecimal],breeze.linalg.DenseMatrix[BigDecimal],That]
starting with method canMulM_M_def in trait DenseMatrixOpsLowPrio
val cal = dm*dm.t
          ^
Error:(11, 15) not enough arguments for method *: (implicit op: breeze.linalg.operators.OpMulMatrix.Impl2
[breeze.linalg.DenseMatrix[BigDecimal],breeze.linalg.DenseMatrix[BigDecimal],That])That.
Unspecified value parameter op.
val cal = dm*dm.t
          ^

I am asking how to implement multiplication or addition on DenseMatrix[BigDecimal] in Breeze. I have read the https://github.com/scalanlp/breeze/wiki/Universal-Functions#enabling-ufuncs-for-your-collection-type and http://dlwh.org/tag/breeze/ trying to solve it. However,as a newer to Breeze and scala,it is really a little hard for me to finish these codes.Hope someone will do me a favor!

4

1 回答 1

0
 val d = dm.*(dm.t)(DenseMatrix.op_DM_DM_Semiring[BigDecimal])

这将起作用。矩阵的任何操作都可以这样做。如果您的返回值的类型是空的,则可能是您没有应用隐式参数(如我在第二个括号中所示)。

于 2016-04-19T08:49:19.630 回答