Module ImportFrom alias alias ImportFrom alias alias alias ImportFrom alias ImportFrom alias FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str For NameStore NameLoad body Assign TupleStore NameStore NameStore NameStore NameLoad If BoolOpAnd CompareGtE NameLoad NameLoad CompareLt NameLoad NameLoad body Expr Yield NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore ListLoad For TupleStore NameStore NameStore Call NameLoad NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr BinOpMult ListLoad NameLoad NameLoad Assign NameStore Call NameLoad Assign NameStore Call NameLoad NameLoad For TupleStore NameStore NameStore Call NameLoad NameLoad body Assign NameStore ListComp ListLoad comprehension NameStore Call NameLoad NameLoad For NameStore Call NameLoad NameLoad body Expr Call AttributeLoad SubscriptLoad NameLoad Index SubscriptLoad NameLoad Index NameLoad attr SubscriptLoad NameLoad Index NameLoad Assign NameStore Call NameLoad Call NameLoad ListComp Call NameLoad NameLoad comprehension NameStore NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Str Assign NameStore Call NameLoad NameLoad NameLoad Assign NameStore Call NameLoad For NameStore Call NameLoad NameLoad body Assign NameStore Call NameLoad Call NameLoad ListComp Call NameLoad NameLoad comprehension NameStore Call NameLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Assert CompareEq NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign TupleStore NameStore NameStore NameStore NameLoad Assign TupleStore NameStore NameStore NameStore NameLoad If BoolOpAnd CompareEq NameLoad NameLoad CompareEq SubscriptLoad NameLoad Slice Num BinOpAdd NameLoad Num SubscriptLoad NameLoad Slice Num BinOpAdd NameLoad Num body If CompareEq SubscriptLoad NameLoad Slice Num SubscriptLoad NameLoad Index BinOpAdd NameLoad Num SubscriptLoad NameLoad Slice Num SubscriptLoad NameLoad Index BinOpAdd NameLoad Num body Return NameLoad Return NameLoad decorator_list FunctionDef arguments args defaults body Expr Str Assign NameStore ListLoad Num Num Expr Call NameLoad NameLoad Assign NameStore ListLoad Num Num Num Expr Call NameLoad NameLoad decorator_list FunctionDef arguments args defaults body Expr Str Assign NameStore ListLoad Num Num Num Num Assign NameStore Call NameLoad For TupleStore NameStore NameStore Call NameLoad Call AttributeLoad NameLoad attr NameLoad Call NameLoad NameLoad body Assert Call NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Assign NameStore Call NameLoad Assert CompareEq Call AttributeLoad NameLoad attr NameLoad Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call NameLoad Assign NameStore Call NameLoad Assign NameStore Call NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad Assign NameStore Call NameLoad Call NameLoad NameLoad NameLoad NameLoad Assign NameStore Call NameLoad Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad Call NameLoad NameLoad Assign NameStore Call NameLoad Call AttributeLoad NameLoad attr NameLoad NameLoad Num NameLoad For TupleStore NameStore NameStore NameStore NameStore Call NameLoad NameLoad NameLoad NameLoad NameLoad body Assert Call NameLoad NameLoad NameLoad Assert Call NameLoad NameLoad NameLoad Assert Call NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args defaults body Assign NameStore ListLoad Num Num Num Num Assign NameStore Num Assign NameStore Num Expr Call NameLoad NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args defaults body Assign NameStore ListLoad Num Num Num Num Assign NameStore Num Assign NameStore Num Expr Call NameLoad NameLoad NameLoad NameLoad decorator_list NameLoad
N/A sympy.core.compatibility range zip_longest sympy.utilities.enumerative list_visitor MultisetPartitionTraverser multiset_partitions_taocp sympy.utilities.iterables _set_partitions sympy.utilities.pytest slow part_range_filter N/A N/A partition_iterator lb ub N/A N/A N/A 
    Filters (on the number of parts) a multiset partition enumeration

    Arguments
    =========

    lb, and ub are a range (in the python slice sense) on the lpart
    variable returned from a multiset partition enumeration.  Recall
    that lpart is 0-based (it points to the topmost part on the part
    stack), so if you want to return parts of sizes 2,3,4,5 you would
    use lb=1 and ub=5.
     N/A state partition_iterator N/A N/A N/A f lpart pstack state N/A N/A N/A lpart lb N/A lpart ub N/A N/A N/A state N/A multiset_partitions_baseline N/A N/A multiplicities components N/A N/A N/A Enumerates partitions of a multiset

    Parameters
    ==========

    multiplicities
         list of integer multiplicities of the components of the multiset.

    components
         the components (elements) themselves

    Returns
    =======

    Set of partitions.  Each partition is tuple of parts, and each
    part is a tuple of components (with repeats to indicate
    multiplicity)

    Notes
    =====

    Multiset partitions can be created as equivalence classes of set
    partitions, and this function does just that.  This approach is
    slow and memory intensive compared to the more advanced algorithms
    available, but the code is simple and easy to understand.  Hence
    this routine is strictly for testing -- to provide a
    straightforward baseline against which to regress the production
    versions.  (This code is a simplified version of an earlier
    production implementation.)
     N/A canon N/A N/A N/A ct elem N/A zip multiplicities components N/A N/A N/A N/A canon extend N/A N/A elem ct N/A cache N/A set N/A n N/A len canon N/A N/A nc q N/A _set_partitions n N/A N/A rv N/A N/A N/A i N/A range nc N/A i N/A range n N/A N/A N/A N/A N/A rv N/A N/A q N/A i append N/A canon N/A i N/A canonical N/A tuple N/A sorted N/A N/A tuple p N/A p rv N/A N/A N/A cache add canonical N/A cache N/A compare_multiset_w_baseline N/A N/A multiplicities N/A N/A N/A 
    Enumerates the partitions of multiset with AOCP algorithm and
    baseline implementation, and compare the results.

     N/A letters abcdefghijklmnopqrstuvwxyz N/A bl_partitions N/A multiset_partitions_baseline multiplicities letters N/A aocp_partitions N/A set N/A state N/A multiset_partitions_taocp multiplicities N/A N/A p1 N/A tuple N/A sorted N/A N/A tuple p N/A p N/A list_visitor state letters N/A N/A N/A aocp_partitions add p1 N/A N/A bl_partitions aocp_partitions N/A compare_multiset_states N/A N/A s1 s2 N/A N/A N/A compare for equality two instances of multiset partition states

    This is useful for comparing different versions of the algorithm
    to verify correctness. N/A N/A f1 lpart1 pstack1 s1 N/A N/A f2 lpart2 pstack2 s2 N/A N/A N/A lpart1 lpart2 N/A N/A f1 N/A 0 N/A lpart1 1 N/A f2 N/A 0 N/A lpart2 1 N/A N/A N/A N/A pstack1 N/A 0 N/A f1 N/A N/A lpart1 1 N/A pstack2 N/A 0 N/A f2 N/A N/A lpart2 1 N/A N/A True N/A False N/A test_multiset_partitions_taocp N/A N/A N/A N/A N/A Compares the output of multiset_partitions_taocp with a baseline
    (set partition based) implementation. N/A multiplicities N/A 2 2 N/A N/A compare_multiset_w_baseline multiplicities N/A multiplicities N/A 4 3 1 N/A N/A compare_multiset_w_baseline multiplicities N/A test_multiset_partitions_versions N/A N/A N/A N/A N/A Compares Knuth-based versions of multiset_partitions N/A multiplicities N/A 5 2 2 1 N/A m N/A MultisetPartitionTraverser N/A N/A s1 s2 N/A zip_longest N/A N/A m enum_all multiplicities N/A multiset_partitions_taocp multiplicities N/A N/A N/A compare_multiset_states s1 s2 N/A subrange_exercise N/A N/A mult lb ub N/A N/A N/A Compare filter-based and more optimized subrange implementations

    Helper for tests, called with both small and larger multisets.
     N/A m N/A MultisetPartitionTraverser N/A N/A N/A N/A m count_partitions mult N/A N/A m count_partitions_slow mult N/A ma N/A MultisetPartitionTraverser N/A mc N/A MultisetPartitionTraverser N/A md N/A MultisetPartitionTraverser N/A a_it N/A N/A ma enum_range mult lb ub N/A b_it N/A part_range_filter N/A multiset_partitions_taocp mult lb ub N/A c_it N/A part_range_filter N/A N/A mc enum_small mult ub lb N/A sum mult N/A d_it N/A part_range_filter N/A N/A md enum_large mult lb 0 ub N/A N/A sa sb sc sd N/A zip_longest a_it b_it c_it d_it N/A N/A N/A compare_multiset_states sa sb N/A N/A compare_multiset_states sa sc N/A N/A compare_multiset_states sa sd N/A test_subrange N/A N/A N/A N/A N/A mult N/A 4 4 2 1 N/A lb 1 N/A ub 2 N/A N/A subrange_exercise mult lb ub N/A test_subrange_large N/A N/A N/A N/A N/A mult N/A 6 3 2 1 N/A lb 4 N/A ub 7 N/A N/A subrange_exercise mult lb ub N/A slow