Вы находитесь на странице: 1из 28

cole Nationale Suprieure de Techniques Avances

Rsolution
des
systmes linaires

aot 2007 MA261 Introduction au calcul scientifique @Eric Lunville


Objectifs
Rsoudre des systmes linaires de faon efficace

A matrice carree dordre n


AX = B
B vecteur de dimension n

hyp : A est inversible


si A nest pas carree ou nest pas inversible et si B Im A
il existe un pseudo-inverse (methode des moindres carres)

Mthode de rsolution rapide et prcise ?


grand systme (n de lordre du million pour les pbs de mcanique)
problme de stockage (matrice symtrique, creuse, )
problme de temps calcul (algorithme efficace)
contrle de la qualit de la solution (stabilit et convergence)

1
Stabilit de la rsolution dun systme linaire
Soit A une perturbation de la matrice A , B une perturbation du vecteur B.
 1 
1) si A 1/ A  alors A+A est inversible

2) Soit X la solution de AX = B et Y = X + X la solution de


(A+A) Y = B + B alors
 
|X| (A) |B| A
+
|X| 1 (A) A / A |B| A
 1 
avec (A) = A A  conditionnement de A ((A) 1 et (I) =1)
     
2.23 1.2 2.06 2
A= B= = X =
1.3 0.7 1.2 2
     
2.23 1.2 2.061 1.5
A= B= = X =
1.3 0.7 1.201 1

3 4 |X|
|B| = 10 (A) 10 0.5 (50% derreur)
|X| 2
Principales mthodes de rsolution
Mthode du dterminant (Cramer)

calcul de linverse dune matrice dordre n :


calcul de n cofacteurs (determinant dordre n)
et du determinant de la matrice

Op(detn ) = nombre doperations pour calculer un determinant dordre n


Op(detn )= nOp(detn1 )=Op(detn )= O(n!)

Op(A1 ) =O(n + 1!)

pour n = 50 on obtient Op(A1 ) 1066 (temps de calcul > lage de lunivers!)

INUTILISABLE !!!

3
Mthodes directes (nb fini doprations)

combinaison linaire des quations du systme permettant de se ramener


un systme triangulaire :

u11 u12 ... u1n
u22 ... u2n

UX = C avec U = .. ..
. .
unn

se resout en calculant xn , puis xn1 , ...

Mthode dlimination de Gauss, lie la factorisation LU


Nombre doperations de ces methodes n3

4
Mthodes itratives (nb infini doprations)

suite de vecteurs (X0 donne) :

Xk+1 = f (Xk ) k 0 avec f (X) = X (X solution de AX = B)

fournit une approximation de la solution test darret |AXk B|

exemple : methode du gradient a pas constant (A symetrique)

Xk+1 = Xk (AXk B)

converge si (I A) <1 ((M) = max |i (M)| rayon spectral)


i=1,n
Il faut que le pas ne soit pas trop grand.
Nombreuses autres mthodes : Gauss-Seidel, SSOR, grad. conjugu, GMRES,
convergence pas toujours garantie
prconditionnement possible
peuvent tre trs performantes
5
Structure et stockage des matrices
Tirer partie de la structure creuse (nombreux termes nuls) de la matrice :
gain de place mmoire (stockages adapts)
gain de temps de calcul (algorithmes adapts)

Matrice symtrique ou antisymtrique : stockage de la moiti

Types de stockage
x x
stockage bande
x x x
rangement diagonal x x x
a21 a32 a43 ... an,n1 a11 a22 ... ann a12 a23 ... an1,n x x x
x x x
rangement ligne
x x x
a11 a12 a21 a22 a23 a32 a33 a34 ... an,n1 ann
x x x
x x

6
stockage profil (skyline) 1 2 3 4 5
1 x x x x
profil superieur : p+
i = max{j/aij = 0} 2 x x x

profil inferieur : p
i = min{j/aij = 0} 3 x x x x x x x

4 x x x
+
aij = 0 si j < p
i ou j > p i
x x x x x
x x x
x x x
p
4 =3 p+
4 =5 x x x x x x x x

rangement ligne a11 a12 a13 a14 a21 a22 a23 a31 a32 a33 ...

variante ligne/colonne
variante pour matrice non symtrique profil symtrique
existe des algorithmes doptimisation de profil (Cutill-MacKee)
compatible avec tous les algorithmes de rsolution

