def complex_magnitude(c):
    """
    Calculate the mangitude of a complex number or array of complex
    numbers. In the case of an array, this returns an array of the
    same shape as the input containing the magnitude of each complex
    number.
    """
    return (c * c.conjugate()) ** 0.5