def extend(ctx, A, b):
        """
        Extend matrix A with column b and return result.
        """
        if not isinstance(A, ctx.matrix):
            raise TypeError("A should be a type of ctx.matrix")
        if A.rows != len(b):
            raise ValueError("Value should be equal to len(b)")
        A = A.copy()
        A.cols += 1
        for i in xrange(A.rows):
            A[i, A.cols-1] = b[i]
        return A
dataset/ETHPy150Open fredrik-johansson/mpmath/mpmath/matrices/matrices.py/MatrixMethods.extend/original