GNU Octave  4.0.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
svnorm.f
Go to the documentation of this file.
1  REAL FUNCTION svnorm (N, V, W)
2 C***BEGIN PROLOGUE SVNORM
3 C***SUBSIDIARY
4 C***PURPOSE Weighted root-mean-square vector norm.
5 C***TYPE SINGLE 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 SVNORM = SQRT( (1/N) * SUM( V(i)*W(i) )**2 )
13 C
14 C***SEE ALSO SLSODE
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 SVNORM
22 C**End
23  INTEGER N, I
24  REAL V, W, SUM
25  dimension v(n), w(n)
26 C
27 C***FIRST EXECUTABLE STATEMENT SVNORM
28  sum = 0.0e0
29  DO 10 i = 1,n
30  10 sum = sum + (v(i)*w(i))**2
31  svnorm = sqrt(sum/n)
32  RETURN
33 C----------------------- END OF FUNCTION SVNORM ------------------------
34  END
std::string dimension(void) const
octave_value sqrt(void) const
Definition: ov.h:1200