def image_quad_norm(inarray):
 if (inarray.shape[(-1)] != inarray.shape[(-2)]):
  return ((2 * np.sum(np.sum((np.abs(inarray) ** 2), axis=(-1)), axis=(-1))) - np.sum((np.abs(inarray[..., 0]) ** 2), axis=(-1)))
 else:
  return np.sum(np.sum((np.abs(inarray) ** 2), axis=(-1)), axis=(-1))

def image_quad_norm ( inarray ) : if ( inarray . shape [ ( - 1 ) ] != inarray . shape [ ( - 2 ) ] ) : return ( ( 2 * np . sum ( np . sum ( ( np . abs ( inarray ) ** 2 ) , axis = ( - 1 ) ) , axis = ( - 1 ) ) ) - np . sum ( ( np . abs ( inarray [ ... , 0 ] ) ** 2 ) , axis = ( - 1 ) ) ) else : return np . sum ( np . sum ( ( np . abs ( inarray ) ** 2 ) , axis = ( - 1 ) ) , axis = ( - 1 ) )
return the quadratic norm of images in fourier space .