1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| program produit
implicit none
integer,parameter :: n=4
integer,parameter :: dp=kind(0.d00)
real(kind=dp), dimension (n,n):: M
real(kind=dp), dimension (n):: xvec=(/1,2,3,4/)
real(kind=dp), dimension (n):: y
real(kind=dp),
integer :: i,j
call produit_matrice_vecteur(M,x,y,n)
end program produit
subroutine produit_matrice_vecteur(mat,a,b,ndim)
implicit none
integer,parameter :: dp =kind(0.d00)
integer, intent(in) :: ndim
real(kind(0.0d00)), dimension(ndim,ndim):: mat
real(kind(0.0d00)), dimension(ndim):: a
real(kind(0.0d00)), intent(out) :: b
integer :: i,prod
prod=0.0d00
prod=prod+b
do i=1,ndim
prod=dot_product(mat(i,:),a)
end do
write(*,*)"prod=b",b
return
end subroutine produit_matrice_vecteur |
Partager