dvnorm Function

pure function dvnorm(n, v, w)

NAME

dvnorm(3f) - [M_odepack] Weighted root-mean-square vector norm.

DESCRIPTION

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 )

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: n
real(kind=dp), intent(in) :: v(n)
real(kind=dp), intent(in) :: w(n)

Return Value real(kind=dp)


Variables

Type Visibility Attributes Name Initial
integer, public :: i
real(kind=dp), public :: sum

Source Code

pure function dvnorm (n, v, w)
integer,intent(in)       :: n
real(kind=dp),intent(in) :: v(n)
real(kind=dp),intent(in) :: w(n)
real(kind=dp)            :: dvnorm

integer                  :: i
real(kind=dp)            :: sum

   sum = 0.0d0
   do i = 1,n
       sum = sum + (v(i)*w(i))**2
   enddo
   dvnorm = sqrt(sum/n)

end function dvnorm