def getidx(i, Ni):
    """
    Get the position of the tuple *i* in the equivalent one-dimensional
    vector. The list *Ni* contains the maximum values of the indices,
    which start all from 0. 
    """
    k, pos = len(Ni), 0
    for j in range(k - 1, 0, -1):
        pos = Ni[j - 1] * (i[j] + pos)
    return pos + i[0]
