-
Notifications
You must be signed in to change notification settings - Fork 2
/
wnorm.f
37 lines (37 loc) · 1.02 KB
/
wnorm.f
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
31
32
33
34
35
36
37
DOUBLE PRECISION FUNCTION WNORM(N,Z,XW)
INTEGER N
DOUBLE PRECISION Z(N), XW(N)
C ------------------------------------------------------------
C
C* Summary :
C
C E N O R M : Return the norm to be used in exit (termination)
C criteria
C
C* Input parameters
C ================
C
C N Int Number of equations/unknowns
C Z(N) Dble The vector, of which the norm is to be computed
C XW(N) Dble The scaling values of Z(N)
C
C* Output
C ======
C
C WNORM(N,Z,XW) Dble The mean square root norm of Z(N) subject
C to the scaling values in XW(N):
C = Sqrt( Sum(1,...N)((Z(I)/XW(I))**2) / N )
C
C ------------------------------------------------------------
C* End Prologue
INTEGER I
DOUBLE PRECISION S
C* Begin
S = 0.0D0
DO 10 I=1,N
S = S + ( Z(I)/XW(I) ) ** 2
10 CONTINUE
WNORM = DSQRT( S / DBLE(FLOAT(N)) )
C End of function WNORM
RETURN
END