def _validate_counts_matrix(counts, ids=None, suppress_cast=False):
    results = []

    # handle case of where counts is a single vector by making it a matrix.
    # this has to be done before forcing counts into an ndarray because we
    # don't yet know that all of the entries are of equal length
    if len(counts) == 0 or not isinstance(counts[0], collections.Iterable):
        counts = [counts]
    counts = np.asarray(counts)
    if counts.ndim > 2:
        raise ValueError("Only 1-D and 2-D array-like objects can be provided "
                         "as input. Provided object has %d dimensions." %
                         counts.ndim)

    if ids is not None and len(counts) != len(ids):
        raise ValueError(
            "Number of rows in ``counts`` must be equal to number of provided "
            "``ids``.")

    lens = []
    for v in counts:
        results.append(_validate_counts_vector(v, suppress_cast))
        lens.append(len(v))
    if len(set(lens)) > 1:
        raise ValueError("All rows in ``counts`` must be of equal length.")

    return np.asarray(results)
dataset/ETHPy150Open biocore/scikit-bio/skbio/diversity/_util.py/_validate_counts_matrix/original