【发布时间】:2016-10-15 22:23:10
【问题描述】:
我正在使用 Breeze 库在 Scala 中进行矩阵运算。一切看起来都不错,但在编译时找不到隐式:
could not find implicit value for parameter bf: breeze.linalg.support.CanMapValues[breeze.linalg.Matrix[Int],Int,Double,That]
有问题的函数是这样的:
import breeze.linalg._ // this is the only import
def writeMatrixToCsv(path: String, matrix: Matrix[Int]) = csvwrite(new File(path), matrix.mapValues(_.toDouble), separator = ',')
我不确定如何继续 - 我在 Breeze 代码中查找了默认的 CanMapValues,但找不到。我该如何解决这个问题?谢谢!
【问题讨论】:
-
你在那里使用过任何进口产品吗?这是什么 csvwrite?
-
嘿 @michaJlS , csvwrite 是一种 Breeze 方法(请参阅 github.com/scalanlp/breeze/wiki/Linear-Algebra-Cheat-Sheet)。我在问题中添加了我的导入。问题出在 .mapValues 中。
标签: scala matrix implicit scala-breeze