如何在 Breeze 中实现 DenseMatrix[BigDecimal] 的乘法?
How to implements multiplication of DenseMatrix[BigDecimal] in Breeze?
我的代码如下:
val bigArrs = Array(BigDecimal(1),BigDecimal(2))
val dm = new DenseMatrix[BigDecimal](2,1,bigArrs)
val cal = dm*dm.t
当我编译它时,出现以下编译错误:
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
^
我问的是如何在 Breeze 的 DenseMatrix[BigDecimal] 上实现乘法或加法。我已阅读 https://github.com/scalanlp/breeze/wiki/Universal-Functions#enabling-ufuncs-for-your-collection-type and http://dlwh.org/tag/breeze/ 试图解决它。但是,作为Breeze和scala的新手,完成这些对我来说真的有点困难codes.Hope有人会帮我一个忙!
val d = dm.*(dm.t)(DenseMatrix.op_DM_DM_Semiring[BigDecimal])
这将 work.Any 矩阵的操作可以像 this.If 你的 return 值的类型什么都没有,可能是你没有应用隐式参数(因为我显示在第二个括号中)。
我的代码如下:
val bigArrs = Array(BigDecimal(1),BigDecimal(2))
val dm = new DenseMatrix[BigDecimal](2,1,bigArrs)
val cal = dm*dm.t
当我编译它时,出现以下编译错误:
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
^
我问的是如何在 Breeze 的 DenseMatrix[BigDecimal] 上实现乘法或加法。我已阅读 https://github.com/scalanlp/breeze/wiki/Universal-Functions#enabling-ufuncs-for-your-collection-type and http://dlwh.org/tag/breeze/ 试图解决它。但是,作为Breeze和scala的新手,完成这些对我来说真的有点困难codes.Hope有人会帮我一个忙!
val d = dm.*(dm.t)(DenseMatrix.op_DM_DM_Semiring[BigDecimal])
这将 work.Any 矩阵的操作可以像 this.If 你的 return 值的类型什么都没有,可能是你没有应用隐式参数(因为我显示在第二个括号中)。