def METHOD_NAME(A, sort=True):  # pragma: no cover
    d = A.shape[0]
    # allocate output arrays
    el = np.empty(d)
    ev = np.zeros_like(A)
    # find non-zero elements and group into charge sectors
    ix, jx = get_nz(A)
    gs = compute_blocks(ix, jx, d)
    gs = [np.array(g) for g in gs]
    # diagonalize each charge sector seperately
    for i, g in enumerate(gs):
        ng = len(g)
        # check if trivial
        if ng == 1:
            el[g[0]] = A[g[0], g[0]].real
            ev[g[0], g[0]] = 1.0
            continue
        # else diagonalize just the block
        sub_el, sub_ev = np.linalg.eigh(subselect(A, g))
        # set the correct eigenpairs in the output
        el[g] = sub_el
        subselect_set(ev, sub_ev, g)
    # sort into ascending eigenvalue order
    if sort:
        so = np.argsort(el)
        el[:] = el[so]
        ev[:, :] = ev[:, so]
    return el, ev