在 Spark MLlib 中转置密集矩阵时出现编译错误
Compile error on transposing a dense matrix in Spark MLlib
我正在尝试在 Spark 中创建一个密集矩阵,然后使用以下代码转置它:
val weightsMatrix = Matrices.dense(1, 3, Array.fill[Double](3)(0))
val weightsMatrix_t = weightsMatrix.transpose()
但它失败并出现以下编译错误。
not enough arguments for method apply: (i: Int, j: Int)Double in
trait Matrix.
[error] Unspecified value parameters i, j.
[error] val weightsMatrix_t = weightsMatrix.transpose()
[error] ^
[error] one error found
[error] (compile:compileIncremental) Compilation failed
我在文档中检查过 transpose
函数不带任何参数,但似乎以某种方式涉及名为 apply
的方法。
apply 是指 () 试用您的转置。 Transpose 是 matrix 的成员变量,因此当您调用 tanspose 时,它返回一个矩阵,然后您在该矩阵上调用一个没有给出索引值的索引。
解决方案是
val weightsMatrix_t = weightsMatrix.transpose
没有 ()
我正在尝试在 Spark 中创建一个密集矩阵,然后使用以下代码转置它:
val weightsMatrix = Matrices.dense(1, 3, Array.fill[Double](3)(0))
val weightsMatrix_t = weightsMatrix.transpose()
但它失败并出现以下编译错误。
not enough arguments for method apply: (i: Int, j: Int)Double in
trait Matrix.
[error] Unspecified value parameters i, j.
[error] val weightsMatrix_t = weightsMatrix.transpose()
[error] ^
[error] one error found
[error] (compile:compileIncremental) Compilation failed
我在文档中检查过 transpose
函数不带任何参数,但似乎以某种方式涉及名为 apply
的方法。
apply 是指 () 试用您的转置。 Transpose 是 matrix 的成员变量,因此当您调用 tanspose 时,它返回一个矩阵,然后您在该矩阵上调用一个没有给出索引值的索引。 解决方案是
val weightsMatrix_t = weightsMatrix.transpose
没有 ()