def _complex_matrix_multiplication(input_tensor, other_tensor, mult_func):
    """
    Perform a matrix multiplication, helper function for complex_bmm and complex_mm.

    Parameters
    ----------
    input_tensor : torch.Tensor
    other_tensor : torch.Tensor
    mult_func : Callable
        Multiplication function e.g. torch.bmm or torch.mm

    Returns
    -------
    torch.Tensor
    """
    if not input_tensor.is_complex() or not other_tensor.is_complex():
        raise ValueError("Both input_tensor and other_tensor have to be complex-valued torch tensors.")

    output = (
        mult_func(input_tensor.real, other_tensor.real)
        - mult_func(input_tensor.imag, other_tensor.imag)
        + 1j * mult_func(input_tensor.real, other_tensor.imag)
        + 1j * mult_func(input_tensor.imag, other_tensor.real)
    )
    return output