def _get_row_col_map_2d(matrix, GCi, GCj, ifo):
    """helper for ``get_row_col_map``"""
    rows = {}
    rows_reversed = {}
    cols = {}
    cols_reversed = {}
    i = 0
    for nid, comp in GCi:
        gci = nid, comp
        if gci not in rows:
            rows[gci] = i
            rows_reversed[i] = gci
            i += 1
    if ifo == 6:
        for nid, comp in GCj:
            gcj = nid, comp
            if gcj not in rows:
                rows[gcj] = i
                rows_reversed[i] = gcj
                i += 1
        cols = rows
        cols_reversed = rows_reversed
    else:
        j = 0
        for nid, comp in GCj:
            gcj = nid, comp
            if gcj not in cols:
                cols[gcj] = j
                cols_reversed[j] = gcj
                j += 1
    return rows, cols, rows_reversed, cols_reversed
