It would be useful to extend the norm2 intrinsic function to complex arrays, so that
norm2(z) returns sqrt(sum(conjg(z)* z)). Note that dot_product already appropriately handles the case of complex arrays so that in the case of a rank-1 array this is equivalent to sqrt(dot_product(z,z)).
This is such an obvious extension of norm2 that is is puzzling why it wasn't included in the first place. There must be implementation difficulties (e.g., the standard recommendation "that the processor compute the result without undue overflow or underflow") for it to have been omitted.
It would be useful to extend the
norm2
intrinsic function to complex arrays, so thatnorm2(z)
returnssqrt(sum(conjg(z)* z))
. Note thatdot_product
already appropriately handles the case of complex arrays so that in the case of a rank-1 array this is equivalent tosqrt(dot_product(z,z))
.This is such an obvious extension of
norm2
that is is puzzling why it wasn't included in the first place. There must be implementation difficulties (e.g., the standard recommendation "that the processor compute the result without undue overflow or underflow") for it to have been omitted.Edit:
sqrt(sum(conjg(z),z))
-->sqrt(sum(conjg(z)*z))