def hsolve(A, y):
    r"""Solver for the linear equations of two variables and equations only.

    It uses Householder reductions to solve ``Ax = y`` in a robust manner.

    Parameters
    ----------
    A : array_like
        Coefficient matrix.
    y : array_like
        Ordinate values.

    Returns
    -------
    :class:`numpy.ndarray`  Solution ``x``.
    """

    n = _norm(A[0, 0], A[1, 0])
    u0 = A[0, 0] - n
    u1 = A[1, 0]
    nu = _norm(u0, u1)

    with errstate(invalid="ignore", divide="ignore"):
        v0 = nan_to_num(u0 / nu)
        v1 = nan_to_num(u1 / nu)

    B00 = 1 - 2 * v0 * v0
    B01 = 0 - 2 * v0 * v1
    B11 = 1 - 2 * v1 * v1

    D00 = B00 * A[0, 0] + B01 * A[1, 0]
    D01 = B00 * A[0, 1] + B01 * A[1, 1]
    D11 = B01 * A[0, 1] + B11 * A[1, 1]

    b0 = y[0] - 2 * y[0] * v0 * v0 - 2 * y[1] * v0 * v1
    b1 = y[1] - 2 * y[0] * v1 * v0 - 2 * y[1] * v1 * v1

    n = _norm(D00, D01)
    u0 = D00 - n
    u1 = D01
    nu = _norm(u0, u1)

    with errstate(invalid="ignore", divide="ignore"):
        v0 = nan_to_num(u0 / nu)
        v1 = nan_to_num(u1 / nu)

    E00 = 1 - 2 * v0 * v0
    E01 = 0 - 2 * v0 * v1
    E11 = 1 - 2 * v1 * v1

    F00 = E00 * D00 + E01 * D01
    F01 = E01 * D11
    F11 = E11 * D11

    F11 = (npy_abs(F11) > epsilon.small) * F11

    with errstate(divide="ignore", invalid="ignore"):
        Fi00 = nan_to_num(F00 / F00 / F00)
        Fi11 = nan_to_num(F11 / F11 / F11)
        Fi10 = nan_to_num(-(F01 / F00) * Fi11)

    c0 = Fi00 * b0
    c1 = Fi10 * b0 + Fi11 * b1

    x0 = E00 * c0 + E01 * c1
    x1 = E01 * c0 + E11 * c1

    return array([x0, x1])
def hsolve ( A , y ) : n = _norm ( A [ 0 , 0 ] , A [ 1 , 0 ] ) u0 = A [ 0 , 0 ] - n u1 = A [ 1 , 0 ] nu = _norm ( u0 , u1 ) with errstate ( invalid = "ignore" , divide = "ignore" ) : v0 = nan_to_num ( u0 / nu ) v1 = nan_to_num ( u1 / nu ) B00 = 1 - 2 * v0 * v0 B01 = 0 - 2 * v0 * v1 B11 = 1 - 2 * v1 * v1 D00 = B00 * A [ 0 , 0 ] + B01 * A [ 1 , 0 ] D01 = B00 * A [ 0 , 1 ] + B01 * A [ 1 , 1 ] D11 = B01 * A [ 0 , 1 ] + B11 * A [ 1 , 1 ] b0 = y [ 0 ] - 2 * y [ 0 ] * v0 * v0 - 2 * y [ 1 ] * v0 * v1 b1 = y [ 1 ] - 2 * y [ 0 ] * v1 * v0 - 2 * y [ 1 ] * v1 * v1 n = _norm ( D00 , D01 ) u0 = D00 - n u1 = D01 nu = _norm ( u0 , u1 ) with errstate ( invalid = "ignore" , divide = "ignore" ) : v0 = nan_to_num ( u0 / nu ) v1 = nan_to_num ( u1 / nu ) E00 = 1 - 2 * v0 * v0 E01 = 0 - 2 * v0 * v1 E11 = 1 - 2 * v1 * v1 F00 = E00 * D00 + E01 * D01 F01 = E01 * D11 F11 = E11 * D11 F11 = ( npy_abs ( F11 ) > epsilon . small ) * F11 with errstate ( divide = "ignore" , invalid = "ignore" ) : Fi00 = nan_to_num ( F00 / F00 / F00 ) Fi11 = nan_to_num ( F11 / F11 / F11 ) Fi10 = nan_to_num ( - ( F01 / F00 ) * Fi11 ) c0 = Fi00 * b0 c1 = Fi10 * b0 + Fi11 * b1 x0 = E00 * c0 + E01 * c1 x1 = E01 * c0 + E11 * c1 return array ( [ x0 , x1 ] )
r"""Solver for the linear equations of two variables and equations only.

    It uses Householder reductions to solve ``Ax = y`` in a robust manner.

    Parameters
    ----------
    A : array_like
        Coefficient matrix.
    y : array_like
        Ordinate values.

    Returns
    -------
    :class:`numpy.ndarray`  Solution ``x``.