我只想知道spark sparse martix创建的逻辑,下面是实际输出
// Create a sparse matrix ((9.0, 0.0), (0.0, 8.0), (0.0, 6.0))
val sm: Matrix = Matrices.sparse(3, 2, Array(0, 1, 3), Array(0, 2, 1), Array(9, 6, 8))
sm: org.apache.spark.mllib.linalg.Matrix =
3 x 2 CSCMatrix
(0,0) 9.0
(2,1) 6.0
(1,1) 8.0
我以为应该是
(0,0) 9.0
(2,1) 6.0
(3,1) 8.0 <-- also it should be a 3 by 2 matrix so the 3 shouldnt even exist in the Array(0,1,3)
有人知道这背后的逻辑吗?
暂无答案!
目前还没有任何答案,快来回答吧!