def calc_dim(x):
    """
    Calculate the dimension of some matrix-like type

    Parameters
    ----------
    x : matrix-like
        The object to get the dimension of.

    Returns
    -------
    int
    """
    d = 0
    for l in x.shape:
        if l > 1: d += 1
    return d