How to iterate over non zero values in a sparse matrix with COLT?

走远了吗. 提交于 2019-12-24 12:08:18

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!