The code example on the COLT website shows:
DoubleFactory2D factory;
factory = DoubleFactory2D.sparse;
DoubleMatrix2D matrix = factory.make(3,4);
for (int row = matrix.rows(); --row >= 0;) {
for (int column = matrix.columns(); --column >= 0;) {
value = matrix.getQuick(row, column);
}
}
but this does not take advantage of the sparsity of the matrix. I'd like to iterate over non zero values only.