public Matrix identity(int dimensions) {
		Matrix matrix = new Matrix(dimensions, dimensions);
		for (int i = 0; i < dimensions; i++) {
			for (int j = 0; j < dimensions; j++) {
				if (i == j) {
					matrix.set(i, j, 1);
				} else {
					matrix.set(i, j, 0);
				}
			}
		}
		return matrix;
	}