Skip to content

Commit

Permalink
Array -> Iterator
Browse files Browse the repository at this point in the history
  • Loading branch information
Reza Zadeh committed Jan 21, 2015
1 parent bbc907a commit 3ce0b5d
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,9 @@ class IndexedRowMatrix(
val rowIndex = row.index
row.vector match {
case SparseVector(size, indices, values) =>
indices.zip(values).map { case (i, iVal) =>
MatrixEntry(rowIndex, i, iVal)
}
Iterator.tabulate(indices.size)(x => MatrixEntry(rowIndex, indices(x), values(x)))
case DenseVector(values) =>
values.zipWithIndex.map { case (iVal, i) =>
MatrixEntry(rowIndex, i, iVal)
}
Iterator.tabulate(values.size)(x => MatrixEntry(rowIndex, x, values(x)))
}
}
new CoordinateMatrix(entries, numRows(), numCols())
Expand Down

0 comments on commit 3ce0b5d

Please sign in to comment.