program exemplos_funcions
integer, dimension(3) :: v = (/1,2,3/)
integer, dimension(3,3) :: a = reshape((/1,2,3,4,5,6,7,8,9/),shape(a)), b

print '("v=",3(i0," "))', v
print *, "a="
call imprime_matriz(a,3)
print '("dot(v,v)=",i0)', dot_product(v,v)
b = matmul(a,a)
print *, "a*a="
call imprime_matriz(b,3)
b = transpose(a)
print *, "a^T="
call imprime_matriz(b,3)
stop
end program exemplos_funcions 


!----------------------------------
subroutine imprime_matriz(a,n)
integer,dimension(n,n),intent(in) :: a
integer,intent(in) :: n
do i=1,n
  do j=1,n
    print '(i0," ",$)',a(i,j)
  end do
  print *,''
end do
return
end subroutine imprime_matriz