Github user myui commented on a diff in the pull request:
https://github.com/apache/incubator-hivemall/pull/111#discussion_r136094514
--- Diff: core/src/main/java/hivemall/math/matrix/sparse/DoKMatrix.java ---
@@ -309,6 +309,20 @@ public void eachNonZeroInColumn(@Nonnegative final int
col,
}
}
+ public void eachNonZeroCell(@Nonnull final VectorProcedure procedure) {
+ if (nnz == 0) {
+ return;
+ }
+ final IMapIterator itor = elements.entries();
+ while (itor.next() != -1) {
+ long k = itor.getKey();
+ int row = Primitives.getHigh(k);
+ int col = Primitives.getLow(k);
+ double value = itor.getValue();
+ procedure.apply(row, col, value);
--- End diff --
`VectorProcedure#apply(@Nonnegative int row, @Nonnegative int col, double
value)` should also be introduced.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---