class DiagonalMatrix extends AbstractRealMatrix implements Serializable {

    public DiagonalMatrix subtract(final DiagonalMatrix m)
        throws MatrixDimensionMismatchException {
        MatrixUtils.checkSubtractionCompatible(this, m);

        final int dim = getRowDimension();
        final double[] outData = new double[dim];
        for (int i = 0; i < dim; i++) {
            outData[i] = data[i] - m.data[i];
        }

        return new DiagonalMatrix(outData, false);
    }

    public  DiagonalMatrix(final int dimension);
    public  DiagonalMatrix(final double[] d);
    public  DiagonalMatrix(final double[] d, final boolean copyArray);

}