import torch


def isPD(B):
    """Check whether a matrix is positive definite.

    Args:
        B ([torch.Tensor]): [Input matrix.]

    Returns:
        [bool]: [Returns True if matrix is positive definite, otherwise False.]
    """
    try:
        _ = torch.cholesky(B)
        return True
    except RuntimeError:
        return False