def test_produit_house_matrix(epsilon):
    n = rd.randint(2,20)
    m = rd.randint(2,20)
    result = p1.generate_x_y(n)
    H = p1.determine_H (result[0],result[1])
    U = p1.determine_U (result[0],result[1])
    M = np.asmatrix(np.random.rand(n,m))
    M = 100 * M
    assert (np.allclose(p1.produit_house_matrix(U,M),H*M))
def compare_time_produit_h(n):
    prod_h = np.asmatrix(np.zeros([n-2,1]))
    prod = np.asmatrix(np.zeros([n-2,1]))
    for i in range(0,n-2):
        result = p1.generate_x_y(i+2)
        H = p1.determine_H (result[0],result[1])
        U = p1.determine_U (result[0],result[1])
        M = np.asmatrix(np.random.rand((i+2),(i+2)))
        M = 100 * M
        start_time = time.time()
        A = p1.produit_house_matrix(U,M)
        prod_h[i] = time.time() - start_time
        start_time = time.time()
        A = H*M
        prod[i] = time.time() - start_time
    mp.plot(range(2,n),prod)
    PH = ["produit matrice Householder","produit matrice numpy"]
    mp.plot(range(2,n),prod_h)
    mp.legend(PH)
    pl.show()