dvnorm_default Function

private function dvnorm_default(me, n, v, w)

weighted root-mean-square vector norm.

this function routine computes the weighted root-mean-square norm of the vector of length n contained in the array v, with weights contained in the array w of length n:

    dvnorm = sqrt( (1/n) * sum( v(i)*w(i) )**2 )

Author

  • hindmarsh, alan c., (llnl)

Revision history

  • 791129 date written
  • 890501 modified prologue to slatec/ldoc format. (fnf)
  • 890503 minor cosmetic changes. (fnf)
  • 930809 renamed to allow single/real(wp) versions. (ach)

Arguments

Type IntentOptional Attributes Name
class(dvode_t), intent(inout) :: me
integer, intent(in) :: n
real(kind=wp), intent(in) :: v(n)
real(kind=wp), intent(in) :: w(n)

Return Value real(kind=wp)


Source Code

      real(wp) function dvnorm_default(me,n,v,w)

      class(dvode_t),intent(inout) :: me
      integer,intent(in) :: n
      real(wp),intent(in) :: v(n)
      real(wp),intent(in) :: w(n)

      integer :: i
      real(wp) :: sum

      sum = zero
      do i = 1 , n
         sum = sum + (v(i)*w(i))**2
      enddo
      dvnorm_default = sqrt(sum/n)

      end function dvnorm_default