GNU Octave  3.8.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
vnorm.f
Go to the documentation of this file.
1  DOUBLE PRECISION FUNCTION vnorm (N, V, W)
2 CLLL. OPTIMIZE
3 C-----------------------------------------------------------------------
4 C THIS FUNCTION ROUTINE COMPUTES THE WEIGHTED ROOT-MEAN-SQUARE NORM
5 C OF THE VECTOR OF LENGTH N CONTAINED IN THE ARRAY V, WITH WEIGHTS
6 C CONTAINED IN THE ARRAY W OF LENGTH N..
7 C VNORM = SQRT( (1/N) * SUM( V(I)*W(I) )**2 )
8 C-----------------------------------------------------------------------
9  INTEGER n, i
10  DOUBLE PRECISION v, w, sum
11  dimension v(n), w(n)
12  sum = 0.0d0
13  DO 10 i = 1,n
14  10 sum = sum + (v(i)*w(i))**2
15  vnorm = dsqrt(sum/dble(n))
16  RETURN
17 C----------------------- END OF FUNCTION VNORM -------------------------
18  END