diff --git a/src/sage/combinat/all.py b/src/sage/combinat/all.py index 9185bf5dc17..37eb840a23e 100644 --- a/src/sage/combinat/all.py +++ b/src/sage/combinat/all.py @@ -45,11 +45,7 @@ OrderedPartitions, PartitionsGreatestLE, PartitionsGreatestEQ,\ PartitionsGreatestLE, PartitionsGreatestEQ, number_of_partitions #Functions being deprecated from partition -from partition import partitions_set, RestrictedPartitions, number_of_partitions_set,\ - ordered_partitions, number_of_ordered_partitions, partitions,\ - cyclic_permutations_of_partition, cyclic_permutations_of_partition_iterator,\ - partitions_greatest, partitions_greatest_eq, partitions_tuples,\ - number_of_partitions_tuples, partition_power +from partition import RestrictedPartitions from sage.combinat.partition_tuple import PartitionTuple, PartitionTuples from skew_partition import SkewPartition, SkewPartitions diff --git a/src/sage/combinat/alternating_sign_matrix.py b/src/sage/combinat/alternating_sign_matrix.py index c4bafb90e26..6959f8adbff 100644 --- a/src/sage/combinat/alternating_sign_matrix.py +++ b/src/sage/combinat/alternating_sign_matrix.py @@ -1416,49 +1416,6 @@ def MonotoneTriangles_n(n): register_unpickle_override('sage.combinat.alternating_sign_matrix', 'MonotoneTriangles_n', MonotoneTriangles) register_unpickle_override('sage.combinat.alternating_sign_matrix', 'MonotoneTriangles_n', MonotoneTriangles_n) -# Here are the previous implementations of the combinatorial structure -# of the alternating sign matrices. Please, consider it obsolete and -# tend to use the monotone triangles instead. - -def from_contre_tableau(comps): - r""" - Returns an alternating sign matrix from a contre-tableau. - - EXAMPLES:: - - sage: import sage.combinat.alternating_sign_matrix as asm - sage: asm.from_contre_tableau([[1, 2, 3], [1, 2], [1]]) - doctest:...: DeprecationWarning: You can use from_monotone_triangle instead. - See http://trac.sagemath.org/12930 for details. - [0 0 1] - [0 1 0] - [1 0 0] - sage: asm.from_contre_tableau([[1, 2, 3], [2, 3], [3]]) - [1 0 0] - [0 1 0] - [0 0 1] - """ - from sage.misc.superseded import deprecation - deprecation(12930, 'You can use from_monotone_triangle instead.') - n = len(comps) - MS = MatrixSpace(ZZ, n) - M = [ [0 for _ in range(n)] for _ in range(n) ] - - previous_set = Set([]) - - for col in range(n-1, -1, -1): - s = Set( comps[col] ) - for x in s - previous_set: - M[x-1][col] = 1 - - for x in previous_set - s: - M[x-1][col] = -1 - - previous_set = s - - return MS(M) - - class ContreTableaux(Parent): """ Factory class for the combinatorial class of contre tableaux of size `n`. diff --git a/src/sage/combinat/combinat.py b/src/sage/combinat/combinat.py index c215685b0ef..a03239b358e 100644 --- a/src/sage/combinat/combinat.py +++ b/src/sage/combinat/combinat.py @@ -44,53 +44,13 @@ .. WARNING:: - The following functions are deprecated and will soon be removed. - - - Combinations of a multiset, :func:`combinations`, - :func:`combinations_iterator`, and :func:`number_of_combinations`. These - are unordered selections without repetition of k objects from a multiset - S. - - - Arrangements of a multiset, :func:`arrangements` and - :func:`number_of_arrangements` These are ordered selections without - repetition of k objects from a multiset S. + The following function is deprecated and will soon be removed. - Permutations of a multiset, :func:`permutations`, :func:`permutations_iterator`, :func:`number_of_permutations`. A permutation is a list that contains exactly the same elements but possibly in different order. -**Partitions:** - -- Partitions of a set, :func:`partitions_set`, - :func:`number_of_partitions_set`. An unordered partition - of set S is a set of pairwise disjoint nonempty sets with union S - and is represented by a sorted list of such sets. - -- Partitions of an integer, :func:`Partitions`. - An unordered partition of n is an unordered sum - `n = p_1+p_2 +\ldots+ p_k` of positive integers and is - represented by the list `p = [p_1,p_2,\ldots,p_k]`, in - nonincreasing order, i.e., `p1\geq p_2 ...\geq p_k`. - -- Ordered partitions of an integer, - :func:`ordered_partitions`, - :func:`number_of_ordered_partitions`. An ordered - partition of n is an ordered sum - `n = p_1+p_2 +\ldots+ p_k` of positive integers and is - represented by the list `p = [p_1,p_2,\ldots,p_k]`, in - nonincreasing order, i.e., `p1\geq p_2 ...\geq p_k`. - -- :func:`partitions_greatest` implements a special type - of restricted partition. - -- :func:`partitions_greatest_eq` is another type of - restricted partition. - -- Tuples of partitions, :class:`PartitionTuples`. A `k`-tuple of partitions is - represented by a list of all `k`-tuples of partitions which together form a - partition of `n`. - **Related functions:** - Bernoulli polynomials, :func:`bernoulli_polynomial` @@ -199,7 +159,6 @@ from sage.structure.sage_object import SageObject from sage.structure.parent import Parent from sage.misc.lazy_attribute import lazy_attribute -from sage.misc.superseded import deprecation from combinat_cython import _stirling_number2 ######### combinatorial sequences @@ -1388,10 +1347,6 @@ def element_class(self): """ # assert not isinstance(self, Parent) # Raises an alert if we override the proper definition from Parent - if hasattr(self, "object_class"): - deprecation(5891, "Using object_class for specifying the class " - "of the elements of a combinatorial class is " - "deprecated. Please use Element instead.") return self.Element def _element_constructor_(self, x): @@ -2199,106 +2154,6 @@ def __iter__(self): ##################################################### #### combinatorial sets/lists -def combinations(mset,k): - r""" - A combination of a multiset (a list of objects which may contain - the same object several times) mset is an unordered selection - without repetitions and is represented by a sorted sublist of ``mset``. - Returns the set of all combinations of the multiset ``mset`` with ``k`` - elements. - - INPUT: - - - ``mset`` -- (list) the multiset presented as a list of objects. - - - ``k`` -- (integer) the size of each set. - - .. NOTE:: - - This function is deprecated in favor of - :func:`sage.combinat.combination.Combinations`. Use - ``Combinations(mset, k).list()`` directly to get the list of - combinations of ``mset``. - - EXAMPLES:: - - sage: combinations([1,2,3], 2) - doctest:...: DeprecationWarning: Use Combinations(mset,k).list() - instead. See http://trac.sagemath.org/13821 for details. - [[1, 2], [1, 3], [2, 3]] - sage: mset = [1,1,2,3,4,4,5] - sage: combinations(mset,2) - [[1, 1], - [1, 2], - [1, 3], - [1, 4], - [1, 5], - [2, 3], - [2, 4], - [2, 5], - [3, 4], - [3, 5], - [4, 4], - [4, 5]] - sage: mset = ["d","a","v","i","d"] - sage: combinations(mset,3) - [['d', 'd', 'a'], - ['d', 'd', 'v'], - ['d', 'd', 'i'], - ['d', 'a', 'v'], - ['d', 'a', 'i'], - ['d', 'v', 'i'], - ['a', 'v', 'i']] - - It is possible to take combinations of Sage objects:: - - sage: combinations([vector([1,1]), vector([2,2]), vector([3,3])], 2) - [[(1, 1), (2, 2)], [(1, 1), (3, 3)], [(2, 2), (3, 3)]] - """ - from sage.combinat.combination import Combinations - deprecation(13821, 'Use Combinations(mset,k).list() instead.') - return Combinations(mset, k).list() - -def combinations_iterator(mset, k=None): - """ - An iterator for combinations of the elements of a multiset ``mset``. - - INPUT: - - - ``mset`` -- (list) the multiset presented as a list of objects. - - - ``k`` -- (integer, default: None) the size of each set. - - .. NOTE:: - - This function is deprecated in favor of - :func:`sage.combinat.combination.Combinations`. Use - ``Combinations(mset, k)`` instead. - - EXAMPLES:: - - sage: X = combinations_iterator([1,2,3,4,5],3) - doctest:...: DeprecationWarning: Use Combinations(mset,k) instead. - See http://trac.sagemath.org/13821 for details. - sage: [x for x in X] - [[1, 2, 3], - [1, 2, 4], - [1, 2, 5], - [1, 3, 4], - [1, 3, 5], - [1, 4, 5], - [2, 3, 4], - [2, 3, 5], - [2, 4, 5], - [3, 4, 5]] - """ - # It is not possible to use deprecated_function_alias since it leads to - # a circular import of combinat from combination and - # combination.Combinations from combinat. - from sage.combinat.combination import Combinations - deprecation(13821, 'Use Combinations(mset,k) instead.') - return Combinations(mset, k) - def number_of_combinations(mset,k): """ Returns the size of combinations(mset,k). IMPLEMENTATION: Wraps @@ -2313,72 +2168,10 @@ def number_of_combinations(mset,k): 12 """ from sage.combinat.combination import Combinations + from sage.misc.superseded import deprecation deprecation(14138, 'Use Combinations(mset,k).cardinality() instead.') return Combinations(mset,k).cardinality() -def arrangements(mset,k): - r""" - An arrangement of ``mset`` is an ordered selection without repetitions - and is represented by a list that contains only elements from mset, - but maybe in a different order. - - ``arrangements`` returns the set of arrangements of the - multiset ``mset`` that contain ``k`` elements. - - INPUT: - - - ``mset`` -- (list) the multiset presented as a list of objects. - - - ``k`` -- (integer) the size of each set. - - .. NOTE:: - - This function is deprecated in favor of - :func:`sage.combinat.permutation.Arrangements`. Use - ``Arrangements(mset, k).list()`` directly to get the list of - arrangements of ``mset``. - - EXAMPLES:: - - sage: arrangements([1,2,3], 2) - doctest:...: DeprecationWarning: Use Arrangements(mset,k).list() - instead. See http://trac.sagemath.org/13821 for details. - [[1, 2], [1, 3], [2, 1], [2, 3], [3, 1], [3, 2]] - sage: mset = [1,1,2,3,4,4,5] - sage: arrangements(mset,2) - [[1, 1], - [1, 2], - [1, 3], - [1, 4], - [1, 5], - [2, 1], - [2, 3], - [2, 4], - [2, 5], - [3, 1], - [3, 2], - [3, 4], - [3, 5], - [4, 1], - [4, 2], - [4, 3], - [4, 4], - [4, 5], - [5, 1], - [5, 2], - [5, 3], - [5, 4]] - sage: arrangements( ["c","a","t"], 2 ) - [['c', 'a'], ['c', 't'], ['a', 'c'], - ['a', 't'], ['t', 'c'], ['t', 'a']] - sage: arrangements( ["c","a","t"], 3 ) - [['c', 'a', 't'], ['c', 't', 'a'], ['a', 'c', 't'], - ['a', 't', 'c'], ['t', 'c', 'a'], ['t', 'a', 'c']] - """ - from sage.combinat.permutation import Arrangements - deprecation(13821, 'Use Arrangements(mset,k).list() instead.') - return Arrangements(mset, k).list() - def number_of_arrangements(mset,k): """ Returns the size of arrangements(mset,k). @@ -2392,6 +2185,7 @@ def number_of_arrangements(mset,k): 22 """ from sage.combinat.permutation import Arrangements + from sage.misc.superseded import deprecation deprecation(14138, 'Use Arrangements(mset,k).cardinality() instead.') return Arrangements(mset, k).cardinality() @@ -2574,6 +2368,7 @@ def permutations(mset): sage: permutations(rows) [[(1, 0), (1, 1)], [(1, 1), (1, 0)]] """ + from sage.misc.superseded import deprecation deprecation(14772, 'Use the Permutations object instead.') from sage.combinat.permutation import Permutations ans = Permutations(mset) @@ -2626,6 +2421,7 @@ def permutations_iterator(mset,n=None): sage: [x for x in X] [[0, 1], [0, 2], [1, 0], [1, 2], [2, 0], [2, 1]] """ + from sage.misc.superseded import deprecation deprecation(14138, 'Use the Permutations object instead.') items = mset if n is None: @@ -2667,6 +2463,7 @@ def number_of_permutations(mset): See http://trac.sagemath.org/14138 for details. 10 """ + from sage.misc.superseded import deprecation deprecation(14138, 'Use the Permutations object instead.') from sage.combinat.permutation import Permutations return Permutations(mset).cardinality() @@ -2705,6 +2502,7 @@ def cyclic_permutations(mset): sage: cyclic_permutations([1,1,1]) [[1, 1, 1]] """ + from sage.misc.superseded import deprecation deprecation(14772, 'Use the CyclicPermutations object instead.') return list(cyclic_permutations_iterator(mset)) @@ -2741,6 +2539,7 @@ def cyclic_permutations_iterator(mset): sage: cyclic_permutations([1,1,1]) [[1, 1, 1]] """ + from sage.misc.superseded import deprecation deprecation(14772, 'Use the CyclicPermutations object instead.') if len(mset) > 2: from sage.combinat.permutation import Permutations diff --git a/src/sage/combinat/free_module.py b/src/sage/combinat/free_module.py index d48d751a8e0..f7b7c386a1c 100644 --- a/src/sage/combinat/free_module.py +++ b/src/sage/combinat/free_module.py @@ -1562,30 +1562,6 @@ def _an_element_impl(self): """ return self.element_class(self, {}) - def combinatorial_class(self): - """ - Returns the combinatorial class that indexes the basis elements. - - Deprecated: use self.basis().keys() instead. - - EXAMPLES:: - - sage: F = CombinatorialFreeModule(QQ, ['a', 'b', 'c']) - sage: F.combinatorial_class() - doctest:...: DeprecationWarning: "FM.combinatorial_class()" is deprecated. Use "F.basis().keys()" instead ! - See http://trac.sagemath.org/6136 for details. - {'a', 'b', 'c'} - - :: - - sage: s = SymmetricFunctions(QQ).schur() - sage: s.combinatorial_class() - Partitions - """ - from sage.misc.superseded import deprecation - deprecation(6136, '"FM.combinatorial_class()" is deprecated. Use "F.basis().keys()" instead !') - return self._basis_keys - def dimension(self): """ Returns the dimension of the combinatorial algebra (which is given diff --git a/src/sage/combinat/partition.py b/src/sage/combinat/partition.py index 2c7772576ba..432f1315459 100644 --- a/src/sage/combinat/partition.py +++ b/src/sage/combinat/partition.py @@ -6411,83 +6411,7 @@ def cardinality(self): #### partitions -def partitions_set(S,k=None, use_file=True): - r""" - An unordered partition of a set `S` is a set of pairwise - disjoint nonempty subsets with union `S` and is represented - by a sorted list of such subsets. - - partitions_set returns the list of all unordered partitions of the - list `S` of increasing positive integers into k pairwise - disjoint nonempty sets. If k is omitted then all partitions are - returned. - - The Bell number `B_n`, named in honor of Eric Temple Bell, - is the number of different partitions of a set with n elements. - - .. WARNING:: - - Wraps GAP - hence `S` must be a list of objects that have string - representations that can be interpreted by the GAP - interpreter. If mset consists of at all complicated Sage - objects, this function does *not* do what you expect. See - SetPartitions in ``combinat/set_partition``. - - .. WARNING:: - - This function is inefficient. The runtime is dominated by - parsing the output from GAP. - - Wraps GAP's PartitionsSet. - - REFERENCES: - - :wikipedia:`Partition_of_a_set` - - EXAMPLES:: - - sage: S = [1,2,3,4] - sage: from sage.combinat.partition import partitions_set - sage: partitions_set(S,2) - doctest:1: DeprecationWarning: partitions_set is deprecated. Use SetPartitions instead. - See http://trac.sagemath.org/13072 for details. - Set partitions of {1, 2, 3, 4} with 2 parts - """ - from sage.misc.superseded import deprecation - deprecation(13072,'partitions_set is deprecated. Use SetPartitions instead.') - from sage.combinat.set_partition import SetPartitions - return SetPartitions(S,k) - - -def number_of_partitions_set(S,k): - r""" - Return the size of ``partitions_set(S,k)``. Wraps - GAP's ``NrPartitionsSet``. - - The Stirling number of the second kind is the number of partitions - of a set of size `n` into `k` blocks. - - REFERENCES: - - :wikipedia:`Partition_of_a_set` - - EXAMPLES:: - - sage: mset = [1,2,3,4] - sage: from sage.combinat.partition import number_of_partitions_set - sage: number_of_partitions_set(mset,2) - doctest:...: DeprecationWarning: number_of_partitions_set is deprecated. Use SetPartitions().cardinality() instead. - See http://trac.sagemath.org/13072 for details. - 7 - sage: stirling_number2(4,2) - 7 - """ - from sage.misc.superseded import deprecation - deprecation(13072, 'number_of_partitions_set is deprecated. Use SetPartitions().cardinality() instead.') - from sage.combinat.set_partition import SetPartitions - return SetPartitions(S,k).cardinality() - -def number_of_partitions(n, k=None, algorithm='default'): +def number_of_partitions(n, algorithm='default'): r""" Returns the number of partitions of `n` with, optionally, at most `k` parts. @@ -6501,11 +6425,6 @@ def number_of_partitions(n, k=None, algorithm='default'): - ``n`` -- an integer - - ``k`` -- (default: ``None``); if specified, instead - returns the cardinality of the set of all (unordered) partitions of - the positive integer ``n`` into sums with ``k`` summands. - [Will be deprecated: please use PartitionTuples(level, size).cardinality() ] - - ``algorithm`` -- (default: 'default') [Will be deprecated except in Partition().cardinality() ] @@ -6516,28 +6435,13 @@ def number_of_partitions(n, k=None, algorithm='default'): - ``'bober'`` -- use Jonathan Bober's implementation - - ``'gap'`` -- use GAP (VERY *slow*) - - - ``'pari'`` -- use PARI. Speed seems the same as GAP until `n` is in - the thousands, in which case PARI is faster. *But* PARI has a bug, - e.g., on 64-bit Linux PARI-2.3.2 outputs numbpart(147007)%1000 as - 536 when it should be 533!. So do not use this option. - EXAMPLES:: sage: v = Partitions(5).list(); v [[5], [4, 1], [3, 2], [3, 1, 1], [2, 2, 1], [2, 1, 1, 1], [1, 1, 1, 1, 1]] sage: len(v) 7 - sage: number_of_partitions(5, algorithm='gap') - doctest:1: DeprecationWarning: sage.combinat.number_of_partitions is deprecated. Use Partitions().cardinality(algorithm='gap') - See http://trac.sagemath.org/13072 for details. - 7 - sage: number_of_partitions(5, algorithm='pari') - doctest:1: DeprecationWarning: sage.combinat.number_of_partitions is deprecated. Use Partitions().cardinality(algorithm='pari') - See http://trac.sagemath.org/13072 for details. - 7 - sage: number_of_partitions(5, algorithm='bober') + sage: number_of_partitions(5, algorithm='bober') 7 The input must be a nonnegative integer or a ``ValueError`` is raised. @@ -6550,22 +6454,12 @@ def number_of_partitions(n, k=None, algorithm='default'): ValueError: n (=-5) must be a nonnegative integer :: - - sage: number_of_partitions(10,2) - doctest:1: DeprecationWarning: sage.combinat.number_of_partitions(size, level) is deprecated. Use PartitionTuples(level, size).cardinality() instead. - See http://trac.sagemath.org/13072 for details. - 5 - sage: number_of_partitions(10) 42 sage: number_of_partitions(3) 3 sage: number_of_partitions(10) 42 - sage: number_of_partitions(3, algorithm='pari') - 3 - sage: number_of_partitions(10, algorithm='pari') - 42 sage: number_of_partitions(40) 37338 sage: number_of_partitions(100) @@ -6624,10 +6518,6 @@ def number_of_partitions(n, k=None, algorithm='default'): sage: number_of_partitions( n - (n % 385) + 369) % 385 == 0 # long time (4s on sage.math, 2011) True - Another consistency test for ``n`` up to 500:: - - sage: len([n for n in [1..500] if number_of_partitions(n) != number_of_partitions(n,algorithm='pari')]) - 0 """ from sage.misc.superseded import deprecation n = ZZ(n) @@ -6637,22 +6527,7 @@ def number_of_partitions(n, k=None, algorithm='default'): return ZZ.one() if algorithm == 'default': - if k is None: - algorithm = 'flint' - else: - algorithm = 'gap' - - if algorithm == 'gap': - if k is None: - deprecation(13072,"sage.combinat.number_of_partitions is deprecated. Use Partitions().cardinality(algorithm='gap')") - ans=gap.eval("NrPartitions(%s)"%(ZZ(n))) - else: - deprecation(13072,'sage.combinat.number_of_partitions(size, level) is deprecated. Use PartitionTuples(level, size).cardinality() instead.') - ans=gap.eval("NrPartitions(%s,%s)"%(ZZ(n),ZZ(k))) - return ZZ(ans) - - if k is not None: - raise ValueError("only the GAP algorithm works if k is specified.") + algorithm = 'flint' if algorithm == 'flint': return cached_number_of_partitions(n) @@ -6660,10 +6535,6 @@ def number_of_partitions(n, k=None, algorithm='default'): elif algorithm == 'bober': return bober_number_of_partitions(n) - elif algorithm == 'pari': - deprecation(13072,"sage.combinat.number_of_partitions is deprecated. Use Partitions().cardinality(algorithm='pari')") - return ZZ(pari(ZZ(n)).numbpart()) - raise ValueError("unknown algorithm '%s'"%algorithm) ########## @@ -6672,393 +6543,11 @@ def number_of_partitions(n, k=None, algorithm='default'): _Partitions = Partitions() - -# This function was previously used to cache number_of_partitions with the -# justification that "Some function e.g.: Partitions(n).random() heavily use -# number_of_partitions", however, the random() method of Partitions() seems to be -# the only place where this was used. -from sage.misc.superseded import deprecated_function_alias -_numpart = deprecated_function_alias(13072, number_of_partitions) - # Rather than caching an under-used function I have cached the default # number_of_partitions functions which is currently using FLINT. # AM :trac:`13072` cached_number_of_partitions = cached_function( flint_number_of_partitions ) -def cyclic_permutations_of_partition(partition): - """ - Return all combinations of cyclic permutations of each cell of the - partition. - - AUTHORS: - - - Robert L. Miller - - EXAMPLES:: - - sage: from sage.combinat.partition import cyclic_permutations_of_partition - sage: cyclic_permutations_of_partition([[1,2,3,4],[5,6,7]]) - doctest:...: DeprecationWarning: cyclic_permutations_of_partition is being removed from the global namespace. Use sage.combinat.set_partition.cyclic_permutations_of_set_partition instead. - See http://trac.sagemath.org/13072 for details. - doctest:...: DeprecationWarning: cyclic_permutations_of_partition_iterator is being removed from the global namespace. Please use sage.combinat.set_partition.cyclic_permutations_of_set_partition_iterator instead. - See http://trac.sagemath.org/13072 for details. - doctest:...: DeprecationWarning: cyclic_permutations_of_partition_iterator is being removed from the global namespace. Please use sage.combinat.set_partition.cyclic_permutations_of_set_partition_iterator instead. - See http://trac.sagemath.org/13072 for details. - doctest:...: DeprecationWarning: Use the CyclicPermutations object instead. - See http://trac.sagemath.org/14772 for details. - doctest:...: DeprecationWarning: Use the CyclicPermutations object instead. - See http://trac.sagemath.org/14772 for details. - [[[1, 2, 3, 4], [5, 6, 7]], - [[1, 2, 4, 3], [5, 6, 7]], - [[1, 3, 2, 4], [5, 6, 7]], - [[1, 3, 4, 2], [5, 6, 7]], - [[1, 4, 2, 3], [5, 6, 7]], - [[1, 4, 3, 2], [5, 6, 7]], - [[1, 2, 3, 4], [5, 7, 6]], - [[1, 2, 4, 3], [5, 7, 6]], - [[1, 3, 2, 4], [5, 7, 6]], - [[1, 3, 4, 2], [5, 7, 6]], - [[1, 4, 2, 3], [5, 7, 6]], - [[1, 4, 3, 2], [5, 7, 6]]] - """ - from sage.misc.superseded import deprecation - deprecation(13072,'cyclic_permutations_of_partition is being removed from the global namespace. Use sage.combinat.set_partition.cyclic_permutations_of_set_partition instead.') - return list(cyclic_permutations_of_partition_iterator(partition)) - - -def cyclic_permutations_of_partition_iterator(partition): - """ - Iterates over all combinations of cyclic permutations of each cell - of the partition. - - AUTHORS: - - - Robert L. Miller - - EXAMPLES:: - - sage: from sage.combinat.partition import cyclic_permutations_of_partition_iterator - sage: list(cyclic_permutations_of_partition_iterator([[1,2,3,4],[5,6,7]])) - doctest:...: DeprecationWarning: cyclic_permutations_of_partition_iterator is being removed from the global namespace. Please use sage.combinat.set_partition.cyclic_permutations_of_set_partition_iterator instead. - See http://trac.sagemath.org/13072 for details. - [[[1, 2, 3, 4], [5, 6, 7]], - [[1, 2, 4, 3], [5, 6, 7]], - [[1, 3, 2, 4], [5, 6, 7]], - [[1, 3, 4, 2], [5, 6, 7]], - [[1, 4, 2, 3], [5, 6, 7]], - [[1, 4, 3, 2], [5, 6, 7]], - [[1, 2, 3, 4], [5, 7, 6]], - [[1, 2, 4, 3], [5, 7, 6]], - [[1, 3, 2, 4], [5, 7, 6]], - [[1, 3, 4, 2], [5, 7, 6]], - [[1, 4, 2, 3], [5, 7, 6]], - [[1, 4, 3, 2], [5, 7, 6]]] - """ - from sage.misc.superseded import deprecation - deprecation(13072,'cyclic_permutations_of_partition_iterator is being removed from the global namespace. Please use sage.combinat.set_partition.cyclic_permutations_of_set_partition_iterator instead.') - if len(partition) == 1: - for i in cyclic_permutations_iterator(partition[0]): - yield [i] - else: - for right in cyclic_permutations_of_partition_iterator(partition[1:]): - for perm in cyclic_permutations_iterator(partition[0]): - yield [perm] + right - - -def partitions(n): - r""" - Generator of all the partitions of the integer `n`. - - To compute the number of partitions of `n` use - :meth:`Partitions_n.cardinality()` or :func:`number_of_partitions()`. - - INPUT: - - - ``n`` -- An integer - - EXAMPLES:: - - sage: partitions(3) - - sage: list(partitions(3)) - doctest:1: DeprecationWarning: partitions is deprecated. Use Partitions() instead. - See http://trac.sagemath.org/13072 for details. - doctest:...: DeprecationWarning: partitions is deprecated. Use Partitions() instead. - See http://trac.sagemath.org/13072 for details. - [(1, 1, 1), (1, 2), (3,)] - - AUTHORS: - - - Adapted from David Eppstein, Jan Van lent, George Yoshida; - Python Cookbook 2, Recipe 19.16. - """ - from sage.misc.superseded import deprecation - deprecation(13072,'partitions is deprecated. Use Partitions() instead.') - n = ZZ(n) - # base case of the recursion: zero is the sum of the empty tuple - if n == 0: - yield ( ) - return - # modify the partitions of n-1 to form the partitions of n - for p in partitions(n-1): - yield (1,) + p - if p and (len(p) < 2 or p[1] > p[0]): - yield (p[0] + 1,) + p[1:] - - -def ordered_partitions(n,k=None): - r""" - An ordered partition of `n` is an ordered sum - - .. MATH:: - - n = p_1+p_2 + \cdots + p_k - - of positive integers and is represented by the list - `p = [p_1,p_2,\cdots ,p_k]`. If `k` is omitted - then all ordered partitions are returned. - - ``ordered_partitions(n,k)`` returns the list of all - (ordered) partitions of the positive integer n into sums with `k` - summands. - - Do not call ``ordered_partitions`` with an `n` much - larger than 15, since the list will simply become too large. - - Wraps GAP's ``OrderedPartitions``. - - The number of ordered partitions `T_n` of - `\{ 1, 2, ..., n \}` has the generating function is - - .. MATH:: - - \sum_n {T_n \over n!} x^n = {1 \over 2-e^x}. - - EXAMPLES:: - - sage: from sage.combinat.partition import ordered_partitions - sage: ordered_partitions(10,2) - doctest:1: DeprecationWarning: ordered_partitions is deprecated. Use OrderedPartitions instead. - See http://trac.sagemath.org/13072 for details. - [[1, 9], [2, 8], [3, 7], [4, 6], [5, 5], [6, 4], [7, 3], [8, 2], [9, 1]] - - :: - - sage: ordered_partitions(4) - [[1, 1, 1, 1], [1, 1, 2], [1, 2, 1], [1, 3], [2, 1, 1], [2, 2], [3, 1], [4]] - - REFERENCES: - - - :wikipedia:`Ordered_partition_of_a_set` - """ - from sage.misc.superseded import deprecation - deprecation(13072,'ordered_partitions is deprecated. Use OrderedPartitions instead.') - if k is None: - ans=gap.eval("OrderedPartitions(%s)"%(ZZ(n))) - else: - ans=gap.eval("OrderedPartitions(%s,%s)"%(ZZ(n),ZZ(k))) - return eval(ans.replace('\n','')) - -def number_of_ordered_partitions(n,k=None): - """ - Returns the size of ``ordered_partitions(n,k)``. Wraps GAP's - ``NrOrderedPartitions``. - - It is possible to associate with every partition of the integer n a - conjugacy class of permutations in the symmetric group on n points - and vice versa. Therefore ``p(n) = NrPartitions(n)`` is the number of - conjugacy classes of the symmetric group on `n` points. - - EXAMPLES:: - - sage: from sage.combinat.partition import number_of_ordered_partitions - sage: number_of_ordered_partitions(10,2) - doctest:...: DeprecationWarning: number_of_ordered_partitions is deprecated. Use OrderedPartitions().cardinality instead. - See http://trac.sagemath.org/13072 for details. - 9 - sage: number_of_ordered_partitions(15) - 16384 - """ - from sage.misc.superseded import deprecation - deprecation(13072,'number_of_ordered_partitions is deprecated. Use OrderedPartitions().cardinality instead.') - if k is None: - ans=gap.eval("NrOrderedPartitions(%s)"%(n)) - else: - ans=gap.eval("NrOrderedPartitions(%s,%s)"%(n,k)) - return ZZ(ans) - -def partitions_greatest(n,k): - """ - Returns the list of all (unordered) "restricted" partitions of the - integer `n` having parts less than or equal to the integer `k`. - - Wraps GAP's ``PartitionsGreatestLE``. - - EXAMPLES:: - - sage: from sage.combinat.partition import partitions_greatest - sage: partitions_greatest(10,2) - doctest:...: DeprecationWarning: partitions_greatest is deprecated. Use PartitionsGreatestLE instead. - See http://trac.sagemath.org/13072 for details. - [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], - [2, 1, 1, 1, 1, 1, 1, 1, 1], - [2, 2, 1, 1, 1, 1, 1, 1], - [2, 2, 2, 1, 1, 1, 1], - [2, 2, 2, 2, 1, 1], - [2, 2, 2, 2, 2]] - """ - from sage.misc.superseded import deprecation - deprecation(13072,'partitions_greatest is deprecated. Use PartitionsGreatestLE instead.') - return eval(gap.eval("PartitionsGreatestLE(%s,%s)"%(ZZ(n),ZZ(k)))) - -def partitions_greatest_eq(n,k): - """ - Returns the list of all (unordered) "restricted" partitions of the - integer `n` having at least one part equal to the integer `k`. - - Wraps GAP's ``PartitionsGreatestEQ``. - - EXAMPLES:: - - sage: from sage.combinat.partition import partitions_greatest_eq - sage: partitions_greatest_eq(10,2) - doctest:...: DeprecationWarning: partitions_greatest_eq is deprecated. Use PartitionsGreatestEQ instead. - See http://trac.sagemath.org/13072 for details. - [[2, 1, 1, 1, 1, 1, 1, 1, 1], - [2, 2, 1, 1, 1, 1, 1, 1], - [2, 2, 2, 1, 1, 1, 1], - [2, 2, 2, 2, 1, 1], - [2, 2, 2, 2, 2]] - """ - from sage.misc.superseded import deprecation - deprecation(13072,'partitions_greatest_eq is deprecated. Use PartitionsGreatestEQ instead.') - ans = gap.eval("PartitionsGreatestEQ(%s,%s)"%(n,k)) - return eval(ans) - - -def partitions_tuples(n,k): - """ - ``partition_tuples( n, k )`` returns the list of all `k`-tuples of - partitions which together form a partition of `n`. - - `k`-tuples of partitions describe the classes and the characters of - wreath products of groups with `k` conjugacy classes with the - symmetric group `S_n`. - - Wraps GAP's ``PartitionTuples``. - - EXAMPLES:: - - sage: from sage.combinat.partition import partitions_tuples - sage: partitions_tuples(3,2) - doctest:...: DeprecationWarning: partition_tuples is deprecated. Use PartitionTuples(level, size) instead. - See http://trac.sagemath.org/13072 for details. - [[[1, 1, 1], []], - [[1, 1], [1]], - [[1], [1, 1]], - [[], [1, 1, 1]], - [[2, 1], []], - [[1], [2]], - [[2], [1]], - [[], [2, 1]], - [[3], []], - [[], [3]]] - """ - from sage.misc.superseded import deprecation - deprecation(13072,'partition_tuples is deprecated. Use PartitionTuples(level, size) instead.') - ans=gap.eval("PartitionTuples(%s,%s)"%(ZZ(n),ZZ(k))) - return eval(ans) - -def number_of_partitions_tuples(n,k): - r""" - ``number_of_partition_tuples( n, k )`` returns the number of - ``partition_tuples(n,k)``. - - Wraps GAP's ``NrPartitionTuples``. - - EXAMPLES:: - - sage: from sage.combinat.partition import number_of_partitions_tuples - sage: number_of_partitions_tuples(3,2) - doctest:...: DeprecationWarning: number_of_partition_tuples(size, level) is deprecated. Use PartitionTuples(level, size).cardinality() instead. - See http://trac.sagemath.org/13072 for details. - 10 - sage: number_of_partitions_tuples(8,2) - 185 - - Now we compare that with the result of the following GAP - computation:: - - gap> S8:=Group((1,2,3,4,5,6,7,8),(1,2)); - Group([ (1,2,3,4,5,6,7,8), (1,2) ]) - gap> C2:=Group((1,2)); - Group([ (1,2) ]) - gap> W:=WreathProduct(C2,S8); - - gap> Size(W); - 10321920 ## = 2^8*Factorial(8), which is good:-) - gap> Size(ConjugacyClasses(W)); - 185 - """ - from sage.misc.superseded import deprecation - deprecation(13072,'number_of_partition_tuples(size, level) is deprecated. Use PartitionTuples(level, size).cardinality() instead.') - ans=gap.eval("NrPartitionTuples(%s,%s)"%(ZZ(n),ZZ(k))) - return ZZ(ans) - -def partition_power(pi,k): - """ - ``partition_power( pi, k )`` returns the partition corresponding to - the `k`-th power of a permutation with cycle structure ``pi`` - (thus describes the powermap of symmetric groups). - - Wraps GAP's ``PowerPartition``. - - EXAMPLES:: - - sage: from sage.combinat.partition import partition_power - sage: partition_power([5,3],1) - doctest:...: DeprecationWarning: partition_power is deprecated. Use Partition(mu).power() instead. - See http://trac.sagemath.org/13072 for details. - [5, 3] - sage: partition_power([5,3],2) - [5, 3] - sage: partition_power([5,3],3) - [5, 1, 1, 1] - sage: partition_power([5,3],4) - [5, 3] - - Now let us compare this to the power map on `S_8`:: - - sage: G = SymmetricGroup(8) - sage: g = G([(1,2,3,4,5),(6,7,8)]) - sage: g - (1,2,3,4,5)(6,7,8) - sage: g^2 - (1,3,5,2,4)(6,8,7) - sage: g^3 - (1,4,2,5,3) - sage: g^4 - (1,5,4,3,2)(6,7,8) - """ - from sage.misc.superseded import deprecation - deprecation(13072,'partition_power is deprecated. Use Partition(mu).power() instead.') - ans=gap.eval("PowerPartition(%s,%s)"%(pi,ZZ(k))) - return eval(ans) - -def PartitionTuples_nk(n,k): - """ - EXAMPLES:: - - sage: sage.combinat.partition.PartitionTuples_nk(3, 2) - doctest:...: DeprecationWarning: this class is deprecated. Use sage.combinat.partition_tuple.PartitionTuples_level_size instead - See http://trac.sagemath.org/13072 for details. - Partition tuples of level 2 and size 3 - """ - from sage.misc.superseded import deprecation - deprecation(13072,'this class is deprecated. Use sage.combinat.partition_tuple.PartitionTuples_level_size instead') - from sage.combinat.partition_tuple import PartitionTuples_level_size - return PartitionTuples_level_size(level=k, size=n) - # October 2012: fixing outdated pickles which use classes being deprecated from sage.structure.sage_object import register_unpickle_override from sage.combinat.partition_tuple import PartitionTuples_level_size diff --git a/src/sage/combinat/skew_tableau.py b/src/sage/combinat/skew_tableau.py index 369bcfb7b9d..52ad1ea96ee 100644 --- a/src/sage/combinat/skew_tableau.py +++ b/src/sage/combinat/skew_tableau.py @@ -2026,72 +2026,6 @@ def from_shape_and_word(shape, word): deprecation(14101, 'from_shape_and_word is deprecated. Use SkewTableaux().from_shape_and_word instead') return SkewTableaux().from_shape_and_word(shape, word) -# Deprecation of internal classes seems to be unnecessarily painful... -def SemistandardSkewTableaux_n(*args, **kargs): - """ - EXAMPLES:: - - sage: sage.combinat.skew_tableau.SemistandardSkewTableaux_n(3) - doctest:...: DeprecationWarning: this class is deprecated. Use SemistandardSkewTableaux_size instead - See http://trac.sagemath.org/9265 for details. - Semistandard skew tableaux of size 3 - """ - from sage.misc.superseded import deprecation - deprecation(9265,'this class is deprecated. Use SemistandardSkewTableaux_size instead') - return SemistandardSkewTableaux(*args, **kargs) - -def SemistandardSkewTableaux_nmu(*args, **kargs): - """ - EXAMPLES:: - - sage: sage.combinat.skew_tableau.SemistandardSkewTableaux_nmu(3,[2,1]) - doctest:...: DeprecationWarning: this class is deprecated. Use SemistandardSkewTableaux_size_weight instead - See http://trac.sagemath.org/9265 for details. - Semistandard skew tableaux of size 3 and weight [2, 1] - """ - from sage.misc.superseded import deprecation - deprecation(9265,'this class is deprecated. Use SemistandardSkewTableaux_size_weight instead') - return SemistandardSkewTableaux(*args, **kargs) - -def SemistandardSkewTableaux_p(*args, **kargs): - """ - EXAMPLES:: - - sage: sage.combinat.skew_tableau.SemistandardSkewTableaux_p([[2,1],[]]) - doctest:1: DeprecationWarning: this class is deprecated. Use SemistandardSkewTableaux_shape instead - See http://trac.sagemath.org/9265 for details. - Semistandard skew tableaux of shape [2, 1] / [] - """ - from sage.misc.superseded import deprecation - deprecation(9265,'this class is deprecated. Use SemistandardSkewTableaux_shape instead') - return SemistandardSkewTableaux_shape(*args, **kargs) - -def SemistandardSkewTableaux_pmu(*args, **kargs): - """ - EXAMPLES:: - - sage: sage.combinat.skew_tableau.SemistandardSkewTableaux_pmu([[2,1],[]],[2,1]) - doctest:...: DeprecationWarning: this class is deprecated. Use SemistandardSkewTableaux_shape_weight instead - See http://trac.sagemath.org/9265 for details. - Semistandard skew tableaux of shape [2, 1] / [] and weight [2, 1] - """ - from sage.misc.superseded import deprecation - deprecation(9265,'this class is deprecated. Use SemistandardSkewTableaux_shape_weight instead') - return SemistandardSkewTableaux_shape_weight(*args, **kargs) - -def StandardSkewTableaux_n(*args, **kargs): - """ - EXAMPLES:: - - sage: sage.combinat.skew_tableau.StandardSkewTableaux_n(2) - doctest:...: DeprecationWarning: this class is deprecated. Use StandardSkewTableaux_size instead - See http://trac.sagemath.org/9265 for details. - Standard skew tableaux of size 2 - """ - from sage.misc.superseded import deprecation - deprecation(9265,'this class is deprecated. Use StandardSkewTableaux_size instead') - return StandardSkewTableaux(*args, **kargs) - def StandardSkewTableaux_skewpartition(skp): """ EXAMPLES:: diff --git a/src/sage/combinat/tableau.py b/src/sage/combinat/tableau.py index 5de4b19b70b..9dbedfbcf8c 100644 --- a/src/sage/combinat/tableau.py +++ b/src/sage/combinat/tableau.py @@ -5954,112 +5954,6 @@ def symmetric_group_action_on_values(word, perm): w[places_r[i]] = l return w - -# August 2012: Deprecation of internal classes seems to be unnecessarily painful... -def Tableau_class(*args, **kargs): - """ - EXAMPLES:: - - sage: sage.combinat.tableau.Tableau_class([[3,2]]) - doctest:1: DeprecationWarning: this class is deprecated. Use Tableau_class instead - See http://trac.sagemath.org/9265 for details. - [[3, 2]] - """ - from sage.misc.superseded import deprecation - deprecation(9265,'this class is deprecated. Use Tableau_class instead') - return Tableau(*args, **kargs) - -def Tableaux_n(*args, **kargs): - """ - EXAMPLES:: - - sage: sage.combinat.tableau.Tableaux_n(3) - doctest:1: DeprecationWarning: this class is deprecated. Use Tableaux_size instead - See http://trac.sagemath.org/9265 for details. - Tableaux of size 3 - """ - from sage.misc.superseded import deprecation - deprecation(9265,'this class is deprecated. Use Tableaux_size instead') - return Tableaux(*args, **kargs) - -def SemistandardTableaux_n(*args, **kargs): - """ - EXAMPLES:: - - sage: sage.combinat.tableau.SemistandardTableaux_n(3) - doctest:1: DeprecationWarning: this class is deprecated. Use SemistandardTableaux_size instead - See http://trac.sagemath.org/9265 for details. - Semistandard tableaux of size 3 and maximum entry 3 - """ - from sage.misc.superseded import deprecation - deprecation(9265,'this class is deprecated. Use SemistandardTableaux_size instead') - return SemistandardTableaux(*args, **kargs) - -def SemistandardTableaux_nmu(*args, **kargs): - """ - EXAMPLES:: - - sage: sage.combinat.tableau.SemistandardTableaux_nmu(3,[2,1]) - doctest:1: DeprecationWarning: this class is deprecated. Use SemistandardTableaux_size_weight instead - See http://trac.sagemath.org/9265 for details. - Semistandard tableaux of size 3 and weight [2, 1] - """ - from sage.misc.superseded import deprecation - deprecation(9265,'this class is deprecated. Use SemistandardTableaux_size_weight instead') - return SemistandardTableaux(*args, **kargs) - -def SemistandardTableaux_p(*args, **kargs): - """ - EXAMPLES:: - - sage: sage.combinat.tableau.SemistandardTableaux_p([2,1]) - doctest:1: DeprecationWarning: this class is deprecated. Use SemistandardTableaux_shape instead - See http://trac.sagemath.org/9265 for details. - Semistandard tableaux of shape [2, 1] and maximum entry 3 - """ - from sage.misc.superseded import deprecation - deprecation(9265,'this class is deprecated. Use SemistandardTableaux_shape instead') - return SemistandardTableaux(*args, **kargs) - -def SemistandardTableaux_pmu(*args, **kargs): - """ - EXAMPLES:: - - sage: sage.combinat.tableau.SemistandardTableaux_pmu([2,1],[2,1]) - doctest:1: DeprecationWarning: this class is deprecated. Use SemistandardTableaux_shape_weight instead - See http://trac.sagemath.org/9265 for details. - Semistandard tableaux of shape [2, 1] and weight [2, 1] - """ - from sage.misc.superseded import deprecation - deprecation(9265,'this class is deprecated. Use SemistandardTableaux_shape_weight instead') - return SemistandardTableaux(*args, **kargs) - -def StandardTableaux_n(*args, **kargs): - """ - EXAMPLES:: - - sage: sage.combinat.tableau.StandardTableaux_n(2) - doctest:1: DeprecationWarning: this class is deprecated. Use StandardTableaux_size instead - See http://trac.sagemath.org/9265 for details. - Standard tableaux of size 2 - """ - from sage.misc.superseded import deprecation - deprecation(9265,'this class is deprecated. Use StandardTableaux_size instead') - return StandardTableaux(*args, **kargs) - -def StandardTableaux_partition(*args, **kargs): - """ - EXAMPLES:: - - sage: sage.combinat.tableau.StandardTableaux_partition([2,1]) - doctest:1: DeprecationWarning: this class is deprecated. Use StandardTableaux_shape instead - See http://trac.sagemath.org/9265 for details. - Standard tableaux of shape [2, 1] - """ - from sage.misc.superseded import deprecation - deprecation(9265,'this class is deprecated. Use StandardTableaux_shape instead') - return StandardTableaux(*args, **kargs) - # October 2012: fixing outdated pickles which use classed being deprecated from sage.structure.sage_object import register_unpickle_override register_unpickle_override('sage.combinat.tableau', 'Tableau_class', Tableau) diff --git a/src/sage/combinat/words/abstract_word.py b/src/sage/combinat/words/abstract_word.py index 5880d51ac85..33c83c2c3d2 100644 --- a/src/sage/combinat/words/abstract_word.py +++ b/src/sage/combinat/words/abstract_word.py @@ -1242,23 +1242,6 @@ def palindrome_prefixes_iterator(self, max_length=None): if p.is_palindrome(): yield p - def alphabet(self): - r""" - EXAMPLES:: - - sage: w = Word('abaccefa') - sage: w. alphabet() - doctest:1: DeprecationWarning: alphabet() is deprecated, use parent().alphabet() instead - See http://trac.sagemath.org/8429 for details. - Set of Python objects of type 'object' - sage: y = Words('456')('64654564') - sage: y.alphabet() - {'4', '5', '6'} - """ - from sage.misc.superseded import deprecation - deprecation(8429, "alphabet() is deprecated, use parent().alphabet() instead") - return self.parent().alphabet() - def _partial_sums_iterator(self, start, mod=None): r""" Iterator over the partial sums of the prefixes of self. diff --git a/src/sage/combinat/words/finite_word.py b/src/sage/combinat/words/finite_word.py index 7a6b2fb1763..72936fa67d1 100644 --- a/src/sage/combinat/words/finite_word.py +++ b/src/sage/combinat/words/finite_word.py @@ -630,127 +630,6 @@ def to_integer_list(self): index = dict((b,a) for (a,b) in enumerate(ordered_alphabet)) return [index[a] for a in self] - def size_of_alphabet(self): - r""" - EXAMPLES:: - - sage: w = Word('abaccefa') - sage: w.size_of_alphabet() - doctest:1: DeprecationWarning: size_of_alphabet() is deprecated, use parent().size_of_alphabet() instead! - See http://trac.sagemath.org/8429 for details. - +Infinity - sage: y = Words('456')('64654564') - sage: y.size_of_alphabet() - 3 - """ - from sage.misc.superseded import deprecation - deprecation(8429, "size_of_alphabet() is deprecated, use parent().size_of_alphabet() instead!") - return self.parent().size_of_alphabet() - - ########################################################################### - ##### DEPRECATION WARNINGS (next 4 functions) ############################# - ##### Added July 2009 ##################################################### - ########################################################################### - def is_suffix_of(self, other): - r""" - Returns True if w is a suffix of other, and False otherwise. - - EXAMPLES:: - - sage: w = Word('0123456789') - sage: y = Word('56789') - sage: y.is_suffix_of(w) - doctest:1: DeprecationWarning: is_suffix_of is deprecated, use is_suffix instead! - See http://trac.sagemath.org/8429 for details. - True - sage: w.is_suffix_of(y) - False - sage: Word('579').is_suffix_of(w) - False - sage: Word().is_suffix_of(y) - True - sage: w.is_suffix_of(Word()) - False - sage: Word().is_suffix_of(Word()) - True - """ - from sage.misc.superseded import deprecation - deprecation(8429, "is_suffix_of is deprecated, use is_suffix instead!") - return self.is_suffix(other) - - def is_proper_suffix_of(self, other): - r""" - Returns True if self is a proper suffix of other, and False otherwise. - - EXAMPLES:: - - sage: Word('23').is_proper_suffix_of(Word('123')) - doctest:1: DeprecationWarning: is_proper_suffix_of is deprecated, use is_proper_suffix instead! - See http://trac.sagemath.org/8429 for details. - doctest:...: DeprecationWarning: is_suffix_of is deprecated, use is_suffix instead! - See http://trac.sagemath.org/8429 for details. - True - sage: Word('12').is_proper_suffix_of(Word('12')) - False - sage: Word().is_proper_suffix_of(Word('123')) - True - sage: Word('123').is_proper_suffix_of(Word('12')) - False - """ - from sage.misc.superseded import deprecation - deprecation(8429, "is_proper_suffix_of is deprecated, use is_proper_suffix instead!") - return self.is_proper_suffix(other) - - def is_prefix_of(self, other): - r""" - Returns True if self is a prefix of other, and False otherwise. - - EXAMPLES:: - - sage: w = Word('0123456789') - sage: y = Word('012345') - sage: y.is_prefix_of(w) - doctest:1: DeprecationWarning: is_prefix_of is deprecated, use is_prefix instead! - See http://trac.sagemath.org/8429 for details. - True - sage: w.is_prefix_of(y) - False - sage: w.is_prefix_of(Word()) - False - sage: Word().is_prefix_of(w) - True - sage: Word().is_prefix_of(Word()) - True - """ - from sage.misc.superseded import deprecation - deprecation(8429, "is_prefix_of is deprecated, use is_prefix instead!") - return self.is_prefix(other) - - def is_proper_prefix_of(self, other): - r""" - Returns True if self is a proper prefix of other, and False otherwise. - - EXAMPLES:: - - sage: Word('12').is_proper_prefix_of(Word('123')) - doctest:1: DeprecationWarning: is_proper_prefix_of is deprecated, use is_proper_prefix instead! - See http://trac.sagemath.org/8429 for details. - doctest:...: DeprecationWarning: is_prefix_of is deprecated, use is_prefix instead! - See http://trac.sagemath.org/8429 for details. - True - sage: Word('12').is_proper_prefix_of(Word('12')) - False - sage: Word().is_proper_prefix_of(Word('123')) - True - sage: Word('123').is_proper_prefix_of(Word('12')) - False - sage: Word().is_proper_prefix_of(Word()) - False - """ - from sage.misc.superseded import deprecation - deprecation(8429, "is_proper_prefix_of is deprecated, use is_proper_prefix instead!") - return self.is_proper_prefix(other) - # To fix : do not slice here ! (quite expensive in copy) def is_suffix(self, other): r""" @@ -790,7 +669,7 @@ def is_proper_suffix(self, other): sage: Word('123').is_proper_suffix(Word('12')) False """ - return self.is_suffix_of(other) and self.length() < other.length() + return self.is_suffix(other) and self.length() < other.length() def has_suffix(self, other): """ @@ -874,7 +753,7 @@ def is_proper_prefix(self, other): sage: Word().is_proper_prefix(Word()) False """ - return self.is_prefix_of(other) and self.length() < other.length() + return self.is_prefix(other) and self.length() < other.length() def has_prefix(self, other): r""" @@ -2218,48 +2097,6 @@ def is_palindrome(self, f=None): raise ValueError, "f must be an involution" return self[:l/2 + l%2] == f(self[l/2:].reversal()) - ########################################################################### - ##### DEPRECATION WARNINGS ################################################ - ##### Added July 2009 ##################################################### - ########################################################################### - def _lps(self, l=None, f=None): - r""" - Returns the longest palindromic (or `f`-palindromic) suffix of self. - - INPUT: - - - ``f`` - involution (default: None) on the alphabet of self. It must - be callable on letters as well as words (e.g. WordMorphism). - - ``l`` - integer (default: None) the length of the longest palindrome - suffix of self[:-1], if known. - - OUTPUT: - - word -- If f is None, the longest palindromic suffix of self; - otherwise, the longest f-palindromic suffix of self. - - EXAMPLES:: - - sage: Word('0111')._lps() - doctest:1: DeprecationWarning: _lps is deprecated, use lps instead! - See http://trac.sagemath.org/8429 for details. - word: 111 - sage: Word('011101')._lps() - word: 101 - sage: Word('6667')._lps() - word: 7 - sage: Word('abbabaab')._lps() - word: baab - sage: Word()._lps() - word: - sage: f = WordMorphism('a->b,b->a') - sage: Word('abbabaab')._lps(f=f) - word: abbabaab - """ - from sage.misc.superseded import deprecation - deprecation(8429, "_lps is deprecated, use lps instead!") - return self.lps(l=l, f=f) - def lps(self, f=None, l=None): r""" Returns the longest palindromic (or `f`-palindromic) suffix of self. @@ -3740,29 +3577,6 @@ def deg_rev_lex_less(self, other, weights=None): return d1 < d2 return self.rev_lex_less(other) - ########################################################################### - ##### DEPRECATION WARNINGS ################################################ - ##### Added July 2009 ##################################################### - ########################################################################### - def last_position_table(self): - r""" - Returns a dictionary that contains the last position of each letter - in self. - - EXAMPLES:: - - sage: Word('1231232').last_position_table() - doctest:1: DeprecationWarning: last_position_table is deprecated, use last_position_dict instead! - See http://trac.sagemath.org/8429 for details. - {'1': 3, '3': 5, '2': 6} - """ - from sage.misc.superseded import deprecation - deprecation(8429, "last_position_table is deprecated, use last_position_dict instead!") - lpd = self.last_position_dict() - if self.parent().size_of_alphabet() in ZZ: - return [lpd.get(a,-1) for a in self.parent().alphabet()] - return lpd - @cached_method def last_position_dict(self): r""" @@ -3943,31 +3757,6 @@ def rfind(self, sub, start=0, end=None): i -= 1 return -1 - ########################################################################### - ##### DEPRECATION WARNINGS ################################################ - ##### Added July 2009 ##################################################### - ########################################################################### - def is_factor_of(self, other): - r""" - Returns True if self is a factor of other, and False otherwise. - - EXAMPLES:: - - sage: u = Word('2113') - sage: w = Word('123121332131233121132123') - sage: u.is_factor_of(w) - doctest:1: DeprecationWarning: is_factor_of is deprecated, use is_factor instead! - See http://trac.sagemath.org/8429 for details. - True - sage: u = Word('321') - sage: w = Word('1231241231312312312') - sage: u.is_factor_of(w) - False - """ - from sage.misc.superseded import deprecation - deprecation(8429, "is_factor_of is deprecated, use is_factor instead!") - return self.is_factor(other) - def is_factor(self, other): r""" Returns True if self is a factor of other, and False otherwise. @@ -4229,27 +4018,6 @@ def is_quasiperiodic(self): return True return False - ########################################################################### - ##### DEPRECATION WARNINGS ################################################ - ##### Added July 2009 ##################################################### - ########################################################################### - def _quasiperiods_list(self): - r""" - Returns the quasiperiods of self as a list ordered from shortest to - longest. - - EXAMPLES:: - - sage: l = Word('abaababaabaababaaba')._quasiperiods_list() - doctest:1: DeprecationWarning: _quasiperiods_list is deprecated, use quasiperiods instead! - See http://trac.sagemath.org/8429 for details. - sage: l - [word: aba, word: abaaba, word: abaababaaba] - """ - from sage.misc.superseded import deprecation - deprecation(8429, "_quasiperiods_list is deprecated, use quasiperiods instead!") - return self.quasiperiods() - def quasiperiods(self): r""" Returns the quasiperiods of self as a list ordered from shortest to @@ -4350,40 +4118,6 @@ def crochemore_factorization(self): v = self[sum(map(len,c)):] # = x_i ... x_n return c - ########################################################################### - ##### DEPRECATION WARNINGS ################################################ - ##### Added July 2009 ##################################################### - ########################################################################### - def freq(self): - r""" - Returns a table of the frequencies of the letters in self. - - OUTPUT: - - dict -- letters associated to their frequency - - EXAMPLES:: - - sage: f = Word('1213121').freq() - doctest:1: DeprecationWarning: freq is deprecated, use evaluation_dict instead! - See http://trac.sagemath.org/8429 for details. - sage: f # keys appear in random order - {'1': 4, '2': 2, '3': 1} - - TESTS:: - - sage: f = Word('1213121').freq() - sage: f['1'] == 4 - True - sage: f['2'] == 2 - True - sage: f['3'] == 1 - True - """ - from sage.misc.superseded import deprecation - deprecation(8429, "freq is deprecated, use evaluation_dict instead!") - return self.evaluation_dict() - def evaluation_dict(self): r""" Returns a dictionary keyed by the letters occurring in self with @@ -4959,82 +4693,6 @@ def BWT(self): conjugates.sort() return self.parent()([x[x.length()-1] for x in conjugates]) - ########################################################################### - ##### DEPRECATION WARNINGS ################################################ - ##### Added July 2009 ##################################################### - ########################################################################### - def iterated_palindromic_closure(self, side='right', f=None): - r""" - Returns the iterated (`f`-)palindromic closure of ``self``. - - INPUT: - - - ``side`` -- ``'right'`` or ``'left'`` (default: ``'right'``) the - direction of the closure - - - ``f`` -- involution (default: ``None``) on the alphabet of ``self``. - It must be callable on letters as well as words (e.g. WordMorphism). - - OUTPUT: - - word -- If `f` is ``None``, the right iterated palindromic closure of - ``self``; otherwise, the right iterated `f`-palindromic closure - of ``self``. If side is ``'left'``, the left palindromic closure. - - EXAMPLES:: - - sage: Word('123').iterated_palindromic_closure() - doctest:1: DeprecationWarning: iterated_palindromic_closure is deprecated, use iterated_left_palindromic_closure or iterated_right_palindromic_closure instead! - See http://trac.sagemath.org/8429 for details. - word: 1213121 - sage: Word('123').iterated_palindromic_closure(side='left') - word: 3231323 - sage: Word('1').iterated_palindromic_closure() - word: 1 - sage: Word().iterated_palindromic_closure() - word: - sage: Word = Words('ab') - sage: f = WordMorphism('a->b,b->a') - sage: Word('ab').iterated_palindromic_closure(f=f) - word: abbaab - sage: Word('ab').iterated_palindromic_closure(f=f, side='left') - word: abbaab - sage: Word('aab').iterated_palindromic_closure(f=f) - word: ababbaabab - sage: Word('aab').iterated_palindromic_closure(f=f, side='left') - word: abbaabbaab - - TESTS:: - - sage: Word('aab').iterated_palindromic_closure(f=f, side='leftt') - Traceback (most recent call last): - ... - ValueError: side must be either 'left' or 'right' (not leftt) - - If f is not an involution: - sage: f = WordMorphism('a->b,b->b') - sage: Word('aab').iterated_palindromic_closure(f=f, side='left') - Traceback (most recent call last): - ... - TypeError: self (=a->b, b->b) is not an endomorphism - - REFERENCES: - - - A. de Luca, A. De Luca, Pseudopalindrome closure operators - in free monoids, Theoret. Comput. Sci. 362 (2006) 282--300. - """ - from sage.misc.superseded import deprecation - deprecation(8429, "iterated_palindromic_closure is deprecated, " - +"use iterated_left_palindromic_closure or " - +"iterated_right_palindromic_closure instead!") - - if side == 'right': - return self.iterated_right_palindromic_closure(f=f) - elif side == 'left': - return self.iterated_left_palindromic_closure(f=f) - else: - raise ValueError, "side must be either 'left' or 'right' (not %s) " % side - def iterated_left_palindromic_closure(self, f=None): r""" Returns the iterated left (`f`-)palindromic closure of self. @@ -6210,29 +5868,6 @@ def standard_factorization(self): if suff.is_lyndon(): return self[:l], suff - def standard_factorization_of_lyndon_factorization(self): - r""" - Returns the standard factorization of the Lyndon factorization - of self. - - OUTPUT: - - list of lists -- the factorization - - EXAMPLES:: - - sage: Words('123')('1221131122').standard_factorization_of_lyndon_factorization() - doctest:...: DeprecationWarning: standard_factorization_of_lyndon_factorization(): is deprecated since March 2012 and will be removed in a later version of Sage. - See http://trac.sagemath.org/12469 for details. - [(word: 12, word: 2), (word: 1, word: 13), (word: 1, word: 122)] - - """ - from sage.misc.superseded import deprecation - deprecation(12469, "standard_factorization_of_lyndon_factorization(): is " - "deprecated since March 2012 and will be removed in " - "a later version of Sage.") - return [x.standard_factorization() for x in self.lyndon_factorization()] - def apply_permutation_to_positions(self, permutation): r""" Return the word obtained by permuting the positions of the letters diff --git a/src/sage/combinat/words/word_generators.py b/src/sage/combinat/words/word_generators.py index 479ec421e7d..b2bbae5a35d 100644 --- a/src/sage/combinat/words/word_generators.py +++ b/src/sage/combinat/words/word_generators.py @@ -301,20 +301,6 @@ def __reduce__(self): """ return self.__class__, (self.__p, self.__q, self.parent().alphabet()) -class ChristoffelWord_Lower(LowerChristoffelWord): - def __new__(cls, *args, **kwds): - r""" - TEST: - sage: from sage.combinat.words.word_generators import ChristoffelWord_Lower - sage: w = ChristoffelWord_Lower(1,0); w - doctest:1: DeprecationWarning: ChristoffelWord_Lower is deprecated, use LowerChristoffelWord instead - See http://trac.sagemath.org/6519 for details. - word: 1 - """ - from sage.misc.superseded import deprecation - deprecation(6519, "ChristoffelWord_Lower is deprecated, use LowerChristoffelWord instead") - return LowerChristoffelWord.__new__(cls, *args, **kwds) - class WordGenerator(object): r""" Constructor of several famous words. diff --git a/src/sage/combinat/words/words.py b/src/sage/combinat/words/words.py index 82aa7d87766..3d6bdad1dc6 100644 --- a/src/sage/combinat/words/words.py +++ b/src/sage/combinat/words/words.py @@ -1219,12 +1219,6 @@ def iter_morphisms(self, arg=None, codomain=None, min_length=1): ... TypeError: codomain (=a) must be an instance of Words_over_OrderedAlphabet - The argument ``l`` is now deprecated:: - - sage: W = Words('ab') - sage: it = W.iter_morphisms(l=None) - doctest:...: DeprecationWarning: use the option 'arg' instead of 'l' - See http://trac.sagemath.org/10134 for details. """ n = self.size_of_alphabet() # create an iterable of compositions (all "compositions" if arg is @@ -1486,26 +1480,3 @@ def iterate_by_length(self, length): else: return iter([]) -########################################################################### -##### DEPRECATION WARNINGS ################################################ -##### Added July 2009 ##################################################### -########################################################################### - -def is_Words(obj): - r""" - Returns True if obj is a word set and False otherwise. - - EXAMPLES:: - - sage: from sage.combinat.words.words import is_Words - sage: is_Words(33) - doctest:1: DeprecationWarning: is_Words is deprecated, use isinstance(your_object, Words_all) instead! - See http://trac.sagemath.org/6519 for details. - False - sage: is_Words(Words('ab')) - True - """ - from sage.misc.superseded import deprecation - deprecation(6519, "is_Words is deprecated, use isinstance(your_object, Words_all) instead!") - return isinstance(obj, Words_all) -