0
在以下方法乘以矩陣我試圖乘以DenseVector一個DenseVector其中DenseVector之一是方法參數:使用ScalaNLP和微風
def mult(features : DenseVector[Array[Int]]) = {
val dv = new DenseVector(Array(-30, 20 , 20))
features :* dv
}
這會導致編譯器錯誤:
Multiple markers at this line:
◾could not find implicit value for parameter op: breeze.linalg.operators.OpMulScalar.Impl2[breeze.linalg.DenseVector[Array[Int]],breeze.linalg.DenseVector[Int],That]
◾not enough arguments for method :*: (implicit op: breeze.linalg.operators.OpMulScalar.Impl2[breeze.linalg.DenseVector[Array[Int]],breeze.linalg.DenseVector[Int],That])That. Unspecified value parameter op.
◾could not find implicit value for parameter op: breeze.linalg.operators.OpMulScalar.Impl2[breeze.linalg.DenseVector[Array[Int]],breeze.linalg.DenseVector[Int],That]
◾not enough arguments for method :*: (implicit op: breeze.linalg.operators.OpMulScalar.Impl2[breeze.linalg.DenseVector[Array[Int]],breeze.linalg.DenseVector[Int],That])That. Unspecified value parameter op.
這代碼彙編:
def mult(features : breeze.linalg.DenseVector[Array[Int]]) = {
val dv1 = new breeze.linalg.DenseVector(Array(-30, 20 , 20))
val dv2 = new breeze.linalg.DenseVector(Array(-30, 20 , 20))
dv1 :* dv2
}
如何將多個features
參數由dv
?我不確定編譯器錯誤的含義,是否與我沒有在方法中指定DenseVector的大小有關?