def METHOD_NAME(b: Union[torch.Tensor, ComplexTensor], a: Union[torch.Tensor, ComplexTensor]):
    """Solve the linear equation ax = b."""
    # NOTE: Do not mix ComplexTensor and torch.complex in the input!
    # NOTE (wangyou): Until PyTorch 1.9.0, torch.solve does not support
    # mixed input with complex and real tensors.
    if isinstance(a, ComplexTensor) or isinstance(b, ComplexTensor):
        if isinstance(a, ComplexTensor) and isinstance(b, ComplexTensor):
            return FC.METHOD_NAME(b, a, return_LU=False)
        else:
            return matmul(inverse(a), b)
    elif torch.is_complex(a) or torch.is_complex(b):
        if torch.is_complex(a) and torch.is_complex(b):
            return torch.linalg.METHOD_NAME(a, b)
        else:
            return matmul(inverse(a), b)
    else:
        return torch.linalg.METHOD_NAME(a, b)