I have a function of an integer and a numpy array. It accepts a single int and a 1D array, or alternatively it accepts an array of ints and a 2D array which are then broadcast, e.g.
def norm_matrix(l, cov):
norm_cov = cov / (l*(l+1))
return norm_cov
My question is how to write the type hints in this case. Does this work?
def norm_matrix(
l: Union[int, np.ndarray],
cov: np.ndarray
):
and is there a better way to do it?