real(8) function norm_d(x,n)
real(8) x(n)

norm_d =maxval(dabs(x))
end
