class ML: Methods ones, zeros, toString
// Construct matrix of all ones.
public static ML ones(int h, int w)
return new ML( h, w, new ml(1.0));
// Construct matrix of all zeros.
public static ML zeros(int h, int w)
return new ML( h, w, new ml(0.0));
// Convert this matrix to String.
for (int r = 0; r < h; r++){
for (int c = 0; c < w; c++)
result = result + values[r][c] + " ";