dvnorm(3f) - [M_odepack] 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 )
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | n | |||
real(kind=dp), | intent(in) | :: | v(n) | |||
real(kind=dp), | intent(in) | :: | w(n) |
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public | :: | i | ||||
real(kind=dp), | public | :: | sum |
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