function norm2( in ) result ( res ) implicit none real(Float64),dimension(:) :: in real(Float64) :: res res = sqrt(sum( in(:)**2 )) end function norm2