[Numpy-discussion] method to calculate the magnitude squared

R Schumacher rays at blue-cove.com
Sat Sep 19 00:41:35 EDT 2015


At 09:16 PM 9/18/2015, you wrote:
>In communications and signal processing, it is 
>frequently necessary to calculate the power of a 
>signal.  This can be done with a function like the following:
>
>def magsq(z):
>Â Â  """
>Â Â  Return the magnitude squared of the real- or complex-valued input.
>Â Â  """
>Â Â  return z.real**2 + z.imag**2

Is that not the same as
     np.abs(z)**2 ?

- Ray





More information about the NumPy-Discussion mailing list