GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
ddanrm.f
Go to the documentation of this file.
1  DOUBLE PRECISION FUNCTION ddanrm (NEQ, V, WT, RPAR, IPAR)
2 C***BEGIN PROLOGUE DDANRM
3 C***SUBSIDIARY
4 C***PURPOSE Compute vector norm for DDASSL.
5 C***LIBRARY SLATEC (DASSL)
6 C***TYPE DOUBLE PRECISION (SDANRM-S, DDANRM-D)
7 C***AUTHOR PETZOLD, LINDA R., (LLNL)
8 C***DESCRIPTION
9 C-----------------------------------------------------------------------
10 C THIS FUNCTION ROUTINE COMPUTES THE WEIGHTED
11 C ROOT-MEAN-SQUARE NORM OF THE VECTOR OF LENGTH
12 C NEQ CONTAINED IN THE ARRAY V,WITH WEIGHTS
13 C CONTAINED IN THE ARRAY WT OF LENGTH NEQ.
14 C DDANRM=SQRT((1/NEQ)*SUM(V(I)/WT(I))**2)
15 C-----------------------------------------------------------------------
16 C***ROUTINES CALLED (NONE)
17 C***REVISION HISTORY (YYMMDD)
18 C 830315 DATE WRITTEN
19 C 901009 Finished conversion to SLATEC 4.0 format (F.N.Fritsch)
20 C 901019 Merged changes made by C. Ulrich with SLATEC 4.0 format.
21 C 901026 Added explicit declarations for all variables and minor
22 C cosmetic changes to prologue. (FNF)
23 C***END PROLOGUE DDANRM
24 C
25  INTEGER neq, ipar(*)
26  DOUBLE PRECISION v(neq), wt(neq), rpar(*)
27 C
28  INTEGER i
29  DOUBLE PRECISION sum, vmax
30 C
31 C***FIRST EXECUTABLE STATEMENT DDANRM
32  ddanrm = 0.0d0
33  vmax = 0.0d0
34  DO 10 i = 1,neq
35  IF(abs(v(i)/wt(i)) .GT. vmax) vmax = abs(v(i)/wt(i))
36 10 CONTINUE
37  IF(vmax .LE. 0.0d0) GO TO 30
38  sum = 0.0d0
39  DO 20 i = 1,neq
40 20 sum = sum + ((v(i)/wt(i))/vmax)**2
41  ddanrm = vmax*sqrt(sum/neq)
42 30 CONTINUE
43  RETURN
44 C------END OF FUNCTION DDANRM------
45  END
double precision function ddanrm(NEQ, V, WT, RPAR, IPAR)
Definition: ddanrm.f:2
static T abs(T x)
Definition: pr-output.cc:1678