7
stockage morse
1 2 3 4 5
Seuls les termes non nuls sont stocks 1 x x x
2 x x
pour chaque ligne i on stocke 3 x x x x x

4 x x x
les coefficients non nuls x x x x
les indices des colonnes des coefficients x x x
x x
ligne 1 a11 a12 a14 124
x x x x
ligne 2 a21 a23 13

double la taille du stockage


peut tre moins intressant que le stockage profil
stockage des matrices creuse (sparse) dans MATLAB
nest pas compatible avec les algorithmes de factorisation
trs adapt aux mthodes itratives

8
Mthodes directes
Rsolution des systmes triangulaires

L matrice triangulaire inferieure : Lij = 0 si j > i

U matrice triangulaire superieure : Uij = 0 si j < i

 
On a det L = Lii det U = Uii
i i
et L (resp. U) est inversible ssi Lii = 0 i (resp. Uii = 0 i)

9
Algorithmes de rsolution

Resolution de LX = B Resolution de UX = B
pour i = 1, n pour i = n, 1
Xi = Bi Xi = Bi
pour j = 1, i 1 pour j = i + 1, n
Xi = Xi Lij Xj Xi = Xi Uij Xj
Xi = Xi /Lii Xi = Xi /Uii

Nb operations n2

X=B
Resolution de LX = B pour j = 1, n
variante colonne Xj = Xj /Ljj
pour i = j + 1, n
Xi = Xi Lij Xj
10
en stockage profil

Resolution de LX = B Resolution de UX = B
pour i = 1, n pour i = n, 1
Xi = Bi Xi = Bi
pour j = p i ,i1 pour j = i + 1, p+
i
Xi = Xi Lij Xj Xi = Xi Uij Xj
Xi = Xi /Lii Xi = Xi /Uii

11
Elimination de Gauss

Se ramener un systme triangulaire suprieur par combinaison linaire de lignes



A1 A11 A12 A23 B1
A2 A A A B2
21 22 23

A3 A31 A32 A33 B3
.. .. .. .. .. ..
. . . . . .

itration 1 si A11 = 0
A21 A21
A12 = A2 A1 B21 = B2 B1
A11 A11
A31 A21
A13 = A3 A1 B31 = B3 B1
A11 A11
plus generalement :

Ai1 Ai1
A1i = Ai A1 Bi1 = Bi B1 i = 2, n
A11 A11
12
matrice A1 a lissue de la premiere iterations

A11 A12 A23 B1 premire ligne non modifie
0 A122 A123 B21

A1 = 0 A132 A133 B31

.. .. .. ..
0 . . . .

itration 2
On recommence le processus sur la sous matrice dordre n 1
1 1
A22 A123 B2
A132 A133 B31

.. .. .. ..
. . . .

et ainsi de suite on realise n 1 iterations

13
Algorithme dlimination de Gauss

pour k = 1, n 1 algorithme auto-crasant


si |Akk | stop pivot trop petit
pour i = k + 1, n
p = Aik /Akk
pour j = k + 1, n
Aij = Aij p Akj
Aik = 0
Bi = Bi p Bk

Nb operations 23 n3

14
Stratgie de permutation

Pivot trs petit ou nul litration k



A11 A12 A13 A1n recherche de i0 > k tel que
0 0 A23 |Ai0 k | |Aik | i > k

0 0 Akk Akn

.. .. .. .. si |Ai0 k | alors
. . . .
matrice non inversible
.. ..
. . Ank Ann


A11 A12 A13 A1n
0 0 A23

0 0 Akk Akn

permutation des lignes k et i0 .. .. ..
. . .

.. ..
. . Ai0 k Ai0 n

.. .. ..
. . .

15
Algorithme avec permutation
On ne ralise pas rellement les permutations, on utilise un vecteur q contenant
les indices permuts

pour i = 1, n q(i) = i (initialisation du vecteur de permutation)


pour k = 1, n 1
si |Akk |
trouver i0 > k tel que |Ai0 k | |Aik | i > k
si |Ai0 k | alors matrice non inversible
t = q(k) q(k) = q(i0 ) q(i0 ) = t (permutation des indices)
pour i = k + 1, n
p = Aq(i)k /Aq(k)k
pour j = k + 1, n
Aq(i)j = Aq(i)j p Aq(k)j
Aq(i)k = 0
Bq(i) = Bq(i) p Bq(k)
16
Elimination avec un stockage profil

pour k = 1, n 1 mme algorithme


