GNU Octave  9.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
dvnorm.f
Go to the documentation of this file.
1  DOUBLE PRECISION FUNCTION dvnorm (N, V, W)
2 C***BEGIN PROLOGUE DVNORM
3 C***SUBSIDIARY
4 C***PURPOSE Weighted root-mean-square vector norm.
5 C***TYPE DOUBLE PRECISION (SVNORM-S, DVNORM-D)
6 C***AUTHOR Hindmarsh, Alan C., (LLNL)
7 C***DESCRIPTION
8 C
9 C This function routine computes the weighted root-mean-square norm
10 C of the vector of length N contained in the array V, with weights
11 C contained in the array W of length N:
12 C DVNORM = SQRT( (1/N) * SUM( V(i)*W(i) )**2 )
13 C
14 C***SEE ALSO DLSODE
15 C***ROUTINES CALLED (NONE)
16 C***REVISION HISTORY (YYMMDD)
17 C 791129 DATE WRITTEN
18 C 890501 Modified prologue to SLATEC/LDOC format. (FNF)
19 C 890503 Minor cosmetic changes. (FNF)
20 C 930809 Renamed to allow single/double precision versions. (ACH)
21 C***END PROLOGUE DVNORM
22 C**End
23  INTEGER n, i
24  DOUBLE PRECISION v, w, sum
25  dimension v(n), w(n)
26 C
27 C***FIRST EXECUTABLE STATEMENT DVNORM
28  sum = 0.0d0
29  DO 10 i = 1,n
30  10 sum = sum + (v(i)*w(i))**2
31  dvnorm = sqrt(sum/n)
32  RETURN
33 C----------------------- END OF FUNCTION DVNORM ------------------------
34  END
double precision function dvnorm(N, V, W)
Definition: dvnorm.f:2