From ccea71af3d69bafec2008284984b8f6c8654ec60 Mon Sep 17 00:00:00 2001 From: DylanVsn <43576618+DylanVsn@users.noreply.github.com> Date: Mon, 10 Feb 2020 09:25:12 +0100 Subject: [PATCH] =?UTF-8?q?=C3=A0=20la=20recherche=20de=20la=20d=C3=A9fini?= =?UTF-8?q?tion=20des=20matrices=20d=C3=A9finies=20positives?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 5/code.py | 19 ++++++++++++++++++- 5/tableau_prof.txt | 5 ++++- 5/tp5.pdf | Bin 107901 -> 107907 bytes 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/5/code.py b/5/code.py index a12f45f..7e62a15 100644 --- a/5/code.py +++ b/5/code.py @@ -2,7 +2,14 @@ import numpy as np from copy import deepcopy as dp -def gradient_conjugué(A, b, nb=50): +""" + TP final MNI + auteurs: Cyril Colin + Dylan Voisin + date: 10/02/2020 +""" + +def gradient_conjugué(A: np.ndarray, b: np.ndarray, nb=50): p = dp(b) r = dp(b) x = np.zeroes(b.shape) @@ -10,3 +17,13 @@ def gradient_conjugué(A, b, nb=50): α = (r.transpose() @ r) / (p.transpose() @ A @ p) x = x + α @ p r = r - α @ A @ p + β = (r.transpose() @ r) / (r.transpose() @ r) + p = r + β @ p + return x + +if __name__ == '__main__': + A = np.array( + [ + [2, 3, 4] + ] + ) \ No newline at end of file diff --git a/5/tableau_prof.txt b/5/tableau_prof.txt index 1b3f226..0994f98 100644 --- a/5/tableau_prof.txt +++ b/5/tableau_prof.txt @@ -3,4 +3,7 @@ Méthode du gradient conjugué On cherche x tq A.x=b A matrice p×p symétrique définie positive (donc inversible) -On cherche à résoudre cette équation (les t dans la formule c'est la transposée) \ No newline at end of file +On cherche à résoudre cette équation (les t dans la formule c'est la transposée) + +jean.sequeira@univ-amu.fr +TPfinal_.py \ No newline at end of file diff --git a/5/tp5.pdf b/5/tp5.pdf index d9c2b8e3afb9e75077a9ae6c7420ecc2eb9947ae..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