-
Notifications
You must be signed in to change notification settings - Fork 697
Closed
Description
according to https://github.com/scalanlp/breeze/wiki/Data-Structures, "colPtr.last is always equal to rowIndices.length.". Yet it's not true when there's extra zero at the end of _data array.
code to repro:
val m1: Matrix[Double] = new CSCMatrix[Double](Array(1.0, 1, 1), 3, 3, Array(0, 1, 2, 3), Array(0, 1, 2))
val m2: Matrix[Double] = new CSCMatrix[Double](Array(1.0, 2, 2, 4), 3, 3, Array(0, 0, 2, 4), Array(1, 2, 1, 2))
println(m1.toDenseMatrix.toString())
println(m2.toDenseMatrix.toString())
println("Sum: ")
val sum = (m1 + m2).asInstanceOf[CSCMatrix[Double]]
println("colptrs: " + sum.colPtrs.mkString(", "))
println("rowIndices: " + sum.rowIndices.mkString(", "))
require(sum.colPtrs.last == sum.rowIndices.length, s"${sum.colPtrs.last} not equals to ${sum.rowIndices.length}")
I know calling compact will help get rid of the extra 0s at the end of _data array and also remove the extra index in rowIndices. Just want to know if this is by design.
Metadata
Metadata
Assignees
Labels
No labels