def test_QR_MGS_Q_orthogonal():
    'verify the orthogonality of the computed Q'
    np.random.seed(1)
    M = 6
    N = 5
    A = np.random.rand(M,N)
    Q1, R1 = qra.QR_MGS(A)
    aae(np.identity(N), np.dot(Q1.T,Q1), decimal=10)
def test_QR_MGS_decomposition():
    'verify the computed Q and R matrices'
    np.random.seed(6)
    M = 6
    N = 5
    A = np.random.rand(M,N)
    Q1, R1 = qra.QR_MGS(A)
    aae(A, np.dot(Q1, R1), decimal=10)
def test_QR_MCS_Cholesky():
    'verify that R is the transpose of the Cholesky factor of ATA'
    np.random.seed(98)
    M = 6
    N = 5
    A = np.random.rand(M,N)
    ATA = np.dot(A.T,A)
    Q1, R1 = qra.QR_MGS(A)
    aae(ATA, np.dot(R1.T,R1), decimal=10)