C VECUNI SOURCE CHAT 05/01/13 04:05:26 5004 c--------------------------------------------------------------------- c SUBROUTINE VECUNI (N, V, MODUL) c c===================================================================== c = c This routine computes the length of the vector 'v' and converts = c it to a unit one. = c = c===================================================================== IMPLICIT INTEGER(I-N) integer*4 n real*8 v (n), modul c integer*4 i real*8 moduli c modul = 0.0 d0 do i = 1, n modul = modul + v (i) **2 end do c if (modul .eq. 1.0 d0) return c modul = SQRT (modul) moduli = 1.0 d0 / modul do i = 1, n v (i) = v (i) * moduli end do c return end