Changeset 1196 in lmdz_wrf for trunk/tools


Ignore:
Timestamp:
Oct 18, 2016, 4:29:08 PM (8 years ago)
Author:
lfita
Message:

Fixing to include the total combination in `list_norepeatcombos'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/generic_tools.py

    r1195 r1196  
    302302      Num= number of elements
    303303    >>> list_norepeatcombos(4)
    304     [[0, 1], [0, 2], [0, 3], [1, 2], [1, 3], [2, 3], [0, 1, 2], [0, 1, 3], [0, 2, 3], [1, 2, 3]]
     304    [[0, 1], [0, 2], [0, 3], [1, 2], [1, 3], [2, 3], [0, 1, 2], [0, 1, 3], [0, 2, 3], [1, 2, 3], [0, 1, 2, 3]]
    305305    """
    306306    from math import factorial
     
    318318    Nlvs = len(listv)
    319319    # Number of possible combinations
    320     for ic in range(2,Nlvs):
     320    for ic in range(2,Nlvs+1):
    321321        Ncombs = factorial(Nlvs)/(factorial(ic)*factorial(Nlvs-ic))
    322322        combo = range(ic)
Note: See TracChangeset for help on using the changeset viewer.