V3FIT
vnorm.f
1  FUNCTION vnorm (n, v, w)
2  USE stel_kinds
3  IMPLICIT NONE
4 C-----------------------------------------------
5 C D u m m y A r g u m e n t s
6 C-----------------------------------------------
7  INTEGER n
8  REAL(rprec), DIMENSION(n) :: v, w
9 C-----------------------------------------------
10 C L o c a l V a r i a b l e s
11 C-----------------------------------------------
12  REAL(rprec) :: sum0, vnorm
13 C-----------------------------------------------
14 clll. optimize
15 c-----------------------------------------------------------------------
16 c this function routine computes the weighted root-mean-square norm
17 c of the vector of length n contained in the array v, with weights
18 c contained in the array w of length n..
19 c vnorm = SQRT( (1/n) * SUM( v(i)*w(i) )**2 )
20 c-----------------------------------------------------------------------
21  sum0 = sum((v*w)**2)
22  vnorm = sqrt(sum0/(n))
23 
24  END FUNCTION vnorm