Observatoire de Paris - Code Fortran  version1.0
tp_opt_doc.f90
Aller à la documentation de ce fichier.
1 
37 
38 program tp_opt_ok
39  use mod_initialise
40  use mod_mat
42  implicit none ! on force l'initialisation de toutes les variables
43 
47  type matrix
48  integer :: n
49  real(kind=8), pointer, dimension(:,:) :: val
50  type(initvar) :: initvaria
51  end type matrix
52 
53  real(kind=kind(1.d0)), allocatable :: a(:,:),b(:,:)
54  real(kind=kind(1.d0)), allocatable :: c(:,:) ! c = A*B
55  real(kind=kind(1.d0)), allocatable :: x(:)
56  real(kind=kind(1.d0)) :: ddot
57 
58  integer :: n ! taille des matrices
59 
60 
61 
62  n = 1000
63 
64  ! initialisation des matrices
65  allocate(a(n,n))
66  call inita(n,a)
67  allocate(b(n,n))
68  call initb(n,b)
69 
70  ! Multiplication A*B
71  allocate (c(n,n))
72  call matmul(n,a,b,c)
73 
74  ! initialisation de x
75  allocate(x(n))
76  call initx(n,x)
77 
78  ! Produit matrice vecteur: x = C*x
79  call matvec(n,c,x)
80 
81  ! Calcul de la norme
82  call norm(n,x)
83 
84 end program tp_opt_ok
program tp_opt_ok
Definition: tp_opt_doc.f90:38
subroutine matmul(n, a, b, c)
matrix-matrix product
Definition: mod_mat.f90:11
subroutine initb(n, b)
subroutine inita(n, a)
subroutine initx(n, x)
X initialization.