def testDecompositionPLU():
    mTests = [[[4, -9, 2], [2, -4, 4], [-1, 2, 2]],
              [[2, 4, 2, 0], [1, 2, 1, 0], [1, 2, 1, 3], [1, 2, 2, 1]],
              [[0, 3, 1], [4, 1, 1], [2, 2, 4]], [[-6, 6], [-2, -4]],
              [[1, 1], [2, -2]],
              [[5, 8, 9, 10, 8], [4, 5, 6, 4, 6], [7, 8, 10, 5, 9],
               [11, 8, 4, 9, 2], [9, 4, 12, 3, 1]]]

    for A in mTests:
        print("#" * 50)
        print("decomposition PLU de : ")

        AfficherMat(A)

        PLU = DecompositionPLU(A)

        matName = ["P", "L", "U"]

        for i in range(3):
            print("")
            print(matName[i], ":")
            AfficherMat(PLU[i])

        print("")
        print("produit P * L * U")
        print("( lourd, pour tester si on retrouve la matrice de depart ) :")
        AfficherMat(produit(produit(PLU[0], PLU[1]), PLU[2]))

        print("")
    print("@" * 100)
    def afficherTest( M, i, a, j ) :

            T = MatriceTransvection( i, a, j, len( M[0] ) )

            print("matrice de transvection : ")
            AfficherMat( T )
            print("")
            print("matrice sur laquelle appliquer la transvection :")
            AfficherMat( M )
            print("")
            print("resultat attendu : ")
            print("C"+str(j),"<= C"+str(j),"+",a,"* C"+str(i), "=", M[0][j-1]+a*M[0][i-1] )
            print("")
            print("resultat de la fonction ProduitTransvectionD :")
            AfficherMat( ProduitTransvectionD( M, T ) )
            print("")
            print("produit en utilisant la methode classique et lourde pour comparer : ")
            try :
                    AfficherMat( produit( M, T ) )
            except Exception as inst:
                    print("")
                    print( inst )
                    print("")
            print("")
def testDecompositionPLU() :
        mTests = [
                                [
                                        [ 4, -9, 2 ],
                                        [ 2, -4, 4 ],
                                        [ -1, 2, 2 ]
                                ],

                                [
                                        [ 2, 4, 2, 0 ],
                                        [ 1, 2, 1, 0 ],
                                        [ 1, 2, 1, 3 ],
                                        [ 1, 2, 2, 1 ]
                                ],

                                [
                                        [ 0, 3, 1 ],
                                        [ 4, 1, 1 ],
                                        [ 2, 2, 4 ]
                                ],

                                [
                                        [ -6, 6 ],
                                        [ -2, -4 ]
                                ],


				[
					[ 1, 1 ],
					[ 2, -2 ]
				],

				[
					[  5, 8,  9, 10, 8 ],
					[  4, 5,  6,  4, 6 ],
					[  7, 8, 10,  5, 9 ],
					[ 11, 8,  4,  9, 2 ],
					[  9, 4, 12,  3, 1 ]
				]


                         ]

        for A in mTests :
                print("#"*50)
                print("decomposition PLU de : ")

                AfficherMat( A )

                PLU = DecompositionPLU( A )

                matName = [ "P", "L", "U" ]

                for i in range( 3 ) :
                        print("")
                        print( matName[ i ], ":")
                        AfficherMat( PLU[ i ] )

                print("")
                print("produit P * L * U")
                print("( lourd, pour tester si on retrouve la matrice de depart ) :")
                AfficherMat( produit( produit( PLU[0], PLU[1] ), PLU[2] ) )

                print("")
        print("@"*100)