@Override public String toString() { if (this.matrixRows == null) return "[]"; final StringBuilder sb = new StringBuilder(); final SymmetricMatrix m = this; m.iterate( new IMatrixAction() { int prevR = 0; @Override public void action(int r, int c) { if (r != prevR) { prevR = r; sb.append("\n"); } sb.append(m.get(r, c)); sb.append(" "); } }); return sb.toString(); }
/** * Values for the main diagonal must NOT be provided. * * @param values */ public void fill(final float[] values) { final SymmetricMatrix m = this; m.iterate( new IMatrixAction() { int index = 0; @Override public void action(int r, int c) { if (r != c) { m.set(r, c, values[index]); index++; } } }); }