code: public static Basic2DMatrix diagonal(int size, double diagonal) {
          double[][] array = new double[size][size];
  
          for (int i = 0; i < size; i++) {
              array[i][i] = diagonal;
          }
  
          return new Basic2DMatrix(array);
      }
docs: Creates a diagonal {@link Basic2DMatrix} of the given {@code size} whose
  diagonal elements are equal to {@code diagonal}.