si |Akk | stop pivot trop petit
pour i = k + 1, n
p = Aik /Akk
+ boucle seulement
pour j = max(k + 1, p
i ), pi
sur les coefficients non nuls
Aij = Aij p Akj
Aik = 0
Bi = Bi p Bk

Lalgorithme avec permutation nest pas compatible avec le stockage profil


car le profil se modifie

17
Factorisation LU
Llimination de Gauss est une mthode de factorisation
L triangulaire inf.
A = LU
U triangulaire sup.

1
Iteration k
..
.

1

.. ..
A(k) = L(k) A(k1) L(k) = . .

(k1)
Ai,k ..
.
(k1)
Ak,k

..
. 1
U = A(n1) = L(n1) ...L(1) A (k) 1
L = 2I L(k)
det L(k) = 1 L(k) inversible
triangulaire inferieure
(1) 1 (n1) 1
L= L ... L triangulaire inferieure

finalement A = LU avec Lii = 1 i = 1, n


18
Algorithme de factorisation

pour k = 1, n 1

Lkk = Akk Lkj Ujk
j<k

pour i = k
+ 1, n 
Nb operations
Lik = Aik Lij Ujk /Ukk si Ukk = 0
j<k 2n3 /3
Lkk = 1

pour i = k + 1, n
 

Uki = Aki Lkj Uji
j<k


formules obtenues a partir de A = LU Aik = Lij Ujk
calcul de L colonne par colonne et U ligne par ligne
variante L ligne par ligne et U colonne par colonne (cf poly)
19
Permutation de ligne
si Ukk = 0 (|Ukk | ) echec de lalgorithme strategie de permutation
matrice de permutation des lignes ik et k (ik > k) a literation k

1
..
.

0 1
k
Pik ,k = .. .. .. A(k) = L(k) Pik ,k A(k1)
. . .

1 0 ik

.. ..
. . 1
On montre alors (voir poly p45) que
U = L(n1) L(n2) L(1) Pin1 ,n1 Pi1 ,1 A
avec L(k) = Pin1 ,n1 Pik+1 ,k+1 L(k) Pik+1 ,k+1 Pin1 ,n1 (triang. inf.)

si A est inversible, il existe une matrice de permutation P telle que


PA = LU
L mat. triang. inf.a diag. unite, U mat. triang. sup
20
Factorisation LU des matrices creuses

P (resp P + ) le profil inferieur (resp. superieur) de A


Aik = 0 pour k < Pi ou k > Pi+

formules de lelimination de Gauss


 

Lik = Aik Lij Ujk /Ukk
j<k
 

Uki = Aki Lkj Uji
j<k

si Lij = 0 j < k et j < Pi alors Lik = 0 pour k < Pi ou k > Pi+


idem pour Uki avec P +
Par recurrence on montre que L a P pour profil inferieur
et U a P + pour profil superieur :

la factorisation LU sans permutation conserve les profils


21
Algorithme de factorisation, stockage profil

pour k = 1, n 1

Lkk = Akk Lkj Ujk
Pk j<k
pour i = k + 1, n
si k Pi alors


Lik = Aik Lij Ujk /Ukk si Ukk = 0
Pk j<k
Lkk = 1
pour i = k + 1, Pk+


Uki = Aki Lkj Uji
Pk j<k

22
Variante Gauss-Jordan

A partir de la factorisation A = LU on obtient facilement la factorisation :


A = LDU (unique)

avec D matrice diagonale Dii = Uii et L et U a diagonale unite


relation simple entre U et U
 ik = Uik /Ukk = Uik /Dkk
U i = 1, k

23
Cas des matrices symtriques
Si A est une matrice symetrique factorisable LU
alors A admet la factorisation

A = LDLt
avec D matrice diagonale et L matrice triang. inferieure a diag. unite

dms A = At et A = LDU = LDU = Ut DLt


unicite de la factorisation LDU = Ut = L et U = Lt

algorithme
pour k = 1, n
Lkk = 1
Nb operations
Dkk = Akk L2kj
j<k n3 /3
pour i = k+ 1, n 

Lik = Aik Lij Ljk /Dkk si Dkk = 0
j<k

24
Cas des matrices symtriques dfinies positives
definie positive : (AX, X) > 0 X = 0

Si A est une matrice symetrique definie positive et factorisable LU


alors A admet la factorisation

A = LDLt avec Dii > 0 i = 1, n

