Exemplo n.º 1
0
def test_m_simplesum():
    a = np.sqrt(.95)
    b = 1

    retval = m_quadratic_sum(a, b)

    assert(abs(retval - 20) < 1e-8)
Exemplo n.º 2
0
def test_m_simplesum():
    a = np.sqrt(.95)
    b = 1

    retval = m_quadratic_sum(a, b)

    assert(abs(retval - 20) < 1e-8)
Exemplo n.º 3
0
def test_m_matsum():

    a = np.eye(3) * .99
    b = np.eye(3)

    retval = m_quadratic_sum(a, b)

    summedval = np.zeros_like(a)

    for i in range(5000):
        summedval = summedval + a**i * b * a.T**i

    assert_allclose(retval, summedval, atol=1e-5, rtol=0)
Exemplo n.º 4
0
def test_m_matsum():

    a = np.eye(3) * .99
    b = np.eye(3)

    retval = m_quadratic_sum(a, b)

    summedval = np.zeros_like(a)

    for i in range(5000):
        summedval = summedval + a**i * b * a.T**i

    assert_allclose(retval, summedval, atol=1e-5, rtol=0)