def hilbert(ctx, m, n=None):
        """
        Create (pseudo) hilbert matrix m x n.
        One given dimension will create hilbert matrix n x n.

        The matrix is very ill-conditioned and symmetric, positive definite if
        square.
        """
        if n is None:
            n = m
        A = ctx.matrix(m, n)
        for i in xrange(m):
            for j in xrange(n):
                A[i,j] = ctx.one / (i + j + 1)
        return A
dataset/ETHPy150Open fredrik-johansson/mpmath/mpmath/matrices/matrices.py/MatrixMethods.hilbert/original