dms 0 < (AX, X) = (LDLt X, X) = (DLt X, Lt X)


1
Lt inversible (diag. unite), Y = 0 on prend X = (Lt ) Y = 0
= (DY, Y ) > 0 Y = 0 = Dii > 0 i = 1, n (D matrice diagonale)


On peut introduire D matrice diagonale de coefficient Dii


poser L = L D pour obtenir

la factorisation dite de Choleski L


A =L t

25
Algorithme de factorisation de Choleski

pour k = 1,
n  12

Lkk = Akk L2kj
j<k
forme colonne pour i = k
+ 1, n 

Lik = Aik Lij Ljk /Lkk
j<k

Nb operations
n3 /3 pour k = 1, n
pour i = 1,k 1 

Lki = Aki Lkj Lij /Lii
forme ligne j<i
  12

Lkk = Akk L2kj
j<k

Sadapte au stockage profil


26
Conclusions

Mthode du dterminant proscrire


Rsolution facile des systmes triangulaires
Mthodes de type factorisation
peuvent tre efficaces (stockage profil)
cas particuliers (symtriques, def pos.)
Mthodes itratives adaptes au stockage morse ( optimal )

27
17

Вам также может понравиться

  • Examen Avec Solution en Électricité Industrielle-2015
    Examen Avec Solution en Électricité Industrielle-2015
    Документ5 страниц
    Examen Avec Solution en Électricité Industrielle-2015
    HØu ÇîNe
    100% (2)
  • Modelisation RE 1 PDF
    Modelisation RE 1 PDF
    Документ41 страница
    Modelisation RE 1 PDF
    HØu ÇîNe
    Оценок пока нет
  • Solution de TP
    Solution de TP
    Документ10 страниц
    Solution de TP
    HØu ÇîNe
    100% (2)
  • 1 - Fractures Généralités
    1 - Fractures Généralités
    Документ134 страницы
    1 - Fractures Généralités
    zarkader
    Оценок пока нет
  • CH1
    CH1
    Документ15 страниц
    CH1
    HØu ÇîNe
    Оценок пока нет
  • Abdou
    Abdou
    Документ6 страниц
    Abdou
    HØu ÇîNe
    0% (1)
  • Crrection Examen
    Crrection Examen
    Документ7 страниц
    Crrection Examen
    HØu ÇîNe
    Оценок пока нет
  • Cours de Protection
    Cours de Protection
    Документ123 страницы
    Cours de Protection
    Youssef Ultras ✔
    93% (15)
  • Les Emetteurs Notice Sonelgaz PDF
    Les Emetteurs Notice Sonelgaz PDF
    Документ60 страниц
    Les Emetteurs Notice Sonelgaz PDF
    HØu ÇîNe
    Оценок пока нет
  • 2826
    2826
    Документ116 страниц
    2826
    HØu ÇîNe
    Оценок пока нет
  • Cours Communication Entreprise
    Cours Communication Entreprise
    Документ45 страниц
    Cours Communication Entreprise
    HØu ÇîNe
    Оценок пока нет
  • Protection Des Personnes 2 Bac Science Dingenieur
    Protection Des Personnes 2 Bac Science Dingenieur
    Документ1 страница
    Protection Des Personnes 2 Bac Science Dingenieur
    HØu ÇîNe
    Оценок пока нет
  • Devoirs Surveilles Et Examens
    Devoirs Surveilles Et Examens
    Документ36 страниц
    Devoirs Surveilles Et Examens
    HØu ÇîNe
    100% (1)
  • Important
    Important
    Документ37 страниц
    Important
    Youssef Samlali
    Оценок пока нет
  • Ratrapage Math - Vi 08 - 09
    Ratrapage Math - Vi 08 - 09
    Документ6 страниц
    Ratrapage Math - Vi 08 - 09
    Käm Îlîă
    Оценок пока нет
  • Polycopie ANI
    Polycopie ANI
    Документ68 страниц
    Polycopie ANI
    marwen12345
    Оценок пока нет
  • Cours
    Cours
    Документ140 страниц
    Cours
    Kh Mh
    100% (1)
  • Matrice PDF
    Matrice PDF
    Документ63 страницы
    Matrice PDF
    Baba
    Оценок пока нет
  • C3 Resolution Systemes Lineaires Enrico Naji
    C3 Resolution Systemes Lineaires Enrico Naji
    Документ73 страницы
    C3 Resolution Systemes Lineaires Enrico Naji
    HajarYazine
    Оценок пока нет
  • Cours Analyse Numerique
    Cours Analyse Numerique
    Документ24 страницы
    Cours Analyse Numerique
    zakariae ben-akka
    Оценок пока нет
  • Chap Syst Part 3 A12 Rob
    Chap Syst Part 3 A12 Rob
    Документ25 страниц
    Chap Syst Part 3 A12 Rob
    OURO-AGOUDA
    Оценок пока нет
  • M148 - Cours (Chapitre 5)
    M148 - Cours (Chapitre 5)
    Документ34 страницы
    M148 - Cours (Chapitre 5)
    ايوب لحنيش
    Оценок пока нет
  • 1ExamenSTMethNum2010 2011 PDF
    1ExamenSTMethNum2010 2011 PDF
    Документ1 страница
    1ExamenSTMethNum2010 2011 PDF
    azzam
    Оценок пока нет
  • Anciens de Sujets Du Semestre 6
    Anciens de Sujets Du Semestre 6
    Документ8 страниц
    Anciens de Sujets Du Semestre 6
    NSANGOU
    Оценок пока нет
  • Chapitre 03
    Chapitre 03
    Документ20 страниц
    Chapitre 03
    ma llek
    Оценок пока нет
  • Serie de Revision
    Serie de Revision
    Документ6 страниц
    Serie de Revision
    hiba mhiri
    Оценок пока нет
  • TD Num PDF
    TD Num PDF
    Документ14 страниц
    TD Num PDF
    Ik Ram
    Оценок пока нет
  • Poly MNB
    Poly MNB
    Документ92 страницы
    Poly MNB
    Chaoune Med
    Оценок пока нет
  • CR TP1 PDF
    CR TP1 PDF
    Документ14 страниц
    CR TP1 PDF
    azzam
    Оценок пока нет
  • Résolution Numérique Des Systèmes Linéaires
    Résolution Numérique Des Systèmes Linéaires
    Документ20 страниц
    Résolution Numérique Des Systèmes Linéaires
    edrissiadnane
    Оценок пока нет
  • Corrige Exam 1 H09
    Corrige Exam 1 H09
    Документ11 страниц
    Corrige Exam 1 H09
    azzam
    Оценок пока нет
  • Correction DS 2017
    Correction DS 2017
    Документ4 страницы
    Correction DS 2017
    Adem Dhokar
    Оценок пока нет
  • Devoir Analyse Numerique smp6 2020
    Devoir Analyse Numerique smp6 2020
    Документ5 страниц
    Devoir Analyse Numerique smp6 2020
    Hachem Fartout
    Оценок пока нет
  • TP Scilab
    TP Scilab
    Документ14 страниц
    TP Scilab
    Latasha Miller
    Оценок пока нет
  • Systeme Lineaire
    Systeme Lineaire
    Документ26 страниц
    Systeme Lineaire
    emile lovi
    Оценок пока нет
  • TP ALL Outils 2015
    TP ALL Outils 2015
    Документ32 страницы
    TP ALL Outils 2015
    buss compte
    Оценок пока нет
  • Serie 1 MProGC
    Serie 1 MProGC
    Документ2 страницы
    Serie 1 MProGC
    Medlemine Aghrabatte
    Оценок пока нет
  • TDS4 Serie5 Presentation - B
    TDS4 Serie5 Presentation - B
    Документ16 страниц
    TDS4 Serie5 Presentation - B
    asmaaaitoumezouar
    Оценок пока нет
  • Epreuve Informatique MP CNC 2022
    Epreuve Informatique MP CNC 2022
    Документ13 страниц
    Epreuve Informatique MP CNC 2022
    AYMAN LARGOU
    Оценок пока нет
  • Smi Sma PDF
    Smi Sma PDF
    Документ100 страниц
    Smi Sma PDF
    azzam
    Оценок пока нет
  • Stra
    Stra
    Документ21 страница
    Stra
    Imen Naija
    Оценок пока нет
  • TD Meth Num
    TD Meth Num
    Документ7 страниц
    TD Meth Num
    Yrdnay Zafindraisaha
    Оценок пока нет
  • Cour Methode Numerique
    Cour Methode Numerique
    Документ24 страницы
    Cour Methode Numerique
    Mabrouk Alaya
    Оценок пока нет
  • Résumé AN
    Résumé AN
    Документ4 страницы
    Résumé AN
    Wiem Melki
    Оценок пока нет