I am using the Apache Commons Math library for matrix operations because it seems quite complete despite its absolute lack of proper documentation.
import org.apache.commons.math3.linear.SparseFieldMatrix;
//inside a function:
int n = 300;
SparseFieldMatrix Y = new SparseFieldMatrix(ComplexField.getInstance(), n, n);
// some code to fill values into Y
I have seen the method Y.walkInRowOrder(FieldMatrixChangingVisitor<Complex>() );
, which I guess does what I want: to list the columns that contain elements for every row.
However I have no idea on how to use it, since FieldMatrixChangingVisitor
cannot be instantiated. What would be the right approach?