Outils pour utilisateurs

Outils du site


math:matrices:systeme_lineaire:directe

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
math:matrices:systeme_lineaire:directe [2019/03/17 23:02] – Ajout de l'implémentation de Cholesky en Python rootmath:matrices:systeme_lineaire:directe [2020/04/28 23:00] (Version actuelle) – mhtml -> html root
Ligne 174: Ligne 174:
  
 ====Méthode de Gauss / Crout : LU (A non symétrique)==== ====Méthode de Gauss / Crout : LU (A non symétrique)====
-Valable pour une matrice carrée définie positive.+A doit être inversible (pas de pivot nul).
  
 Étape 1 : Étape 1 :
Ligne 258: Ligne 258:
 Méthode : Méthode :
  
-[[https://en.wikipedia.org/wiki/Cholesky_decomposition#The_Cholesky_algorithm|The Cholesky algorithm]] {{ math:matrices:systeme_lineaire:directe:cholesky_decomposition_-_wikipedia.mhtml |Archive 17/10/2018}}+[[https://en.wikipedia.org/wiki/Cholesky_decomposition#The_Cholesky_algorithm|The Cholesky algorithm]] {{ :math:matrices:systeme_lineaire:directe:cholesky_decomposition_-_wikipedia_2020-04-28_10_55_30_pm_.html |Archive du 13/04/2020 le 28/04/2020}}
  
 Soit Soit
Ligne 432: Ligne 432:
 def cholesky(A): def cholesky(A):
     n = len(A)     n = len(A)
-    L = np.matrix(np.zeros((n,n), dtype=np.complex64))+    L = np.zeros((n,n), dtype=np.complex64)
     L[0,0] = cmath.sqrt(A[0,0])     L[0,0] = cmath.sqrt(A[0,0])
     L[1:,0] = A[1:,0]/L[0,0]     L[1:,0] = A[1:,0]/L[0,0]
-    +
     for j in range(1,n):     for j in range(1,n):
         if (not np.isreal(A[j, j])):         if (not np.isreal(A[j, j])):
 +# Matrice A non hermitienne
             L.fill(np.nan)             L.fill(np.nan)
             return (L,-1)             return (L,-1)
-           + 
-        carre = A[j,j] - L[j,:j]*L[j,:j].H+        carre = A[j,j] - np.dot(L[j,:j],L[j,:j].transpose().conjugate()) 
 +        if (carre <= 0): 
 +# Matrice non définie strictement positive 
 +            L.fill(np.nan) 
 +            return (L,0)
         L[j,j] = cmath.sqrt(carre)         L[j,j] = cmath.sqrt(carre)
  
         for i in range(j+1,n):         for i in range(j+1,n):
             if (A[i,j] != np.conjugate(A[j,i])):             if (A[i,j] != np.conjugate(A[j,i])):
 +# Matrice A non hermitienne
                 L.fill(np.nan)                 L.fill(np.nan)
                 return (L,0)                 return (L,0)
-            L[i,j]=(A[i,j]-L[i,0:i]*L[j,0:i].H)/L[j,j]+            L[i,j]=(A[i,j]-np.dot(L[i,:i],L[j,:i].transpose().conjugate()))/L[j,j]
  
     return (L,1)     return (L,1)
 +
 +
 +A4 = np.array(
 +        [[  4,  12, -16],
 +         [ 12,  37, -43+2j],
 +         [-16, -43-2j,  98]], dtype=np.complex64)
 +(L, sol) = cholesky(A4)
 +print ("L",L)
 +print ("sol",sol)
 +print (L.dot(L.transpose().conjugate()))
 </code> </code>
  
Ligne 477: Ligne 493:
 $$Q = \prod_{k=1}^{N-1}Q_i$$ $$Q = \prod_{k=1}^{N-1}Q_i$$
  
-[[https://fr.wikipedia.org/wiki/D%C3%A9composition_QR|Décomposition QR]] {{ :math:matrices:systeme_lineaire:directe:decomposition_qr_wikipedia.mhtml |Archive du 06/02/2019}}+[[https://fr.wikipedia.org/wiki/D%C3%A9composition_QR|Décomposition QR]] {{ :math:matrices:systeme_lineaire:directe:decomposition_qr_wikipedia_2020-04-28_10_55_29_pm_.html |Archive du 16/05/2019 le 28/04/2020}}
  
 [[http://metronu.ulb.ac.be/MATH-H-202/an_ch3.pdf|Factorisation QR et systèmes surdéterminés]] {{ :math:matrices:systeme_lineaire:directe:an_ch3.pdf |Archive du 06/02/2019}} [[http://metronu.ulb.ac.be/MATH-H-202/an_ch3.pdf|Factorisation QR et systèmes surdéterminés]] {{ :math:matrices:systeme_lineaire:directe:an_ch3.pdf |Archive du 06/02/2019}}
math/matrices/systeme_lineaire/directe.1552860123.txt.gz · Dernière modification : 2019/03/17 23:02 de root