ddanrm.f

Go to the documentation of this file.
00001       DOUBLE PRECISION FUNCTION DDANRM (NEQ, V, WT, RPAR, IPAR)
00002 C***BEGIN PROLOGUE  DDANRM
00003 C***SUBSIDIARY
00004 C***PURPOSE  Compute vector norm for DDASSL.
00005 C***LIBRARY   SLATEC (DASSL)
00006 C***TYPE      DOUBLE PRECISION (SDANRM-S, DDANRM-D)
00007 C***AUTHOR  PETZOLD, LINDA R., (LLNL)
00008 C***DESCRIPTION
00009 C-----------------------------------------------------------------------
00010 C     THIS FUNCTION ROUTINE COMPUTES THE WEIGHTED
00011 C     ROOT-MEAN-SQUARE NORM OF THE VECTOR OF LENGTH
00012 C     NEQ CONTAINED IN THE ARRAY V,WITH WEIGHTS
00013 C     CONTAINED IN THE ARRAY WT OF LENGTH NEQ.
00014 C        DDANRM=SQRT((1/NEQ)*SUM(V(I)/WT(I))**2)
00015 C-----------------------------------------------------------------------
00016 C***ROUTINES CALLED  (NONE)
00017 C***REVISION HISTORY  (YYMMDD)
00018 C   830315  DATE WRITTEN
00019 C   901009  Finished conversion to SLATEC 4.0 format (F.N.Fritsch)
00020 C   901019  Merged changes made by C. Ulrich with SLATEC 4.0 format.
00021 C   901026  Added explicit declarations for all variables and minor
00022 C           cosmetic changes to prologue.  (FNF)
00023 C***END PROLOGUE  DDANRM
00024 C
00025       INTEGER  NEQ, IPAR(*)
00026       DOUBLE PRECISION  V(NEQ), WT(NEQ), RPAR(*)
00027 C
00028       INTEGER  I
00029       DOUBLE PRECISION  SUM, VMAX
00030 C
00031 C***FIRST EXECUTABLE STATEMENT  DDANRM
00032       DDANRM = 0.0D0
00033       VMAX = 0.0D0
00034       DO 10 I = 1,NEQ
00035         IF(ABS(V(I)/WT(I)) .GT. VMAX) VMAX = ABS(V(I)/WT(I))
00036 10      CONTINUE
00037       IF(VMAX .LE. 0.0D0) GO TO 30
00038       SUM = 0.0D0
00039       DO 20 I = 1,NEQ
00040 20      SUM = SUM + ((V(I)/WT(I))/VMAX)**2
00041       DDANRM = VMAX*SQRT(SUM/NEQ)
00042 30    CONTINUE
00043       RETURN
00044 C------END OF FUNCTION DDANRM------
00045       END
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines