问题
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.
来源:https://stackoverflow.com/questions/44655457/how-to-iterate-over-non-zero-values-in-a-sparse-matrix-with-colt