From 4dd482287eb167e777b70d1c58a7bb38ce95ddd8 Mon Sep 17 00:00:00 2001 From: darij grinberg Date: Fri, 12 Jul 2013 08:43:41 -0700 Subject: [PATCH 01/85] Trac #14884: replace multiplication-by-identity by list padding in tableau.py and tableau_tuple.py --- src/sage/combinat/tableau.py | 2 +- src/sage/combinat/tableau_tuple.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sage/combinat/tableau.py b/src/sage/combinat/tableau.py index 373f58fe200..ad275b98b48 100644 --- a/src/sage/combinat/tableau.py +++ b/src/sage/combinat/tableau.py @@ -2724,7 +2724,7 @@ def symmetric_group_action_on_entries(self, w): sage: _.category() Category of elements of Tableaux """ - w=w*permutation.Permutation( (self.size(),) ) #need to ensure that it belongs to Sym_size + w = w + [i+1 for i in range(len(w), self.size())] #need to ensure that it belongs to Sym_size try: return self.parent()([[w[entry-1] for entry in row] for row in self]) except StandardError: diff --git a/src/sage/combinat/tableau_tuple.py b/src/sage/combinat/tableau_tuple.py index 7da6aaf527d..5ddf2aa9994 100644 --- a/src/sage/combinat/tableau_tuple.py +++ b/src/sage/combinat/tableau_tuple.py @@ -1148,7 +1148,7 @@ def symmetric_group_action_on_entries(self, w): sage: TableauTuple([[[1,2],[4]],[[3,5]]]).symmetric_group_action_on_entries( Permutation(((1,2))) ) ([[2, 1], [4]], [[3, 5]]) """ - w=w*permutation.Permutation( (self.size(),) ) #need to ensure that it belongs to Sym_size + w = w + [i+1 for i in range(len(w), self.size())] #need to ensure that it belongs to Sym_size try: return self.parent()([[[w[entry-1] for entry in row] for row in t] for t in self]) except ValueError: From e56b5f9abb05be7fe62bcebfe3c759e655c3bf1e Mon Sep 17 00:00:00 2001 From: Jeffrey Ferreira Date: Mon, 27 May 2013 16:28:29 -0400 Subject: [PATCH 02/85] Trac #13505: add composition tableaux and quasisymmetric Schur functions --- src/sage/combinat/all.py | 3 +- src/sage/combinat/composition_tableau.py | 866 +++++++++++++++++++ src/sage/combinat/ncsf_qsym/combinatorics.py | 75 +- src/sage/combinat/ncsf_qsym/qsym.py | 207 ++++- src/sage/combinat/ncsf_qsym/tutorial.py | 1 + 5 files changed, 1145 insertions(+), 7 deletions(-) create mode 100644 src/sage/combinat/composition_tableau.py diff --git a/src/sage/combinat/all.py b/src/sage/combinat/all.py index fa370d31a1c..07b6ce9b826 100644 --- a/src/sage/combinat/all.py +++ b/src/sage/combinat/all.py @@ -77,6 +77,7 @@ from skew_tableau import SkewTableau, SkewTableaux, StandardSkewTableaux, SemistandardSkewTableaux from ribbon_shaped_tableau import RibbonShapedTableau, StandardRibbonShapedTableaux from ribbon_tableau import RibbonTableaux, RibbonTableau, MultiSkewTableaux, MultiSkewTableau, SemistandardMultiSkewTableaux +from composition_tableau import CompositionTableau, CompositionTableaux #deprecated from ribbon import Ribbon, StandardRibbons @@ -119,7 +120,7 @@ from root_system.all import * from sf.all import * -from ncsf_qsym.all import QuasiSymmetricFunctions, NonCommutativeSymmetricFunctions +from ncsf_qsym.all import * from matrices.all import * # Posets from posets.all import * diff --git a/src/sage/combinat/composition_tableau.py b/src/sage/combinat/composition_tableau.py new file mode 100644 index 00000000000..086a8a6d234 --- /dev/null +++ b/src/sage/combinat/composition_tableau.py @@ -0,0 +1,866 @@ +r""" +Composition Tableaux + +AUTHORS: + +- Chris Berg, Jeff Ferreira (2012-9): Initial version +""" +from sage.sets.disjoint_union_enumerated_sets import DisjointUnionEnumeratedSets +from sage.sets.non_negative_integers import NonNegativeIntegers +from sage.sets.family import Family +from sage.misc.misc_c import prod +from sage.misc.classcall_metaclass import ClasscallMetaclass +from sage.functions.other import factorial +from sage.misc.cachefunc import cached_function +from sage.structure.element import Element +from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets +from sage.structure.parent import Parent +from sage.structure.unique_representation import UniqueRepresentation +from sage.combinat.composition import Composition, Compositions +from sage.combinat.partition import Partition +from sage.combinat.combinat import CombinatorialObject +from sage.rings.integer import Integer +from sage.combinat.backtrack import GenericBacktracker +import copy + +class CompositionTableau(CombinatorialObject, Element): + r""" + A composition tableau. + + A *composition tableau* `t` of shape `I = (I_1, \ldots, I_{\ell})` is an + array of boxes in rows, `I_i` boxes in row `i`, filled with positive + integers such that: + + 1) the entries in the rows of `t` weakly decrease from left to right, + 2) the left-most column of `t` strictly increase from top to bottom. + 3) Add zero entries to the rows of `t` until the resulting array is + rectangular of shape `\ell \times m`. For `1 \leq i < j \leq \ell, + 2 \leq k \leq m` and `(t(j,k) \neq 0`, and also if `t(j,k) \geq t(i,k))` + implies `t(j,k) > t(i,k-1).` + + INPUT: + + - ``t`` -- A list of lists + + EXAMPLES:: + + sage: CompositionTableau([[1],[2,2]]) + [[1], [2, 2]] + sage: CompositionTableau([[1],[3,2],[4,4]]) + [[1], [3, 2], [4, 4]] + sage: CompositionTableau([]) + [] + """ + __metaclass__ = ClasscallMetaclass + + @staticmethod + def __classcall_private__(self, t): + r""" + This ensures that a composition tableau is only ever constructed as + an ``element_class`` call of an appropriate parent. + + TESTS:: + + sage: t = CompositionTableau([[1],[2,2]]) + sage: TestSuite(t).run() + + sage: t.parent() + Composition Tableaux + sage: t.category() + Category of elements of Composition Tableaux + """ + if isinstance(t, CompositionTableau): + return t + return CompositionTableaux_all().element_class(CompositionTableaux_all(), t) + + def __init__(self, parent, t): + r""" + Initialize a composition tableau. + + TESTS:: + + sage: t = CompositionTableaux()([[1],[2,2]]) + sage: s = CompositionTableaux(3)([[1],[2,2]]) + sage: s==t + True + sage: t.parent() + Composition Tableaux + sage: s.parent() + Composition Tableaux of size 3 and maximum entry 3 + sage: r = CompositionTableaux()(s) + sage: r.parent() + Composition Tableaux + """ + if isinstance(t, CompositionTableau): + Element.__init__(self, parent) + CombinatorialObject.__init__(self, t._list) + return + + # CombinatorialObject verifies that t is a list + # We must verify t is a list of lists + if not all(isinstance(row, list) for row in t): + raise ValueError("A composition tableau must be a list of lists.") + + if not map(len,t) in Compositions(): + raise ValueError("A composition tableau must be a list of non-empty lists.") + + # Verify rows weakly decrease from left to right + for row in t: + if any(row[i] < row[i+1] for i in range(len(row)-1)): + raise ValueError("Rows must weakly decrease from left to right.") + + # Verify leftmost column strictly increases from top to bottom + first_col = [row[0] for row in t if t!=[[]]] + if any(first_col[i] >= first_col[i+1] for i in range(len(t)-1)): + raise ValueError("Leftmost column must strictly increase from top to bottom.") + + # Verify triple condition + l = len(t) + m = max(map(len,t)+[0]) + TT = [row+[0]*(m-len(row)) for row in t] + for i in range(l): + for j in range(i+1,l): + for k in range(1,m): + if TT[j][k] != 0 and TT[j][k] >= TT[i][k] and TT[j][k] <= TT[i][k-1]: + raise ValueError("Triple condition must be satisfied.") + + Element.__init__(self, parent) + CombinatorialObject.__init__(self, t) + + def _repr_diagram(self): + r""" + Return a string representation of ``self`` as an array. + + EXAMPLES:: + + sage: t = CompositionTableau([[1],[3,2],[4,4]]) + sage: print t._repr_diagram() + 1 + 3 2 + 4 4 + """ + return '\n'.join(["".join(map(lambda x: "%3s"%str(x) , row)) for row in self]) + + def __call__(self, *cell): + r""" + Return the value in the corresponding cell of ``self``. + + EXAMPLES:: + + sage: t = CompositionTableau([[1],[3,2],[4,4]]) + sage: t(1,1) + 2 + sage: t(2,0) + 4 + sage: t(2,2) + Traceback (most recent call last): + ... + IndexError: The cell (2,2) is not contained in [[1], [3, 2], [4, 4]] + """ + try: + i,j = cell + except ValueError: + i,j = cell[0] + + try: + return self[i][j] + except IndexError: + raise IndexError, "The cell (%d,%d) is not contained in %s"%(i,j,self) + + def pp(self): + r""" + Return a pretty print string of ``self``. + + EXAMPLES:: + + sage: CompositionTableau([[1],[3,2],[4,4]]).pp() + 1 + 3 2 + 4 4 + """ + print self._repr_diagram() + + def size(self): + r""" + Return the number of boxes in ``self``. + + EXAMPLES:: + + sage: CompositionTableau([[1],[3,2],[4,4]]).size() + 5 + """ + return sum([len(row) for row in self]) + + def weight(self): + r""" + Return a composition where entry `i` is the number of times that `i` appears in + ``self``. + + EXAMPLES:: + + sage: CompositionTableau([[1],[3,2],[4,4]]).weight() + [1, 1, 1, 2, 0] + """ + w = {i:0 for i in range(1,self.size()+1)} + for row in self: + for i in row: + w[i] += 1 + return Composition([w[i] for i in range(1,self.size()+1)]) + + def descent_set(self): + r""" + Return the set of all `i` that do *not* have `i+1` appearing strictly + to the left of `i` in ``self``. + + EXAMPLES:: + + sage: CompositionTableau([[1],[3,2],[4,4]]).descent_set() + [1, 3] + """ + cols = {} + for row in self: + for (col,i) in enumerate(row): + cols[i] = col + des_set = [i for i in cols if i+1 in cols and cols[i+1] >= cols[i]] + des_set.sort() + return des_set + + def descent_composition(self): + r""" + Return the composition corresponding to the set of all `i` that do + not have `i+1` appearing strictly to the left of `i` in ``self``. + + EXAMPLES:: + + sage: CompositionTableau([[1],[3,2],[4,4]]).descent_composition() + [1, 2, 2] + """ + return Composition(from_subset=(self.descent_set(), self.size())) + + def shape_composition(self): + r""" + Return a Composition object which is the shape of ``self``. + + EXAMPLES:: + + sage: CompositionTableau([[1,1],[3,2],[4,4,3]]).shape_composition() + [2, 2, 3] + sage: CompositionTableau([[2,1],[3],[4]]).shape_composition() + [2, 1, 1] + """ + return Composition([len(row) for row in self]) + + def shape_partition(self): + r""" + Return a partition which is the shape of ``self`` sorted into weakly + decreasing order. + + EXAMPLES:: + + sage: CompositionTableau([[1,1],[3,2],[4,4,3]]).shape_partition() + [3, 2, 2] + sage: CompositionTableau([[2,1],[3],[4]]).shape_partition() + [2, 1, 1] + """ + return Partition(sorted([len(row) for row in self], reverse=True)) + + def is_standard(self): + r""" + Return ``True`` if ``self`` is a standard composition tableau and + ``False`` otherwise. + + EXAMPLES:: + + sage: CompositionTableau([[1,1],[3,2],[4,4,3]]).is_standard() + False + sage: CompositionTableau([[2,1],[3],[4]]).is_standard() + True + """ + entries = sum(self,[]) + return sorted(entries) == range(1, self.size() + 1) + +class CompositionTableaux(UniqueRepresentation, Parent): + r""" + Composition tableaux. + + INPUT: + + Keyword arguments: + + - ``size`` -- the size of the composition tableaux + - ``shape`` -- the shape of the composition tableaux + - ``max_entry`` -- the maximum entry for the composition tableaux + + Positional arguments: + + - The first argument is interpreted as ``size`` or ``shape`` depending on + whether it is an integer or a composition. + + EXAMPLES:: + + sage: CT = CompositionTableaux(3); CT + Composition Tableaux of size 3 and maximum entry 3 + sage: list(CT) + [[[1], [2], [3]], + [[1], [2, 2]], + [[1], [3, 2]], + [[1], [3, 3]], + [[2], [3, 3]], + [[1, 1], [2]], + [[1, 1], [3]], + [[2, 1], [3]], + [[2, 2], [3]], + [[1, 1, 1]], + [[2, 1, 1]], + [[2, 2, 1]], + [[2, 2, 2]], + [[3, 1, 1]], + [[3, 2, 1]], + [[3, 2, 2]], + [[3, 3, 1]], + [[3, 3, 2]], + [[3, 3, 3]]] + + sage: CT = CompositionTableaux([1,2,1]); CT + Composition tableaux of shape [1, 2, 1] and maximun entry 4 + sage: list(CT) + [[[1], [2, 2], [3]], + [[1], [2, 2], [4]], + [[1], [3, 2], [4]], + [[1], [3, 3], [4]], + [[2], [3, 3], [4]]] + + sage: CT = CompositionTableaux(shape=[1,2,1],max_entry=3); CT + Composition tableaux of shape [1, 2, 1] and maximun entry 3 + sage: list(CT) + [[[1], [2, 2], [3]]] + + sage: CT = CompositionTableaux(2,max_entry=3); CT + Composition Tableaux of size 2 and maximum entry 3 + sage: list(CT) + [[[1], [2]], + [[1], [3]], + [[2], [3]], + [[1, 1]], + [[2, 1]], + [[2, 2]], + [[3, 1]], + [[3, 2]], + [[3, 3]]] + + sage: CT = CompositionTableaux(0); CT + Composition Tableaux of size 0 and maximum entry 0 + sage: list(CT) + [[]] + """ + @staticmethod + def __classcall_private__(cls, *args, **kwargs): + r""" + This is a factory class which returns the appropriate parent based on + arguments. See the documentation for :class:`CompositionTableaux` for + more information. + + TESTS:: + + sage: CT = CompositionTableaux(3); CT + Composition Tableaux of size 3 and maximum entry 3 + sage: CT = CompositionTableaux(size=3); CT + Composition Tableaux of size 3 and maximum entry 3 + sage: CT = CompositionTableaux([1,2]); CT + Composition tableaux of shape [1, 2] and maximun entry 3 + sage: CT = CompositionTableaux(shape=[1,2]); CT + Composition tableaux of shape [1, 2] and maximun entry 3 + sage: CT = CompositionTableaux(shape=[]); CT + Composition tableaux of shape [] and maximun entry 0 + sage: CT = CompositionTableaux(0); CT + Composition Tableaux of size 0 and maximum entry 0 + sage: CT = CompositionTableaux(max_entry=3); CT + Composition tableaux with maximum entry 3 + sage: CT = CompositionTableaux([1,2],max_entry=3); CT + Composition tableaux of shape [1, 2] and maximun entry 3 + sage: CT = CompositionTableaux(size=2,shape=[1,2]); CT + Traceback (most recent call last): + ... + ValueError: size and shape are different sizes + """ + # Process keyword arguments first + n = kwargs.get('n', None) + size = kwargs.get('size', n) + + comp = kwargs.get('comp', None) + shape = kwargs.get('shape', comp) + + max_entry = kwargs.get('max_entry', None) + + # Process positional arguments + if args: + # The first arg could be either a size or a shape + if isinstance(args[0], (int, Integer)): + if size is not None: + raise ValueError("size was specified more than once") + else: + size = args[0] + else: + if shape is not None: + raise ValueError("the shape was specified more than once") + shape = args[0] + + # Consistency checks + if size is not None: + if not isinstance(size, (int, Integer)): + raise ValueError("size must be an integer") + elif size < 0: + raise ValueError("size must be non-negative") + + if shape is not None: + # use in (and not isinstance) below so that lists can be used as + # shorthand + if not shape in Compositions(): + raise ValueError("shape must be a composition") + if any(i == 0 for i in shape): + raise ValueError("shape must have non-zero parts") + shape = Composition(shape) + + if (size is not None) and (shape is not None): + if sum(shape) != size: + raise ValueError("size and shape are different sizes") + + if max_entry is not None: + if not isinstance(max_entry, (int, Integer)): + raise ValueError("max_entry must be an integer") + elif max_entry <= 0: + raise ValueError("max_entry must be positive") + + # Dispatch to appropriate class + if (shape is not None): + return CompositionTableaux_shape(shape, max_entry) + + if (size is not None): + return CompositionTableaux_size(size, max_entry) + + return CompositionTableaux_all(max_entry) + + def __init__(self, **kwds): + r""" + Initialize ``self``. + + TESTS:: + + sage: CT = CompositionTableaux() + sage: TestSuite(CT).run() + """ + if kwds.has_key('max_entry'): + self.max_entry = kwds['max_entry'] + kwds.pop('max_entry') + else: + self.max_entry = None + super(CompositionTableaux, self).__init__(**kwds) + + Element = CompositionTableau + + def _element_constructor_(self, t): + r""" + Construct an object from ``t`` as an element of ``self``, if + possible. + + INPUT: + + - ``t`` -- data which can be interpreted as a composition tableau + + OUTPUT: + + - The corresponding CompositionTableau object + + TESTS:: + + sage: CT = CompositionTableaux(3) + sage: CT([[1],[2,2]]).parent() is CT + True + sage: CT([[1],[1,2]]) + Traceback (most recent call last): + ... + ValueError: [[1], [1, 2]] is not an element of Composition Tableaux of size 3 and maximum entry 3. + """ + if not t in self: + raise ValueError("%s is not an element of %s."%(t, self)) + + return self.element_class(self, t) + + def __contains__(self, T): + r""" + Return ``True`` if ``T`` can be interpreted as + :class:`CompositionTableau`. + + TESTS:: + + sage: [[1],[2,2]] in CompositionTableaux(3) + True + sage: [[1],[2,2]] in CompositionTableaux(shape=[1,2]) + True + sage: CompositionTableau([[1],[2,2]]) in CompositionTableaux() + True + sage: [[1],[2,2],[2]] in CompositionTableaux() + False + """ + if isinstance(T, CompositionTableau): + return True + + # leftmost column of T strictly increases from top to bottom + first_col = [row[0] for row in T] + if any(first_col[i] >= first_col[i+1] for i in range(len(T)-1)): + return False + # rows of T weakly decrease from left to right + for row in T: + if any(row[i] < row[i+1] for i in range(len(row)-1)): + return False + # for 1 <= i < j <= len(comp), for 2 <= k <= m, + # T[j,k] \neq 0 and T[j,k] >= T[i,k] ==> T[j,k] > T[i,k-1] + l = len(T) + m = max(map(len,T)+[0]) + TT = [row+[0]*(m-len(row)) for row in T] + for i in range(l): + for j in range(i+1,l): + for k in range(1,m): + if TT[j][k] != 0 and TT[j][k] >= TT[i][k] and TT[j][k] <= TT[i][k-1]: + return False + return True + +class CompositionTableaux_all(CompositionTableaux, DisjointUnionEnumeratedSets): + r""" + All composition tableaux. + """ + def __init__(self, max_entry=None): + r""" + Initialize ``self``. + + TESTS:: + + sage: CT = CompositionTableaux() + sage: TestSuite(CT).run() + """ + self.max_entry = max_entry + CT_n = lambda n: CompositionTableaux_size(n, max_entry) + DisjointUnionEnumeratedSets.__init__(self, + Family(NonNegativeIntegers(), CT_n), + facade=True, keepkey = False) + + def _repr_(self): + r""" + TESTS:: + + sage: CompositionTableaux(3) + Composition Tableaux of size 3 and maximum entry 3 + + sage: CompositionTableaux() + Composition Tableaux + """ + if self.max_entry is not None: + return "Composition tableaux with maximum entry %s"%str(self.max_entry) + return "Composition Tableaux" + + def an_element(self): + r""" + Return a particular element of ``self``. + + EXAMPLES:: + + sage: CT = CompositionTableaux() + sage: CT.an_element() + [[1, 1], [2]] + """ + return self.element_class(self, [[1, 1], [2]]) + +class CompositionTableaux_size(CompositionTableaux): + r""" + Composition tableaux of a fixed size `n`. + + INPUT: + + - ``n`` -- a nonnegative integer. + - ``max_entry`` -- a nonnegative integer. This keyword argument defaults to ``n``. + + OUTUT: + + - The class of composition tableaux of size ``n``. + """ + def __init__(self, n, max_entry=None): + r""" + Initializes the class of composition tableaux of size ``n``. + + TESTS:: + + sage: CT = CompositionTableaux(4) + sage: TestSuite(CT).run() + """ + if max_entry is None: + max_entry = n + super(CompositionTableaux_size, self).__init__(max_entry=max_entry, + category=FiniteEnumeratedSets()) + self.size = n + + def __contains__(self,x): + r""" + TESTS:: + + sage: [[1],[2,2]] in CompositionTableaux(3) + True + sage: [[1],[2,2]] in CompositionTableaux(4) + False + """ + return CompositionTableaux.__contains__(self, x) and sum(map(len,x)) == self.size + + def __iter__(self): + r""" + EXAMPLES:: + + sage: [t for t in CompositionTableaux(3)] + [[[1], [2], [3]], + [[1], [2, 2]], + [[1], [3, 2]], + [[1], [3, 3]], + [[2], [3, 3]], + [[1, 1], [2]], + [[1, 1], [3]], + [[2, 1], [3]], + [[2, 2], [3]], + [[1, 1, 1]], + [[2, 1, 1]], + [[2, 2, 1]], + [[2, 2, 2]], + [[3, 1, 1]], + [[3, 2, 1]], + [[3, 2, 2]], + [[3, 3, 1]], + [[3, 3, 2]], + [[3, 3, 3]]] + + sage: CompositionTableaux(3)[0].parent() is CompositionTableaux(3) + True + """ + for comp in Compositions(self.size): + for T in CompositionTableaux_shape(comp,self.max_entry): + yield self.element_class(self, T) + + def _repr_(self): + r""" + TESTS:: + + sage: CompositionTableaux(3) + Composition Tableaux of size 3 and maximum entry 3 + """ + return "Composition Tableaux of size %s and maximum entry %s"%(str(self.size), str(self.max_entry)) + + def _an_element_(self): + r""" + Return a particular element of ``self``. + + EXAMPLES:: + + sage: CT = CompositionTableaux(4) + sage: CT.an_element() + [[1, 1, 1], [2]] + sage: CompositionTableaux(0).an_element() + [] + sage: CompositionTableaux(1).an_element() + [[1]] + """ + if self.size == 0: + return self.element_class(self, []) + if self.size == 1: + return self.element_class(self,[[1]]) + + return self.element_class(self, [[1]*(self.size-1),[2]]) + +class CompositionTableaux_shape(CompositionTableaux): + r""" + Composition tableaux of a fixed shape ``comp`` with a given max entry. + + INPUT: + + - ``comp`` -- a composition. + - ``max_entry`` -- a nonnegative integer. This keyword argument defaults + to the size of ``comp``. + """ + def __init__(self, comp, max_entry=None): + """ + Initialize ``sefl``. + + TESTS:: + + sage: CT = CompositionTableaux([1,2]) + sage: TestSuite(CT).run() + + sage: CT = CompositionTableaux([1,2], max_entry=4) + sage: TestSuite(CT).run() + """ + if max_entry is None: + max_entry = sum(comp) + super(CompositionTableaux_shape, self).__init__(max_entry = max_entry, + category = FiniteEnumeratedSets()) + self.shape = comp + + def __iter__(self): + r""" + An iterator for composition tableaux of a given shape. + + EXAMPLES:: + + sage: [t for t in CompositionTableaux([1,2])] + [[[1], [2, 2]], [[1], [3, 2]], [[1], [3, 3]], [[2], [3, 3]]] + sage: [t for t in CompositionTableaux([1,2],max_entry=4)] + [[[1], [2, 2]], + [[1], [3, 2]], + [[1], [3, 3]], + [[1], [4, 2]], + [[1], [4, 3]], + [[1], [4, 4]], + [[2], [3, 3]], + [[2], [4, 3]], + [[2], [4, 4]], + [[3], [4, 4]]] + """ + if sum(self.shape) == 0: + yield CompositionTableau([]) + else: + for z in CompositionTableauxBacktracker(self.shape, self.max_entry): + yield CompositionTableau(z) + + def __contains__(self, x): + r""" + TESTS:: + + sage: [[2],[4,3]] in CompositionTableaux([1,2]) + True + sage: [[2],[3,2]] in CompositionTableaux([1,2]) + False + """ + return CompositionTableaux.__contains__(self, x) and map(len, x) == self.shape + + def _repr_(self): + r""" + TESTS:: + + sage: CompositionTableaux([1,2,1]) + Composition tableaux of shape [1, 2, 1] and maximun entry 4 + sage: CompositionTableaux([1,2,1],max_entry=3) + Composition tableaux of shape [1, 2, 1] and maximun entry 3 + """ + return "Composition tableaux of shape %s and maximun entry %s"%(str(self.shape), str(self.max_entry)) + + def an_element(self): + r""" + Return a particular element of :class:`CompositionTableaux_shape`. + + EXAMPLES:: + + sage: CT = CompositionTableaux([1,2,1]) + sage: CT.an_element() + [[1], [2, 2], [3]] + """ + if self.shape == []: + return self.element_class(self, []) + t = [[i]*len for (i,len) in enumerate(self.shape,start=1)] + return self.element_class(self, t) + +class CompositionTableauxBacktracker(GenericBacktracker): + r""" + A backtracker class for generating sets of composition tableaux. + """ + def __init__(self, shape, max_entry=None): + """ + EXAMPLES:: + + sage: from sage.combinat.composition_tableau import CompositionTableauxBacktracker + sage: n = CompositionTableauxBacktracker([1,3,2]) + sage: n._ending_position + (2, 1) + sage: n._initial_state + (0, 0) + """ + self._shape = shape + self._n = sum(shape) + self._initial_data = [ [None]*s for s in shape ] + if max_entry==None: + max_entry=sum(shape) + self.max_entry=max_entry + + # The ending position will be at the lowest box which is farthest right + ending_row = len(shape)-1 + ending_col = shape[-1]-1 + self._ending_position = (ending_row, ending_col) + + # Get the highest box that is farthest left + starting_row = 0 + starting_col = 0 + + GenericBacktracker.__init__(self, self._initial_data, (starting_row, starting_col)) + + def _rec(self, obj, state): + r""" + EXAMPLES:: + + sage: from sage.combinat.composition_tableau import CompositionTableauxBacktracker + sage: n = CompositionTableauxBacktracker([1,3,2]) + sage: obj = [ [None], [None, None, None], [None, None] ] + sage: list(n._rec(obj, n._initial_state)) + [([[1], [None, None, None], [None, None]], (1, 0), False), + ([[2], [None, None, None], [None, None]], (1, 0), False), + ([[3], [None, None, None], [None, None]], (1, 0), False), + ([[4], [None, None, None], [None, None]], (1, 0), False), + ([[5], [None, None, None], [None, None]], (1, 0), False), + ([[6], [None, None, None], [None, None]], (1, 0), False)] + """ + #Append zeros to a copy of obj + obj_copy = copy.deepcopy(obj) + for a in range(len(obj_copy)): + for b in range(len(max(obj_copy))-len(obj_copy[a])): + obj_copy[a].append(0) + + #We need to set the i,j^th entry. + i, j = state + + #Get the next state + new_state = self.get_next_pos(i, j) + yld = True if new_state is None else False + + for k in range(1,self.max_entry +1): + #We check to make sure that k does not violate the rule weak decrease in rows + if j!=0 and obj[i][j-1] < k: + continue + + #We check to make sure that k does not violate strict increase in first column + if j == 0 and i != 0 and k <= obj[i-1][j]: + continue + + #We check to make sure that k does not violate the Triple Rule + if j != 0 and i != 0 and any(k == obj_copy[m][j] for m in range(i)): + continue + if j != 0 and i != 0 and any(obj_copy[m][j] < k and k <= obj_copy[m][j-1] for m in range(i)): + continue + + #Fill in the in the i,j box with k + obj[i][j] = k + obj_copy[i][j] = k + + #Yield the object + yield copy.deepcopy(obj), new_state, yld + + def get_next_pos(self, ii, jj): + r""" + EXAMPLES:: + + sage: from sage.combinat.composition_tableau import CompositionTableauxBacktracker + sage: T = CompositionTableau([[2,1],[5,4,3,2],[6],[7,7,6]]) + sage: n = CompositionTableauxBacktracker(T.shape_composition()) + sage: n.get_next_pos(1,1) + (1, 2) + """ + if (ii, jj) == self._ending_position: + return None + + for j in range(jj+1, self._shape[ii]): + if self._shape[ii] >= j: + return ii, j + + return ii+1, 0 + diff --git a/src/sage/combinat/ncsf_qsym/combinatorics.py b/src/sage/combinat/ncsf_qsym/combinatorics.py index 403b973821f..43b9f088c2b 100644 --- a/src/sage/combinat/ncsf_qsym/combinatorics.py +++ b/src/sage/combinat/ncsf_qsym/combinatorics.py @@ -1,4 +1,4 @@ -""" +r""" Common combinatorial tools @@ -6,14 +6,15 @@ .. [NCSF] Gelfand, Krob, Lascoux, Leclerc, Retakh, Thibon, *Noncommutative Symmetric Functions*, Adv. Math. 112 (1995), no. 2, 218-348. - +.. [QSCHUR] Haglund, Luoto, Mason, van Willigenburg, + *Quasisymmetric Schur functions*, J. Comb. Theory Ser. A 118 (2011), 463-490. """ - from sage.misc.misc_c import prod from sage.functions.other import factorial -from sage.misc.cachefunc import cached_method, cached_function +from sage.misc.cachefunc import cached_function from sage.combinat.composition import Composition, Compositions -from sage.combinat.permutation import Permutations +from sage.combinat.composition_tableau import CompositionTableaux + # The following might call for defining a morphism from ``structure # coefficients'' / matrix using something like: @@ -112,6 +113,69 @@ def coeff_sp(J,I): """ return prod(factorial(len(K))*prod(K) for K in J.refinement_splitting(I)) +def coeff_dab(I, J): + r""" + Return the number of standard composition tableaux of shape `I` with + descent composition `J`. + + INPUT: + + - ``I, J`` -- compositions + + OUTPUT: + + - An integer + + EXAMPLES:: + + sage: from sage.combinat.ncsf_qsym.combinatorics import coeff_dab + sage: coeff_dab(Composition([2,1]),Composition([2,1])) + 1 + sage: coeff_dab(Composition([1,1,2]),Composition([1,2,1])) + 0 + """ + d = 0 + for T in CompositionTableaux(I): + if (T.is_standard()) and (T.descent_composition() == J): + d += 1 + return d + +def compositions_order(n): + r""" + Return the compositions of `n` ordered as defined in [QSCHUR]_. + + Let `S(\gamma)` return the composition `\gamma` after sorting. For + compositions `\alpha` and `\beta`, we order `\alpha \rhd \beta` if + + 1) `S(\alpha) > S(\beta)` lexicographically, or + 2) `S(\alpha) = S(\beta)` and `\alpha > \beta` lexicographically. + + INPUT: + + - ``n`` -- a positive integer + + OUTPUT: + + - A list of the compositions of ``n`` sorted into decreasing order + by `\rhd` + + EXAMPLES:: + + sage: from sage.combinat.ncsf_qsym.combinatorics import compositions_order + sage: compositions_order(3) + [[3], [2, 1], [1, 2], [1, 1, 1]] + sage: compositions_order(4) + [[4], [3, 1], [1, 3], [2, 2], [2, 1, 1], [1, 2, 1], [1, 1, 2], [1, 1, 1, 1]] + """ + def _myorder(I,J): + pI = sorted(I, reverse=True) + pJ = sorted(J, reverse=True) + if pI == pJ: + return cmp(list(J), list(I)) + else: + return cmp(pJ , pI) + return sorted(Compositions(n), cmp=_myorder) + def m_to_s_stat(R, I, K): r""" Returns the statistic for the expansion of the Monomial basis element indexed by two @@ -178,3 +242,4 @@ def number_of_fCT(content_comp, shape_comp): if len(x) >= len(shape_comp)-1: s += number_of_fCT(Composition(content_comp[:-1]),x) return s + diff --git a/src/sage/combinat/ncsf_qsym/qsym.py b/src/sage/combinat/ncsf_qsym/qsym.py index 5a182332b2e..1e8cc83368f 100644 --- a/src/sage/combinat/ncsf_qsym/qsym.py +++ b/src/sage/combinat/ncsf_qsym/qsym.py @@ -30,9 +30,11 @@ from sage.categories.realizations import Category_realization_of_parent from sage.structure.parent import Parent from sage.structure.unique_representation import UniqueRepresentation +from sage.matrix.constructor import matrix from sage.combinat.subset import Subsets from sage.combinat.permutation import Permutation, Permutations from sage.combinat.composition import Composition, Compositions +from sage.combinat.composition_tableau import CompositionTableaux from sage.combinat.partition import Partitions from sage.combinat.free_module import CombinatorialFreeModule from sage.combinat.sf.sf import SymmetricFunctions @@ -430,6 +432,7 @@ def __init__(self, R): Monomial = self.Monomial() Fundamental = self.Fundamental() dualImmaculate = self.dualImmaculate() + QS = self.Quasisymmetric_Schur() # Change of bases Fundamental.module_morphism(Monomial.sum_of_finer_compositions, @@ -446,6 +449,15 @@ def __init__(self, R): Monomial.module_morphism(dualImmaculate._from_Monomial_on_basis, codomain = dualImmaculate, category = category ).register_as_coercion() + #This changes Quasisymmetric Schur into Fundamental + QS .module_morphism(QS._to_fundamental_on_basis, + codomain=Fundamental, category=category + ).register_as_coercion() + #This changes Fundamental into Quasisymmetric Schur + Fundamental.module_morphism(QS._from_fundamental_on_basis, + codomain=QS, category=category + ).register_as_coercion() + # Embedding of Sym into QSym in the monomial bases Sym = SymmetricFunctions(self.base_ring()) Sym_m_to_M = Sym.m().module_morphism(Monomial.sum_of_partition_rearrangements, @@ -479,7 +491,7 @@ def a_realization(self): """ return self.Monomial() - _shorthands = tuple(['M', 'F', 'dI']) + _shorthands = tuple(['M', 'F', 'dI', 'QS']) def dual(self): r""" @@ -1176,6 +1188,199 @@ def coproduct_on_basis(self, compo): F = Fundamental + class Quasisymmetric_Schur(CombinatorialFreeModule, BindableClass): + r""" + The Hopf algebra of quasi-symmetric function in the Quasisymmetric + Schur basis. + + The basis of Quasisymmetric Schur functions is defined in [QSCHUR]_. + + EXAMPLES:: + + sage: QSym = QuasiSymmetricFunctions(QQ) + sage: QS = QSym.QS() + sage: F = QSym.F() + sage: M = QSym.M() + sage: F(QS[1,2]) + F[1, 2] + sage: M(QS[1,2]) + M[1, 1, 1] + M[1, 2] + sage: s = SymmetricFunctions(QQ).s() + sage: QS(s[2,1,1]) + QS[1, 1, 2] + QS[1, 2, 1] + QS[2, 1, 1] + """ + def __init__(self, QSym): + r""" + EXAMPLES:: + + sage: QSym = QuasiSymmetricFunctions(QQ) + sage: F = QSym.Fundamental() + sage: QS = QSym.Quasisymmetric_Schur() + sage: QS(F(QS.an_element())) == QS.an_element() + True + sage: F(QS(F.an_element())) == F.an_element() + True + sage: M = QSym.Monomial() + sage: QS(M(QS.an_element())) == QS.an_element() + True + sage: M(QS(M.an_element())) == M.an_element() + True + sage: TestSuite(QS).run() + """ + CombinatorialFreeModule.__init__(self, QSym.base_ring(), Compositions(), + prefix='QS', bracket=False, + category=QSym.Bases()) + + def _realization_name(self): + r""" + Return a nicer name for ``self`` than what is inherited + from :mod:`sage.categories.sets_cat`. + + EXAMPLES:: + + sage: QSym = QuasiSymmetricFunctions(QQ) + sage: QS = QSym.QS() + sage: QS._realization_name() + 'Quasisymmetric Schur' + """ + return "Quasisymmetric Schur" + + def _to_fundamental_on_basis(self, comp): + r""" + Map the quasi-symmetric Schur function indexed by ``comp`` to + the Fundamental basis. + + INPUT: + + - ``comp`` -- a composition + + OUTPUT: + + - a quasi-symmetric function in the Fundamental basis + + EXAMPLES:: + + sage: QSym = QuasiSymmetricFunctions(QQ) + sage: QS = QSym.QS() + sage: QS._to_fundamental_on_basis([1,3,1]) + F[1, 3, 1] + F[2, 2, 1] + """ + F = self.realization_of().Fundamental() + return F.sum_of_monomials(T.descent_composition() for T in CompositionTableaux(comp) if T.is_standard()) + + ########################################################################## + # Implementation of the from_fundamental by inverting to_fundamental + # TODO: discard once we have inverse isomorphisms for graded vector spaces + # and throw instead, in QuasiSymmetricFunctions.__init__, something like: + # Schur_to_F.inverse().register_as_coercion() + + @cached_method + def _to_fundamental_transition_matrix(self, n): + r""" + Return the transition matrix from the basis of Quasisymmetric + Schur functions to the Fundamental basis. + + INPUT: + + - ``n`` -- an integer + + OUTPUT: + + - a square matrix + + EXAMPLES:: + + sage: QSym = QuasiSymmetricFunctions(QQ) + sage: QS = QSym.QS() + sage: QS._to_fundamental_transition_matrix(4) + [1 0 0 0 0 0 0 0] + [0 1 0 0 0 0 0 0] + [0 0 1 1 0 0 0 0] + [0 0 0 1 0 1 0 0] + [0 0 0 0 1 0 0 0] + [0 0 0 0 0 1 0 0] + [0 0 0 0 0 0 1 0] + [0 0 0 0 0 0 0 1] + """ + if n == 0: + return matrix([[]]) + + ranks = dict((comp,rank) for (rank,comp) in enumerate(compositions_order(n))) + d = {} + for T in CompositionTableaux(n): + if T.is_standard(): + I = T.shape_composition() + J = T.descent_composition() + if (I,J) in d: + d[I,J] += 1 + else: + d[I,J] = 1 + m = {} + for (I,J) in d: + m[ranks[I], ranks[J]] = d[I,J] + return matrix(len(ranks), len(ranks), m) + + @cached_method + def _from_fundamental_transition_matrix(self, n): + r""" + Return the transition matrix from the Fundamental basis of + quasi-symmetric functions to the Quasisymmetric Schur basis. + + INPUT: + + - ``n`` -- an integer + + OUTPUT: + + - a square matrix + + EXAMPLES:: + + sage: QSym = QuasiSymmetricFunctions(QQ) + sage: QS = QSym.QS() + sage: QS._from_fundamental_transition_matrix(4) + [ 1 0 0 0 0 0 0 0] + [ 0 1 0 0 0 0 0 0] + [ 0 0 1 -1 0 1 0 0] + [ 0 0 0 1 0 -1 0 0] + [ 0 0 0 0 1 0 0 0] + [ 0 0 0 0 0 1 0 0] + [ 0 0 0 0 0 0 1 0] + [ 0 0 0 0 0 0 0 1] + """ + if n == 0: + return matrix([[]]) + return self._to_fundamental_transition_matrix(n).inverse() + + def _from_fundamental_on_basis(self, comp): + r""" + Maps the Fundamental quasi-symmetric function indexed by ``comp`` to the Quasisymmetric + Schur basis. + + INPUT: + + - ``comp`` -- a composition + + OUTPUT: + + - a quasi-symmetric function in the Quasisymmetric Schur basis + + EXAMPLES:: + + sage: QSym = QuasiSymmetricFunctions(QQ) + sage: QS = QSym.QS() + sage: QS._from_fundamental_on_basis([1,3,1]) + QS[1, 2, 1, 1] + QS[1, 3, 1] - QS[2, 2, 1] + """ + comp = Composition(comp) + if comp == []: + return self.one() + comps = compositions_order(comp.size()) + T = self._from_fundamental_transition_matrix(comp.size()) + return self.sum_of_terms( zip(comps, T[comps.index(comp)]) ) + + QS = Quasisymmetric_Schur + class dualImmaculate(CombinatorialFreeModule, BindableClass): def __init__(self, QSym): r""" diff --git a/src/sage/combinat/ncsf_qsym/tutorial.py b/src/sage/combinat/ncsf_qsym/tutorial.py index af8872854fc..91deaf411ab 100644 --- a/src/sage/combinat/ncsf_qsym/tutorial.py +++ b/src/sage/combinat/ncsf_qsym/tutorial.py @@ -49,6 +49,7 @@ Injecting M as shorthand for Quasisymmetric functions over the Rational Field in the Monomial basis Injecting F as shorthand for Quasisymmetric functions over the Rational Field in the Fundamental basis Injecting dI as shorthand for Quasisymmetric functions over the Rational Field in the dualImmaculate basis + Injecting QS as shorthand for Quasisymmetric functions over the Rational Field in the Quasisymmetric Schur basis Now one can start constructing quasisymmetric functions. From f9198636195d63d07b8ac096c7e07755a2337629 Mon Sep 17 00:00:00 2001 From: Anne Schilling Date: Mon, 8 Jul 2013 18:28:47 -0700 Subject: [PATCH 03/85] Trac #12250: Implementation of weak k-tableaux --- src/doc/en/reference/combinat/tableaux.rst | 1 + src/sage/combinat/all.py | 1 + src/sage/combinat/k_tableau.py | 2198 ++++++++++++++++++++ src/sage/combinat/skew_tableau.py | 16 + src/sage/combinat/tableau.py | 17 + 5 files changed, 2233 insertions(+) create mode 100644 src/sage/combinat/k_tableau.py diff --git a/src/doc/en/reference/combinat/tableaux.rst b/src/doc/en/reference/combinat/tableaux.rst index a38b5c4e978..f33bd3db3ef 100644 --- a/src/doc/en/reference/combinat/tableaux.rst +++ b/src/doc/en/reference/combinat/tableaux.rst @@ -9,3 +9,4 @@ Tableaux and Tableaux-like Objects sage/combinat/ribbon sage/combinat/ribbon_tableau sage/combinat/tableau_tuple + sage/combinat/k_tableau diff --git a/src/sage/combinat/all.py b/src/sage/combinat/all.py index 07b6ce9b826..6d5852c29ec 100644 --- a/src/sage/combinat/all.py +++ b/src/sage/combinat/all.py @@ -83,6 +83,7 @@ from sage.combinat.tableau_tuple import TableauTuple, StandardTableauTuple, TableauTuples, StandardTableauTuples +from k_tableau import WeakTableau, WeakTableaux #Words from words.all import * diff --git a/src/sage/combinat/k_tableau.py b/src/sage/combinat/k_tableau.py new file mode 100644 index 00000000000..bb971ea2c23 --- /dev/null +++ b/src/sage/combinat/k_tableau.py @@ -0,0 +1,2198 @@ +r""" +Strong and weak tableaux + +There are two types of `k`-tableaux: strong `k`-tableaux and weak `k`-tableaux. +Standard weak `k`-tableaux correspond to saturated chains in the weak order, +whereas standard strong `k`-tableaux correspond to saturated chains in the strong Bruhat order. +For semistandard tableaux, the notion of weak and strong horizontal strip is necessary. +More information can be found in [LLMS2006]_ . + +REFERENCES: + +.. [LLMS2006] T. Lam, L. Lapointe, J. Morse, M. Shimozono, + Affine insertion and Pieri rules for the affine Grassmannian, + Memoirs of the AMS, 208 (2010), no. 977, :arxiv:`math.CO/0609110` + +.. [LLMSSZ2013] T. Lam, L. Lapointe, J. Morse, A. Schilling, M. Shimozono, M. Zabrocki, + `k`-Schur functions and affine Schubert calculus, + preprint :arXiv:`1301.3569` + +Authors: + +- Anne Schilling and Mike Zabrocki (2013): initial version +- Avi Dalal and Nate Gallup (2013): implementation of `k`-charge +""" +#***************************************************************************** +# Copyright (C) 2013 Anne Schilling +# Mike Zabrocki +# +# Distributed under the terms of the GNU General Public License (GPL) +# +# This code is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# The full text of the GPL is available at: +# +# http://www.gnu.org/licenses/ +#**************************************************************************** +from sage.structure.unique_representation import UniqueRepresentation +from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets +from sage.structure.parent import Parent +from sage.structure.list_clone import ClonableList +from sage.misc.classcall_metaclass import ClasscallMetaclass +from sage.combinat.skew_tableau import SkewTableau, SemistandardSkewTableaux +from sage.combinat.partition import Partition, Partitions +from sage.combinat.root_system.weyl_group import WeylGroup +from sage.combinat.core import Core +from sage.rings.all import ZZ +from sage.misc.misc import uniq + +def WeakTableau(t, k, inner_shape = [], representation = "core"): + r""" + This is the dispatcher method for the element class of weak `k`-tableaux. + + Standard weak `k`-tableaux correspond to saturated chains in the weak order. + There are three formulations of weak tableaux, one in terms of cores, one in terms + of `k`-bounded partitions, and one in terms of factorizations of affine Grassmannian + elements. For semistandard weak `k`-tableaux, all letters of the same value have to + satisfy the conditions of a horizontal strip. In the affine Grassmannian formulation this + means that all factors are cyclically decreasing elements. For more information, see + for example [LLMSSZ2013]_. + + INPUT: + + - ``t`` -- a weak `k`-tableau in the specified representation: + + - for the 'core' representation ``t`` is a list of lists where each subtableaux + should have a `k+1`-core shape; ``None`` is allowed as an entry for skew weak + `k`-tableaux + - for the 'bounded' representation ``t`` is a list of lists where each subtableaux + should have a `k`-bounded shape; ``None`` is allowed as an entry for skew weak + `k`-tableaux + - for the 'factorized_permutation' representation ``t`` is either a list of + cyclically decreasing Weyl group elements or a list of reduced words of cyclically + decreasing Weyl group elements; to indicate a skew tableau in this representation, + ``inner_shape`` should be the inner shape as a `(k+1)`-core + + - ``k`` -- positive integer + + - ``inner_shape`` -- this entry is only relevant for the 'factorized_permutation' + representation and specifies the inner shape in case the tableau is skew + (default: ``[]``) + + - ``representation`` -- 'core', 'bounded', or 'factorized_permutation' + (default: 'core') + + EXAMPLES: + + Here is an example of a weak 3-tableau in core representation:: + + sage: t = WeakTableau([[1, 1, 2, 2, 3], [2, 3], [3]], 3) + sage: t.shape() + [5, 2, 1] + sage: t.weight() + (2, 2, 2) + sage: type(t) + + + And now we give a skew weak 3-tableau in core representation:: + + sage: ts = WeakTableau([[None, 1, 1, 2, 2], [None, 2], [1]], 3) + sage: ts.shape() + ([5, 2, 1], [1, 1]) + sage: ts.weight() + (2, 2) + sage: type(ts) + + + Next we create the analogue of the first example in bounded representation:: + + sage: tb = WeakTableau([[1,1,2],[2,3],[3]], 3, representation="bounded") + sage: tb.shape() + [3, 2, 1] + sage: tb.weight() + (2, 2, 2) + sage: type(tb) + + sage: tb.to_core_tableau() + [[1, 1, 2, 2, 3], [2, 3], [3]] + sage: t == tb.to_core_tableau() + True + + And the analogue of the skew example in bounded representation:: + + sage: tbs = WeakTableau([[None, 1, 2], [None, 2], [1]], 3, representation = "bounded") + sage: tbs.shape() + ([3, 2, 1], [1, 1]) + sage: tbs.weight() + (2, 2) + sage: tbs.to_core_tableau() + [[None, 1, 1, 2, 2], [None, 2], [1]] + sage: ts.to_bounded_tableau() == tbs + True + + Finally we do the same examples for the factorized permutation representation:: + + sage: tf = WeakTableau([[2,0],[3,2],[1,0]], 3, representation = "factorized_permutation") + sage: tf.shape() + [5, 2, 1] + sage: tf.weight() + (2, 2, 2) + sage: type(tf) + + sage: tf.to_core_tableau() == t + True + + sage: tfs = WeakTableau([[0,3],[2,1]], 3, inner_shape = [1,1], representation = 'factorized_permutation') + sage: tfs.shape() + ([5, 2, 1], [1, 1]) + sage: tfs.weight() + (2, 2) + sage: type(tfs) + + sage: tfs.to_core_tableau() + [[None, 1, 1, 2, 2], [None, 2], [1]] + + Another way to pass from one representation to another is as follows:: + + sage: ts + [[None, 1, 1, 2, 2], [None, 2], [1]] + sage: ts.parent()._representation + 'core' + sage: ts.representation('bounded') + [[None, 1, 2], [None, 2], [1]] + + To test whether a given semistandard tableau is a weak `k`-tableau in the bounded representation, + one can ask:: + + sage: t = Tableau([[1,1,2],[2,3],[3]]) + sage: t.is_k_tableau(3) + True + sage: t = SkewTableau([[None, 1, 2], [None, 2], [1]]) + sage: t.is_k_tableau(3) + True + sage: t = SkewTableau([[None, 1, 1], [None, 2], [2]]) + sage: t.is_k_tableau(3) + False + + TESTS:: + + sage: t = WeakTableau([[2,0],[3,2],[1,0]], 3, representation = "bla") + Traceback (most recent call last): + ... + NotImplementedError: The representation option needs to be 'core', 'bounded', or 'factorized_permuation' + """ + if representation == "core": + return WeakTableau_core(t, k) + elif representation == "bounded": + return WeakTableau_bounded(t, k) + elif representation == "factorized_permutation": + return WeakTableau_factorized_permutation(t, k, inner_shape = inner_shape) + else: + raise NotImplementedError, "The representation option needs to be 'core', 'bounded', or 'factorized_permuation'" + +def WeakTableaux(k, shape , weight, representation = "core"): + r""" + This is the dispatcher method for the parent class of weak `k`-tableaux. + + INPUT: + + - ``k`` -- positive integer + - ``shape`` -- shape of the weak `k`-tableaux; for the 'core' and + 'factorized_permutation' representation, the shape is inputted as a `(k+1)`-core; + for the 'bounded' representation, the shape is inputted as a `k`-bounded partition; + for skew tableaux, the shape is inputted as a tuple of the outer and inner shape + - ``weight`` -- the weight of the weak `k`-tableaux as a list or tuple + - ``representation`` -- 'core', 'bounded', or 'factorized_permutation' (default: 'core') + + EXAMPLES:: + + sage: T = WeakTableaux(3, [5,2,1], [1,1,1,1,1,1]) + sage: T.list() + [[[1, 3, 4, 5, 6], [2, 6], [4]], + [[1, 2, 4, 5, 6], [3, 6], [4]], + [[1, 2, 3, 4, 6], [4, 6], [5]], + [[1, 2, 3, 4, 5], [4, 5], [6]]] + sage: T.cardinality() + 4 + + sage: T = WeakTableaux(3, [[5,2,1], [2]], [1,1,1,1]) + sage: T.list() + [[[None, None, 2, 3, 4], [1, 4], [2]], + [[None, None, 1, 2, 4], [2, 4], [3]], + [[None, None, 1, 2, 3], [2, 3], [4]]] + + sage: T = WeakTableaux(3, [3,2,1], [1,1,1,1,1,1], representation = 'bounded') + sage: T.list() + [[[1, 3, 5], [2, 6], [4]], + [[1, 2, 5], [3, 6], [4]], + [[1, 2, 3], [4, 6], [5]], + [[1, 2, 3], [4, 5], [6]]] + + sage: T = WeakTableaux(3, [[3,2,1], [2]], [1,1,1,1], representation = 'bounded') + sage: T.list() + [[[None, None, 3], [1, 4], [2]], + [[None, None, 1], [2, 4], [3]], + [[None, None, 1], [2, 3], [4]]] + + sage: T = WeakTableaux(3, [5,2,1], [1,1,1,1,1,1], representation = 'factorized_permutation') + sage: T.list() + [[s0, s3, s2, s1, s3, s0], + [s0, s3, s2, s3, s1, s0], + [s0, s2, s3, s2, s1, s0], + [s2, s0, s3, s2, s1, s0]] + + sage: T = WeakTableaux(3, [[5,2,1], [2]], [1,1,1,1], representation = 'factorized_permutation') + sage: T.list() + [[s0, s3, s2, s3], [s0, s2, s3, s2], [s2, s0, s3, s2]] + """ + if representation == "core": + return WeakTableaux_core(k, shape, weight) + elif representation == "bounded": + return WeakTableaux_bounded(k, shape, weight) + elif representation == "factorized_permutation": + return WeakTableaux_factorized_permutation(k, shape, weight) + else: + raise NotImplementedError, "The representation option needs to be 'core', 'bounded', or 'factorized_permuation'" + +#Abstract class for the elements of weak tableau +class WeakTableau_abstract(ClonableList): + r""" + Abstract class for the various element classes of WeakTableau. + """ + __metaclass__ = ClasscallMetaclass + + def shape(self): + r""" + Return the shape of ``self``. + + When the tableau is straight, the outer shape is returned. + When the tableau is skew, the tuple of the outer and inner shape is returned. + + EXAMPLES:: + + sage: t = WeakTableau([[1, 1, 2, 2, 3], [2, 3], [3]], 3) + sage: t.shape() + [5, 2, 1] + sage: t = WeakTableau([[None, None, 2, 3, 4], [1, 4], [2]], 3) + sage: t.shape() + ([5, 2, 1], [2]) + + sage: t = WeakTableau([[1,1,1],[2,2],[3]], 3, representation = 'bounded') + sage: t.shape() + [3, 2, 1] + sage: t = WeakTableau([[None, None, 1], [2, 4], [3]], 3, representation = 'bounded') + sage: t.shape() + ([3, 2, 1], [2]) + + sage: t = WeakTableau([[2],[0,3],[2,1,0]], 3, representation = 'factorized_permutation') + sage: t.shape() + [5, 2, 1] + sage: t = WeakTableau([[2,0],[3,2]], 3, inner_shape = [2], representation = 'factorized_permutation') + sage: t.shape() + ([5, 2, 1], [2]) + """ + return self.parent().shape() + + def weight(self): + r""" + Return the weight of ``self``. + + The weight is a tuple whose `i`-th entry is the number of labels `i` in the + bounded representation of ``self``. + + EXAMPLES:: + + sage: t = WeakTableau([[1, 1, 2, 2, 3], [2, 3], [3]], 3) + sage: t.weight() + (2, 2, 2) + sage: t = WeakTableau([[None, None, 2, 3, 4], [1, 4], [2]], 3) + sage: t.weight() + (1, 1, 1, 1) + sage: t = WeakTableau([[None,2,3],[3]],2) + sage: t.weight() + (0, 1, 1) + + sage: t = WeakTableau([[1,1,1],[2,2],[3]], 3, representation = 'bounded') + sage: t.weight() + (3, 2, 1) + sage: t = WeakTableau([[1,1,2],[2,3],[3]], 3, representation = 'bounded') + sage: t.weight() + (2, 2, 2) + sage: t = WeakTableau([[None, None, 1], [2, 4], [3]], 3, representation = 'bounded') + sage: t.weight() + (1, 1, 1, 1) + + sage: t = WeakTableau([[2],[0,3],[2,1,0]], 3, representation = 'factorized_permutation') + sage: t.weight() + (3, 2, 1) + sage: t = WeakTableau([[2,0],[3,2],[1,0]], 3, representation = 'factorized_permutation') + sage: t.weight() + (2, 2, 2) + sage: t = WeakTableau([[2,0],[3,2]], 3, inner_shape = [2], representation = 'factorized_permutation') + sage: t.weight() + (2, 2) + """ + return self.parent()._weight + + def size_of_shape(self): + r""" + Return the size of the shape of ``self``. + + In the bounded representation, the size of the shape is the number of boxes in the + outer shape minus the number of boxes in the inner shape. For the core and + factorized permutation representation, the size is the length of the outer shape + minus the length of the inner shape. + + .. SEEALSO:: :meth:`sage.combinat.core.Core.length` + + EXAMPLES:: + + sage: t = WeakTableau([[None, 1, 1, 2, 2], [None, 2], [1]], 3) + sage: t.shape() + ([5, 2, 1], [1, 1]) + sage: t.size_of_shape() + 4 + sage: t = WeakTableau([[1,1,2],[2,3],[3]], 3, representation="bounded") + sage: t.shape() + [3, 2, 1] + sage: t.size_of_shape() + 6 + """ + return self.parent().size_of_shape() + + def intermediate_shapes(self): + r""" + Return the intermediate shapes of ``self``. + + A (skew) tableau with letters `1,2,\ldots,\ell` can be viewed as a sequence of shapes, + where the `i`-th shape is given by the shape of the subtableau on letters `1,2,\ldots,i`. + The output is the list of these shapes. + + EXAMPLES:: + + sage: t = WeakTableau([[1, 1, 2, 2, 3], [2, 3], [3]],3) + sage: t.intermediate_shapes() + [[], [2], [4, 1], [5, 2, 1]] + + sage: t = WeakTableau([[None, None, 2, 3, 4], [1, 4], [2]], 3) + sage: t.intermediate_shapes() + [[2], [2, 1], [3, 1, 1], [4, 1, 1], [5, 2, 1]] + + sage: t = WeakTableau([[1,1,1],[2,2],[3]], 3, representation = 'bounded') + sage: t.intermediate_shapes() + [[], [3], [3, 2], [3, 2, 1]] + + sage: t = WeakTableau([[None, None, 1], [2, 4], [3]], 3, representation = 'bounded') + sage: t.intermediate_shapes() + [[2], [3], [3, 1], [3, 1, 1], [3, 2, 1]] + + sage: t = WeakTableau([[0],[3],[2],[3]], 3, inner_shape = [2], representation = 'factorized_permutation') + sage: t.intermediate_shapes() + [[2], [2, 1], [3, 1, 1], [4, 1, 1], [5, 2, 1]] + """ + if self.parent()._representation in ['core', 'bounded']: + return intermediate_shapes(self) + else: + return intermediate_shapes(self.to_core_tableau()) + + def pp(self): + r""" + Return a pretty print string of the tableau. + + EXAMPLES:: + + sage: t = WeakTableau([[None, 1, 1, 2, 2], [None, 2], [1]], 3) + sage: t.pp() + . 1 1 2 2 + . 2 + 1 + sage: t = WeakTableau([[2,0],[3,2]], 3, inner_shape = [2], representation = 'factorized_permutation') + sage: t.pp() + [s2*s0, s3*s2] + """ + if self.parent()._representation in ['core', 'bounded']: + print self._repr_diagram() + else: + print self + + def _latex_(self): + r""" + Return a latex method for the tableau. + + EXAMPLES:: + + sage: t = WeakTableau([[None, 1, 1, 2, 2], [None, 2], [1]], 3) + sage: latex(t) + {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}} + \raisebox{-.6ex}{$\begin{array}[b]{*{5}c}\cline{1-5} + \lr{}&\lr{1}&\lr{1}&\lr{2}&\lr{2}\\\cline{1-5} + \lr{}&\lr{2}\\\cline{1-2} + \lr{1}\\\cline{1-1} + \end{array}$} + } + + sage: t = WeakTableau([[0,3],[2,1]], 3, inner_shape = [1,1], representation = 'factorized_permutation') + sage: latex(t) + [s_{0}s_{3},s_{2}s_{1}] + """ + def chi(x): + if x is None: + return "" + if x in ZZ: + return x + return "%s"%x + if self.parent()._representation in ['core', 'bounded']: + t = [[chi(x) for x in row] for row in self._list] + from output import tex_from_array + return tex_from_array(t) + else: + return "["+"".join(self[i]._latex_()+',' for i in range(len(self)-1))+self[len(self)-1]._latex_()+"]" + + def representation(self, representation = 'core'): + r""" + Return the analogue of ``self`` in the specified representation. + + INPUT: + + - ``representation`` -- 'core', 'bounded', or 'factorized_permutation' (default: 'core') + + EXAMPLES:: + + sage: t = WeakTableau([[1, 1, 2, 3, 4, 4, 5, 5, 6], [2, 3, 5, 5, 6], [3, 4, 7], [5, 6], [6], [7]], 4) + sage: t.parent()._representation + 'core' + sage: t.representation('bounded') + [[1, 1, 2, 4], [2, 3, 5], [3, 4], [5, 6], [6], [7]] + sage: t.representation('factorized_permutation') + [s0, s3*s1, s2*s1, s0*s4, s3*s0, s4*s2, s1*s0] + + sage: tb = WeakTableau([[1, 1, 2, 4], [2, 3, 5], [3, 4], [5, 6], [6], [7]], 4, representation = 'bounded') + sage: tb.parent()._representation + 'bounded' + sage: tb.representation('core') == t + True + sage: tb.representation('factorized_permutation') + [s0, s3*s1, s2*s1, s0*s4, s3*s0, s4*s2, s1*s0] + + sage: tp = WeakTableau([[0],[3,1],[2,1],[0,4],[3,0],[4,2],[1,0]], 4, representation = 'factorized_permutation') + sage: tp.parent()._representation + 'factorized_permutation' + sage: tp.representation('core') == t + True + sage: tp.representation('bounded') == tb + True + """ + t = self + if self.parent()._representation in ['bounded', 'factorized_permutation']: + t = t.to_core_tableau() + if representation == 'core': + return t + elif representation == 'bounded': + return t.to_bounded_tableau() + elif representation == 'factorized_permutation': + return t.to_factorized_permutation_tableau() + else: + raise ValueError("The representation must be one of 'core', 'bounded', or 'factorized_permutation'") + +#Abstract class for the parents of weak tableaux +class WeakTableaux_abstract(UniqueRepresentation, Parent): + r""" + Abstract class for the various parent classes of WeakTableaux. + """ + def shape(self): + r""" + Return the shape of the tableaux of ``self``. + + When ``self`` is the class of straight tableaux, the outer shape is returned. + When ``self`` is the class of skew tableaux, the tuple of the outer and inner + shape is returned. + + Note that in the 'core' and 'factorized_permutation' representation, the shapes + are `(k+1)`-cores. In the 'bounded' representation, the shapes are `k`-bounded + partitions. + + If the user wants to access the skew shape (even if the inner shape is empty), + please use ``self._shape``. + + EXAMPLES:: + + sage: T = WeakTableaux(3, [5,2,2], [2,2,2,1]) + sage: T.shape() + [5, 2, 2] + sage: T._shape + ([5, 2, 2], []) + sage: T = WeakTableaux(3, [[5,2,2], [1]], [2,1,2,1]) + sage: T.shape() + ([5, 2, 2], [1]) + + sage: T = WeakTableaux(3, [3,2,2], [2,2,2,1], representation = 'bounded') + sage: T.shape() + [3, 2, 2] + sage: T._shape + ([3, 2, 2], []) + sage: T = WeakTableaux(3, [[3,2,2], [1]], [2,1,2,1], representation = 'bounded') + sage: T.shape() + ([3, 2, 2], [1]) + + sage: T = WeakTableaux(3, [4,1], [2,2], representation = 'factorized_permutation') + sage: T.shape() + [4, 1] + sage: T._shape + ([4, 1], []) + sage: T = WeakTableaux(4, [[6,2,1], [2]], [2,1,1,1], representation = 'factorized_permutation') + sage: T.shape() + ([6, 2, 1], [2]) + """ + if self._skew: + return (self._outer_shape, self._inner_shape) + return self._outer_shape + + def size_of_shape(self): + r""" + Return the size of the shape. + + In the bounded representation, the size of the shape is the number of boxes in the + outer shape minus the number of boxes in the inner shape. For the core and + factorized permutation representation, the size is the length of the outer shape + minus the length of the inner shape. + + EXAMPLES:: + + sage: T = WeakTableaux(3, [5,2,1], [1,1,1,1,1,1]) + sage: T.size_of_shape() + 6 + sage: T = WeakTableaux(3, [3,2,1], [1,1,1,1,1,1], representation = 'bounded') + sage: T.size_of_shape() + 6 + sage: T = WeakTableaux(4, [[6,2,1], [2]], [2,1,1,1], 'factorized_permutation') + sage: T.size_of_shape() + 5 + """ + if self._representation == 'bounded': + return self._outer_shape.size() - self._inner_shape.size() + else: + return self._outer_shape.length() - self._inner_shape.length() + + def representation(self, representation = 'core'): + r""" + Return the analogue of ``self`` in the specified representation. + + INPUT: + + - ``representation`` -- 'core', 'bounded', or 'factorized_permutation' (default: 'core') + + EXAMPLES:: + + sage: T = WeakTableaux(3, [5,2,1], [1,1,1,1,1,1]) + sage: T._representation + 'core' + sage: T.representation('bounded') + Bounded weak 3-Tableaux of (skew) 3-bounded shape [3, 2, 1] and weight (1, 1, 1, 1, 1, 1) + sage: T.representation('factorized_permutation') + Factorized permutation (skew) weak 3-Tableaux of shape [5, 2, 1] and weight (1, 1, 1, 1, 1, 1) + + sage: T = WeakTableaux(3, [3,2,1], [1,1,1,1,1,1], representation = 'bounded') + sage: T._representation + 'bounded' + sage: T.representation('core') + Core weak 3-Tableaux of (skew) core shape [5, 2, 1] and weight (1, 1, 1, 1, 1, 1) + sage: T.representation('bounded') + Bounded weak 3-Tableaux of (skew) 3-bounded shape [3, 2, 1] and weight (1, 1, 1, 1, 1, 1) + sage: T.representation('bounded') == T + True + sage: T.representation('factorized_permutation') + Factorized permutation (skew) weak 3-Tableaux of shape [5, 2, 1] and weight (1, 1, 1, 1, 1, 1) + sage: T.representation('factorized_permutation') == T + False + + sage: T = WeakTableaux(3, [5,2,1], [1,1,1,1,1,1], representation = 'factorized_permutation') + sage: T._representation + 'factorized_permutation' + sage: T.representation('core') + Core weak 3-Tableaux of (skew) core shape [5, 2, 1] and weight (1, 1, 1, 1, 1, 1) + sage: T.representation('bounded') + Bounded weak 3-Tableaux of (skew) 3-bounded shape [3, 2, 1] and weight (1, 1, 1, 1, 1, 1) + sage: T.representation('factorized_permutation') + Factorized permutation (skew) weak 3-Tableaux of shape [5, 2, 1] and weight (1, 1, 1, 1, 1, 1) + """ + outer_shape = self._outer_shape + inner_shape = self._inner_shape + weight = self._weight + if (self._representation in ['core', 'factorized_permutation']) and representation == 'bounded': + outer_shape = outer_shape.to_bounded_partition() + inner_shape = inner_shape.to_bounded_partition() + if self._representation == 'bounded' and (representation in ['core', 'factorized_permutation']): + outer_shape = outer_shape.to_core(self.k) + inner_shape = inner_shape.to_core(self.k) + return WeakTableaux(self.k, [outer_shape, inner_shape], weight, representation = representation) + + +#Weak Tableaux in terms of cores +class WeakTableau_core(WeakTableau_abstract): + r""" + A (skew) weak `k`-tableau represented in terms of `(k+1)`-cores. + """ + @staticmethod + def __classcall_private__(cls, t, k): + r""" + Implements the shortcut ``WeakTableau_core(t, k)`` to ``WeakTableaux_core(k, shape , weight)(t)`` + where ``shape`` is the shape of the tableau and ``weight`` is its weight. + + TESTS:: + + sage: from sage.combinat.k_tableau import WeakTableau_core + sage: t = WeakTableau_core([[1, 1, 2, 2, 3], [2, 3], [3]], 3) + sage: t.check() + sage: type(t) + + sage: TestSuite(t).run() + sage: t.parent()._skew + False + + sage: t = WeakTableau_core([[None, None, 1, 1, 2], [1, 2], [2]],3) + sage: t.check() + sage: type(t) + + sage: TestSuite(t).run() + sage: t.parent()._skew + True + """ + if isinstance(t, cls): + return t + tab = SkewTableau(list(t)) + outer = Core(tab.outer_shape(),k+1) + inner = Core(tab.inner_shape(),k+1) + weight = WeakTableau_bounded.from_core_tableau(t,k).weight() + return WeakTableaux_core(k, [outer, inner], weight)(t) + + def __init__(self, parent, t): + r""" + Initialization of weak `k`-tableau ``t`` in core representation. + + INPUT: + + - ``t`` -- weak tableau in core representation; the input is supposed to be a list + of lists specifying the rows of the tableau; + ``None`` is allowed as an entry for skew weak `k`-tableaux + + TESTS:: + + sage: from sage.combinat.k_tableau import WeakTableau_core, WeakTableaux_core + sage: T = WeakTableaux_core(3,[5,2,1],[2,2,2]) + sage: t = T([[1, 1, 2, 2, 3], [2, 3], [3]]); t + [[1, 1, 2, 2, 3], [2, 3], [3]] + sage: c = WeakTableau_core([[1, 1, 2, 2, 3], [2, 3], [3]],3) + sage: T = WeakTableaux_core(3,[5,2,1],[2,2,2]) + sage: t = T([[1, 1, 2, 2, 3], [2, 3], [3]]); t + [[1, 1, 2, 2, 3], [2, 3], [3]] + sage: c == t + True + sage: type(t) + + sage: t.parent() + Core weak 3-Tableaux of (skew) core shape [5, 2, 1] and weight (2, 2, 2) + sage: TestSuite(t).run() + + sage: t = WeakTableau_core([[None, None, 1, 1, 2], [1, 2], [2]],3); t + [[None, None, 1, 1, 2], [1, 2], [2]] + sage: t.weight() + (2, 2) + sage: t.shape() + ([5, 2, 1], [2]) + sage: TestSuite(t).run() + """ + self.k = parent.k + self._list = [r for r in t] + ClonableList.__init__(self, parent, t) + + def _repr_diagram(self): + r""" + Return a string representation of ``self`` as a diagram. + + EXAMPLES:: + + sage: t = WeakTableau([[None, None, 2, 3, 4], [1, 4], [2]], 3) + sage: print t._repr_diagram() + . . 2 3 4 + 1 4 + 2 + """ + t = SkewTableau(list(self)) + return t._repr_diagram() + + def shape_core(self): + r""" + Return the shape of ``self`` as a `(k+1)`-core. + + When the tableau is straight, the outer shape is returned as a core. When the + tableau is skew, the tuple of the outer and inner shape is returned as cores. + + EXAMPLES:: + + sage: t = WeakTableau([[1, 1, 2, 2, 3], [2, 3], [3]],3) + sage: t.shape_core() + [5, 2, 1] + + sage: t = WeakTableau([[None, None, 2, 3, 4], [1, 4], [2]], 3) + sage: t.shape_core() + ([5, 2, 1], [2]) + """ + return self.shape() + + def shape_bounded(self): + r""" + Return the shape of ``self`` as a `k`-bounded partition. + + When the tableau is straight, the outer shape is returned as a `k`-bounded + partition. When the tableau is skew, the tuple of the outer and inner shape is + returned as `k`-bounded partitions. + + EXAMPLES:: + + sage: t = WeakTableau([[1, 1, 2, 2, 3], [2, 3], [3]],3) + sage: t.shape_bounded() + [3, 2, 1] + + sage: t = WeakTableau([[None, None, 2, 3, 4], [1, 4], [2]], 3) + sage: t.shape_bounded() + ([3, 2, 1], [2]) + """ + if self.parent()._skew: + return tuple([r.to_bounded_partition() for r in self.shape_core()]) + return self.shape_core().to_bounded_partition() + + def check(self): + r""" + Check that ``self`` is a valid weak `k`-tableau. + + EXAMPLES:: + + sage: t = WeakTableau([[1, 1, 2], [2]], 2) + sage: t.check() + sage: t = WeakTableau([[None, None, 2, 3, 4], [1, 4], [2]], 3) + sage: t.check() + + TESTS:: + + sage: T = WeakTableaux(2, [3,1], [1,1,1,1]) + sage: t = T([[1,2,3],[3]]) + Traceback (most recent call last): + ... + ValueError: The weight of the parent does not agree with the weight of the tableau! + + sage: t = WeakTableau([[1, 2, 2], [1]], 2) + Traceback (most recent call last): + ... + ValueError: The tableau is not semistandard! + """ + if not self.parent()._weight == WeakTableau_bounded.from_core_tableau(self._list,self.k).weight(): + raise ValueError("The weight of the parent does not agree with the weight of the tableau!") + t = SkewTableau(list(self)) + if not t in SemistandardSkewTableaux(): + raise ValueError("The tableau is not semistandard!") + outer = Core(t.outer_shape(),self.k+1) + inner = Core(t.inner_shape(),self.k+1) + if self.parent()._outer_shape != outer: + raise ValueError("The outer shape of the parent does not agree with the outer shape of the tableau!") + if self.parent()._inner_shape != inner: + raise ValueError("The inner shape of the parent does not agree with the inner shape of the tableau!") + self.to_bounded_tableau().check() + + def to_bounded_tableau(self): + r""" + Return the bounded representation of the weak `k`-tableau ``self``. + + Each restricted sutableaux of the output is a `k`-bounded partition. + + EXAMPLES:: + + sage: t = WeakTableau([[1, 1, 2, 2, 3], [2, 3], [3]], 3) + sage: c = t.to_bounded_tableau(); c + [[1, 1, 2], [2, 3], [3]] + sage: type(c) + + + sage: t = WeakTableau([[None, None, 2, 3, 4], [1, 4], [2]], 3) + sage: t.to_bounded_tableau() + [[None, None, 3], [1, 4], [2]] + sage: t.to_bounded_tableau().to_core_tableau() == t + True + """ + shapes = [ Core(p,self.k+1).to_bounded_partition() for p in self.intermediate_shapes() ] + if self.parent()._skew: + l = [[None]*i for i in shapes[0]] + else: + l = [] + for i in range(1,len(shapes)): + p = shapes[i] + if len(l) < len(p): + l += [[]] + l_new = [] + for j in range(len(l)): + l_new += [l[j] + [i]*(p[j]-len(l[j]))] + l = l_new + return WeakTableau_bounded(l, self.k) + + def to_factorized_permutation_tableau(self): + r""" + Return the factorized permutation representation of the weak `k`-tableau ``self``. + + EXAMPLES:: + + sage: t = WeakTableau([[1, 1, 2, 2, 3], [2, 3], [3]], 3) + sage: c = t.to_factorized_permutation_tableau(); c + [s2*s0, s3*s2, s1*s0] + sage: type(c) + + sage: c.to_core_tableau() == t + True + + sage: t = WeakTableau([[None, None, 2, 3, 4], [1, 4], [2]], 3) + sage: c = t.to_factorized_permutation_tableau(); c + [s0, s3, s2, s3] + sage: c._inner_shape + [2] + sage: c.to_core_tableau() == t + True + + TESTS:: + + sage: t = WeakTableau([], 4) + sage: c = t.to_factorized_permutation_tableau(); c + [1] + sage: c._inner_shape + [] + sage: c.to_core_tableau() == t + True + """ + shapes = [ Core(p,self.k+1).to_grassmannian() for p in self.intermediate_shapes() ] + perms = [ shapes[i]*(shapes[i-1].inverse()) for i in range(len(shapes)-1,0,-1)] + return WeakTableau_factorized_permutation(perms, self.k, inner_shape = self.parent()._inner_shape) + + def residues_of_entries(self, v): + r""" + Return a list of residues of cells of weak `k`-tableau ``self`` labeled by ``v``. + + INPUT: + + - ``v`` -- a label of a cell in ``self`` + + OUTPUT: + + - a list of residues + + EXAMPLES:: + + sage: t = WeakTableau([[1, 1, 2, 2, 3], [2, 3], [3]],3) + sage: t.residues_of_entries(1) + [0, 1] + + sage: t = WeakTableau([[None, None, 1, 1, 4], [1, 4], [3]], 3) + sage: t.residues_of_entries(1) + [2, 3] + """ + return uniq([(j - i)%(self.k+1) for i in range(len(self)) for j in range(len(self[i])) if self[i][j] == v]) + + def dictionary_of_coordinates_at_residues(self, v): + r""" + Return a dictionary assigning to all residues of ``self`` with label ``v`` a list + of cells with the given residue. + + INPUT: + + - ``v`` -- a label of a cell in ``self`` + + OUTPUT: + + - dictionary assigning coordinates in ``self`` to residues + + EXAMPLES:: + + sage: t = WeakTableau([[1, 1, 2, 2, 3], [2, 3], [3]],3) + sage: t.dictionary_of_coordinates_at_residues(3) + {0: [(0, 4), (1, 1)], 2: [(2, 0)]} + + sage: t = WeakTableau([[None, None, 1, 1, 4], [1, 4], [3]], 3) + sage: t.dictionary_of_coordinates_at_residues(1) + {2: [(0, 2)], 3: [(0, 3), (1, 0)]} + + sage: t = WeakTableau([], 3) + sage: t.dictionary_of_coordinates_at_residues(1) + {} + """ + d = {} + for r in self.residues_of_entries(v): + d[r] = [] + for i in range(len(self)): + for j in range(len(self[i])): + if self[i][j]==v and (j - i)%(self.k+1) == r: + d[r]+=[(i,j)] + return d + + def list_of_standard_cells(self): + r""" + Return a list of lists of the coordinates of the standard cells of ``self``. + + INPUT: + + - ``self`` -- a weak `k`-tableau in core representation with partition weight + + OUTPUT: + + - a list of lists of coordinates + + .. WARNING:: + + This method currently only works for straight weak tableaux with partition + weight. + + EXAMPLES:: + + sage: t = WeakTableau([[1, 1, 2, 2, 3], [2, 3], [3]], 3) + sage: t.list_of_standard_cells() + [[(0, 1), (1, 0), (2, 0)], [(0, 0), (0, 2), (1, 1)]] + sage: t = WeakTableau([[1, 1, 1, 2], [2, 2, 3]], 5) + sage: t.list_of_standard_cells() + [[(0, 2), (1, 1), (1, 2)], [(0, 1), (1, 0)], [(0, 0), (0, 3)]] + sage: t = WeakTableau([[1, 1, 2, 3, 4, 4, 5, 5, 6], [2, 3, 5, 5, 6], [3, 4, 7], [5, 6], [6], [7]], 4) + sage: t.list_of_standard_cells() + [[(0, 1), (1, 0), (2, 0), (0, 5), (3, 0), (4, 0), (5, 0)], [(0, 0), (0, 2), (1, 1), (2, 1), (1, 2), (3, 1)]] + + TESTS:: + + sage: t = WeakTableau([],3) + sage: t.list_of_standard_cells() + [] + + sage: t = WeakTableau([[None, None, 2, 3, 4], [1, 4], [2]], 3) + sage: t.list_of_standard_cells() + Traceback (most recent call last): + ... + ValueError: This method only works for straight tableaux! + + sage: t = WeakTableau([[1,2],[2]], 3) + sage: t.list_of_standard_cells() + Traceback (most recent call last): + ... + ValueError: This method only works for weak tableaux with partition weight! + """ + if self.parent()._skew: + raise ValueError("This method only works for straight tableaux!") + if self.weight() not in Partitions(sum(self.weight())): + raise ValueError("This method only works for weak tableaux with partition weight!") + if self._list == []: + return [] + mu = Partition(self.weight()).conjugate() + already_used = [] + out = [] + for i in range(self[0].count(1)): + standard_cells = [(0,self[0].count(1) - i - 1)] + r = self[0].count(1) - i - 1 + for v in range(1,mu[i]): + D = self.dictionary_of_coordinates_at_residues(v+1) + new_D = {a:b for (a,b) in D.iteritems() if all(x not in already_used for x in b)} + r = (r - min([self.k+1 - (x-r)%(self.k+1) for x in new_D.keys()]))%(self.k+1) + standard_cells.append(new_D[r][-1]) + already_used += new_D[r] + out.append(standard_cells) + return out + + def k_charge(self, algorithm = "I"): + r""" + Return the `k`-charge of ``self``. + + INPUT: + + - ``algorithm`` -- (default: "I") if "I", computes `k`-charge using the `I` + algorithm, otherwise uses the `J`-algorithm + + OUTPUT: + + - a nonnegative integer + + For the definition of `k`-charge and the various algorithms to compute it see + Section 3.3 of [LLMSSZ2013]_. + + .. SEEALSO:: :meth:`k_charge_I` and :meth:`k_charge_J` + + EXAMPLES:: + + sage: t = WeakTableau([[1, 1, 2, 2, 3], [2, 3], [3]], 3) + sage: t.k_charge() + 2 + sage: t = WeakTableau([[1, 3, 4, 5, 6], [2, 6], [4]], 3) + sage: t.k_charge() + 8 + sage: t = WeakTableau([[1, 1, 2, 3, 4, 4, 5, 5, 6], [2, 3, 5, 5, 6], [3, 4, 7], [5, 6], [6], [7]], 4) + sage: t.k_charge() + 12 + + TESTS:: + + sage: T = WeakTableaux(4, [13,9,5,3,2,1,1], [4,3,3,2,2,1,1,1]) + sage: T.cardinality() + 6 + sage: all(t.k_charge_I() == t.k_charge_J() for t in T) + True + """ + if algorithm == "I": + return self.k_charge_I() + return self.k_charge_J() + + def k_charge_I(self): + r""" + Return the `k`-charge of ``self`` using the `I`-algorithm. + + For the definition of `k`-charge and the `I`-algorithm see Section 3.3 of [LLMSSZ2013]_. + + OUTPUT: + + - a nonnegative integer + + .. SEEALSO:: :meth:`k_charge` and :meth:`k_charge_J` + + EXAMPLES:: + + sage: t = WeakTableau([[1, 1, 2, 2, 3], [2, 3], [3]], 3) + sage: t.k_charge_I() + 2 + sage: t = WeakTableau([[1, 3, 4, 5, 6], [2, 6], [4]], 3) + sage: t.k_charge_I() + 8 + sage: t = WeakTableau([[1, 1, 2, 3, 4, 4, 5, 5, 6], [2, 3, 5, 5, 6], [3, 4, 7], [5, 6], [6], [7]], 4) + sage: t.k_charge_I() + 12 + + TESTS:: + + sage: t = WeakTableau([[None, None, 1, 1, 4], [1, 4], [3]], 3) + sage: t.k_charge_I() + Traceback (most recent call last): + ... + ValueError: k-charge is not defined for skew weak tableaux + """ + if self.parent()._skew: + raise ValueError("k-charge is not defined for skew weak tableaux") + stt = self.list_of_standard_cells() + kch = 0 + for sw in stt: + Ii = 0 + for r in range(len(sw)-1): + if sw[r][1] < sw[r+1][1]: + Ii += 1 + abs(self.parent().diag(sw[r+1],sw[r])) + else: + Ii += - abs(self.parent().diag(sw[r],sw[r+1])) + kch += Ii + return kch + + def k_charge_J(self): + r""" + Return the `k`-charge of ``self`` using the `J`-algorithm. + + For the definition of `k`-charge and the `J`-algorithm see Section 3.3 of [LLMSSZ2013]_. + + OUTPUT: + + - a nonnegative integer + + .. SEEALSO:: :meth:`k_charge` and :meth:`k_charge_I` + + EXAMPLES:: + + sage: t = WeakTableau([[1, 1, 2, 2, 3], [2, 3], [3]], 3) + sage: t.k_charge_J() + 2 + sage: t = WeakTableau([[1, 3, 4, 5, 6], [2, 6], [4]], 3) + sage: t.k_charge_J() + 8 + sage: t = WeakTableau([[1, 1, 2, 3, 4, 4, 5, 5, 6], [2, 3, 5, 5, 6], [3, 4, 7], [5, 6], [6], [7]], 4) + sage: t.k_charge_J() + 12 + + TESTS:: + + sage: t = WeakTableau([[None, None, 1, 1, 4], [1, 4], [3]], 3) + sage: t.k_charge_I() + Traceback (most recent call last): + ... + ValueError: k-charge is not defined for skew weak tableaux + """ + if self.parent()._skew: + raise ValueError("k-charge is not defined for skew weak tableaux") + stt = self.list_of_standard_cells() + kch = 0 + for sw in stt: + Ji = 0 + for i in range(len(sw)-1): + c = (self._height_of_restricted_subword(sw,i+2)+1,0) + cdi = self.parent().circular_distance((-c[0])%(self.k+1),(sw[i][1]-sw[i][0])%(self.k+1)) + cdi1 = self.parent().circular_distance((-c[0])%(self.k+1),(sw[i+1][1]-sw[i+1][0])%(self.k+1)) + if (cdi > cdi1): + Ji += 1 + kch += Ji + self.parent().diag(sw[i+1],c) + return kch + + def _height_of_restricted_subword(self, sw, r): + r""" + Return the row of the highest addable cell of the subtableau of ``self`` with letters `\le r` + (excluding letters `r` in standard subwords before ``sw``). + + Restrict the weak `k`-tableau ``self`` to letters `\le r` and remove all letters + `r` that appeared in a previous standard subword selected by + :meth:`list_of_standard_cells`. + + INPUT: + + - ``sw`` -- one of the subwords of standard cells of ``self`` + - ``r`` -- nonnegative integer + + OUTPUT: + + - a nonnegative integer + + EXAMPLES:: + + sage: t = WeakTableau([[1, 1, 2, 2, 3], [2, 3], [3]], 3) + sage: s = t.list_of_standard_cells()[0]; s + [(0, 1), (1, 0), (2, 0)] + sage: t._height_of_restricted_subword(s,2) + 1 + + sage: t = WeakTableau([[1, 3, 4, 5, 6], [2, 6], [4]], 3) + sage: s = t.list_of_standard_cells()[0]; s + [(0, 0), (1, 0), (0, 1), (2, 0), (0, 3), (1, 1)] + sage: t._height_of_restricted_subword(s,4) + 2 + + sage: t = WeakTableau([[1, 1, 2, 3, 4, 4, 5, 5, 6], [2, 3, 5, 5, 6], [3, 4, 7], [5, 6], [6], [7]], 4) + sage: s = t.list_of_standard_cells()[0]; s + [(0, 1), (1, 0), (2, 0), (0, 5), (3, 0), (4, 0), (5, 0)] + sage: t._height_of_restricted_subword(s,6) + 4 + """ + L = filter(lambda v: self[v[0]][v[1]] <= r, sw) + return max([v[0] for v in L]) + +class WeakTableaux_core(WeakTableaux_abstract): + r""" + The class of (skew) weak `k`-tableaux in the core representation of shape ``shape`` + (as `k+1`-core) and weight ``weight``. + + INPUT: + + - ``k`` -- positive integer + - ``shape`` -- the shape of the `k`-tableaux represented as a `(k+1)`-core; if the + tableaux are skew, the shape is a tuple of the outer and inner shape (both as + `(k+1)`-cores) + - ``weight`` -- the weight of the `k`-tableaux + + EXAMPLES:: + + sage: T = WeakTableaux(3, [4,1], [2,2]) + sage: T.list() + [[[1, 1, 2, 2], [2]]] + + sage: T = WeakTableaux(3, [[5,2,1], [2]], [1,1,1,1]) + sage: T.list() + [[[None, None, 2, 3, 4], [1, 4], [2]], + [[None, None, 1, 2, 4], [2, 4], [3]], + [[None, None, 1, 2, 3], [2, 3], [4]]] + """ + + @staticmethod + def __classcall_private__(cls, k, shape, weight): + r""" + Straighten arguments before unique representation. + + TESTS:: + + sage: from sage.combinat.k_tableau import WeakTableaux_core + sage: T = WeakTableaux_core(3, [2,1], [1,1,1]) + sage: TestSuite(T).run() + sage: T = WeakTableaux_core(3, [[5,2,1], [2]], [1,1,1,1]) + sage: TestSuite(T).run() + """ + if shape == [] or shape[0] in ZZ: + shape = (Core(shape, k+1), Core([],k+1)) + else: + shape = tuple([Core(r,k+1) for r in shape]) + return super(WeakTableaux_core, cls).__classcall__(cls, k, shape, tuple(weight)) + + def __init__(self, k, shape, weight): + r""" + Initializes the parent class of (skew) weak `k`-tableaux in core representation. + + INPUT: + + - ``k`` -- positive integer + - ``outer_shape`` -- the outer shape of the `k`-tableaux represented as a + `(k+1)`-core + - ``weight`` -- the weight of the `k`-tableaux + - ``inner_shape`` -- the inner shape of the skew `k`-tableaux represented as a + `(k+1)`-core; for straight tableaux the inner shape does not need to be + specified (default: []) + + TESTS:: + + sage: from sage.combinat.k_tableau import WeakTableaux_core + sage: T = WeakTableaux_core(3, [4,1], [2,2]) + sage: TestSuite(T).run() + sage: T = WeakTableaux_core(3, [[5,2,1], [2]], [1,1,1,1]) + sage: TestSuite(T).run() + """ + self.k = k + self._skew = shape[1]!=[] + self._outer_shape = shape[0] + self._inner_shape = shape[1] + self._shape = (self._outer_shape, self._inner_shape) + self._weight = weight + self._representation = 'core' + Parent.__init__(self, category = FiniteEnumeratedSets()) + + def _repr_(self): + """ + TESTS:: + + sage: from sage.combinat.k_tableau import WeakTableaux_core + sage: repr(WeakTableaux_core(3, [2,1], [1,1,1])) + 'Core weak 3-Tableaux of (skew) core shape [2, 1] and weight (1, 1, 1)' + sage: repr(WeakTableaux_core(3, [[5,2,1], [2]], [1,1,1,1])) + 'Core weak 3-Tableaux of (skew) core shape ([5, 2, 1], [2]) and weight (1, 1, 1, 1)' + """ + return "Core weak %s-Tableaux of (skew) core shape %s and weight %s"%(self.k, self.shape(), self._weight) + + def __iter__(self): + r""" + TESTS:: + + sage: T = WeakTableaux(3, [4,1], [2,2]) + sage: T.list() + [[[1, 1, 2, 2], [2]]] + sage: T = WeakTableaux(3, [5,2,2], [2,2,2,1]) + sage: T.list() + [[[1, 1, 3, 3, 4], [2, 2], [3, 3]], [[1, 1, 2, 2, 3], [2, 3], [3, 4]]] + sage: T = WeakTableaux(3, [[5,2,2], [1]], [2,1,2,1]) + sage: T.list() + [[[None, 1, 3, 3, 4], [1, 2], [3, 3]], + [[None, 1, 2, 3, 3], [1, 3], [2, 4]], + [[None, 1, 1, 2, 3], [2, 3], [3, 4]]] + """ + for t in WeakTableaux_bounded(self.k, [self._outer_shape.to_bounded_partition(), self._inner_shape.to_bounded_partition()], self._weight): + yield t.to_core_tableau() + + def diag(self, c, ha): + r""" + Return the number of diagonals strictly between cells ``c`` and ``ha`` of the same residue as ``c``. + + INPUT: + + - ``c`` -- a cell in the lattice + - ``ha`` -- another cell in the lattice with bigger row and smaller column than `c` + + OUTPUT: + + - a nonnegative integer + + EXAMPLES:: + + sage: T = WeakTableaux(4, [5,2,2], [2,2,2,1]) + sage: T.diag((1,2),(4,0)) + 0 + """ + return divmod((c[1]-c[0])-(ha[1]-ha[0])-1, self.k+1)[0] + + def circular_distance(self, cr, r): + r""" + Return the shortest counterclockwise distance between ``cr`` and ``r`` modulo `k+1`. + + INPUT: + + - ``cr``, ``r`` -- nonnegative integers between `0` and `k` + + OUTPUT: + + - a positive integer + + EXAMPLES:: + + sage: T = WeakTableaux(10, [], []) + sage: T.circular_distance(8, 6) + 2 + sage: T.circular_distance(8, 8) + 0 + sage: T.circular_distance(8, 9) + 10 + """ + return self.k - ((r+self.k-cr)%(self.k+1)) + + Element = WeakTableau_core + + +#Weak tableaux in terms of `k`-bounded partitions +class WeakTableau_bounded(WeakTableau_abstract): + r""" + A (skew) weak `k`-tableau represented in terms of `k`-bounded partitions. + """ + @staticmethod + def __classcall_private__(cls, t, k): + r""" + Implements the shortcut ``WeakTableau_bounded(t, k)`` to ``WeakTableaux_bounded(k, shape, weight)(t)`` + where ``shape`` is the shape of the tableau and ``weight`` is its weight. + + TESTS:: + + sage: from sage.combinat.k_tableau import WeakTableau_bounded + sage: t = WeakTableau_bounded([[1,1,2],[2,3],[3]],3) + sage: t.check() + sage: type(t) + + sage: TestSuite(t).run() + sage: t.parent()._skew + False + + sage: t = WeakTableau_bounded([[None, None, 1], [1, 2], [2]], 3) + sage: t.check() + sage: type(t) + + sage: TestSuite(t).run() + sage: t.parent()._skew + True + """ + if isinstance(t, cls): + return t + tab = SkewTableau(list(t)) + outer = tab.outer_shape() + inner = tab.inner_shape() + weight = tuple(tab.weight()) + if outer.conjugate().length() > k: + raise ValueError, "The shape of %s is not %s-bounded"%(t, k) + return WeakTableaux_bounded(k, [outer, inner], weight)(t) + + def __init__(self, parent, t): + r""" + Initialization of (skew) weak `k`-tableau ``t`` in `k`-bounded representation. + + INPUT: + + - ``t`` -- weak tableau in `k`-bounded representation; the input is supposed to be + a list of lists specifying the rows of the tableau; ``None`` is allowed as an + entry for skew weak `k`-tableaux + + TESTS:: + + sage: from sage.combinat.k_tableau import WeakTableau_bounded, WeakTableaux_bounded + sage: c = WeakTableau_bounded([[1,1,2],[2,3],[3]],3) + sage: T = WeakTableaux_bounded(3,[3,2,1],[2,2,2]) + sage: t = T([[1,1,2],[2,3],[3]]); t + [[1, 1, 2], [2, 3], [3]] + sage: c == t + True + sage: type(t) + + sage: t.parent() + Bounded weak 3-Tableaux of (skew) 3-bounded shape [3, 2, 1] and weight (2, 2, 2) + sage: TestSuite(t).run() + + sage: t = WeakTableau_bounded([[None, None, 1], [2, 4], [3]], 3) + sage: t.shape() + ([3, 2, 1], [2]) + sage: t.weight() + (1, 1, 1, 1) + sage: TestSuite(t).run() + + sage: t = T([[1,1,3],[2,2],[3]]) + Traceback (most recent call last): + ... + ValueError: This is not a proper weak 3-tableau + """ + k = parent.k + self.k = k + self._list = [r for r in t] + if parent._outer_shape.conjugate().length() > k: + raise ValueError, "%s is not a %s-bounded tableau"%(t, k) + ClonableList.__init__(self, parent, t) + + def _repr_diagram(self): + r""" + Return a string representation of ``self`` as a diagram. + + EXAMPLES:: + + sage: t = WeakTableau([[None, None, 1], [2, 4], [3]], 3, representation = 'bounded') + sage: print t._repr_diagram() + . . 1 + 2 4 + 3 + sage: t = WeakTableau([[1,1,1],[2,2],[3]], 3, representation = 'bounded') + sage: print t._repr_diagram() + 1 1 1 + 2 2 + 3 + """ + t = SkewTableau(list(self)) + return t._repr_diagram() + + def shape_core(self): + r""" + Return the shape of ``self`` as `(k+1)`-core. + + When the tableau is straight, the outer shape is returned as a `(k+1)`-core. + When the tableau is skew, the tuple of the outer and inner shape is returned as + `(k+1)`-cores. + + EXAMPLES:: + + sage: t = WeakTableau([[1,1,1],[2,2],[3]], 3, representation = 'bounded') + sage: t.shape_core() + [5, 2, 1] + + sage: t = WeakTableau([[None, None, 1], [2, 4], [3]], 3, representation = 'bounded') + sage: t.shape_core() + ([5, 2, 1], [2]) + """ + if self.parent()._skew: + return tuple([r.to_core(self.k) for r in self.shape_bounded()]) + return self.shape_bounded().to_core(self.k) + + def shape_bounded(self): + r""" + Return the shape of ``self`` as `k`-bounded partition. + + When the tableau is straight, the outer shape is returned as a `k`-bounded + partition. When the tableau is skew, the tuple of the outer and inner shape is + returned as `k`-bounded partitions. + + EXAMPLES:: + + sage: t = WeakTableau([[1,1,1],[2,2],[3]], 3, representation = 'bounded') + sage: t.shape_bounded() + [3, 2, 1] + + sage: t = WeakTableau([[None, None, 1], [2, 4], [3]], 3, representation = 'bounded') + sage: t.shape_bounded() + ([3, 2, 1], [2]) + """ + return self.shape() + + def check(self): + r""" + Check that ``self`` is a valid weak `k`-tableau. + + EXAMPLES:: + + sage: t = WeakTableau([[1,1],[2]], 2, representation = 'bounded') + sage: t.check() + + sage: t = WeakTableau([[None, None, 1], [2, 4], [3]], 3, representation = 'bounded') + sage: t.check() + + TESTS:: + + sage: t = WeakTableau([[1,1,3],[2,2],[3]], 3, representation = 'bounded') + Traceback (most recent call last): + ... + ValueError: This is not a proper weak 3-tableau + + sage: T = WeakTableaux(3, [3,1], [2,1], representation = 'bounded') + sage: t = T([[None, 1,1], [2]]) + Traceback (most recent call last): + ... + ValueError: The inner shape of the parent does not agree with the inner shape of the tableau! + + sage: t = WeakTableau([[1,1],[1]], 3, representation = 'bounded') + Traceback (most recent call last): + ... + ValueError: The tableaux is not semistandard! + """ + t = SkewTableau(list(self)) + if not t in SemistandardSkewTableaux(): + raise ValueError("The tableaux is not semistandard!") + if not self.parent()._weight == tuple(t.weight()): + raise ValueError("The weight of the parent does not agree with the weight of the tableau!") + outer = t.outer_shape() + inner = t.inner_shape() + if self.parent()._outer_shape != outer: + raise ValueError("The outer shape of the parent does not agree with the outer shape of the tableau!") + if self.parent()._inner_shape != inner: + raise ValueError("The inner shape of the parent does not agree with the inner shape of the tableau!") + if not t.is_k_tableau(self.k): + raise ValueError("This is not a proper weak %s-tableau"%(self.k)) + + def _is_k_tableau(self): + r""" + Checks whether ``self`` is a valid weak `k`-tableau. + + EXAMPLES:: + + sage: t = WeakTableau([[1,1,1],[2,2],[3]], 3, representation = 'bounded') + sage: t._is_k_tableau() + True + + sage: t = WeakTableau([[None, None, 1], [2, 4], [3]], 3, representation = 'bounded') + sage: t._is_k_tableau() + True + """ + shapes = self.intermediate_shapes() + kshapes = [ la.k_conjugate(self.k) for la in shapes ] + return all( kshapes[i+1].contains(kshapes[i]) for i in range(len(shapes)-1) ) + + def to_core_tableau(self): + r""" + Return the weak `k`-tableau ``self`` where the shape of each restricted tableau is a `(k+1)`-core. + + EXAMPLES:: + + sage: t = WeakTableau([[1,1,2,4],[2,3,5],[3,4],[5,6],[6],[7]], 4, representation = 'bounded') + sage: c = t.to_core_tableau(); c + [[1, 1, 2, 3, 4, 4, 5, 5, 6], [2, 3, 5, 5, 6], [3, 4, 7], [5, 6], [6], [7]] + sage: type(c) + + sage: t = WeakTableau([], 4, representation = 'bounded') + sage: t.to_core_tableau() + [] + + sage: from sage.combinat.k_tableau import WeakTableau_bounded + sage: t = WeakTableau([[1,1,2],[2,3],[3]], 3, representation = 'bounded') + sage: WeakTableau_bounded.from_core_tableau(t.to_core_tableau(),3) + [[1, 1, 2], [2, 3], [3]] + sage: t == WeakTableau_bounded.from_core_tableau(t.to_core_tableau(),3) + True + + sage: t = WeakTableau([[None, None, 1], [2, 4], [3]], 3, representation = 'bounded') + sage: t.to_core_tableau() + [[None, None, 1, 2, 4], [2, 4], [3]] + sage: t == WeakTableau_bounded.from_core_tableau(t.to_core_tableau(),3) + True + """ + shapes = [ p.to_core(self.k) for p in self.intermediate_shapes() ] + if self.parent()._skew: + l = [[None]*i for i in shapes[0]] + else: + l = [] + for i in range(1,len(shapes)): + p = shapes[i] + if len(l) < len(p): + l += [[]] + l_new = [] + for j in range(len(l)): + l_new += [l[j] + [i]*(p[j]-len(l[j]))] + l = l_new + return WeakTableau_core(l, self.k) + + @classmethod + def from_core_tableau(cls, t, k): + r""" + Construct weak `k`-bounded tableau from in `k`-core tableau. + + EXAMPLES:: + + sage: from sage.combinat.k_tableau import WeakTableau_bounded + sage: WeakTableau_bounded.from_core_tableau([[1, 1, 2, 2, 3], [2, 3], [3]], 3) + [[1, 1, 2], [2, 3], [3]] + + sage: WeakTableau_bounded.from_core_tableau([[None, None, 2, 3, 4], [1, 4], [2]], 3) + [[None, None, 3], [1, 4], [2]] + + sage: WeakTableau_bounded.from_core_tableau([[None,2,3],[3]], 2) + [[None, 2], [3]] + """ + t = SkewTableau(list(t)) + shapes = [ Core(p, k+1).to_bounded_partition() for p in intermediate_shapes(t) ]#.to_chain() ] + if t.inner_shape() == Partition([]): + l = [] + else: + l = [[None]*i for i in shapes[0]] + for i in range(1,len(shapes)): + p = shapes[i] + if len(l) < len(p): + l += [[]] + l_new = [] + for j in range(len(l)): + l_new += [l[j] + [i]*(p[j]-len(l[j]))] + l = l_new + return cls(l, k) + + def k_charge(self, algorithm = 'I'): + r""" + Return the `k`-charge of ``self``. + + INPUT: + + - ``algorithm`` -- (default: "I") if "I", computes `k`-charge using the `I` + algorithm, otherwise uses the `J`-algorithm + + OUTPUT: + + - a nonnegative integer + + For the definition of `k`-charge and the various algorithms to compute it see Section 3.3 of [LLMSSZ2013]_. + + EXAMPLES:: + + sage: t = WeakTableau([[1, 1, 2], [2, 3], [3]], 3, representation = 'bounded') + sage: t.k_charge() + 2 + sage: t = WeakTableau([[1, 3, 5], [2, 6], [4]], 3, representation = 'bounded') + sage: t.k_charge() + 8 + sage: t = WeakTableau([[1, 1, 2, 4], [2, 3, 5], [3, 4], [5, 6], [6], [7]], 4, representation = 'bounded') + sage: t.k_charge() + 12 + """ + return self.to_core_tableau().k_charge(algorithm = algorithm) + + +class WeakTableaux_bounded(WeakTableaux_abstract): + r""" + The class of (skew) weak `k`-tableaux in the bounded representation of shape ``shape`` + (as `k`-bounded partition or tuple of `k`-bounded partitions in the skew case) and + weight ``weight``. + + INPUT: + + - ``k`` -- positive integer + - ``shape`` -- the shape of the `k`-tableaux represented as a `k`-bounded partition; + if the tableaux are skew, the shape is a tuple of the outer and inner shape each + represented as a `k`-bounded partition + - ``weight`` -- the weight of the `k`-tableaux + + EXAMPLES:: + + sage: T = WeakTableaux(3, [3,1], [2,2], representation = 'bounded') + sage: T.list() + [[[1, 1, 2], [2]]] + + sage: T = WeakTableaux(3, [[3,2,1], [2]], [1,1,1,1], representation = 'bounded') + sage: T.list() + [[[None, None, 3], [1, 4], [2]], + [[None, None, 1], [2, 4], [3]], + [[None, None, 1], [2, 3], [4]]] + """ + @staticmethod + def __classcall_private__(cls, k, shape, weight): + r""" + Straighten arguments before unique representation. + + TESTS:: + + sage: from sage.combinat.k_tableau import WeakTableaux_bounded + sage: T = WeakTableaux_bounded(3, [2,1], [1,1,1]) + sage: TestSuite(T).run() + sage: T = WeakTableaux_bounded(3, [[3,2,1], [2]], [1,1,1,1]) + sage: TestSuite(T).run() + """ + if shape == [] or shape[0] in ZZ: + shape = (Partition(shape), Partition([])) + else: + shape = tuple([Partition(r) for r in shape]) + return super(WeakTableaux_bounded, cls).__classcall__(cls, k, shape, tuple(weight)) + + def __init__(self, k, shape, weight): + r""" + Initializes the parent class of (skew) weak `k`-tableaux in bounded representation. + + INPUT: + + - ``k`` -- positive integer + - ``shape`` -- the shape of the `k`-tableaux represented as a `k`-bounded + partition; if the tableaux are skew, the shape is a tuple of the outer and inner + shape each represented as a `k`-bounded partition + - ``weight`` -- the weight of the `k`-tableaux + + TESTS:: + + sage: from sage.combinat.k_tableau import WeakTableaux_bounded + sage: T = WeakTableaux_bounded(3, [3,1], [2,2]) + sage: TestSuite(T).run() + sage: T = WeakTableaux_bounded(3, [[3,2,1], [2]], [1,1,1,1]) + sage: TestSuite(T).run() + """ + self.k = k + self._skew = shape[1]!=[] + self._outer_shape = Partition(shape[0]) + self._inner_shape = Partition(shape[1]) + self._shape = (self._outer_shape, self._inner_shape) + self._weight = tuple(weight) + self._representation = 'bounded' + Parent.__init__(self, category = FiniteEnumeratedSets()) + + def _repr_(self): + """ + TESTS:: + + sage: from sage.combinat.k_tableau import WeakTableaux_bounded + sage: repr(WeakTableaux_bounded(3, [2,1], [1,1,1])) + 'Bounded weak 3-Tableaux of (skew) 3-bounded shape [2, 1] and weight (1, 1, 1)' + sage: repr(WeakTableaux_bounded(3, [[3,2,1], [2]], [1,1,1,1])) + 'Bounded weak 3-Tableaux of (skew) 3-bounded shape ([3, 2, 1], [2]) and weight (1, 1, 1, 1)' + """ + return "Bounded weak %s-Tableaux of (skew) %s-bounded shape %s and weight %s"%(self.k, self.k, self.shape(), self._weight) + + def __iter__(self): + r""" + TESTS:: + + sage: T = WeakTableaux(3, [3,1], [2,2], representation = 'bounded') + sage: T.list() + [[[1, 1, 2], [2]]] + sage: T = WeakTableaux(3, [3,2,2], [2,2,2,1], representation = 'bounded') + sage: T.list() + [[[1, 1, 4], [2, 2], [3, 3]], [[1, 1, 2], [2, 3], [3, 4]]] + sage: T = WeakTableaux(3, [[3,2,2], [1]], [2,1,2,1], representation = 'bounded') + sage: T.list() + [[[None, 1, 4], [1, 2], [3, 3]], + [[None, 1, 3], [1, 3], [2, 4]], + [[None, 1, 1], [2, 3], [3, 4]]] + """ + for t in SemistandardSkewTableaux([self._outer_shape, self._inner_shape], self._weight): + if t.is_k_tableau(self.k): + yield self(t) + + Element = WeakTableau_bounded + +#Weak tableaux in terms of factorized permutations +class WeakTableau_factorized_permutation(WeakTableau_abstract): + r""" + A weak (skew) `k`-tableau represented in terms of factorizations of affine + permutations into cyclically decreasing elements. + """ + @staticmethod + def straighten_input(t, k): + r""" + Straightens input. + + INPUT: + + - ``t`` -- a list of reduced words or a list of elements in the Weyl group of type + `A_k^{(1)}` + - ``k`` -- a positive integer + + EXAMPLES:: + + sage: from sage.combinat.k_tableau import WeakTableau_factorized_permutation + sage: WeakTableau_factorized_permutation.straighten_input([[2,0],[3,2],[1,0]], 3) + (s2*s0, s3*s2, s1*s0) + sage: W = WeylGroup(['A',4,1]) + sage: WeakTableau_factorized_permutation.straighten_input([W.an_element(),W.an_element()], 4) + (s0*s1*s2*s3*s4, s0*s1*s2*s3*s4) + + TESTS:: + + sage: WeakTableau_factorized_permutation.straighten_input([W.an_element(),W.an_element()], 3) + Traceback (most recent call last): + ... + ValueError: a matrix from Full MatrixSpace of 5 by 5 dense matrices over Rational Field cannot be converted to a matrix in Full MatrixSpace of 4 by 4 dense matrices over Rational Field! + """ + W = WeylGroup(['A', k, 1], prefix='s') + if len(t) > 0: + if isinstance(t[0], list) or isinstance(t[0], tuple): + w_tuple = tuple(W.from_reduced_word(p) for p in t) + elif t[0] not in W: + raise ValueError, "The input must be a list of reduced words or Weyl group elements" + else: + w_tuple = tuple(W(r) for r in t) + else: + w_tuple = tuple([W.one()]) + return w_tuple + + @staticmethod + def __classcall_private__(cls, t, k, inner_shape = []): + r""" + Implements the shortcut ``WeakTableau_factorized_permutation(t, k)`` to + ``WeakTableaux_factorized_permutation(k, shape, weight)(t)`` + where ``shape`` is the shape of the tableau as a `(k+1)`-core (or a tuple of + `(k+1)`-cores if the tableau is skew) and ``weight`` is its weight. + + TESTS:: + + sage: from sage.combinat.k_tableau import WeakTableau_factorized_permutation + sage: t = WeakTableau_factorized_permutation([[2,0],[3,2],[1,0]], 3) + sage: t.check() + sage: type(t) + + sage: TestSuite(t).run() + + sage: t = WeakTableau_factorized_permutation([[0,3],[2,1]], 3, inner_shape = [1,1]) + sage: t.check() + sage: TestSuite(t).run() + + sage: t = WeakTableau_factorized_permutation([], 3); t + [1] + sage: t.check() + sage: TestSuite(t).run() + """ + if isinstance(t, cls): + return t + W = WeylGroup(['A', k, 1], prefix='s') + w = cls.straighten_input(t, k) + weight = tuple(w[i].length() for i in range(len(w)-1,-1,-1)) + inner_shape = Core(inner_shape, k+1) + outer_shape = (W.prod(w)*W(inner_shape.to_grassmannian())).affine_grassmannian_to_core() + return WeakTableaux_factorized_permutation(k, [outer_shape, inner_shape], weight)(w) + + def __init__(self, parent, t): + r""" + Initialization of (skew) weak `k`-tableau ``t`` in factorized permutation representation. + + INPUT: + + - ``t`` -- (skew) weak tableau in factorized permutation representation; the input + can either be a list of reduced words of cyclically decreasing elements, or a + list of cyclically decreasing elements; when the tableau is skew, the inner + shape needs to be specified as a `(k+1)`-core + + TESTS:: + + sage: from sage.combinat.k_tableau import WeakTableau_factorized_permutation, WeakTableaux_factorized_permutation + sage: c = WeakTableau_factorized_permutation([[2,0],[3,2],[1,0]], 3) + sage: T = WeakTableaux_factorized_permutation(3, [5,2,1],[2,2,2]) + sage: t = T([[2,0],[3,2],[1,0]]); t + [s2*s0, s3*s2, s1*s0] + sage: c == t + True + sage: type(t) + + sage: t.parent() + Factorized permutation (skew) weak 3-Tableaux of shape [5, 2, 1] and weight (2, 2, 2) + sage: TestSuite(t).run() + + sage: t = WeakTableau_factorized_permutation([[2,0],[3,2]], 3, inner_shape = [2]); t + [s2*s0, s3*s2] + sage: t._inner_shape + [2] + sage: t.weight() + (2, 2) + sage: t.shape() + ([5, 2, 1], [2]) + sage: TestSuite(t).run() + + sage: t = T([[3,0],[0,3],[1,0]]) + Traceback (most recent call last): + ... + ValueError: The outer shape of the parent does not agree with the outer shape of the tableau! + + sage: t = WeakTableau_factorized_permutation([], 3); t + [1] + sage: t.parent()._outer_shape + [] + sage: t.parent()._weight + (0,) + """ + self.k = parent.k + self._inner_shape = parent._inner_shape + ClonableList.__init__(self, parent, self.straighten_input(t, parent.k)) + + def shape_core(self): + r""" + Return the shape of ``self`` as a `(k+1)`-core. + + When the tableau is straight, the outer shape is returned as a core. + When the tableau is skew, the tuple of the outer and inner shape is returned as + cores. + + EXAMPLES:: + + sage: t = WeakTableau([[2],[0,3],[2,1,0]], 3, representation = 'factorized_permutation') + sage: t.shape_core() + [5, 2, 1] + + sage: t = WeakTableau([[2,0],[3,2]], 3, inner_shape = [2], representation = 'factorized_permutation') + sage: t.shape() + ([5, 2, 1], [2]) + """ + return self.shape() + + def shape_bounded(self): + r""" + Return the shape of ``self`` as a `k`-bounded partition. + + When the tableau is straight, the outer shape is returned as a `k`-bounded + partition. When the tableau is skew, the tuple of the outer and inner shape is + returned as `k`-bounded partitions. + + EXAMPLES:: + + sage: t = WeakTableau([[2],[0,3],[2,1,0]], 3, representation = 'factorized_permutation') + sage: t.shape_bounded() + [3, 2, 1] + + sage: t = WeakTableau([[2,0],[3,2]], 3, inner_shape = [2], representation = 'factorized_permutation') + sage: t.shape_bounded() + ([3, 2, 1], [2]) + """ + if self.parent()._skew: + return tuple([r.to_bounded_partition() for r in self.shape_core()]) + return self.shape_core().to_bounded_partition() + + def check(self): + r""" + Check that ``self`` is a valid weak `k`-tableau. + + EXAMPLES:: + + sage: t = WeakTableau([[2],[0,3],[2,1,0]], 3, representation = 'factorized_permutation') + sage: t.check() + + TESTS:: + + sage: t = WeakTableau([[2,0],[3,2]], 3, representation = 'factorized_permutation') + Traceback (most recent call last): + ... + ValueError: Error! this only works on type 'A' affine Grassmannian elements + + sage: T = WeakTableaux(3, [4,1], [2,1], representation = 'factorized_permutation') + sage: t = T([[2],[1],[0]]) + Traceback (most recent call last): + ... + ValueError: The weight of the parent does not agree with the weight of the tableau! + """ + weight = tuple(self[i].length() for i in range(len(self)-1,-1,-1)) + if not self.parent()._weight == weight: + raise ValueError("The weight of the parent does not agree with the weight of the tableau!") + W = self[0].parent() + outer = (W.prod(self)*W((self._inner_shape).to_grassmannian())).affine_grassmannian_to_core() + if self.parent()._outer_shape != outer: + raise ValueError("The outer shape of the parent does not agree with the outer shape of the tableau!") + if not self._is_k_tableau(): + raise ValueError("This is not a proper weak %s-tableau"%(self.k)) + + def _is_k_tableau(self): + r""" + Checks whether ``self`` is a valid weak `k`-tableau. + + EXAMPLES:: + + sage: t = WeakTableau([[2],[0,3],[2,1,0]], 3, representation = 'factorized_permutation') + sage: t._is_k_tableau() + True + + sage: t = WeakTableau([[2,0],[3,2]], 3, inner_shape = [2], representation = 'factorized_permutation') + sage: t._is_k_tableau() + True + """ + W = self[0].parent() + if (W.prod(self)*W(self.parent()._inner_shape.to_grassmannian())).is_affine_grassmannian(): + return all( r.is_pieri_factor() for r in self ) + return False + + def to_core_tableau(self): + r""" + Return the weak `k`-tableau ``self`` where the shape of each restricted tableau is a `(k+1)`-core. + + EXAMPLES:: + + sage: t = WeakTableau([[0], [3,1], [2,1], [0,4], [3,0], [4,2], [1,0]], 4, representation = 'factorized_permutation'); t + [s0, s3*s1, s2*s1, s0*s4, s3*s0, s4*s2, s1*s0] + sage: c = t.to_core_tableau(); c + [[1, 1, 2, 3, 4, 4, 5, 5, 6], [2, 3, 5, 5, 6], [3, 4, 7], [5, 6], [6], [7]] + sage: type(c) + + sage: t = WeakTableau([[]], 4, representation = 'factorized_permutation'); t + [1] + sage: t.to_core_tableau() + [] + + sage: from sage.combinat.k_tableau import WeakTableau_factorized_permutation + sage: t = WeakTableau([[2,0],[3,2],[1,0]], 3, representation = 'factorized_permutation') + sage: WeakTableau_factorized_permutation.from_core_tableau(t.to_core_tableau(), 3) + [s2*s0, s3*s2, s1*s0] + sage: t == WeakTableau_factorized_permutation.from_core_tableau(t.to_core_tableau(), 3) + True + + sage: t = WeakTableau([[2,0],[3,2]], 3, inner_shape = [2], representation = 'factorized_permutation') + sage: t.to_core_tableau() + [[None, None, 1, 1, 2], [1, 2], [2]] + sage: t == WeakTableau_factorized_permutation.from_core_tableau(t.to_core_tableau(), 3) + True + """ + W = self[0].parent() + factor = W(self._inner_shape.to_grassmannian()) + shapes = [factor] + for i in range(len(self)-1,-1,-1): + factor = self[i]*factor + shapes += [factor.affine_grassmannian_to_core()] + if self.parent()._skew: + l = [[None]*i for i in self._inner_shape] + else: + l = [] + for i in range(1,len(shapes)): + p = shapes[i] + if len(l) < len(p): + l += [[]] + l_new = [] + for j in range(len(l)): + l_new += [l[j] + [i]*(p[j]-len(l[j]))] + l = l_new + return WeakTableau_core(l, self.k) + + @classmethod + def from_core_tableau(cls, t, k): + r""" + Construct weak factorized affine permutation tableau from a `k`-core tableau. + + EXAMPLES:: + + sage: from sage.combinat.k_tableau import WeakTableau_factorized_permutation + sage: WeakTableau_factorized_permutation.from_core_tableau([[1, 1, 2, 2, 3], [2, 3], [3]],3) + [s2*s0, s3*s2, s1*s0] + sage: WeakTableau_factorized_permutation.from_core_tableau([[1, 1, 2, 3, 4, 4, 5, 5, 6], [2, 3, 5, 5, 6], [3, 4, 7], [5, 6], [6], [7]], 4) + [s0, s3*s1, s2*s1, s0*s4, s3*s0, s4*s2, s1*s0] + sage: WeakTableau_factorized_permutation.from_core_tableau([[None, 1, 1, 2, 2], [None, 2], [1]], 3) + [s0*s3, s2*s1] + """ + t = SkewTableau(list(t)) + shapes = [ Core(p, k+1).to_grassmannian() for p in intermediate_shapes(t) ] #t.to_chain() ] + perms = [ shapes[i]*(shapes[i-1].inverse()) for i in range(len(shapes)-1,0,-1)] + return cls(perms, k, inner_shape = t.inner_shape()) + + def k_charge(self, algorithm = 'I'): + r""" + Return the `k`-charge of ``self``. + + OUTPUT: + + - a nonnegative integer + + EXAMPLES:: + + sage: t = WeakTableau([[2,0],[3,2],[1,0]], 3, representation = 'factorized_permutation') + sage: t.k_charge() + 2 + sage: t = WeakTableau([[0],[3],[2],[1],[3],[0]], 3, representation = 'factorized_permutation') + sage: t.k_charge() + 8 + sage: t = WeakTableau([[0],[3,1],[2,1],[0,4],[3,0],[4,2],[1,0]], 4, representation = 'factorized_permutation') + sage: t.k_charge() + 12 + """ + return self.to_core_tableau().k_charge(algorithm = algorithm) + + +class WeakTableaux_factorized_permutation(WeakTableaux_abstract): + r""" + The class of (skew) weak `k`-tableaux in the factorized permutation representation of shape ``shape`` (as `k+1`-core + or tuple of `(k+1)`-cores in the skew case) and weight ``weight``. + + INPUT: + + - ``k`` -- positive integer + - ``shape`` -- the shape of the `k`-tableaux represented as a `(k+1)`-core; + in the skew case the shape is a tuple of the outer and inner shape both as `(k+1)`-cores + - ``weight`` -- the weight of the `k`-tableaux + + EXAMPLES:: + + sage: T = WeakTableaux(3, [4,1], [2,2], representation = 'factorized_permutation') + sage: T.list() + [[s3*s2, s1*s0]] + + sage: T = WeakTableaux(4, [[6,2,1], [2]], [2,1,1,1], representation = 'factorized_permutation') + sage: T.list() + [[s0, s4, s3, s4*s2], [s0, s3, s4, s3*s2], [s3, s0, s4, s3*s2]] + """ + @staticmethod + def __classcall_private__(cls, k, shape, weight): + r""" + Straighten arguments before unique representation. + + TESTS:: + + sage: from sage.combinat.k_tableau import WeakTableaux_factorized_permutation + sage: T = WeakTableaux_factorized_permutation(3, [2,1], [1,1,1]) + sage: TestSuite(T).run() + sage: T = WeakTableaux_factorized_permutation(4, [[6,2,1], [2]], [2,1,1,1]) + sage: TestSuite(T).run() + """ + if shape == [] or shape[0] in ZZ: + shape = (Core(shape, k+1), Core([],k+1)) + else: + shape = tuple([Core(r,k+1) for r in shape]) + return super(WeakTableaux_factorized_permutation, cls).__classcall__(cls, k, shape, tuple(weight)) + + def __init__(self, k, shape, weight): + r""" + Initializes the parent class of weak `k`-tableaux in factorized permutation representation. + + INPUT: + + - ``k`` -- positive integer + - ``shape`` -- the shape of the `k`-tableaux represented as a `(k+1)`-core; + in the skew case the shape is a tuple of the outer and inner shape both as + `(k+1)`-cores + - ``weight`` -- the weight of the `k`-tableaux + + TESTS:: + + sage: from sage.combinat.k_tableau import WeakTableaux_factorized_permutation + sage: T = WeakTableaux_factorized_permutation(3, [4,1], [2,2]) + sage: TestSuite(T).run() + sage: T = WeakTableaux_factorized_permutation(4, [[6,2,1], [2]], [2,1,1,1]) + sage: TestSuite(T).run() + """ + self.k = k + self._skew = shape[1]!=[] + self._outer_shape = Core(shape[0], k+1) + self._inner_shape = Core(shape[1], k+1) + self._shape = (self._outer_shape, self._inner_shape) + self._weight = weight + self._representation = 'factorized_permutation' + Parent.__init__(self, category = FiniteEnumeratedSets()) + + def _repr_(self): + """ + TESTS:: + + sage: from sage.combinat.k_tableau import WeakTableaux_factorized_permutation + sage: repr(WeakTableaux_factorized_permutation(3, [2,1], [1,1,1])) + 'Factorized permutation (skew) weak 3-Tableaux of shape [2, 1] and weight (1, 1, 1)' + sage: repr(WeakTableaux_factorized_permutation(4, [[6,2,1], [2]], [2,1,1,1])) + 'Factorized permutation (skew) weak 4-Tableaux of shape ([6, 2, 1], [2]) and weight (2, 1, 1, 1)' + """ + return "Factorized permutation (skew) weak %s-Tableaux of shape %s and weight %s"%(self.k, self.shape(), self._weight) + + def __iter__(self): + r""" + TESTS:: + + sage: T = WeakTableaux(3, [4,1], [2,2], representation = 'factorized_permutation') + sage: T.list() + [[s3*s2, s1*s0]] + sage: T = WeakTableaux(3, [5,2,2], [2,2,2,1], representation = 'factorized_permutation') + sage: T.list() + [[s0, s3*s2, s0*s3, s1*s0], [s3, s2*s0, s3*s2, s1*s0]] + sage: T = WeakTableaux(4, [[6,2,1], [2]], [2,1,1,1], representation = 'factorized_permutation') + sage: T.list() + [[s0, s4, s3, s4*s2], [s0, s3, s4, s3*s2], [s3, s0, s4, s3*s2]] + """ + for t in WeakTableaux_core(self.k, self.shape(), self._weight): + yield WeakTableau_factorized_permutation.from_core_tableau(t, self.k) + + Element = WeakTableau_factorized_permutation + +def intermediate_shapes(t): + r""" + Return the intermediate shapes of tableau ``t``. + + A (skew) tableau with letters `1,2,\ldots,\ell` can be viewed as a sequence of shapes, + where the `i`-th shape is given by the shape of the subtableau on letters `1,2,\ldots,i`. + The output is the list of these shapes. + + EXAMPLES:: + + sage: from sage.combinat.k_tableau import intermediate_shapes + sage: t = WeakTableau([[1, 1, 2, 2, 3], [2, 3], [3]],3) + sage: intermediate_shapes(t) + [[], [2], [4, 1], [5, 2, 1]] + + sage: t = WeakTableau([[None, None, 2, 3, 4], [1, 4], [2]], 3) + sage: intermediate_shapes(t) + [[2], [2, 1], [3, 1, 1], [4, 1, 1], [5, 2, 1]] + """ + shapes = [] + t = SkewTableau(list(t)) + for i in range(len(t.weight())+1): + shapes += [ t.restrict(i).outer_shape()] + return shapes diff --git a/src/sage/combinat/skew_tableau.py b/src/sage/combinat/skew_tableau.py index 51afad34fd7..e90da31179d 100644 --- a/src/sage/combinat/skew_tableau.py +++ b/src/sage/combinat/skew_tableau.py @@ -1001,6 +1001,22 @@ def cells(self): res.append( (i,j) ) return res + def is_k_tableau(self, k): + r""" + Checks whether ``self`` is a valid skew weak `k`-tableau. + + EXAMPLES:: + + sage: t = SkewTableau([[None,2,3],[2,3],[3]]) + sage: t.is_k_tableau(3) + True + sage: t = SkewTableau([[None,1,3],[2,2],[3]]) + sage: t.is_k_tableau(3) + False + """ + shapes = self.to_chain() + kshapes = [ la.k_conjugate(k) for la in shapes ] + return all( kshapes[i+1].contains(kshapes[i]) for i in range(len(shapes)-1) ) def _label_skew(list, sk): diff --git a/src/sage/combinat/tableau.py b/src/sage/combinat/tableau.py index ad275b98b48..c112eb0e7ba 100644 --- a/src/sage/combinat/tableau.py +++ b/src/sage/combinat/tableau.py @@ -1425,6 +1425,23 @@ def k_weight(self, k): return res + def is_k_tableau(self, k): + r""" + Checks whether ``self`` is a valid weak `k`-tableau. + + EXAMPLES:: + + sage: t = Tableau([[1,2,3],[2,3],[3]]) + sage: t.is_k_tableau(3) + True + sage: t = Tableau([[1,1,3],[2,2],[3]]) + sage: t.is_k_tableau(3) + False + """ + shapes = self.to_chain() + kshapes = [ la.k_conjugate(k) for la in shapes ] + return all( kshapes[i+1].contains(kshapes[i]) for i in range(len(shapes)-1) ) + def restrict(self, n): """ Return the restriction of the (standard) tableau to `n`. If possible, From 2da762eb4e64d229138cc9bb87678ac84451f720 Mon Sep 17 00:00:00 2001 From: darij grinberg Date: Fri, 12 Jul 2013 07:16:50 -0700 Subject: [PATCH 04/85] Trac #14881: traac #14881: symmetric group algebra modifications --- src/sage/combinat/symmetric_group_algebra.py | 313 +++++++++++++++---- src/sage/combinat/tableau.py | 18 +- 2 files changed, 260 insertions(+), 71 deletions(-) diff --git a/src/sage/combinat/symmetric_group_algebra.py b/src/sage/combinat/symmetric_group_algebra.py index a8d6160fc0a..3977d61f261 100644 --- a/src/sage/combinat/symmetric_group_algebra.py +++ b/src/sage/combinat/symmetric_group_algebra.py @@ -23,9 +23,9 @@ permutation_options = permutation.PermutationOptions -def SymmetricGroupAlgebra(R,n): +def SymmetricGroupAlgebra(R, n): """ - Returns the symmetric group algebra of order n over R. + Return the symmetric group algebra of order ``n`` over the ring ``R``. EXAMPLES:: @@ -114,7 +114,7 @@ def __init__(self, R, n): def group(self): """ - Returns the underlying group + Return the underlying group. EXAMPLES :: @@ -126,8 +126,8 @@ def group(self): @cached_method def one_basis(self): """ - Returns the identity of the symmetric group, as per - ``AlgebrasWithBasis.ParentMethods.one_basis`` + Return the identity of the symmetric group, as per + ``AlgebrasWithBasis.ParentMethods.one_basis``. EXAMPLES:: @@ -139,8 +139,8 @@ def one_basis(self): def product_on_basis(self, left, right): """ - Returns the product of the basis elements indexed by left and - right. + Return the product of the basis elements indexed by ``left`` and + ``right``. EXAMPLES:: @@ -154,12 +154,12 @@ def product_on_basis(self, left, right): def canonical_embedding(self, other): """ + Return the canonical embedding of ``self`` into ``other``. + INPUTS: - ``self``, ``other`` -- two symmetric group algebras with respective - order 'p < n' - - Returns the canonical embedding of self into other + orders `p` and `n` satisfying `p < n`. EXAMPLES:: @@ -185,9 +185,9 @@ def canonical_embedding(self, other): def monomial_from_smaller_permutation(self, permutation): """ - Converts the input into a permutation, possibly extending it - to the appropriate size, and returns the corresponding basis - element. + Convert ``permutation`` into a permutation, possibly extending it + to the appropriate size, and return the corresponding basis + element of ``self``. EXAMPLES:: @@ -229,7 +229,8 @@ def monomial_from_smaller_permutation(self, permutation): def cpis(self): """ - Returns a list of the centrally primitive idempotents. + Return a list of the centrally primitive idempotents of + ``self``. EXAMPLES:: @@ -244,9 +245,9 @@ def cpis(self): def cpi(self, p): """ - Returns the centrally primitive idempotent for the symmetric group - of order n for the irreducible corresponding indexed by the - partition p. + Return the centrally primitive idempotent for the symmetric group + of order `n` corresponding to the irreducible representation + indexed by the partition ``p``. EXAMPLES:: @@ -257,44 +258,70 @@ def cpi(self, p): 1/6*[1, 2, 3] + 1/6*[1, 3, 2] + 1/6*[2, 1, 3] + 1/6*[2, 3, 1] + 1/6*[3, 1, 2] + 1/6*[3, 2, 1] sage: QS3.cpi([1,1,1]) 1/6*[1, 2, 3] - 1/6*[1, 3, 2] - 1/6*[2, 1, 3] + 1/6*[2, 3, 1] + 1/6*[3, 1, 2] - 1/6*[3, 2, 1] + + sage: QS0 = SymmetricGroupAlgebra(QQ, 0) + sage: QS0.cpi(Partition([])) + [] + + TESTS:: + + sage: QS3.cpi([2,2]) + Traceback (most recent call last): + ... + TypeError: p (= [2, 2]) must be a partition of n (= 3) """ if p not in partition.Partitions_n(self.n): - raise TypeError, "p must be a partition of %s"%self.n + raise TypeError("p (= %(p)s) must be a partition of n (= %(n)d)" % {'p': p, 'n': self.n}) character_table = eval(gap.eval("Display(Irr(SymmetricGroup(%d)));"%self.n)) - cpi = self(0) + cpi = self.zero() np = partition.Partitions_n(self.n).list() np.reverse() p_index = np.index(p) - big_coeff = character_table[p_index][0]/factorial(self.n) + big_coeff = character_table[p_index][0] / factorial(self.n) - for g in permutation.StandardPermutations_n(self.n): - cpi += big_coeff * character_table[p_index][np.index(g.inverse().cycle_type())] * self(g) + character_row = character_table[p_index] + dct = { g : big_coeff * character_row[np.index(g.cycle_type())] + for g in permutation.StandardPermutations_n(self.n) } - return cpi + return self._from_dict(dct) def algebra_generators(self): r""" - Returns generators of this group algebra (as algebra). + Return generators of this group algebra (as algebra) as a + list of permutations. + + The generators used for the group algebra of `S_n` are the + transposition `(2, 1)` and the `n`-cycle `(1, 2, ..., n)`, + unless `n \leq 1` (in which case no generators are needed). EXAMPLES:: sage: SymmetricGroupAlgebra(ZZ,5).algebra_generators() [[2, 1, 3, 4, 5], [2, 3, 4, 5, 1]] + + sage: SymmetricGroupAlgebra(QQ,0).algebra_generators() + [] + + sage: SymmetricGroupAlgebra(QQ,1).algebra_generators() + [] """ - a=range(1,self.n+1) - a[0]=2 - a[1]=1 - b=range(2,self.n+2) - b[self.n-1]=1 - return [self(a),self(b)] + if self.n <= 1: + return [] + a = range(1, self.n+1) + a[0] = 2 + a[1] = 1 + b = range(2, self.n+2) + b[self.n-1] = 1 + return [self(a), self(b)] def _conjugacy_classes_representatives_underlying_group(self): r""" - Returns a complete list of representatives of conjugacy classes of the underlying symmetric group + Return a complete list of representatives of conjugacy + classes of the underlying symmetric group. EXAMPLES:: @@ -306,12 +333,15 @@ def _conjugacy_classes_representatives_underlying_group(self): def jucys_murphy(self, k): """ - Returns the Jucys-Murphy element J_k for the symmetric group - algebra. + Return the Jucys-Murphy element `J_k` (also known as a + Young-Jucys-Murphy element) for the symmetric group + algebra ``self``. EXAMPLES:: sage: QS3 = SymmetricGroupAlgebra(QQ, 3) + sage: QS3.jucys_murphy(1) + 0 sage: QS3.jucys_murphy(2) [2, 1, 3] sage: QS3.jucys_murphy(3) @@ -329,11 +359,17 @@ def jucys_murphy(self, k): sage: QS5.jucys_murphy(4) [1, 2, 4, 3, 5] + [1, 4, 3, 2, 5] + [4, 2, 3, 1, 5] + TESTS:: + + sage: QS3.jucys_murphy(4) + Traceback (most recent call last): + ... + ValueError: k (= 4) must be between 1 and n (= 3) (inclusive) """ - res = self(0) + res = self.zero() - if k < 2 or k > self.n: - raise ValueError, "k must between 2 and n (inclusive)" + if k < 1 or k > self.n: + raise ValueError("k (= %(k)d) must be between 1 and n (= %(n)d) (inclusive)" % {'k': k, 'n': self.n}) for i in range(1, k): p = range(1, self.n+1) @@ -346,7 +382,7 @@ def jucys_murphy(self, k): def seminormal_basis(self): """ - Returns a list of the seminormal basis elements of self. + Return a list of the seminormal basis elements of ``self``. EXAMPLES:: @@ -370,7 +406,7 @@ def seminormal_basis(self): def dft(self, form="seminormal"): """ - Returns the discrete Fourier transform for self. + Return the discrete Fourier transform for ``self``. EXAMPLES:: @@ -386,11 +422,11 @@ def dft(self, form="seminormal"): if form == "seminormal": return self._dft_seminormal() else: - raise ValueError, "invalid form (= %s)"%form + raise ValueError("invalid form (= %s)"%form) def _dft_seminormal(self): """ - Returns the seminormal form of the discrete Fourier for self. + Return the seminormal form of the discrete Fourier for ``self``. EXAMPLES:: @@ -413,8 +449,8 @@ def _dft_seminormal(self): def epsilon_ik(self, itab, ktab, star=0): """ - Returns the seminormal basis element of self corresponding to the - pair of tableaux itab and ktab. + Return the seminormal basis element of ``self`` corresponding to the + pair of tableaux ``itab`` and ``ktab``. EXAMPLES:: @@ -434,13 +470,13 @@ def epsilon_ik(self, itab, ktab, star=0): stn = StandardTableaux_size(self.n) if it not in stn: - raise TypeError, "it must be a standard tableaux of size %s"%self.n + raise TypeError("it must be a standard tableau of size %s"%self.n) if kt not in stn: - raise TypeError, "kt must be a standard tableaux of size %s"%self.n + raise TypeError("kt must be a standard tableau of size %s"%self.n) if it.shape() != kt.shape(): - raise ValueError, "it and kt must be of the same shape" + raise ValueError("it and kt must be of the same shape") BR = self.base_ring() z_elts = {} @@ -475,7 +511,7 @@ def epsilon_ik(itab, ktab, star=0): kt = kt.restrict(kt.size() - star) if it.shape() != kt.shape(): - raise ValueError, "the two tableaux must be of the same shape" + raise ValueError("the two tableaux must be of the same shape") mult = permutation_options['mult'] permutation_options['mult'] = 'l2r' @@ -550,7 +586,7 @@ def pi_ik(itab, ktab): def kappa(alpha): r""" - Returns `\kappa_\alpha` which is n! divided by the number + Return `\kappa_\alpha`, which is `n!` divided by the number of standard tableaux of shape `\alpha`. EXAMPLES:: @@ -565,13 +601,135 @@ def kappa(alpha): n = alpha.size() except AttributeError: n = sum(alpha) - return factorial(n)/StandardTableaux(alpha).cardinality() + return factorial(n) / StandardTableaux(alpha).cardinality() + + +def a(tableau, star=0): + """ + The row projection operator corresponding to the Young tableau + ``tableau`` (which is supposed to contain every integer from + `1` to its size precisely once, but may and may not be standard). + This is the sum (in the group algebra of the relevant symmetric + group over `\\mathbb{Q}`) of all the permutations which preserve + the rows of ``tableau``. It is called `a_{\\text{tableau}}` in + [EtRT]_, Section 4.2. + + REFERENCES: + + .. [EtRT] Pavel Etingof, Oleg Golberg, Sebastian Hensel, Tiankai + Liu, Alex Schwendner, Dmitry Vaintrob, Elena Yudovina, + "Introduction to representation theory", + :arXiv:`0901.0827v5`. + + EXAMPLES:: + + sage: from sage.combinat.symmetric_group_algebra import a + sage: a([[1,2]]) + [1, 2] + [2, 1] + sage: a([[1],[2]]) + [1, 2] + sage: a([]) + [] + sage: a([[1, 5], [2, 3], [4]]) + [1, 2, 3, 4, 5] + [1, 3, 2, 4, 5] + [5, 2, 3, 4, 1] + [5, 3, 2, 4, 1] + """ + t = Tableau(tableau) + if star: + t = t.restrict(t.size()-star) + + rs = t.row_stabilizer().list() + n = t.size() + + # This all should be over ZZ, not over QQ, but symmetric group + # algebras don't seem to preserve coercion (the one over ZZ + # doesn't coerce into the one over QQ even for the same n), + # and the QQ version of this method is more important, so let + # me stay with QQ. + # TODO: Fix this. + sgalg = SymmetricGroupAlgebra(QQ, n) + one = QQ.one() + P = permutation.Permutation + + # Ugly hack for the case of an empty tableau, due to the + # annoyance of Permutation(Tableau([]).row_stabilizer()[0]) + # being [1] rather than [] (which seems to have its origins in + # permutation group code). + # TODO: Fix this. + if len(tableau) == 0: + return sgalg.one() + + rd = dict((P(h), one) for h in rs) + return sgalg._from_dict(rd) + +def b(tableau, star=0): + """ + The column projection operator corresponding to the Young tableau + ``tableau`` (which is supposed to contain every integer from + `1` to its size precisely once, but may and may not be standard). + + This is the signed sum (in the group algebra of the relevant + symmetric group over `\\mathbb{Q}`) of all the permutations which + preserve the column of ``tableau`` (where the signs are the usual + signs of the permutations). It is called `b_{\\text{tableau}}` in + [EtRT]_, Section 4.2. + + EXAMPLES:: + + sage: from sage.combinat.symmetric_group_algebra import b + sage: b([[1,2]]) + [1, 2] + sage: b([[1],[2]]) + [1, 2] - [2, 1] + sage: b([]) + [] + sage: b([[1, 2, 4], [5, 3]]) + [1, 2, 3, 4, 5] - [1, 3, 2, 4, 5] - [5, 2, 3, 4, 1] + [5, 3, 2, 4, 1] + + With the `l2r` setting for multiplication, the unnormalized + Young symmetrizer ``e(tableau)`` should be the product + ``b(tableau) * a(tableau)`` for every ``tableau``. Let us check + this on the standard tableaux of size 5:: + + sage: from sage.combinat.symmetric_group_algebra import a, b, e + sage: all( e(t) == b(t) * a(t) for t in StandardTableaux(5) ) + True + """ + t = Tableau(tableau) + if star: + t = t.restrict(t.size()-star) + + cs = t.column_stabilizer().list() + n = t.size() + + # This all should be over ZZ, not over QQ, but symmetric group + # algebras don't seem to preserve coercion (the one over ZZ + # doesn't coerce into the one over QQ even for the same n), + # and the QQ version of this method is more important, so let + # me stay with QQ. + # TODO: Fix this. + sgalg = SymmetricGroupAlgebra(QQ, n) + one = QQ.one() + P = permutation.Permutation + + # Ugly hack for the case of an empty tableau, due to the + # annoyance of Permutation(Tableau([]).row_stabilizer()[0]) + # being [1] rather than [] (which seems to have its origins in + # permutation group code). + # TODO: Fix this. + if len(tableau) == 0: + return sgalg.one() + + cd = dict((P(v), v.sign()*one) for v in cs) + return sgalg._from_dict(cd) e_cache = {} def e(tableau, star=0): """ - The unnormalized Young projection operator. + The unnormalized Young projection operator corresponding to + the Young tableau ``tableau`` (which is supposed to contain + every integer from `1` to its size precisely once, but may + and may not be standard). EXAMPLES:: @@ -580,6 +738,8 @@ def e(tableau, star=0): [1, 2] + [2, 1] sage: e([[1],[2]]) [1, 2] - [2, 1] + sage: e([]) + [] There are differing conventions for the order of the symmetrizers and antisymmetrizers. This example illustrates our conventions:: @@ -602,7 +762,7 @@ def e(tableau, star=0): n = t.size() QSn = SymmetricGroupAlgebra(QQ, n) - one = QQ(1) + one = QQ.one() P = permutation.Permutation rd = dict((P(h), one) for h in rs) @@ -613,15 +773,27 @@ def e(tableau, star=0): res = antisym*sym + # Ugly hack for the case of an empty tableau, due to the + # annoyance of Permutation(Tableau([]).row_stabilizer()[0]) + # being [1] rather than [] (which seems to have its origins in + # permutation group code). + # TODO: Fix this. + if len(tableau) == 0: + res = QSn.one() + e_cache[t] = res permutation_options['mult'] = mult + return res ehat_cache = {} def e_hat(tab, star=0): """ - The Young projection operator, an idempotent in the rational group algebra. + The Young projection operator corresponding to the Young tableau + ``tab`` (which is supposed to contain every integer from `1` to + its size precisely once, but may and may not be standard). This + is an idempotent in the rational group algebra. EXAMPLES:: @@ -664,7 +836,7 @@ def e_ik(itab, ktab, star=0): kt = kt.restrict(kt.size() - star) if it.shape() != kt.shape(): - raise ValueError, "the two tableaux must be of the same shape" + raise ValueError("the two tableaux must be of the same shape") mult = permutation_options['mult'] permutation_options['mult'] = 'l2r' @@ -699,22 +871,22 @@ def seminormal_test(n): for tab in StandardTableaux(part): #3.1.10 if not e(tab)*(1/kappa(part)) - e_hat(tab) == 0: - raise ValueError, "3.1.10 - %s"%tab + raise ValueError("3.1.10 - %s"%tab) #3.2.12.2 value = e(tab)*epsilon(tab,1)*e(tab) - e(tab)*(kappa(part)) if value != 0: print value - raise ValueError, "3.2.12.2 - %s"%tab + raise ValueError("3.2.12.2 - %s"%tab) for tab2 in StandardTableaux(part): #3.2.8 1 if e_ik(tab, tab2) - e(tab)*pi_ik(tab, tab2)*e(tab2)*(1/kappa(part)) != 0: - raise ValueError, "3.2.8.1 - %s, %s"%(tab, tab2) + raise ValueError("3.2.8.1 - %s, %s"%(tab, tab2)) #3.2.8.1 if e(tab)*e_ik(tab, tab2) - e_ik(tab, tab2)*(kappa(part)) != 0: - raise ValueError, "3.2.8.2 - %s, %s"%(tab, tab2) + raise ValueError("3.2.8.2 - %s, %s"%(tab, tab2)) if tab == tab2: continue @@ -722,9 +894,9 @@ def seminormal_test(n): if tab.last_letter_lequal(tab2): #3.1.20 if e(tab2)*e(tab) != 0: - raise ValueError, "3.1.20 - %s, %s"%(tab, tab2) + raise ValueError("3.1.20 - %s, %s"%(tab, tab2)) if e_hat(tab2)*e_hat(tab) != 0: - raise ValueError, "3.1.20 - %s, %s"%(tab, tab2) + raise ValueError("3.1.20 - %s, %s"%(tab, tab2)) return True ####################### @@ -732,7 +904,7 @@ def seminormal_test(n): def HeckeAlgebraSymmetricGroupT(R, n, q=None): """ - Returns the Hecke algebra of the symmetric group on the T basis. + Return the Hecke algebra of the symmetric group on the T basis. EXAMPLES:: @@ -770,7 +942,7 @@ def __init__(self, R, n, q=None): R = q.parent() else: if q not in R: - raise ValueError, "q must be in R (= %s)"%R + raise ValueError("q must be in R (= %s)"%R) self._name += " with q=%s"%q self._q = q @@ -840,7 +1012,8 @@ def t_action_on_basis(self, perm, i): T[1, 2, 3] """ if i not in range(1, self.n): - raise ValueError, "i must be between 1 and n (= %s)"%self.n + raise ValueError("i (= %(i)d) must be between 1 and n (= %(n)d)" % {'i': i, 'n': self.n}) + t_i = permutation.Permutation( (i, i+1) ) perm_i = t_i * perm @@ -903,10 +1076,10 @@ def t(self, i): sage: H3.t(0) Traceback (most recent call last): ... - ValueError: i must be between 1 and n-1 (= 2) + ValueError: i (= 0) must be between 1 and n-1 (= 2) """ if i not in range(1, self.n): - raise ValueError, "i must be between 1 and n-1 (= %s)"%(self.n-1) + raise ValueError("i (= %(i)d) must be between 1 and n-1 (= %(nm)d)" % {'i': i, 'nm': self.n - 1}) return self.monomial(self.basis().keys()(permutation.Permutation( (i, i+1) ) )) @@ -923,7 +1096,7 @@ def algebra_generators(self): def jucys_murphy(self, k): """ - Returns the Jucys-Murphy element J_k of the Hecke algebra. The + Return the Jucys-Murphy element `J_k` of the Hecke algebra. The Jucys-Murphy elements generate the maximal commutative sub-algebra of the Hecke algebra. @@ -932,17 +1105,21 @@ def jucys_murphy(self, k): sage: H3 = HeckeAlgebraSymmetricGroupT(QQ,3) sage: j2 = H3.jucys_murphy(2); j2 q*T[1, 2, 3] + (q-1)*T[2, 1, 3] - sage: j3 = H3.jucys_murphy(3); j3 #################### SEGFAULTS ################ + sage: j3 = H3.jucys_murphy(3); j3 q^2*T[1, 2, 3] + (q^2-q)*T[1, 3, 2] + (q-1)*T[3, 2, 1] sage: j2*j3 == j3*j2 True - sage: H3.jucys_murphy(1) + sage: j0 = H3.jucys_murphy(1); j0 == H3.one() + True + sage: H3.jucys_murphy(0) Traceback (most recent call last): ... - ValueError: k must be between 2 and n (= 3) + ValueError: k (= 0) must be between 1 and n (= 3) """ if k not in range(2, self.n+1): - raise ValueError, "k must be between 2 and n (= %s)"%self.n + if k == 1: + return self.one() + raise ValueError("k (= %(k)d) must be between 1 and n (= %(n)d)" % {'k': k, 'n': self.n}) left = 1 right = 1 diff --git a/src/sage/combinat/tableau.py b/src/sage/combinat/tableau.py index c112eb0e7ba..1ddda0a1773 100644 --- a/src/sage/combinat/tableau.py +++ b/src/sage/combinat/tableau.py @@ -2172,6 +2172,9 @@ def row_stabilizer(self): Return the PermutationGroup corresponding to the row stabilizer of ``self``. + This assumes that every integer from `1` to the size of ``self`` + appears exactly once in ``self``. + EXAMPLES:: sage: rs = Tableau([[1,2,3],[4,5]]).row_stabilizer() @@ -2189,11 +2192,17 @@ def row_stabilizer(self): sage: rs = Tableau([[1],[2],[3]]).row_stabilizer() sage: rs.order() 1 + sage: rs = Tableau([[2,4,5],[1,3]]).row_stabilizer() + sage: rs.order() + 12 + sage: rs = Tableau([]).row_stabilizer() + sage: rs.order() + 1 """ # Ensure that the permutations involve all elements of the # tableau, by including the identity permutation on the set [1..k]. - k = max(self.entries()) + k = self.size() gens = [range(1,k+1)] for i in range(len(self)): for j in range(0, len(self[i])-1): @@ -2206,6 +2215,9 @@ def column_stabilizer(self): Return the PermutationGroup corresponding to the column stabilizer of ``self``. + This assumes that every integer from `1` to the size of ``self`` + appears exactly once in ``self``. + EXAMPLES:: sage: cs = Tableau([[1,2,3],[4,5]]).column_stabilizer() @@ -2221,7 +2233,7 @@ def column_stabilizer(self): def height(self): """ - Returns the height of the tableau. + Return the height of ``self``. EXAMPLES:: @@ -2420,7 +2432,7 @@ def add_entry(self,cell,m): def catabolism(self): """ - Remove the top row of ``self`` and inserts it back in using + Remove the top row of ``self`` and insert it back in using column Schensted insertion (starting with the largest letter). EXAMPLES:: From a757e08ea31dc6702d32d9e1f98c4af41f895e55 Mon Sep 17 00:00:00 2001 From: Travis Scrimshaw Date: Thu, 8 Aug 2013 12:07:15 -0700 Subject: [PATCH 05/85] Trac #14881: review patch --- src/sage/combinat/symmetric_group_algebra.py | 35 ++++++++++---------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/src/sage/combinat/symmetric_group_algebra.py b/src/sage/combinat/symmetric_group_algebra.py index 3977d61f261..4c16183f0c5 100644 --- a/src/sage/combinat/symmetric_group_algebra.py +++ b/src/sage/combinat/symmetric_group_algebra.py @@ -51,7 +51,7 @@ def SymmetricGroupAlgebra(R, n): True The canonical embedding from the symmetric group algebra of order - `n` to the symmetric group algebra of order `p>n` is available as + `n` to the symmetric group algebra of order `p > n` is available as a coercion:: sage: QS3 = SymmetricGroupAlgebra(QQ, 3) @@ -98,8 +98,7 @@ def __init__(self, R, n): TESTS:: sage: QS3 = SymmetricGroupAlgebra(QQ, 3) - sage: QS3 is loads(dumps(QS3)) - True + sage: TestSuite(QS3).run() """ self.n = n self._name = "Symmetric group algebra of order %s"%self.n @@ -116,7 +115,7 @@ def group(self): """ Return the underlying group. - EXAMPLES :: + EXAMPLES:: sage: SymmetricGroupAlgebra(QQ,4).group() Symmetric group of order 4! as a permutation group @@ -156,10 +155,10 @@ def canonical_embedding(self, other): """ Return the canonical embedding of ``self`` into ``other``. - INPUTS: + INPUT: - - ``self``, ``other`` -- two symmetric group algebras with respective - orders `p` and `n` satisfying `p < n`. + - ``other`` -- a symmetric group algebra with order `p` + satisfying `p \leq n` where `n` is the order of ``self``. EXAMPLES:: @@ -179,8 +178,8 @@ def canonical_embedding(self, other): From: Symmetric group algebra of order 2 over Rational Field To: Symmetric group algebra of order 4 over Rational Field """ - assert isinstance(other, SymmetricGroupAlgebra_n) - assert self.n < other.n + if not isinstance(other, SymmetricGroupAlgebra_n) or self.n > other.n: + raise ValueError("There is no canonical embedding from {0} to {1}".format(other, self)) return self.module_morphism(other.monomial_from_smaller_permutation, codomain = other) # category = self.category() (currently broken) def monomial_from_smaller_permutation(self, permutation): @@ -271,7 +270,7 @@ def cpi(self, p): TypeError: p (= [2, 2]) must be a partition of n (= 3) """ if p not in partition.Partitions_n(self.n): - raise TypeError("p (= %(p)s) must be a partition of n (= %(n)d)" % {'p': p, 'n': self.n}) + raise TypeError("p (= {p}) must be a partition of n (= {n})".format(p=p, n=self.n)) character_table = eval(gap.eval("Display(Irr(SymmetricGroup(%d)));"%self.n)) @@ -295,7 +294,7 @@ def algebra_generators(self): list of permutations. The generators used for the group algebra of `S_n` are the - transposition `(2, 1)` and the `n`-cycle `(1, 2, ..., n)`, + transposition `(2, 1)` and the `n`-cycle `(1, 2, \ldots, n)`, unless `n \leq 1` (in which case no generators are needed). EXAMPLES:: @@ -369,7 +368,7 @@ def jucys_murphy(self, k): res = self.zero() if k < 1 or k > self.n: - raise ValueError("k (= %(k)d) must be between 1 and n (= %(n)d) (inclusive)" % {'k': k, 'n': self.n}) + raise ValueError("k (= {k}) must be between 1 and n (= {n}) (inclusive)".format(k=k, n=self.n)) for i in range(1, k): p = range(1, self.n+1) @@ -605,14 +604,14 @@ def kappa(alpha): def a(tableau, star=0): - """ + r""" The row projection operator corresponding to the Young tableau ``tableau`` (which is supposed to contain every integer from `1` to its size precisely once, but may and may not be standard). This is the sum (in the group algebra of the relevant symmetric - group over `\\mathbb{Q}`) of all the permutations which preserve - the rows of ``tableau``. It is called `a_{\\text{tableau}}` in + group over `\QQ`) of all the permutations which preserve + the rows of ``tableau``. It is called `a_{\text{tableau}}` in [EtRT]_, Section 4.2. REFERENCES: @@ -663,15 +662,15 @@ def a(tableau, star=0): return sgalg._from_dict(rd) def b(tableau, star=0): - """ + r""" The column projection operator corresponding to the Young tableau ``tableau`` (which is supposed to contain every integer from `1` to its size precisely once, but may and may not be standard). This is the signed sum (in the group algebra of the relevant - symmetric group over `\\mathbb{Q}`) of all the permutations which + symmetric group over `\QQ`) of all the permutations which preserve the column of ``tableau`` (where the signs are the usual - signs of the permutations). It is called `b_{\\text{tableau}}` in + signs of the permutations). It is called `b_{\text{tableau}}` in [EtRT]_, Section 4.2. EXAMPLES:: From 946fd6ba121ebfca599630896be7c895a9fe9029 Mon Sep 17 00:00:00 2001 From: Samuele Giraudo Date: Fri, 24 Feb 2012 10:27:55 +0100 Subject: [PATCH 06/85] Trac #12571: shifted stuff, now with fixed docstring --- src/sage/combinat/permutation.py | 112 +++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) diff --git a/src/sage/combinat/permutation.py b/src/sage/combinat/permutation.py index 673e02ad095..50beff373da 100644 --- a/src/sage/combinat/permutation.py +++ b/src/sage/combinat/permutation.py @@ -110,6 +110,9 @@ :meth:`~sage.combinat.permutation.Permutation.RS_partition` | Returns the shape of the tableaux obtained by the RSK algorithm. :meth:`~sage.combinat.permutation.Permutation.remove_extra_fixed_points` | Returns the permutation obtained by removing any fixed points at the end of ``self``. :meth:`~sage.combinat.permutation.Permutation.hyperoctahedral_double_coset_type` | Returns the coset-type of ``self`` as a partition. + :meth:`~sage.combinat.permutation.Permutation.binary_search_tree_shape` | Returns the shape of the binary search tree of ``self`` (a non labelled binary tree). + :meth:`~sage.combinat.permutation.Permutation.shifted_concatenation` | Returns the right (or left) shifted concatenation of ``self`` with a permutation ``other``. + :meth:`~sage.combinat.permutation.Permutation.shifted_shuffle` | Returns the shifted shuffle of ``self`` with a permutation ``other``. **Other classes defined in this file** @@ -3453,6 +3456,115 @@ def binary_search_tree_shape(self, left_to_right=True): """ return self.binary_search_tree(left_to_right).shape() + ##################### + # Binary operations # + ##################### + + def shifted_concatenation(self, other, side = "right"): + r""" + Return the right (or left) shifted concatenation of ``self`` + with a permutation ``other``. These operations are also known + as the Loday-Ronco over and under operations. + + INPUT: + + - ``other`` -- a permutation, a list, a tuple, or any iterable + representing a permutation. + + - ``side`` -- (default: ``"right"``) the string "left" or "right". + + OUTPUT: + + If ``side`` is ``"right"``, the method returns the permutation + obtained by concatenating ``self`` with the letters of ``other`` + incremented by the size of ``self``. This is what is called + ``side / other`` in [LodRon0102066]_, and denoted as the "over" + operation. + Otherwise, i. e., when ``side`` is ``"left"``, the method + returns the permutation obtained by concatenating the letters + of ``other`` incremented by the size of ``self`` with ``self``. + This is what is called ``side \ other`` in [LodRon0102066]_ + (which seems to use the `(\sigma \pi)(i) = \pi(\sigma(i))` + convention for the product of permutations). + + EXAMPLES:: + + sage: Permutation([]).shifted_concatenation(Permutation([]), "right") + [] + sage: Permutation([]).shifted_concatenation(Permutation([]), "left") + [] + sage: Permutation([2, 4, 1, 3]).shifted_concatenation(Permutation([3, 1, 2]), "right") + [2, 4, 1, 3, 7, 5, 6] + sage: Permutation([2, 4, 1, 3]).shifted_concatenation(Permutation([3, 1, 2]), "left") + [7, 5, 6, 2, 4, 1, 3] + + REFERENCES: + + .. [LodRon0102066] Jean-Louis Loday and Maria O. Ronco, + Order structure on the algebra of permutations + and of planar binary trees, + :arXiv:`math/0102066v1`. + """ + if side == "right" : + return Permutation(list(self) + [a + len(self) for a in other]) + elif side == "left" : + return Permutation([a + len(self) for a in other] + list(self)) + else : + raise ValueError, "%s must be \"left\" or \"right\"" %(side) + + def shifted_shuffle(self, other): + r""" + Return the shifted shuffle of two permutations ``self`` and ``other``. + + INPUT: + + - ``other`` -- a permutation, a list, a tuple, or any iterable + representing a permutation. + + OUTPUT: + + The list of the permutations appearing in the shifted + shuffle of the permutations ``self`` and ``other``. + + EXAMPLES:: + + sage: Permutation([]).shifted_shuffle(Permutation([])) + [[]] + sage: Permutation([1, 2, 3]).shifted_shuffle(Permutation([1])) + [[1, 2, 3, 4], [1, 2, 4, 3], [1, 4, 2, 3], [4, 1, 2, 3]] + sage: Permutation([1, 2]).shifted_shuffle(Permutation([2, 1])) + [[1, 2, 4, 3], [1, 4, 2, 3], [1, 4, 3, 2], [4, 1, 2, 3], [4, 1, 3, 2], [4, 3, 1, 2]] + sage: Permutation([1]).shifted_shuffle([1]) + [[1, 2], [2, 1]] + sage: len(Permutation([3, 1, 5, 4, 2]).shifted_shuffle(Permutation([2, 1, 4, 3]))) + 126 + + The shifted shuffle product is associative. We can test this on an + admittedly toy example:: + + sage: all( all( all( sorted(flatten([abs.shifted_shuffle(c) + ....: for abs in a.shifted_shuffle(b)])) + ....: == sorted(flatten([a.shifted_shuffle(bcs) + ....: for bcs in b.shifted_shuffle(c)])) + ....: for c in Permutations(2) ) + ....: for b in Permutations(2) ) + ....: for a in Permutations(2) ) + True + + The ``shifted_shuffle`` method on permutations gives the same + permutations as the ``shifted_shuffle`` method on words (but is + faster):: + + sage: all( all( sorted(p1.shifted_shuffle(p2)) + ....: == sorted([Permutation(p) for p in + ....: Word(p1).shifted_shuffle(Word(p2))]) + ....: for p2 in Permutations(3) ) + ....: for p1 in Permutations(2) ) + True + """ + return self.shifted_concatenation(other, "right").\ + right_permutohedron_interval(self.shifted_concatenation(other, "left")) + ################################################################ # Parent classes ################################################################ From b563e531e61de6f7b116562f8956b38dd9bba7dd Mon Sep 17 00:00:00 2001 From: Paul Scurek Date: Tue, 6 Aug 2013 11:48:37 -0700 Subject: [PATCH 07/85] Trac #15013: updated all of the docstrings in the logic module --- src/sage/logic/booleval.py | 68 ++- src/sage/logic/boolformula.py | 1018 +++++++++++++++++++++++---------- src/sage/logic/logic.py | 441 ++++++++------ src/sage/logic/logicparser.py | 213 +++++-- src/sage/logic/logictable.py | 121 ++-- src/sage/logic/propcalc.py | 49 +- 6 files changed, 1306 insertions(+), 604 deletions(-) diff --git a/src/sage/logic/booleval.py b/src/sage/logic/booleval.py index 204dc3987fb..686b3bd9919 100644 --- a/src/sage/logic/booleval.py +++ b/src/sage/logic/booleval.py @@ -1,27 +1,37 @@ r""" -Evaluate Boolean Formulas - -Perform boolean evaluation of boolean formulas. +Module used to evaluate boolean formulas AUTHORS: -- Chris Gorecki +- Chris Gorecki (2006): initial version + +- Paul Scurek (2013-08-05): updated docstring formatting EXAMPLES:: +We can assign values to the variables and evaluate a formula:: + sage: import sage.logic.booleval as booleval sage: t = ['|', ['&', 'a', 'b'], ['&', 'a', 'c']] sage: d = {'a' : True, 'b' : False, 'c' : True} sage: booleval.eval_formula(t, d) True + +We can change our assignment of values by modifying the dictionary:: + sage: d['a'] = False sage: booleval.eval_formula(t, d) False - - -Classes and functions -===================== """ +#***************************************************************************** +# Copyright (C) 2006 Chris Gorecki +# Copyright (C) 2013 Paul Scurek +# +# Distributed under the terms of the GNU General Public License (GPL) +# as published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# http://www.gnu.org/licenses/ +#***************************************************************************** import logicparser @@ -30,8 +40,7 @@ def eval_formula(tree, vdict): r""" - Evaluates the tree using the boolean values contained in dictionary - and returns a single boolean value. + Evaluate the tree and return a boolean value. INPUT: @@ -42,15 +51,22 @@ def eval_formula(tree, vdict): OUTPUT: - - Returns the boolean evaluation of a boolean formula. + The result of the evaluation as a boolean value EXAMPLES:: + This example illustrates evaluating a boolean formula. + + :: + sage: import sage.logic.booleval as booleval sage: t = ['|', ['&', 'a', 'b'], ['&', 'a', 'c']] sage: d = {'a' : True, 'b' : False, 'c' : True} sage: booleval.eval_formula(t, d) True + + :: + sage: d['a'] = False sage: booleval.eval_formula(t, d) False @@ -62,7 +78,7 @@ def eval_formula(tree, vdict): def eval_f(tree): r""" - This function can be applied to a parse tree to evaluate it. + Evaluate the tree INPUT: @@ -71,15 +87,25 @@ def eval_f(tree): OUTPUT: - - Returns a boolean evaluation of the tree. + The result of the evaluation as a boolean value EXAMPLES:: + This example illustrates how to evaluate a parse tree. + + :: + sage: import sage.logic.booleval as booleval sage: booleval.eval_f(['&', True, False]) False + + :: + sage: booleval.eval_f(['^', True, True]) False + + :: + sage: booleval.eval_f(['|', False, True]) True """ @@ -87,7 +113,7 @@ def eval_f(tree): def eval_op(op, lv, rv): r""" - This function evaluates ``lv`` and ``rv`` according to the operator ``op``. + Evaluate ``lv`` and ``rv`` according to the operator ``op``. INPUT: @@ -99,15 +125,25 @@ def eval_op(op, lv, rv): OUTPUT: - - Returns the evaluation of ``lv op rv``. + The evaluation of ``lv op rv`` as a boolean value - EXAMPLES:: + EXAMPLES: + + We can evaluate an operator given the values on either side. + + :: sage: import sage.logic.booleval as booleval sage: booleval.eval_op('&', True, False) False + + :: + sage: booleval.eval_op('^', True, True) False + + :: + sage: booleval.eval_op('|', False, True) True """ diff --git a/src/sage/logic/boolformula.py b/src/sage/logic/boolformula.py index ab5ef266ab1..b20057cb741 100644 --- a/src/sage/logic/boolformula.py +++ b/src/sage/logic/boolformula.py @@ -1,123 +1,135 @@ r""" - Module associated with booleval, logictable, and logicparser, to do - boolean evaluation of boolean formulas. - Formulas consist of the operators &, |, ~, ^, ->, <->, corresponding - to and, or, not, xor, if...then, if and only if. Operators can - be applied to variables that consist of a leading letter and trailing - underscores and alphanumerics. Parentheses may be used to - explicitly show order of operation. - - AUTHORS: - -- Chris Gorecki - - EXAMPLES: - sage: import sage.logic.propcalc as propcalc - sage: f = propcalc.formula("a&((b|c)^a->c)<->b") - sage: g = propcalc.formula("boolean<->algebra") - sage: (f&~g).ifthen(f) - ((a&((b|c)^a->c)<->b)&(~(boolean<->algebra)))->(a&((b|c)^a->c)<->b) - - EXAMPLES: - sage: import sage.logic.propcalc as propcalc - sage: f = propcalc.formula("a&((b|c)^a->c)<->b") - sage: g = propcalc.formula("boolean<->algebra") - sage: (f&~g).ifthen(f) - ((a&((b|c)^a->c)<->b)&(~(boolean<->algebra)))->(a&((b|c)^a->c)<->b) - - We can create a truth table from a formula. - sage: f.truthtable() - a b c value - False False False True - False False True True - False True False False - False True True False - True False False True - True False True False - True True False True - True True True True - sage: f.truthtable(end=3) - a b c value - False False False True - False False True True - False True False False - sage: f.truthtable(start=4) - a b c value - True False False True - True False True False - True True False True - True True True True - sage: propcalc.formula("a").truthtable() - a value - False False - True True - - Now we can evaluate the formula for a given set of inputs. - sage: f.evaluate({'a':True, 'b':False, 'c':True}) - False - sage: f.evaluate({'a':False, 'b':False, 'c':True}) - True - - And we can convert a boolean formula to conjunctive normal form. - sage: f.convert_cnf_table() - sage: f - (a|~b|c)&(a|~b|~c)&(~a|b|~c) - sage: f.convert_cnf_recur() - sage: f - (a|~b|c)&(a|~b|~c)&(~a|b|~c) - - Or determine if an expression is satisfiable, a contradiction, or a tautology. - sage: f = propcalc.formula("a|b") - sage: f.is_satisfiable() - True - sage: f = f & ~f - sage: f.is_satisfiable() - False - sage: f.is_contradiction() - True - sage: f = f | ~f - sage: f.is_tautology() - True - - The equality operator compares semantic equivalence. - sage: f = propcalc.formula("(a|b)&c") - sage: g = propcalc.formula("c&(b|a)") - sage: f == g - True - sage: g = propcalc.formula("a|b&c") - sage: f == g - False - - It is an error to create a formula with bad syntax. - sage: propcalc.formula("") - Traceback (most recent call last): - ... - SyntaxError: malformed statement - sage: propcalc.formula("a&b~(c|(d)") - Traceback (most recent call last): - ... - SyntaxError: malformed statement - sage: propcalc.formula("a&&b") - Traceback (most recent call last): - ... - SyntaxError: malformed statement - sage: propcalc.formula("a&b a") - Traceback (most recent call last): - ... - SyntaxError: malformed statement - - It is also an error to not abide by the naming conventions. - sage: propcalc.formula("~a&9b") - Traceback (most recent call last): - ... - NameError: invalid variable name 9b: identifiers must begin with a letter and contain only alphanumerics and underscores +Module that creates boolean formulas as instances of the BooleanFormula class. + +Formulas consist of the operators &, |, ~, ^, ->, <->, corresponding +to and, or, not, xor, if...then, if and only if. Operators can +be applied to variables that consist of a leading letter and trailing +underscores and alphanumerics. Parentheses may be used to +explicitly show order of operation. + +AUTHORS: + +- Chris Gorecki (2006): initial version + +- Paul Scurek (2013-08-03): added polish_notation, full_tree, + updated docstring formatting + +EXAMPLES: + +Create boolean formulas and combine them with ifthen() method:: + + sage: import sage.logic.propcalc as propcalc + sage: f = propcalc.formula("a&((b|c)^a->c)<->b") + sage: g = propcalc.formula("boolean<->algebra") + sage: (f&~g).ifthen(f) + ((a&((b|c)^a->c)<->b)&(~(boolean<->algebra)))->(a&((b|c)^a->c)<->b) + +We can create a truth table from a formula:: + + sage: f.truthtable() + a b c value + False False False True + False False True True + False True False False + False True True False + True False False True + True False True False + True True False True + True True True True + sage: f.truthtable(end=3) + a b c value + False False False True + False False True True + False True False False + sage: f.truthtable(start=4) + a b c value + True False False True + True False True False + True True False True + True True True True + sage: propcalc.formula("a").truthtable() + a value + False False + True True + +Now we can evaluate the formula for a given set of inputs:: + + sage: f.evaluate({'a':True, 'b':False, 'c':True}) + False + sage: f.evaluate({'a':False, 'b':False, 'c':True}) + True + +And we can convert a boolean formula to conjunctive normal form:: + + sage: f.convert_cnf_table() + sage: f + (a|~b|c)&(a|~b|~c)&(~a|b|~c) + sage: f.convert_cnf_recur() + sage: f + (a|~b|c)&(a|~b|~c)&(~a|b|~c) + +Or determine if an expression is satisfiable, a contradiction, or a tautology:: + + sage: f = propcalc.formula("a|b") + sage: f.is_satisfiable() + True + sage: f = f & ~f + sage: f.is_satisfiable() + False + sage: f.is_contradiction() + True + sage: f = f | ~f + sage: f.is_tautology() + True + +The equality operator compares semantic equivalence:: + + sage: f = propcalc.formula("(a|b)&c") + sage: g = propcalc.formula("c&(b|a)") + sage: f == g + True + sage: g = propcalc.formula("a|b&c") + sage: f == g + False + +It is an error to create a formula with bad syntax:: + + sage: propcalc.formula("") + Traceback (most recent call last): + ... + SyntaxError: malformed statement + sage: propcalc.formula("a&b~(c|(d)") + Traceback (most recent call last): + ... + SyntaxError: malformed statement + sage: propcalc.formula("a&&b") + Traceback (most recent call last): + ... + SyntaxError: malformed statement + sage: propcalc.formula("a&b a") + Traceback (most recent call last): + ... + SyntaxError: malformed statement + +It is also an error to not abide by the naming conventions:: + + sage: propcalc.formula("~a&9b") + Traceback (most recent call last): + ... + NameError: invalid variable name 9b: identifiers must begin with a letter and contain only alphanumerics and underscores """ -#******************************************************************************************* -# copyright (C) 2006 William Stein -# copyright (C) 2006 Chris Gorecki -# Distributed under the terms of the GNU General Public License (GPL) -# http://www.gnu.org/licenses/ -#******************************************************************************************* +#***************************************************************************** +# Copyright (C) 2006 William Stein +# Copyright (C) 2006 Chris Gorecki +# Copyright (C) 2013 Paul Scurek +# +# Distributed under the terms of the GNU General Public License (GPL) +# as published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# http://www.gnu.org/licenses/ +#***************************************************************************** + import booleval import logictable import logicparser @@ -139,21 +151,30 @@ class BooleanFormula: def __init__(self, exp, tree, vo): r""" - This function initializes the data fields and is called when a - new statement is created. + Initialize the data fields INPUT: - self -- the calling object. - exp -- a string containing the logic expression to be manipulated. - tree -- a list containing the parse tree of the expression. - vo -- a list of the variables in the expression in order, - with each variable occurring only once. + + - ``self`` -- calling object + + - ``exp`` -- a string. This contains the boolean expression + to be manipulated + + - ``tree`` -- a list. This contains the parse tree of the expression. + + - ``vo`` -- a list. This contains the variables in the expression, in the + order that they appear. Each variable only occurs once in the list. OUTPUT: - Effectively returns an instance of this class. + + None EXAMPLES: + This example illustrates the creation of a statement. + + :: + sage: import sage.logic.propcalc as propcalc sage: s = propcalc.formula("a&b|~(c|a)") sage: s @@ -165,15 +186,22 @@ def __init__(self, exp, tree, vo): def __repr__(self): r""" - Returns a string representation of this statement. + Return a string representation of this statement. INPUT: - self -- the calling object. + + - ``self`` -- calling object OUTPUT: - Returns the string representation of this statement. + + A string representation of calling statement EXAMPLES: + + This example illustrates how a statement is represented with __repr__. + + :: + sage: import sage.logic.propcalc as propcalc sage: propcalc.formula("man->monkey&human") man->monkey&human @@ -182,20 +210,29 @@ def __repr__(self): def _latex_(self): r""" - Returns a LaTeX representation of this statement. + Return a LaTeX representation of this statement. INPUT: - self -- the calling object. + + - ``self`` -- calling object OUTPUT: - Returns the latex representation of this statement. + + A string containing the latex code for the statement EXAMPLES: + + This example shows how to get the latex code for a boolean formula. + + :: + sage: import sage.logic.propcalc as propcalc sage: s = propcalc.formula("man->monkey&human") sage: latex(s) man\rightarrow monkey\wedge human + :: + sage: f = propcalc.formula("a & ((~b | c) ^ a -> c) <-> ~b") sage: latex(f) a\wedge ((\neg b\vee c)\oplus a\rightarrow c)\leftrightarrow \neg b @@ -207,88 +244,147 @@ def _latex_(self): def polish_notation(self): r""" - This function returns the calling formula in polish notation in - the form of a string. + Convert the calling boolean formula into polish notation INPUT: - self -- the calling object, which is a boolean formula + + - ``self`` -- calling object OUTPUT: - Returns the caling formula in polish notation as a string + + A string representation of the formula in polish notation. EXAMPLES: + + This example illustrates converting a formula to polish notation. + + :: + sage: import sage.logic.propcalc as propcalc sage: f = propcalc.formula("~~a|(c->b)") sage: f.polish_notation() '|~~a->cb' + + :: + sage: g = propcalc.formula("(a|~b)->c") sage: g.polish_notation() '->|a~bc' + + AUTHORS: + + - Paul Scurek (2013-08-03) """ return ''.join(flatten(logicparser.polish_parse(repr(self)))) def tree(self): r""" - Returns a list containing the parse tree of this boolean expression. + Return the parse tree of this boolean expression. INPUT: - self -- the calling object. + + - ``self`` -- calling object OUTPUT: - A list containing the parse tree of self. + + The parse tree as a nested list EXAMPLES: + + This example illustrates how to find the parse tree of a boolean formula. + + :: + sage: import sage.logic.propcalc as propcalc sage: s = propcalc.formula("man -> monkey & human") sage: s.tree() ['->', 'man', ['&', 'monkey', 'human']] + + :: + sage: f = propcalc.formula("a & ((~b | c) ^ a -> c) <-> ~b") sage: f.tree() - ['<->', ['&', 'a', ['->', ['^', ['|', ['~', 'b', None], 'c'], 'a'], 'c']], ['~', 'b', None]] + + .. NOTE:: + + This function is used by other functions in the logic module + that perform semantic operations on a boolean formula. """ return self.__tree def full_tree(self): r""" - This function returns a full syntax parse tree of the - calling boolean formula. + Return a full syntax parse tree of the calling formula. INPUT: - self -- the calling object, which is a boolean formula + + - ``self`` -- calling object. This is a boolean formula. OUTPUT: - Returns a list containing the full syntax parse tree of self, with - the symbols arranged from left to right as in polish notation. + + The full syntax parse tree as a nested list EXAMPLES: + + This example shows how to find the full syntax parse tree of a formula. + + :: + sage: import sage.logic.propcalc as propcalc sage: s = propcalc.formula("a->(b&c)") sage: s.full_tree() ['->', 'a', ['&', 'b', 'c']] + + :: + sage: t = propcalc.formula("a & ((~b | c) ^ a -> c) <-> ~b") sage: t.full_tree() ['<->', ['&', 'a', ['->', ['^', ['|', ['~', 'b'], 'c'], 'a'], 'c']], ['~', 'b']] + + :: + sage: f = propcalc.formula("~~(a&~b)") sage: f.full_tree() ['~', ['~', ['&', 'a', ['~', 'b']]]] + + .. NOTE:: + + This function is used by other functions in the logic module + that perform syntactic operations on a boolean formula. + + AUTHORS: + + - Paul Scurek (2013-08-03) """ return logicparser.polish_parse(repr(self)) def __or__(self, other): r""" - Overloads the | operator to 'or' two statements together. + Overload the | operator to 'or' two statements together. INPUT: - self -- the right hand side statement. - other -- the left hand side statement. + + - ``self`` -- calling object. This is the statement on + the left side of the operator. + + - ``other`` -- a boolean formula. This is the statement + on the right side of the operator. OUTPUT: - Returns a new statement that is the first statement logically - or'ed together. + + A boolean formula of the following form: + + ``self`` | ``other`` + EXAMPLES: + + This example illustrates combining two formulas with '|'. + + :: + sage: import sage.logic.propcalc as propcalc sage: s = propcalc.formula("a&b") sage: f = propcalc.formula("c^d") @@ -299,17 +395,28 @@ def __or__(self, other): def __and__(self, other): r""" - Overloads the & operator to 'and' two statements together. + Overload the & operator to 'and' two statements together. INPUT: - self -- the right hand side statement. - other -- the left hand side statement. + + - ``self`` -- calling object. This is the formula on the + left side of the operator. + + - ``other`` -- a boolean formula. This is the formula on + the right side of the operator. OUTPUT: - Returns a new statement that is the first statement logically - and'ed together. + + A boolean formula of the following form: + + ``self`` & ``other`` EXAMPLES: + + This example shows how to combine two formulas with '&'. + + :: + sage: import sage.logic.propcalc as propcalc sage: s = propcalc.formula("a&b") sage: f = propcalc.formula("c^d") @@ -320,17 +427,28 @@ def __and__(self, other): def __xor__(self, other): r""" - Overloads the ^ operator to xor two statements together. + Overload the ^ operator to xor two statements together. INPUT: - self -- the right hand side statement. - other -- the left hand side statement. + + - ``self`` -- calling object. This is the formula on the + left side of the operator. + + - ``other`` -- a boolean formula. This is the formula on + the right side of the operator. OUTPUT: - Returns a new statement that is the first statement logically - xor'ed together. + + A boolean formula of the following form: + + ``self`` ^ ``other`` EXAMPLES: + + This example illustrates how to combine two formulas with '^'. + + :: + sage: import sage.logic.propcalc as propcalc sage: s = propcalc.formula("a&b") sage: f = propcalc.formula("c^d") @@ -341,38 +459,64 @@ def __xor__(self, other): def __pow__(self, other): r""" - Overloads the ^ operator to xor two statements together. + Overload the ^ operator to xor two statements together. INPUT: - self -- the right hand side statement. - other -- the left hand side statement. + + - ``self`` -- calling object. This is the formula on the + left side of the operator. + + - ``other`` -- a boolean formula. This is the formula on + the right side of the operator. OUTPUT: - Returns a new statement that is the first statement logically - xor'ed together. + + A boolean formula of the following form: + + ``self`` ^ ``other`` EXAMPLES: + + This example shows how to combine two formulas with '^'. + + :: + sage: import sage.logic.propcalc as propcalc sage: s = propcalc.formula("a&b") sage: f = propcalc.formula("c^d") sage: s ^ f (a&b)^(c^d) + + .. TODO:: + + This function seems to be identical to __xor__. + Thus, this function should be replaced with __xor__ everywhere + that it appears in the logic module. Then it can be deleted + altogether. """ return self.add_statement(other, '^') def __invert__(self): r""" - Overloads the ~ operator to not a statement. + Overload the ~ operator to not a statement. INPUT: - self -- the right hand side statement. - other -- the left hand side statement. + + - ``self`` -- calling object. This is the formula on the + right side of the operator. OUTPUT: - Returns a new statement that is the first statement logically - not'ed. + + A boolean formula of the following form: + + ~``self`` EXAMPLES: + + This example shows how to negate a boolean formula. + + :: + sage: import sage.logic.propcalc as propcalc sage: s = propcalc.formula("a&b") sage: ~s @@ -384,17 +528,28 @@ def __invert__(self): def ifthen(self, other): r""" - Returns two statements attached by the -> operator. + Combine two formulas with the -> operator. INPUT: - self -- the right hand side statement. - other -- the left hand side statement. + + - ``self`` -- calling object. This is the formula on + the left side of the operator. + + - ``other`` -- a boolean formula. This is the formula + on the right side of the operator. OUTPUT: - Returns a new statement that is the first statement logically - ifthen'ed together. + + A boolean formula of the following form: + + ``self`` -> ``other`` EXAMPLES: + + This example illustrates how to combine two formulas with '->'. + + :: + sage: import sage.logic.propcalc as propcalc sage: s = propcalc.formula("a&b") sage: f = propcalc.formula("c^d") @@ -405,17 +560,28 @@ def ifthen(self, other): def iff(self, other): r""" - Returns two statements attached by the <-> operator. + Combine two formulas with the <-> operator. INPUT: - self -- the right hand side statement. - other -- the left hand side statement. + + - ``self`` -- calling object. This is the formula + on the left side of the operator. + + - ``other`` -- a boolean formula. This is the formula + on the right side of the operator. OUTPUT: - Returns a new statement that is the first statement logically - ifandonlyif'ed together. + + A boolean formula of the following form: + + ``self`` <-> ``other`` EXAMPLES: + + This example illustrates how to combine two formulas with '<->'. + + :: + sage: import sage.logic.propcalc as propcalc sage: s = propcalc.formula("a&b") sage: f = propcalc.formula("c^d") @@ -426,23 +592,38 @@ def iff(self, other): def __eq__(self, other): r""" - Overloads the == operator to determine if two expressions - are logically equivalent. + Overload the == operator to deterine logical equivalence. INPUT: - self -- the right hand side statement. - other -- the left hand side statement. + + - ``self`` -- calling object. This is the formula on + the left side of the comparator. + + - ``other`` -- a boolean formula. This is the formula + on the right side of the comparator. OUTPUT: - Returns true if the left hand side is equivalent to the - right hand side, and false otherwise. + + A boolean value to be determined as follows: + + True - if ``self`` and ``other`` are logically equivalent + + False - if ``self`` and ``other`` are not logically equivalent EXAMPLES: + + This example shows how to determine logical equivalence. + + :: + sage: import sage.logic.propcalc as propcalc sage: f = propcalc.formula("(a|b)&c") sage: g = propcalc.formula("c&(b|a)") sage: f == g True + + :: + sage: g = propcalc.formula("a|b&c") sage: f == g False @@ -451,30 +632,28 @@ def __eq__(self, other): def truthtable(self, start = 0, end = -1): r""" - This function returns a truthtable object corresponding to the given - statement. Each row of the table corresponds to a binary number, with - each variable associated to a column of the number, and taking on - a true value if that column has a value of 1. Please see the - logictable module for details. The function returns a table that - start inclusive and end exclusive so truthtable(0, 2) will include - row 0, but not row 2. + Return a truth table for the calling formula. INPUT: - self -- the calling object. - start -- an integer representing the row of the truth - table from which to start initialized to 0, which - is the first row when all the variables are - false. - end -- an integer representing the last row of the truthtable - to be created. It is initialized to the last row of the - full table. + + - ``self`` -- calling object + + - ``start`` -- (default: 0) an integer. This is the first + row of the truth table to be created. + + - ``end`` -- (default: -1) an integer. This is the laste + row of the truth table to be created. OUTPUT: - Returns the truthtable (a 2-D array with the creating statement - tacked on the front) corresponding to the statement. + + The truth table as a 2-D array EXAMPLES: - This example illustrates the creation of a statement. + + This example illustrates the creation of a truth table. + + :: + sage: import sage.logic.propcalc as propcalc sage: s = propcalc.formula("a&b|~(c|a)") sage: s.truthtable() @@ -488,7 +667,10 @@ def truthtable(self, start = 0, end = -1): True True False True True True True True - We can now create truthtable of rows 1 to 4, inclusive + We can now create a truthtable of rows 1 to 4, inclusive. + + :: + sage: s.truthtable(1, 5) a b c value False False True False @@ -496,9 +678,15 @@ def truthtable(self, start = 0, end = -1): False True True False True False False False - There should be no errors. + .. NOTE:: + + Each row of the table corresponds to a binary number, with + each variable associated to a column of the number, and taking on + a true value if that column has a value of 1. Please see the + logictable module for details. The function returns a table that + start inclusive and end exclusive so truthtable(0, 2) will include + row 0, but not row 2. - NOTES: When sent with no start or end parameters, this is an exponential time function requiring O(2**n) time, where n is the number of variables in the expression. @@ -534,23 +722,32 @@ def truthtable(self, start = 0, end = -1): def evaluate(self, var_values): r""" - Evaluates a formula for the given input values. + Evaluate a formula for the given input values. INPUT: - self -- the calling object. - var_values -- a dictionary containing pairs of - variables and their boolean values. - All variable must be present. + + - ``self`` -- calling object + + - ``var_values`` -- a dictionary. This contains the + pairs of variables and their boolean values. OUTPUT: - Return the evaluation of the formula with the given - inputs, either True or False. + + The result of the evaluation as a boolean. EXAMPLES: + + This example illustrates the evaluation of a boolean formula. + + :: + sage: import sage.logic.propcalc as propcalc sage: f = propcalc.formula("a&b|c") sage: f.evaluate({'a':False, 'b':False, 'c':True}) True + + :: + sage: f.evaluate({'a':True, 'b':False, 'c':False}) False """ @@ -558,20 +755,33 @@ def evaluate(self, var_values): def is_satisfiable(self): r""" - Is_satisfiable determines if there is some assignment of - variables for which the formula will be true. + Determine if the formula is True for some assignment of values. INPUT: - self -- the calling object. + + - ``self`` -- calling object OUTPUT: - True if the formula can be satisfied, False otherwise. + + A boolean value to be determined as follows: + + True - if there is an assignment of values that makes the formula True + + False - if the formula cannot be made True by any assignment of values EXAMPLES: + + This example illustrates how to check a formula for satisfiability. + + :: + sage: import sage.logic.propcalc as propcalc sage: f = propcalc.formula("a|b") sage: f.is_satisfiable() True + + :: + sage: g = f & (~f) sage: g.is_satisfiable() False @@ -584,23 +794,39 @@ def is_satisfiable(self): def is_tautology(self): r""" - Is_tautology determines if the formula is always - true. + Determine if the formula is always True. INPUT: - self -- the calling object. + + - ``self`` -- calling object OUTPUT: - True if the formula is a tautology, False otherwise. + + A boolean value to be determined as follows: + + True - if the formula is a tautology + + False - if the formula is not a tautology EXAMPLES: + + This example illustrates how to check if a formula is a tautology. + + :: + sage: import sage.logic.propcalc as propcalc sage: f = propcalc.formula("a|~a") sage: f.is_tautology() True + + :: + sage: f = propcalc.formula("a&~a") sage: f.is_tautology() False + + :: + sage: f = propcalc.formula("a&b") sage: f.is_tautology() False @@ -610,23 +836,39 @@ def is_tautology(self): def is_contradiction(self): r""" - Is_contradiction determines if the formula is always - false. + Determine if the formula is always False. INPUT: - self -- the calling object. + + - ``self`` -- calling object OUTPUT: - True if the formula is a contradiction, False otherwise. + + A boolean value to be determined as follows: + + True - if the formula is a contradiction + + False - if the formula is not a contradiction EXAMPLES: + + This example illustrates how to check if a formula is a contradiction. + + :: + sage: import sage.logic.propcalc as propcalc sage: f = propcalc.formula("a&~a") sage: f.is_contradiction() True + + :: + sage: f = propcalc.formula("a|~a") sage: f.is_contradiction() False + + :: + sage: f = propcalc.formula("a|b") sage: f.is_contradiction() False @@ -635,23 +877,36 @@ def is_contradiction(self): def equivalent(self, other): r""" - This function determines if two formulas are semantically - equivalent. + Determine if two formulas are semantically equivalent. INPUT: - self -- the calling object. - other -- a boolformula instance. + + - ``self`` -- calling object + + - ``other`` -- instance of BooleanFormula class. OUTPUT: - True if the two formulas are logically equivalent, False - otherwise. + + A boolean value to be determined as follows: + + True - if the two formulas are logically equivalent + + False - if the two formulas are not logically equivalent EXAMPLES: + + This example shows how to check for logical equivalence. + + :: + sage: import sage.logic.propcalc as propcalc sage: f = propcalc.formula("(a|b)&c") sage: g = propcalc.formula("c&(a|b)") sage: f.equivalent(g) True + + :: + sage: g = propcalc.formula("a|b&c") sage: f.equivalent(g) False @@ -660,28 +915,31 @@ def equivalent(self, other): def convert_cnf_table(self): r""" - This function converts an instance of boolformula to conjunctive - normal form. It does this by examining the truthtable of the formula, - and thus takes `O(2^n)` time, where `n` is the number of variables. + Convert boolean formula to conjunctive normal form. INPUT: - - ``self`` -- the calling object. + - ``self`` -- calling object OUTPUT: - An instance of :class:`BooleanFormula` with an identical truth - table that is in conjunctive normal form. + An instance of :class:`BooleanFormula` in conjunctive normal form EXAMPLES:: + This example illustrates how to convert a formula to cnf. + + :: + sage: import sage.logic.propcalc as propcalc sage: s = propcalc.formula("a ^ b <-> c") sage: s.convert_cnf() sage: s (a|b|~c)&(a|~b|c)&(~a|b|c)&(~a|~b|~c) - The methods :meth:`convert_cnf` and :meth:`convert_cnf_table` are aliases. :: + We now show that :meth:`convert_cnf` and :meth:`convert_cnf_table` are aliases. + + :: sage: t = propcalc.formula("a ^ b <-> c") sage: t.convert_cnf_table(); t @@ -718,27 +976,35 @@ def convert_cnf_table(self): def convert_cnf_recur(self): r""" - This function converts an instance of boolformula to conjunctive - normal form. It does this by applying a set of rules that are - guaranteed to convert the formula. Worst case the converted - expression has an O(2^n) increase in size (and time as well), but if - the formula is already in CNF (or close to) it is only O(n). + Convert boolean formula to conjunctive normal form. INPUT: - self -- the calling object. + + - ``self`` -- calling object OUTPUT: - An instance of boolformula with an identical truth table that is in - conjunctive normal form. + + An instance of :class:`BooleanFormula` in conjunctive normal form EXAMPLES: + + This example hows how to convert a formula to conjunctive normal form. + + :: + sage: import sage.logic.propcalc as propcalc sage: s = propcalc.formula("a^b<->c") sage: s.convert_cnf_recur() sage: s (~a|a|c)&(~b|a|c)&(~a|b|c)&(~b|b|c)&(~c|a|b)&(~c|~a|~b) - NOTES: + .. NOTES:: + + This function works by applying a set of rules that are + guaranteed to convert the formula. Worst case the converted + expression has an O(2^n) increase in size (and time as well), but if + the formula is already in CNF (or close to) it is only O(n). + This function can require an exponential blow up in space from the original expression. This in turn can require large amounts of time. Unless a formula is already in (or close to) being in cnf convert_cnf() @@ -751,17 +1017,22 @@ def convert_cnf_recur(self): def satformat(self): r""" - This function returns the satformat representation of a boolean formula. - See www.cs.ubc.ca/~hoos/SATLIB/Benchmarks/SAT/satformat.ps for a - description of satformat. + Return the satformat representation of a boolean formula. INPUT: - self -- the calling object. + + - ``self`` -- calling object OUTPUT: - A string representing the satformat representation of this object. + + The satformat of the formula as a string EXAMPLES: + + This example illustrates how to find the satformat of a formula. + + :: + sage: import sage.logic.propcalc as propcalc sage: f = propcalc.formula("a&((b|c)^a->c)<->b") sage: f.convert_cnf() @@ -770,7 +1041,11 @@ def satformat(self): sage: f.satformat() 'p cnf 3 0\n1 -2 3 0 1 -2 -3 \n0 -1 2 -3' - NOTES: + .. NOTES:: + + See www.cs.ubc.ca/~hoos/SATLIB/Benchmarks/SAT/satformat.ps for a + description of satformat. + If the instance of boolean formula has not been converted to CNF form by a call to convert_cnf() or convert_cnf_recur() satformat() will call convert_cnf(). Please see the notes for @@ -879,23 +1154,37 @@ def satformat(self): def convert_opt(self, tree): r""" - This function can be applied to a parse tree to convert to the tuple - form used by bool opt. The expression must only contain '&', '|', and - '~' operators. + Convert a parse tree to the tuple form used by bool_opt. INPUT: - self -- the calling object. - tree -- a list of three elements corresponding to a branch of a - parse tree. + + - ``self`` -- calling object + + - ``tree`` -- a list. This is a branch of a + parse tree and can only contain the '&', '|' + and '~' operators along with variables. + OUTPUT: - A tree branch that does not contain ^, ->, or <-> operators. + + A 3-tupple EXAMPLES: + + This example illustrates the conersion of a formula into its corresponding tupple. + + :: + sage: import sage.logic.propcalc as propcalc, sage.logic.logicparser as logicparser sage: s = propcalc.formula("a&(b|~c)") sage: tree = ['&', 'a', ['|', 'b', ['~', 'c', None]]] sage: logicparser.apply_func(tree, s.convert_opt) ('and', ('prop', 'a'), ('or', ('prop', 'b'), ('not', ('prop', 'c')))) + + .. NOTES:: + + This function only works on one branch of the parse tree. to + apply the function to every branch of a parse tree, pass the + function as an argument in :func:`apply_func` in logicparser.py. """ if type(tree[1]) is not TupleType and tree[1] != None: lval = ('prop', tree[1]) @@ -915,24 +1204,37 @@ def convert_opt(self, tree): def add_statement(self, other, op): r""" - This function takes two statements and combines them - together with the given operator. + Combine two formulas with the give operator. INPUT: - self -- the left hand side statement object. - other -- the right hand side statement object. - op -- the character of the operation to be performed. + + - ``self`` -- calling object. This is the formula on + the left side of the operator. + + - ``other`` -- instance of BooleanFormula class. This + is the formula on the right of the operator. + + - ``op`` -- a string. This is the operator used to + combine the two formulas. OUTPUT: - Returns a new statement that is the first statement attached to - the second statement by the operator op. + + The result as an instance of :class:`BooleanFormula` EXAMPLES: + + This example shows how to create a new formula from two others. + + :: + sage: import sage.logic.propcalc as propcalc sage: s = propcalc.formula("a&b") sage: f = propcalc.formula("c^d") sage: s.add_statement(f, '|') (a&b)|(c^d) + + :: + sage: s.add_statement(f, '->') (a&b)->(c^d) """ @@ -942,21 +1244,32 @@ def add_statement(self, other, op): def get_bit(self, x, c): r""" - This function returns bit c of the number x. The 0 bit is the - low order bit. Errors should be handled gracefully by a return - of false, and negative numbers x always return false while a - negative c will index from the high order bit. + Determine if bit c of the number x is 1. INPUT: - self -- the calling object. - x -- an integer, the number from which to take the bit. - c -- an integer, the bit number to be taken, where 0 is - the low order bit. + + - ``self`` -- calling object + + - ``x`` -- an integer. This is the number from + which to take the bit. + + - ``c`` -- an integer. This is the but number to + be taken, where 0 is the low order bit. OUTPUT: - returns True if bit c of number x is 1, False otherwise. + + A boolean to be determined as follows: + + True - if bit c of x is 1 + + False - if bit c of x is not 1 EXAMPLES: + + This example illustrates the use of :meth:`get_bit`. + + :: + sage: import sage.logic.propcalc as propcalc sage: s = propcalc.formula("a&b") sage: s.get_bit(2, 1) @@ -965,16 +1278,29 @@ def get_bit(self, x, c): False It is not an error to have a bit out of range. + + :: + sage: s.get_bit(64, 7) False Nor is it an error to use a negative number. + + :: + sage: s.get_bit(-1, 3) False sage: s.get_bit(64, -1) True sage: s.get_bit(64, -2) False + + .. NOTES:: + + The 0 bit is the low order bit. Errors should be handled + gracefully by a return of false, and negative numbers x + always return false while a negative c will index from the + high order bit. """ bits = [] while x > 0: @@ -991,22 +1317,37 @@ def get_bit(self, x, c): def reduce_op(self, tree): r""" - This function can be applied to a parse tree to convert if-and-only-if, - if-then, and xor operations to operations only involving and/or operations. + Convert if-and-only-if, if-then, and xor operations to operations + only involving and/or operations. INPUT: - self -- the calling object. - tree -- a list of three elements corresponding to a branch of a - parse tree. + + - ``self`` -- calling object + + - ``tree`` -- a list. This represents a branch + of a parse tree. + OUTPUT: - A tree branch that does not contain ^, ->, or <-> operators. + + A new list with no ^, ->, or <-> as first element of list. EXAMPLES: + + This example illustrates the use of :meth:`reduce_op` with :func:`apply_func`. + + :: + sage: import sage.logic.propcalc as propcalc, sage.logic.logicparser as logicparser sage: s = propcalc.formula("a->b^c") sage: tree = ['->', 'a', ['^', 'b', 'c']] sage: logicparser.apply_func(tree, s.reduce_op) ['|', ['~', 'a', None], ['&', ['|', 'b', 'c'], ['~', ['&', 'b', 'c'], None]]] + + .. NOTES:: + + This function only operates on a single branch of a parse tree. + To apply the function to an entire parse tree, pass the function + as an argument to :func:`apply_func` in logicparser.py. """ if tree[0] == '<->': # parse tree for (~tree[1]|tree[2])&(~tree[2]|tree[1]) @@ -1025,22 +1366,36 @@ def reduce_op(self, tree): def dist_not(self, tree): r""" - This function can be applied to a parse tree to distribute not operators - over other operators. + Distribute ~ operators over & and | operators. INPUT: - self -- the calling object. - tree -- a list of three elements corresponding to a branch of a - parse tree. + + - ``self`` calling object + + - ``tree`` a list. This represents a branch + of a parse tree. + OUTPUT: - A tree branch that does not contain un-distributed nots. + + A new list EXAMPLES: + + This example illustrates the distribution of '~' over '&'. + + :: + sage: import sage.logic.propcalc as propcalc, sage.logic.logicparser as logicparser sage: s = propcalc.formula("~(a&b)") sage: tree = ['~', ['&', 'a', 'b'], None] sage: logicparser.apply_func(tree, s.dist_not) #long time ['|', ['~', 'a', None], ['~', 'b', None]] + + .. NOTES:: + + This function only operates on a single branch of a parse tree. + To apply the function to an entire parse tree, pass the function + as an argument to :func:`apply_func` in logicparser.py. """ if tree[0] == '~' and type(tree[1]) is ListType: op = tree[1][0] @@ -1059,22 +1414,36 @@ def dist_not(self, tree): def dist_ors(self, tree): r""" - This function can be applied to a parse tree to distribute or over and. + Distribute | over &. INPUT: - self -- the calling object. - tree -- a list of three elements corresponding to a branch of a - parse tree. + + - ``self`` -- calling object + + _ ``tree`` -- a list. This represents a branch of + a parse tree. + OUTPUT: - A tree branch that does not contain un-distributed ors. + + A new list EXAMPLES: + + This example illustrates the distribution of '|' over '&'. + + :: + sage: import sage.logic.propcalc as propcalc, sage.logic.logicparser as logicparser sage: s = propcalc.formula("(a&b)|(a&c)") sage: tree = ['|', ['&', 'a', 'b'], ['&', 'a', 'c']] sage: logicparser.apply_func(tree, s.dist_ors) #long time ['&', ['&', ['|', 'a', 'a'], ['|', 'b', 'a']], ['&', ['|', 'a', 'c'], ['|', 'b', 'c']]] + .. NOTES:: + + This function only operates on a single branch of a parse tree. + To apply the function to an entire parse tree, pass the function + as an argument to :func:`apply_func` in logicparser.py. """ if tree[0] == '|' and type(tree[2]) is ListType and tree[2][0] == '&': new_tree = ['&', ['|', tree[1], tree[2][1]], ['|', tree[1], tree[2][2]]] @@ -1086,23 +1455,36 @@ def dist_ors(self, tree): def to_infix(self, tree): r""" - This function can be applied to a parse tree to convert it from prefix to - infix. + Convert a parse tree from prefix to infix form. INPUT: - self -- the calling object. - tree -- a list of three elements corresponding to a branch of a - parse tree. + + - ``self`` -- calling object + + _ ``tree`` -- a list. This represents a branch + of a parse tree. OUTPUT: - A tree branch in infix form. + + A new list EXAMPLES: + + This example shows how to convert a parse tree from prefix to infix form. + + :: + sage: import sage.logic.propcalc as propcalc, sage.logic.logicparser as logicparser sage: s = propcalc.formula("(a&b)|(a&c)") sage: tree = ['|', ['&', 'a', 'b'], ['&', 'a', 'c']] sage: logicparser.apply_func(tree, s.to_infix) [['a', '&', 'b'], '|', ['a', '&', 'c']] + + .. NOTES:: + + This function only operates on a single branch of a parse tree. + To apply the function to an entire parse tree, pass the function + as an argument to :func:`apply_func` in logicparser.py. """ if tree[0] != '~': return [tree[1], tree[0], tree[2]] @@ -1110,22 +1492,26 @@ def to_infix(self, tree): def convert_expression(self): r""" - This function converts the string expression associated with an instance - of boolformula to match with its tree representation after being converted - to conjunctive normal form. + Convert the string representation of a formula to conjunctive normal form. INPUT: - self -- the calling object. + + -- ``self`` -- calling object OUTPUT: - None. + + None EXAMPLES: + + We show how the converted formula is printed in conjunctive normal form. + + :: + sage: import sage.logic.propcalc as propcalc sage: s = propcalc.formula("a^b<->c") sage: s.convert_cnf_recur(); s #long time (~a|a|c)&(~b|a|c)&(~a|b|c)&(~b|b|c)&(~c|a|b)&(~c|~a|~b) - """ ttree = self.__tree[:] ttree = logicparser.apply_func(ttree, self.to_infix) @@ -1153,20 +1539,34 @@ def convert_expression(self): def get_next_op(self, str): r""" - This function returns the next operator in a string. + Return the next operator in a string. INPUT: - self -- the calling object. - tree -- a string containing a logical expression. + + - ``self`` -- calling object + + _ ``str`` -- a string. This contains a logical + expression. OUTPUT: - The next operator in the string. + + The next operator as a string EXAMPLES: + + This example illustrates how to find the next operator in a formula. + + :: + sage: import sage.logic.propcalc as propcalc sage: s = propcalc.formula("f&p") sage: s.get_next_op("abra|cadabra") '|' + + .. NOTES:: + + The parameter ``str`` is not necessarily the string + representation of the calling object. """ i = 0 while i < len(str) - 1 and str[i] != '&' and str[i] != '|': diff --git a/src/sage/logic/logic.py b/src/sage/logic/logic.py index 41951b08511..4954f7a200d 100644 --- a/src/sage/logic/logic.py +++ b/src/sage/logic/logic.py @@ -8,16 +8,22 @@ alpha-numerics and the underscore character. AUTHORS: - -- Chris Gorecki (2007): initial version - -- William Stein (2007-08-31): integration into Sage 2.8.4 -""" +- Chris Gorecki (2007): initial version + +- William Stein (2007-08-31): integration into Sage 2.8.4 + +- Paul Scurek (2013-08-03): updated docstring formatting +""" #***************************************************************************** -# Copyright (C) 2006 William Stein -# Copyright (C) 2007 Chris Gorecki +# Copyright (C) 2007 Chris Gorecki +# Copyright (C) 2007 William Stein +# Copyright (C) 2013 Paul Scurek # -# Distributed under the terms of the GNU General Public License (GPL) -# http://www.gnu.org/licenses/ +# Distributed under the terms of the GNU General Public License (GPL) +# as published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# http://www.gnu.org/licenses/ #***************************************************************************** import string @@ -32,8 +38,12 @@ class SymbolicLogic: """ - EXAMPLES: + + This example illustrates how to create a boolean formula and print its table. + + :: + sage: log = SymbolicLogic() sage: s = log.statement("a&b|!(c|a)") sage: t = log.truthtable(s) @@ -51,35 +61,53 @@ class SymbolicLogic: """ def statement(self, s): r""" - This function returns a token list to be further manipulated - by other functions in the class. + Return a token list to be used by other functions in the class INPUT: - self -- the calling object - s -- a string containing the logic expression to be manipulated - global vars -- a dictionary with the variable names and - their current boolean value - global vars_order -- a list of the variable names in - the order they were found + + - ``self`` -- calling object + + - ``s`` -- a string containing the logic expression to be manipulated + + - ``global vars`` -- a dictionary with variable names as keys and the + variables' current boolean values as dictionary values + + - ``global vars_order`` -- a list of the variables in the order that they + are found + OUTPUT: - returns a list containing a list of tokens, a dictionary of - variable/value pairs (where the value is 'True' or 'False') - and a list of the variable names in the order they were found + + A list of length three containing the following in this order: + + 1. a list of tokens + 2. a dictionary of variable/value pairs + 3. a list of the variables in the order they were found EXAMPLES: + This example illustrates the creation of a statement. + + :: + sage: log = SymbolicLogic() sage: s = log.statement("a&b|!(c|a)") - We can now create another statement. + :: + sage: s2 = log.statement("!((!(a&b)))") It is an error to use invalid variable names. + + :: + sage: s = log.statement("3fe & @q") Invalid variable name: 3fe Invalid variable name: @q It is also an error to use invalid syntax. + + :: + sage: s = log.statement("a&&b") Malformed Statement sage: s = log.statement("a&((b)") @@ -99,44 +127,44 @@ def statement(self, s): def truthtable(self, statement, start=0, end=-1): r""" - This function returns a truthtable corresponding to - the given statement. + Return a truth table. INPUT: - self -- the calling object: not used - statement -- a list of 3 items, the tokens and two global - variables vars and vars_order - start -- an integer representing the row of the truth - table from which to start initialized to 0 which - is the first row when all the variables are - false - end -- an integer representing the last row of the truthtable - to be created initialized to -1 which if left is converted - to the last row of the full table - global vars -- a dictionary with the variable names and - their current boolean value - global vars_order -- a list of the variable names in - the order they were found + + - ``self`` -- calling object + + - ``statement`` -- a list. It contains the tokens and the two global + variables vars and vars_order + + - ``start`` -- (default : 0) an integer. This represents the row of the + truth table from which to start. + + - ``end`` -- (default : -1) an integer. This represents the last row of the + truth table to be created OUTPUT: - returns the truthtable (a 2-d array with the creating statement - tacked on the front) corresponding to the statement + + The truth table as a 2d array with the creating formula tacked to the front EXAMPLES: + This example illustrates the creation of a statement. + + :: + sage: log = SymbolicLogic() sage: s = log.statement("a&b|!(c|a)") sage: t = log.truthtable(s) #creates the whole truth table We can now create truthtable of rows 1 to 5 + + :: + sage: s2 = log.truthtable(s, 1, 5); s2 [[['OPAREN', 'a', 'AND', 'b', 'OR', 'NOT', 'OPAREN', 'c', 'OR', 'a', 'CPAREN', 'CPAREN'], {'a': 'False', 'c': 'True', 'b': 'False'}, ['a', 'b', 'c']], ['False', 'False', 'True', 'False'], ['False', 'True', 'False', 'True'], ['False', 'True', 'True', 'True'], ['True', 'False', 'False', 'False']] + .. NOTE:: - There should be no errors if the statement did not return - any errors. - - NOTES: When sent with no start or end parameters this is an exponential time function requiring O(2**n) time, where n is the number of variables in the logic expression @@ -162,23 +190,25 @@ def truthtable(self, statement, start=0, end=-1): def print_table(self, table): r""" - This function returns a truthtable corresponding to - the given statement. + Return a truthtable corresponding to the given statement. INPUT: - self -- the calling object: not used - table -- an object created by the truthtable method - that contains variable values and the - corresponding evaluation of the statement - global vars_order -- a list of the variable names in - the order they were found + + - ``self`` -- calling object + + - ``table`` -- object created by truthtable() method. It contains + the variable values and the evaluation of the statement OUTPUT: - prints to the terminal window a formatted version of - the truthtable (which is basically a 2-d array). + + A formatted version of the truth table EXAMPLES: - This example illustrates the creation of a statement. + + This example illustrates the creation of a statement and its truth table. + + :: + sage: log = SymbolicLogic() sage: s = log.statement("a&b|!(c|a)") sage: t = log.truthtable(s) #creates the whole truth table @@ -195,6 +225,9 @@ def print_table(self, table): True | True | True | True | We can also print a shortened table. + + :: + sage: t = log.truthtable(s, 1, 5) sage: log.print_table(t) a | b | c | value | value | @@ -204,9 +237,6 @@ def print_table(self, table): False | False | True | True | False | False | True | False | False | True | - There should be no errors if the statement did not return - any errors. - """ statement = table[0] del table[0] @@ -261,16 +291,25 @@ def prove(self, statement): def get_bit(x, c): r""" - This function is for internal use by the class SymbolicLogic. - It returns bit c of the number x. + Determine if bit c of the number x is 1. - INPUT: - x -- An integer, the number from which to take the bit - c -- An integer, the bit number to be taken, where 0 is - the low order bit + INPUT: - OUTPUT: - returns 'True' if bit c of number x is 1 'False' otherwise + - ``x`` -- an integer. This is the number from which to take the bit. + + - ``c`` -- an integer. This is the bit number to be taken. + + OUTPUT: + + A boolean value to be determined as follows: + + True - if bit c of x is 1 + + False - if bit c of x is not 1 + + .. NOTE:: + + This function is for internal use by the SymbolicLogic class. """ bits = [] while x > 0: @@ -287,17 +326,25 @@ def get_bit(x, c): def eval(toks): r""" - This function is for internal use by the class SymbolicLogic. - It returns 'True' if the expression contained in toks would - evaluate to 'True' and 'False' otherwise. It relies on setting - the values of the variables in the global dictionary vars. + Evaluate the expression contained in toks. - INPUT: - toks -- a token list representing a logic expression + INPUT: - OUTPUT: - returns 'True' if evaluates to true with variables in vars and - 'False' otherwise + - ``toks`` -- a list of tokens. This represents a boolean expression. + + OUTPUT: + + A boolean value to be determined as follows: + + True - if expression evaluates to True + + False - if expression evaluates to False + + .. NOTE:: + + This function is for internal use by the SymbolicLogic class. The + evaluations rely on setting the values of the variables in the global + dictionary vars. """ stack = [] for tok in toks: @@ -314,18 +361,26 @@ def eval(toks): def eval_ltor_toks(lrtoks): r""" - This function is for internal use by the class SymbolicLogic. - It returns 'True' if the expression contained in lrtoks would - evaluate to 'True' and 'False' otherwise. It relies on setting - the values of the variables in the global dictionary vars. + Evaluates the expression contained in lrtoks. - INPUT: - lrtoks -- a token list representing part of a logical - expression that contains no inner parenthesis + INPUT: - OUTPUT: - returns 'True' if evaluates to true with variables in vars and - 'False' otherwise + - ``lrtoks`` -- a list of tokens. This represents a part of a boolean + formula that contains no inner parentheses. + + OUTPUT: + + A boolean value to be determined as follows: + + True - if expression evaluates to True + + False - if expression evaluates to False + + .. NOTE:: + + This function is for internal use by the SymbolicLogic class. The + evaluations rely on setting the values of the variables in the global + dictionary vars. """ reduce_monos(lrtoks) # monotonic ! operators go first reduce_bins(lrtoks) # then the binary operators @@ -335,18 +390,20 @@ def eval_ltor_toks(lrtoks): def reduce_bins(lrtoks): r""" - This function is for internal use by the class SymbolicLogic. - It takes a series of tokens with no parentheses or monotonic - operators and evaluates it to a single boolean value. + Evaluate lrtoks to a single boolean value. - INPUT: - lrtoks -- a token list representing part of a logical - expression that contains no inner parenthesis - or monotonic operators + INPUT: - OUTPUT: - The pointer to lrtoks is now a list containing 'True' or - 'False' + - ``lrtoks`` -- a list of tokens. This represents a part of a boolean + formula that contains no inner parentheses or monotonic operators. + + OUTPUT: + + None. The pointer to lrtoks is now a list containing True or False + + .. NOTE:: + + This function is for internal use by the SymbolicLogic class. """ i = 0 while i < len(lrtoks): @@ -360,17 +417,19 @@ def reduce_bins(lrtoks): def reduce_monos(lrtoks): r""" - This function is for internal use by the class SymbolicLogic. - It takes a series of tokens with no parentheses and replaces - the monotonic operator/variable pairs with a boolean value. + Replace monotonic operator/variable pairs with a boolean value. - INPUT: - lrtoks -- a token list representing part of a logical - expression that contains no inner parenthesis + INPUT: - OUTPUT: - The pointer to lrtoks is now a list containing no monotonic - operators. + - ``lrtoks`` -- a list of tokens. This represents a part of a boolean + expression that contains now inner parentheses. + + OUTPUT: + + None. The pointer to lrtoks is now a list containing monotonic operators. + + .. NOTE:: + This function is for internal use by the SymbolicLogic class. """ i = 0 while i < len(lrtoks): @@ -382,19 +441,24 @@ def reduce_monos(lrtoks): def eval_mon_op(args): r""" - This function is for internal use by the class SymbolicLogic. - It returns a boolean value based on the truthtable of - the operator sent to it. + Return a boolean value based on the truth table of the operator in args. - INPUT: - args -- a list of length 2 containing the token 'NOT' and - then a variable name - global vars -- a dictionary with the variable names and - their current boolean value + INPUT: - OUTPUT: - returns the inverse of the boolean value represented by the - variable + - ``args`` -- a list of length 2. This contains the token 'NOT' and + then a variable name. + + OUTPUT: + + A boolean value to be determined as follows: + + True - if the variable in args is False + + False - if the variable in args is True + + .. NOTE:: + + This function is for internal use by the SymbolicLogic class. """ if args[1] != 'True' and args[1] != 'False': val = vars[args[1]] @@ -408,20 +472,21 @@ def eval_mon_op(args): def eval_bin_op(args): r""" - This function is for internal use by the class SymbolicLogic. - It returns a boolean value based on the truthtable of - the operator sent to it. + Return a boolean value based on the truth table of the operator in args. - INPUT: - args -- a list of length 3 to containing a variable name - then a token representing a binary logical operator - then another variable name - global vars -- a dictionary with the variable names and - their current boolean value + INPUT: - OUTPUT: - returns the boolean evaluation of the operator based on - the values of the variables + - ``args`` -- a list of length 3. This contains a variable name, + then a binary operator, and then a variable name, in that order. + + OUTPUT: + + A boolean value. This is the evaluation of the operator based on the + truth values of the variables. + + .. NOTE:: + + This function is for internal use by the SymbolicLogic class. """ if args[0] == 'False': lval = 'False' @@ -448,17 +513,24 @@ def eval_bin_op(args): def eval_and_op(lval, rval): r""" - This function is for internal use by the class SymbolicLogic. - It returns the logical 'and' operator applied to lval and rval. + Apply the 'and' operator to lval and rval. - INPUT: - lval -- the variable name appearing to the left of the and - operator - rval -- the variable name appearing to the right of the and - operator + INPUT: - OUTPUT: - returns the logical 'and' operator applied to lval and rval. + - ``lval`` -- a string. This represents the value of the variable + appearing to the left of the 'and' operator. + + - ``rval`` -- a string. This represents the value of the variable + appearing to the right of the 'and' operator. + + + OUTPUT: + + The result of applying 'and' to lval and rval as a string. + + .. NOTE:: + + This function is for internal use by the SymbolicLogic class. """ if lval == 'False' and rval == 'False': return 'False' @@ -471,17 +543,23 @@ def eval_and_op(lval, rval): def eval_or_op(lval, rval): r""" - This function is for internal use by the class SymbolicLogic. - It returns the logical 'or' operator applied to lval and rval. + Apply the 'or' operator to lval and rval - INPUT: - lval -- the variable name appearing to the left of the or - operator - rval -- the variable name appearing to the right of the or - operator + INPUT: - OUTPUT: - returns the logical 'or' operator applied to lval and rval. + - ``lval`` -- a string. This represents the value of the variable + appearing to the left of the 'or' operator. + + - ``rval`` -- a string. This represents the value of the variable + appearing to the right of the 'or' operator. + + OUTPUT: + + A string representing the result of applying 'or' to lval and rval + + .. NOTE:: + + This function is for internal use by the SymbolicLogic class. """ if lval == 'False' and rval == 'False': return 'False' @@ -494,17 +572,23 @@ def eval_or_op(lval, rval): def eval_ifthen_op(lval, rval): r""" - This function is for internal use by the class SymbolicLogic. - It returns the logical 'if then' operator applied to lval and rval. + Apply the 'if then' operator to lval and rval - INPUT: - lval -- the variable name appearing to the left of the if then - operator - rval -- the variable name appearing to the right of the if then - operator + INPUT: - OUTPUT: - returns the logical 'if then' operator applied to lval and rval. + - ``lval`` -- a string. This represents the value of the variable + appearing to the left of the 'if then' operator. + + - ``rval`` -- a string. This represents the value of the variable + appearing to the right of the 'if then' operator. + + OUTPUT: + + A string representing the result of applying 'if then' to lval and rval. + + .. NOTE:: + + This function is for internal use by the SymbolicLogic class. """ if lval == 'False' and rval == 'False': return 'True' @@ -517,21 +601,23 @@ def eval_ifthen_op(lval, rval): def eval_iff_op(lval, rval): r""" - This function is for internal use by the class SymbolicLogic. - It returns the logical 'if and only if' operator applied to lval and -rval. + Apply the 'if and only if' operator to lval and rval. - INPUT: - lval -- the variable name appearing to the left of the if and -only if - operator - rval -- the variable name appearing to the right of the if and -only if - operator + INPUT: - OUTPUT: - returns the logical 'if and only if' operator applied to lval -and rval. + - ``lval`` -- a string. This represents the value of the variable + appearing to the left of the 'if and only if' operator. + + - ``rval`` -- a string. This represents the value of the variable + appearing to the right of the 'if and only if' operator. + + OUTPUT: + + A string representing the result of applying 'if and only if' to lval and rval + + .. NOTE:: + + This function is for internal use by the SymbolicLogic class. """ if lval == 'False' and rval == 'False': return 'True' @@ -544,19 +630,22 @@ def eval_iff_op(lval, rval): def tokenize(s, toks): r""" - This function is for internal use by the class SymbolicLogic. - It tokenizes the string s and places the tokens in toks + Tokenize s and place the tokens of s in toks. - INPUT: - s -- a string that contains a logical expression - toks -- a list to contain the tokens of s - global vars -- a dictionary with the variable names and - their current boolean value - global vars_order -- a list of the variable names in - the order they were found + INPUT: - OUTPUT: - the tokens are placed in toks + - ``s`` -- a string. This contains a boolean expression. + + - ``toks`` -- a list. This will be populated with the tokens + of s. + + OUTPUT: + + None. The tokens of s are placed in toks. + + .. NOTE:: + + This function is for internal use by the SymbolicLogic class. """ i = 0 while i < len(s): diff --git a/src/sage/logic/logicparser.py b/src/sage/logic/logicparser.py index f268d3e8792..649979827af 100644 --- a/src/sage/logic/logicparser.py +++ b/src/sage/logic/logicparser.py @@ -1,17 +1,78 @@ r""" -Module that creates and modifies parse trees of well formed -boolean formulas. +Module that creates and modifies parse trees of well formed boolean formulas. + +A parse tree of a boolean formula is a nested list, where each branch is either +a single variable, or a formula composed of either two variables and a binary +operator or one variable and a unary operator. The function parse() produces +a parse tree that is simplified for the purposes of more efficient truth value +evaluation. The function polish_parse() produces the full parse tree of a boolean +formula which is used in functions related to proof and inference. That is, +parse() is meant to be used with functions in the logic module that perform +semantic operations on a boolean formula, and polish_parse() is to be used with +functions that perform syntactic operations on a boolean formula. AUTHORS: - -- Chris Gorecki + +- Chris Gorecki (2007): initial version + +- Paul Scurek (2013-08-01): added polish_parse, cleaned up python code, + updated docstring formatting EXAMPLES: + +Find the parse tree and variables of a string representation of a boolean formula:: + sage: import sage.logic.logicparser as logicparser sage: s = 'a|b&c' sage: t = logicparser.parse(s) sage: t (['|', 'a', ['&', 'b', 'c']], ['a', 'b', 'c']) + +Find the full syntax parse tree of a string representation of a boolean formula:: + + sage: import sage.logic.logicparser as logicparser + sage: s = '(a&b)->~~c' + sage: logicparser.polish_parse(s) + ['->', ['&', 'a', 'b'], ['~', ['~', 'c']]] + +Find the tokens and distinct variables of a boolean formula:: + + sage: import sage.logic.logicparser as logicparser + sage: s = '~(a|~b)<->(c->c)' + sage: logicparser.tokenize(s) + (['(', '~', '(', 'a', '|', '~', 'b', ')', '<->', '(', 'c', '->', 'c', ')', ')'], ['a', 'b', 'c']) + +Find the parse tree of a boolean formula from a list of the formula's tokens:: + + sage: import sage.logic.logicparser as logicparser + sage: t = ['(', 'a', '->', '~', 'c', ')'] + sage: logicparser.tree_parse(t) + ['->', 'a', ['~', 'c', None]] + sage: r = ['(', '~', '~', 'a', '|', 'b', ')'] + sage: logicparser.tree_parse(r) + ['|', 'a', 'b'] + +Find the full syntax parse tree of a boolean formula from a list of tokens:: + + sage: import sage.logic.logicparser as logicparser + sage: t = ['(', 'a', '->', '~', 'c', ')'] + sage: logicparser.tree_parse(t, polish = True) + ['->', 'a', ['~', 'c']] + sage: r = ['(', '~', '~', 'a', '|', 'b', ')'] + sage: logicparser.tree_parse(r, polish = True) + ['|', ['~', ['~', 'a']], 'b'] + + """ +#***************************************************************************** +# Copyright (C) 2007 Chris Gorecki +# Copyright (C) 2013 Paul Scurek +# +# Distributed under the terms of the GNU General Public License (GPL) +# as published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# http://www.gnu.org/licenses/ +#***************************************************************************** from types import * import string @@ -21,15 +82,26 @@ def parse(s): r""" - This function produces a parse tree from a boolean formula s. + Return a parse tree from a boolean formula s. INPUT: - s -- a string containing a boolean formula. + + - ``s`` -- a string containing a boolean formula. OUTPUT: - Returns the tuple (parse tree of s, variables in s). + + A list containing the prase tree and a list containing the + variables in a boolean formula in this order: + + 1. the list containing the pase tree + 2. the list containing the variables EXAMPLES: + + This example illustrates how to produce the parse tree of a boolean formula s. + + :: + sage: import sage.logic.logicparser as logicparser sage: s = 'a|b&c' sage: t = logicparser.parse(s) @@ -45,22 +117,31 @@ def parse(s): def polish_parse(s): r""" - This function produces a full syntax parse tree from - a boolean formlua s. + Return the full syntax parse tree from a boolean formula s. INPUT: - s -- a string containing a boolean expression + + - ``s`` -- a string containing a boolean expression OUTPUT: - Returns a list representing the full syntax parse tree of s, with - the symbols in s arranged from left to right as in polish notation + + The full syntax parse tree as a nested list EXAMPLES: + + This example illustrates how to find the full syntax parse tree of a boolean formula. + + :: + sage: import sage.logic.logicparser as logicparser sage: s = 'a|~~b' sage: t = logicparser.polish_parse(s) sage: t ['|', 'a', ['~', ['~', 'b']]] + + AUTHORS: + + - Paul Scurek (2013-08-03) """ toks, vars_order = tokenize(s) tree = tree_parse(toks, polish = True) @@ -71,15 +152,25 @@ def polish_parse(s): def tokenize(s): r""" - This function produces a string of tokens from s. + Return the tokens and the distinct variables appearing in a boolean formula s. INPUT: - s -- a string containing a boolean formula. + + - ``s`` -- a string representation of a boolean formula OUTPUT: - Returns a tuple consisting of (tokens in s, variables in s). + + The tokens and variables as an ordered pair of lists in the following order: + + 1. A list containing the tokens of s, in the order they appear in s + 2. A list containing the distinct variables in s, in the order they appearn in s EXAMPLES: + + This example illustrates how to tokenize a string representation of a boolean formula. + + :: + sage: import sage.logic.logicparser as logicparser sage: s = 'a|b&c' sage: t = logicparser.tokenize(s) @@ -101,7 +192,7 @@ def tokenize(s): elif s[i:i + 3] == '<->': tok = '<->' skip = 3 - # check to see if '-', '<' or '>' are used incorretly + # check to see if '-', '<' or '>' are used incorrectly elif s[i] in '<->': msg = "'%s' can only be used as part of the operators '<->' or '->'." % (s[i]) raise SyntaxError, msg @@ -141,27 +232,38 @@ def tokenize(s): def tree_parse(toks, polish = False): r""" - This function produces a parse tree from the tokens in toks. + Return a parse tree from the tokens in toks. INPUT: - toks -- a list of tokens. - polish -- (default : False) A boolean value. - When true, causes the function to produce the full - syntax parse tree from toks + + - ``toks`` -- a list of tokens from a boolean formula + + - ``polish`` -- (default: False) a boolean. When true, tree_parse will return + the full syntax parse tree. OUTPUT: - -- Returns a parse tree of the tokens toks. - -- If polish = True is passed as an argument, - returns the full syntax parse tree of toks + A parse tree in the form of a nested list that depends on ``polish`` as follows: + + polish == False -- Return a simplified parse tree. + + polish == True -- Return the full syntax parse tree. EXAMPLES: + + This example illustrates the use of tree_parse when polish == False. + + :: + sage: import sage.logic.logicparser as logicparser sage: t = ['(', 'a', '|', 'b', '&', 'c', ')'] sage: logicparser.tree_parse(t) ['|', 'a', ['&', 'b', 'c']] - note the difference when polish = True + We now demonstrate the use of tree_parse when polish == True. + + :: + sage: t = ['(', 'a', '->', '~', '~', 'b', ')'] sage: logicparser.tree_parse(t) ['->', 'a', 'b'] @@ -183,32 +285,49 @@ def tree_parse(toks, polish = False): def parse_ltor(toks, n = 0, polish = False): r""" - This function produces a parse tree from the tokens in toks under - the precondition that each token in toks is atomic. + Return a parse tree from toks, where each token in toks is atomic. INPUT: - toks -- a list of tokens. - n -- an integer representing which order of operations - are occurring. - polish -- (default : False) A boolean value. If True, - double negations are not cancelled and negated statements - are turned into lists of length 2 + + - ``toks`` -- a list of tokens. Each token is atomic. + + - ``n`` -- (default: 0) an integer representing which order of + operations are occurring + + - ``polish`` -- (default: False) a boolean. When true, double negations + are not cancelled and negated statements are turned into list of length two. OUTPUT: - -- Returns a parse tree of the tokens toks. - -- If polish = True is passed as an argument, returns the full syntax parse - tree of the tokens toks + + The parse tree as a nested list that depends on ``polish`` as follows: + + polish == False - Return a simplified parse tree. + + polish == True - Return the full syntax parse tree. EXAMPLES: + + This example illustrates the use of parse_ltor when polish == False. + + :: + sage: import sage.logic.logicparser as logicparser sage: t = ['a', '|', 'b', '&', 'c'] sage: logicparser.parse_ltor(t) ['|', 'a', ['&', 'b', 'c']] - note the difference when polish = True is passed + :: + + sage: import sage.logic.logicparser as logicparser sage: t = ['a', '->', '~', '~', 'b'] sage: logicparser.parse_ltor(t) ['->', 'a', 'b'] + + We now repeat the previous example, but with polish == True. + + :: + + sage: import sage.logic.logicparser as logicparser sage: t = ['a', '->', '~', '~', 'b'] sage: logicparser.parse_ltor(t, polish = True) ['->', 'a', ['~', ['~', 'b']]] @@ -254,22 +373,30 @@ def parse_ltor(toks, n = 0, polish = False): def apply_func(tree, func): r""" - This function applies func to each node of tree. + Apply func to each node of tree. Return a new parse tree. INPUT: - tree -- a parse tree. - func -- a function to be applied to tree. + + - ``tree`` -- a parse tree of a boolean formula + + - ``func`` -- a function to be applied to each node of tree. This may + be a function that comes from elsewhere in the logic module. OUTPUT: - Returns a parse tree after func has been applied - to it. + + The new parse tree in the form of a nested list EXAMPLES: + + This example uses :func:`apply_func` where ``func`` switches two entries of tree. + + :: + sage: import sage.logic.logicparser as logicparser sage: t = ['|', ['&', 'a', 'b'], ['&', 'a', 'c']] - sage: f = lambda t: t + sage: f = lambda t: [t[0], t[2], t[1]] sage: logicparser.apply_func(t, f) - ['|', ['&', 'a', 'b'], ['&', 'a', 'c']] + ['|', ['&', 'c', 'a'], ['&', 'b', 'a']] """ if type(tree[1]) is ListType and type(tree[2]) is ListType: lval = apply_func(tree[1], func) diff --git a/src/sage/logic/logictable.py b/src/sage/logic/logictable.py index 0487dc19f97..2f74e9f6dca 100644 --- a/src/sage/logic/logictable.py +++ b/src/sage/logic/logictable.py @@ -1,6 +1,5 @@ r""" -Module designed for the creation and printing of truth tables that are -associated with a logical statement. +Module that creates truth tables of boolean formulas. A logic table is essentially a 2-D array that is created by the statement class and stored in the private global variable table, along with a list containing @@ -35,7 +34,18 @@ values for a given statement, it is easy to find the value of a statement for arbitrary values of its variables. +AUTHORS: + +- William Stein (2006): initial version + +- Chris Gorecki (2006): initial version + +- Paul Scurek (2013-08-03): updated docstring formatting + EXAMPLES: + +Create a truth table of a boolean formula:: + sage: import sage.logic.propcalc as propcalc sage: s = propcalc.formula("a&b|~(c|a)") sage: s.truthtable() @@ -49,10 +59,13 @@ True True False True True True True True +Get the letex code for a truth table:: + sage: latex(s.truthtable(5,11)) \\\begin{tabular}{llll}c & b & a & value \\\hline True & False & True & False \\True & True & False & True \\True & True & True & True\end{tabular} -It is not an error to use nonsensical numeric inputs. +It is not an error to use nonsensical numeric inputs:: + sage: s = propcalc.formula("a&b|~(c|a)") sage: s.truthtable(5, 9) a b c value @@ -63,7 +76,8 @@ sage: s.truthtable(9, 5) a b c value -If one argument is provided, truthtable defaults to the end. +If one argument is provided, truthtable defaults to the end:: + sage: s.truthtable(-1) a b c value False False False True @@ -75,7 +89,8 @@ True True False True True True True True -If the second argument is negative, truthtable defaults to the end. +If the second argument is negative, truthtable defaults to the end:: + sage: s.truthtable(4, -2) a b c value True False False False @@ -83,19 +98,23 @@ True True False True True True True True -NOTES: +.. NOTE:: + For statements that contain a variable list that when printed is longer than the \latex page, the columns of the table will run off the screen. """ -#************************************************************************************* -# Copyright (C) 2006 William Stein -# Copyright (C) 2006 Chris Gorecki +#***************************************************************************** +# Copyright (C) 2006 William Stein +# Copyright (C) 2006 Chris Gorecki +# Copyright (C) 2013 Paul Scurek # -# Distributed under the terms of the GNU General Public License (GPL) -# http://www.gnu.org/licenses/ -#************************************************************************************* +# Distributed under the terms of the GNU General Public License (GPL) +# as published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# http://www.gnu.org/licenses/ +#***************************************************************************** -#Global variables +# Global variables __table = [] __vars_order = [] @@ -103,20 +122,27 @@ class Truthtable: def __init__(self, t, vo): r""" - This function initializes the data fields and is called when a - new table is created. + Initialize the data fields INPUT: - self -- the calling object. - t -- a 2-D array containing the table values - vo -- a list of the variables in the expression in order, - with each variable occurring only once. + + - ``self'' -- calling object + + - ``t`` -- a 2-D array containing the table values + + - ``vo`` -- a list of the variables in the expression in order, + with each variable occurring only once OUTPUT: - Effectively returns an instance of this class. + + None EXAMPLES: - This example illustrates the creation of a table. + + This example illustrates the creation of a table + + :: + sage: import sage.logic.propcalc as propcalc sage: s = propcalc.formula("a&b|~(c|a)") sage: s.truthtable() @@ -129,29 +155,37 @@ def __init__(self, t, vo): True False True False True True False True True True True True - - There should be no errors. """ self.__table = t self.__vars_order = vo def _latex_(self): r""" - Returns a string representation of the calling table object. + Return a latex representation of the calling table object. INPUT: - self -- the calling object. + + - ``self`` -- calling object OUTPUT: - Returns the \latex representation of this table. + + The latex representation of the table EXAMPLES: + + This example illustrates how to get the latex represenation of the table + + :: + sage: import sage.logic.propcalc as propcalc sage: s = propcalc.formula("man->monkey&human") sage: latex(s.truthtable()) \\\begin{tabular}{llll}human & monkey & man & value \\\hline False & False & False & True \\False & False & True & True \\False & True & False & True \\False & True & True & True \\True & False & False & False \\True & False & True & False \\True & True & False & False \\True & True & True & True\end{tabular} - Strange parameters can lead to a table header with no body. + Now, we show that strange parameters can lead to a table header with no body. + + :: + sage: latex(s.truthtable(2, 1)) \\\begin{tabular}{llll}human & monkey & man & value \\\hli\end{tabular} """ @@ -174,15 +208,22 @@ def _latex_(self): def __repr__(self): r""" - This function returns a string representation of the calling table object. + Return a string representation of the calling table object. INPUT: - self -- the calling object: not used. + + - ``self`` -- the calling object OUTPUT: - Returns a string representation of this table. + + The talbe as a 2-D array EXAMPLES: + + This example illustrates how to display the truth table of a boolean formula. + + :: + sage: import sage.logic.propcalc as propcalc sage: s = propcalc.formula("man->monkey&human") sage: s.truthtable() @@ -196,11 +237,12 @@ def __repr__(self): True True False False True True True True - Strange parameters can lead to the table header with no body. + We now show that strange parameters can lead to the table header with no body. + + :: + sage: s.truthtable(2, 1) man monkey human value - - There should be no errors. """ vars_len = [] line = rt = s = "" @@ -232,15 +274,22 @@ def __repr__(self): def get_table_list(self): r""" - This function returns a string representation of the calling table object. + Return a list representation of the calling table object. INPUT: - self -- the calling object: not used. + + - ``self`` -- calling object OUTPUT: - Returns the list representation of this table. + + A list representation of the table EXAMPLES: + + This example illustrates how to show the table as a list. + + :: + sage: import sage.logic.propcalc as propcalc sage: s = propcalc.formula("man->monkey&human") sage: s.truthtable().get_table_list() diff --git a/src/sage/logic/propcalc.py b/src/sage/logic/propcalc.py index caf26fc4eaa..7546ef95dd6 100644 --- a/src/sage/logic/propcalc.py +++ b/src/sage/logic/propcalc.py @@ -1,5 +1,5 @@ r""" -Propositional Calculus +Module that creates formulas of propositional calculus Formulas consist of the following operators: @@ -16,12 +16,17 @@ AUTHORS: -- Chris Gorecki -- propcalc, boolformula, logictable, logicparser, booleval +- Chris Gorecki (2006): initial version, propcalc, boolformula, + logictable, logicparser, booleval - Michael Greenberg -- boolopt +- Paul Scurek (2013-08-05): updated docstring formatting + EXAMPLES:: +We can create boolean formulas in different ways:: + sage: import sage.logic.propcalc as propcalc sage: f = propcalc.formula("a&((b|c)^a->c)<->b") sage: g = propcalc.formula("boolean<->algebra") @@ -96,8 +101,6 @@ sage: f == g False -TESTS: - It is an error to create a formula with bad syntax:: sage: propcalc.formula("") @@ -122,19 +125,17 @@ Traceback (most recent call last): ... NameError: invalid variable name 9b: identifiers must begin with a letter and contain only alphanumerics and underscores - - -Classes and functions -===================== """ - -#************************************************************************** -# Copyright (C) 2006 William Stein -# Copyright (C) 2006 Chris Gorecki +#***************************************************************************** +# Copyright (C) 2006 William Stein +# Copyright (C) 2006 Chris Gorecki +# Copyright (C) 2013 Paul Scurek # -# Distributed under the terms of the GNU General Public License (GPL) -# http://www.gnu.org/licenses/ -#************************************************************************** +# Distributed under the terms of the GNU General Public License (GPL) +# as published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# http://www.gnu.org/licenses/ +#***************************************************************************** ### TODO: ### converts (cnf) returns w/o change @@ -144,9 +145,7 @@ def formula(s): r""" - Returns an instance of - :class:`BooleanFormula ` - if possible, and throws a syntax error if not. + Return an instance of :class:`BooleanFormula` INPUT: @@ -154,11 +153,13 @@ def formula(s): OUTPUT: - - An instance of - :class:`BooleanFormula ` - representing the logical expression ``s``. + An instance of :class:`BooleanFormula` + + EXAMPLES: + + This example illustrates ways to create a boolean formula. - EXAMPLES:: + :: sage: import sage.logic.propcalc as propcalc sage: f = propcalc.formula("a&~b|c") @@ -166,9 +167,9 @@ def formula(s): sage: f&g|f ((a&~b|c)&(a^c<->b))|(a&~b|c) - TESTS: + We now demonstrate some possible errors. - There are a number of possible errors:: + :: sage: propcalc.formula("((a&b)") Traceback (most recent call last): From 9da166c669db6b351014decbf682bce1243d8900 Mon Sep 17 00:00:00 2001 From: Frederic Chapoton Date: Fri, 23 Aug 2013 10:41:02 +0200 Subject: [PATCH 08/85] Trac #15013: make sure that doc builds --- src/sage/logic/booleval.py | 7 ++++--- src/sage/logic/propcalc.py | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/sage/logic/booleval.py b/src/sage/logic/booleval.py index 686b3bd9919..ae05fc248e0 100644 --- a/src/sage/logic/booleval.py +++ b/src/sage/logic/booleval.py @@ -7,7 +7,7 @@ - Paul Scurek (2013-08-05): updated docstring formatting -EXAMPLES:: +EXAMPLES: We can assign values to the variables and evaluate a formula:: @@ -38,6 +38,7 @@ # dictionary containing variable keys and boolean values __vars = {} + def eval_formula(tree, vdict): r""" Evaluate the tree and return a boolean value. @@ -53,7 +54,7 @@ def eval_formula(tree, vdict): The result of the evaluation as a boolean value - EXAMPLES:: + EXAMPLES: This example illustrates evaluating a boolean formula. @@ -89,7 +90,7 @@ def eval_f(tree): The result of the evaluation as a boolean value - EXAMPLES:: + EXAMPLES: This example illustrates how to evaluate a parse tree. diff --git a/src/sage/logic/propcalc.py b/src/sage/logic/propcalc.py index 7546ef95dd6..446267f5fe3 100644 --- a/src/sage/logic/propcalc.py +++ b/src/sage/logic/propcalc.py @@ -23,7 +23,7 @@ - Paul Scurek (2013-08-05): updated docstring formatting -EXAMPLES:: +EXAMPLES: We can create boolean formulas in different ways:: @@ -143,6 +143,7 @@ import boolformula import logicparser + def formula(s): r""" Return an instance of :class:`BooleanFormula` From c91eec979e15e2b0463b56278990a359e7da1ace Mon Sep 17 00:00:00 2001 From: Charles Savel Date: Fri, 23 Aug 2013 17:34:17 +0200 Subject: [PATCH 09/85] Trac #15088: valuation of zero Laurent series --- .../rings/laurent_series_ring_element.pyx | 21 ++++++++++++++++++- src/sage/rings/power_series_ring_element.pyx | 4 +++- .../elliptic_curves/ell_curve_isogeny.py | 10 ++++----- .../elliptic_curves/monsky_washnitzer.py | 5 ++++- 4 files changed, 32 insertions(+), 8 deletions(-) diff --git a/src/sage/rings/laurent_series_ring_element.pyx b/src/sage/rings/laurent_series_ring_element.pyx index 6f62791a30c..7013e050b43 100644 --- a/src/sage/rings/laurent_series_ring_element.pyx +++ b/src/sage/rings/laurent_series_ring_element.pyx @@ -982,14 +982,33 @@ cdef class LaurentSeries(AlgebraElement): """ EXAMPLES:: - sage: x = Frac(QQ[['x']]).0 + sage: R. = LaurentSeriesRing(QQ) sage: f = 1/x + x^2 + 3*x^4 + O(x^7) sage: g = 1 - x + x^2 - x^4 + O(x^8) sage: f.valuation() -1 sage: g.valuation() 0 + + Note that the valuation of an element undistinguishable from + zero is infinite:: + + sage: h = f - f; h + O(x^7) + sage: h.valuation() + +Infinity + + TESTS: + + The valuation of the zero element is ``+Infinity`` + (see :trac:`15088`):: + + sage: zero = R(0) + sage: zero.valuation() + +Infinity """ + if self.is_zero(): + return infinity return self.__n def variable(self): diff --git a/src/sage/rings/power_series_ring_element.pyx b/src/sage/rings/power_series_ring_element.pyx index 7486b155acf..8d6612ccddd 100644 --- a/src/sage/rings/power_series_ring_element.pyx +++ b/src/sage/rings/power_series_ring_element.pyx @@ -1609,7 +1609,9 @@ cdef class PowerSeries(AlgebraElement): This is equal to the valuation of the underlying polynomial. - EXAMPLES: Sparse examples:: + EXAMPLES: + + Sparse examples:: sage: R. = PowerSeriesRing(QQ, sparse=True) sage: f = t^100000 + O(t^10000000) diff --git a/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py b/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py index 0cd3b12a37f..f251148cc0a 100644 --- a/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py +++ b/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py @@ -874,7 +874,7 @@ def __init__(self, E, kernel, codomain=None, degree=None, model=None, check=True sage: EllipticCurveIsogeny(E,X^3-13*X^2-58*X+503,check=False) Isogeny of degree 7 from Elliptic Curve defined by y^2 + x*y = x^3 - x^2 - 107*x + 552 over Rational Field to Elliptic Curve defined by y^2 + x*y = x^3 - x^2 - 5252*x - 178837 over Rational Field - """ + """ if not is_EllipticCurve(E): raise ValueError, "E parameter must be an EllipticCurve." @@ -3594,7 +3594,7 @@ def compute_isogeny_starks(E1, E2, ell): n += 1 a_n = 0 r = -T.valuation() - while ( 0 <= r and T != 0): + while (0 <= r): t_r = T[-r] #print ' r=',r #print ' t_r=',t_r @@ -3609,9 +3609,9 @@ def compute_isogeny_starks(E1, E2, ell): #p_n = a_n*p[n-1] + q[n-2] #p.append(p_n) - if (n == ell+1 or T==0): - if T.valuation()<2: - raise ValueError, "The two curves are not linked by a cyclic normalized isogeny of degree %s"%ell + if (n == ell+1 or T == 0): + if (T == 0 or T.valuation()<2): + raise ValueError("The two curves are not linked by a cyclic normalized isogeny of degree %s" % ell) #print 'breaks here' break diff --git a/src/sage/schemes/elliptic_curves/monsky_washnitzer.py b/src/sage/schemes/elliptic_curves/monsky_washnitzer.py index b66f6d48a50..3011d3681bf 100644 --- a/src/sage/schemes/elliptic_curves/monsky_washnitzer.py +++ b/src/sage/schemes/elliptic_curves/monsky_washnitzer.py @@ -53,6 +53,7 @@ from sage.modules.all import vector from sage.rings.ring import CommutativeAlgebra from sage.structure.element import CommutativeAlgebraElement +from sage.rings.infinity import Infinity from sage.rings.arith import binomial, integer_ceil as ceil from sage.misc.functional import log @@ -2264,7 +2265,9 @@ def coeffs(self, R=None): coeffs = [] n = y_degree - y_offset + 1 for a in self._f.list(): - k = a.valuation() - y_offset + k = a.valuation() + if k is Infinity: k = 0 + k -= y_offset z = a.list() coeffs.append( [zero] * k + z + [zero]*(n - len(z) - k)) while len(coeffs) < self.parent().degree(): From 87224a1e61a32d3a6d0c6dd48268b58a2cb1c9ad Mon Sep 17 00:00:00 2001 From: Frederic Chapoton Date: Wed, 21 Aug 2013 18:22:16 +0200 Subject: [PATCH 10/85] Trac #5608: remove merten (bad name for mertens) --- src/sage/symbolic/all.py | 2 +- src/sage/symbolic/constants.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/sage/symbolic/all.py b/src/sage/symbolic/all.py index 27f23a1a57d..957242a06bb 100644 --- a/src/sage/symbolic/all.py +++ b/src/sage/symbolic/all.py @@ -2,7 +2,7 @@ i = I from ring import SR from constants import (pi, e, NaN, golden_ratio, log2, euler_gamma, catalan, - khinchin, twinprime, merten, mertens, glaisher, brun) + khinchin, twinprime, mertens, glaisher, brun) from expression import Expression from callable import is_CallableSymbolicExpressionRing, CallableSymbolicExpressionRing diff --git a/src/sage/symbolic/constants.py b/src/sage/symbolic/constants.py index 8f909014ac9..646b3d32f42 100644 --- a/src/sage/symbolic/constants.py +++ b/src/sage/symbolic/constants.py @@ -1146,6 +1146,7 @@ def __float__(self): twinprime = TwinPrime().expression() + class Mertens(Constant): """ The Mertens constant is related to the Twin Primes constant and @@ -1192,7 +1193,8 @@ def __float__(self): """ return 0.26149721284764278375542683861 -merten = mertens = Mertens().expression() +mertens = Mertens().expression() + class Glaisher(Constant): r""" From 7ef65bcdee1292d7d20be186c00529cd8627c662 Mon Sep 17 00:00:00 2001 From: Birk Eisermann Date: Sun, 18 Aug 2013 18:47:45 +0200 Subject: [PATCH 11/85] Trac #14980: part 1, restructure documentation --- src/sage/graphs/generators/families.py | 42 ++++++++++---------- src/sage/graphs/graph_generators.py | 54 ++++++++++++++------------ 2 files changed, 50 insertions(+), 46 deletions(-) diff --git a/src/sage/graphs/generators/families.py b/src/sage/graphs/generators/families.py index c5cc7138488..bdc833343db 100644 --- a/src/sage/graphs/generators/families.py +++ b/src/sage/graphs/generators/families.py @@ -82,27 +82,6 @@ def HararyGraph( k, n ): G.name('Harary graph {0}, {1}'.format(k,n)) return G -def DorogovtsevGoltsevMendesGraph(n): - """ - Construct the n-th generation of the Dorogovtsev-Goltsev-Mendes - graph. - - EXAMPLE:: - - sage: G = graphs.DorogovtsevGoltsevMendesGraph(8) - sage: G.size() - 6561 - - REFERENCE: - - - [1] Dorogovtsev, S. N., Goltsev, A. V., and Mendes, J. - F. F., Pseudofractal scale-free web, Phys. Rev. E 066122 - (2002). - """ - import networkx - return graph.Graph(networkx.dorogovtsev_goltsev_mendes_graph(n),\ - name="Dorogovtsev-Goltsev-Mendes Graph, %d-th generation"%n) - def IntervalGraph(intervals): r""" Returns the graph corresponding to the given intervals. @@ -765,6 +744,27 @@ def CubeGraph(n): return r +def DorogovtsevGoltsevMendesGraph(n): + """ + Construct the n-th generation of the Dorogovtsev-Goltsev-Mendes + graph. + + EXAMPLE:: + + sage: G = graphs.DorogovtsevGoltsevMendesGraph(8) + sage: G.size() + 6561 + + REFERENCE: + + - [1] Dorogovtsev, S. N., Goltsev, A. V., and Mendes, J. + F. F., Pseudofractal scale-free web, Phys. Rev. E 066122 + (2002). + """ + import networkx + return graph.Graph(networkx.dorogovtsev_goltsev_mendes_graph(n),\ + name="Dorogovtsev-Goltsev-Mendes Graph, %d-th generation"%n) + def FoldedCubeGraph(n): r""" Returns the folded cube graph of order `2^{n-1}`. diff --git a/src/sage/graphs/graph_generators.py b/src/sage/graphs/graph_generators.py index 36e1db2b1ea..2442c323658 100644 --- a/src/sage/graphs/graph_generators.py +++ b/src/sage/graphs/graph_generators.py @@ -8,7 +8,7 @@ sage: g = graphs.CompleteGraph(15) More interestingly, one can get the list of all graphs that Sage knows how to -buid by typing ``graphs.`` in Sage, then hitting tab. +build by typing ``graphs.`` in Sage and then hitting tab. """ # This method appends a list of methods to the doc as a 3xN table. @@ -87,6 +87,9 @@ def __append_to_doc(methods): __doc__ += """ **Small Graphs** + +A small graph is just a single graph and has no parameter influencing +the number of edges or vertices. """ __append_to_doc( @@ -116,8 +119,6 @@ def __append_to_doc(methods): "GrayGraph", "GrotzschGraph", "HallJankoGraph", - "WellsGraph", - "HararyGraph", "HarriesGraph", "HarriesWongGraph", "HeawoodGraph", @@ -143,41 +144,50 @@ def __append_to_doc(methods): "ThomsenGraph", "Tutte12Cage", "TutteCoxeterGraph", - "WagnerGraph"]) + "WagnerGraph", + "WellsGraph"]) __doc__ += """ **Families of graphs** + +A family of graph is an infinite set of graphs which can be indexed by fixed +number of parameters, e.g. two integer parameters. (A method whose name starts +with a small letter does not return a single graph object but a graph iterator +or a list of graphs or ...) """ __append_to_doc( ["BalancedTree", + "benzenoids" "BubbleSortGraph", "CirculantGraph", + "cospectral_graphs", "CubeGraph", + "DorogovtsevGoltsevMendesGraph", "FibonacciTree", "FoldedCubeGraph", "FriendshipGraph", + "fullerenes", "FuzzyBallGraph", "GeneralizedPetersenGraph", "HanoiTowerGraph", + "HararyGraph", "HyperStarGraph", "IntervalGraph", "JohnsonGraph", "KneserGraph", "LCFGraph", + "line_graph_forbidden_subgraphs", "MycielskiGraph", "MycielskiStep", "NKStarGraph", "NStarGraph", "OddGraph", "PaleyGraph", - "RingedTree", - "line_graph_forbidden_subgraphs", "PermutationGraph", + "RingedTree", "SymplecticGraph", - "trees", - "fullerenes", - "benzenoids"]) + "trees"]) __doc__ += """ **Chessboard graphs** @@ -190,12 +200,6 @@ def __append_to_doc(methods): "QueenGraph", "RookGraph"]) -__doc__ += """ -**Pseudofractal graphs** -""" - -__append_to_doc(["DorogovtsevGoltsevMendesGraph"]) - __doc__ += """ **Random graphs** """ @@ -1206,34 +1210,34 @@ def fusenes(self, hexagon_count, benzenoids=False): ########################################################################### import sage.graphs.generators.families - JohnsonGraph = staticmethod(sage.graphs.generators.families.JohnsonGraph) - MycielskiGraph = staticmethod(sage.graphs.generators.families.MycielskiGraph) - MycielskiStep = staticmethod(sage.graphs.generators.families.MycielskiStep) - KneserGraph = staticmethod(sage.graphs.generators.families.KneserGraph) BalancedTree = staticmethod(sage.graphs.generators.families.BalancedTree) BubbleSortGraph = staticmethod(sage.graphs.generators.families.BubbleSortGraph) CirculantGraph = staticmethod(sage.graphs.generators.families.CirculantGraph) CubeGraph = staticmethod(sage.graphs.generators.families.CubeGraph) - FoldedCubeGraph = staticmethod(sage.graphs.generators.families.FoldedCubeGraph) DorogovtsevGoltsevMendesGraph = staticmethod(sage.graphs.generators.families.DorogovtsevGoltsevMendesGraph) + FibonacciTree = staticmethod(sage.graphs.generators.families.FibonacciTree) + FoldedCubeGraph = staticmethod(sage.graphs.generators.families.FoldedCubeGraph) FriendshipGraph = staticmethod(sage.graphs.generators.families.FriendshipGraph) FuzzyBallGraph = staticmethod(sage.graphs.generators.families.FuzzyBallGraph) - FibonacciTree = staticmethod(sage.graphs.generators.families.FibonacciTree) GeneralizedPetersenGraph = staticmethod(sage.graphs.generators.families.GeneralizedPetersenGraph) - HyperStarGraph = staticmethod(sage.graphs.generators.families.HyperStarGraph) + HanoiTowerGraph = staticmethod(sage.graphs.generators.families.HanoiTowerGraph) HararyGraph = staticmethod(sage.graphs.generators.families.HararyGraph) + HyperStarGraph = staticmethod(sage.graphs.generators.families.HyperStarGraph) IntervalGraph = staticmethod(sage.graphs.generators.families.IntervalGraph) + JohnsonGraph = staticmethod(sage.graphs.generators.families.JohnsonGraph) + KneserGraph = staticmethod(sage.graphs.generators.families.KneserGraph) LCFGraph = staticmethod(sage.graphs.generators.families.LCFGraph) + line_graph_forbidden_subgraphs = staticmethod(sage.graphs.generators.families.line_graph_forbidden_subgraphs) + MycielskiGraph = staticmethod(sage.graphs.generators.families.MycielskiGraph) + MycielskiStep = staticmethod(sage.graphs.generators.families.MycielskiStep) NKStarGraph = staticmethod(sage.graphs.generators.families.NKStarGraph) NStarGraph = staticmethod(sage.graphs.generators.families.NStarGraph) OddGraph = staticmethod(sage.graphs.generators.families.OddGraph) PaleyGraph = staticmethod(sage.graphs.generators.families.PaleyGraph) PermutationGraph = staticmethod(sage.graphs.generators.families.PermutationGraph) + RingedTree = staticmethod(sage.graphs.generators.families.RingedTree) SymplecticGraph = staticmethod(sage.graphs.generators.families.SymplecticGraph) - HanoiTowerGraph = staticmethod(sage.graphs.generators.families.HanoiTowerGraph) - line_graph_forbidden_subgraphs = staticmethod(sage.graphs.generators.families.line_graph_forbidden_subgraphs) trees = staticmethod(sage.graphs.generators.families.trees) - RingedTree = staticmethod(sage.graphs.generators.families.RingedTree) ########################################################################### # Small Graphs From 2857544f79abb4c4647498dbef2c9e4b1aebeb21 Mon Sep 17 00:00:00 2001 From: Birk Eisermann Date: Tue, 23 Jul 2013 20:29:58 +0200 Subject: [PATCH 12/85] Trac #14980: part 2, restructure documentation --- src/sage/graphs/generators/basic.py | 2 +- src/sage/graphs/generators/chessboard.py | 10 +- src/sage/graphs/generators/degree_sequence.py | 2 +- src/sage/graphs/generators/families.py | 237 +++++++++--------- src/sage/graphs/generators/platonic_solids.py | 6 +- src/sage/graphs/generators/random.py | 9 +- src/sage/graphs/generators/smallgraphs.py | 2 +- src/sage/graphs/generators/world_map.py | 2 +- src/sage/graphs/graph_generators.py | 137 +++++----- 9 files changed, 195 insertions(+), 212 deletions(-) diff --git a/src/sage/graphs/generators/basic.py b/src/sage/graphs/generators/basic.py index ad9b74f348f..bb0559ba0b4 100644 --- a/src/sage/graphs/generators/basic.py +++ b/src/sage/graphs/generators/basic.py @@ -2,7 +2,7 @@ r""" Basic Graphs -The methods defined here appear in sage.graphs.grah_generators. +The methods defined here appear in :mod:`sage.graphs.graph_generators`. """ ########################################################################### diff --git a/src/sage/graphs/generators/chessboard.py b/src/sage/graphs/generators/chessboard.py index 395cb3d0379..3eeb7099768 100644 --- a/src/sage/graphs/generators/chessboard.py +++ b/src/sage/graphs/generators/chessboard.py @@ -1,7 +1,8 @@ # -*- coding: utf-8 -*- r""" -Chessboard Graphs Generators -============================ +Chessboard Graphs + +The methods defined here appear in :mod:`sage.graphs.graph_generators`. - :meth:`BishopGraph ` - :meth:`KingGraph ` @@ -12,7 +13,6 @@ AUTHORS: - David Coudert (2012) - """ ################################################################################ @@ -22,10 +22,6 @@ # http://www.gnu.org/licenses/ ################################################################################ -########################################################################### -# Chessboard graphs -########################################################################### - def ChessboardGraphGenerator(dim_list, rook = True, rook_radius = None, bishop = True, bishop_radius = None, diff --git a/src/sage/graphs/generators/degree_sequence.py b/src/sage/graphs/generators/degree_sequence.py index 57a892f7b1e..2c7a145c776 100644 --- a/src/sage/graphs/generators/degree_sequence.py +++ b/src/sage/graphs/generators/degree_sequence.py @@ -2,7 +2,7 @@ r""" Degree Sequence -The methods defined here appear in sage.graphs.grah_generators. +The methods defined here appear in :mod:`sage.graphs.graph_generators`. """ ########################################################################### diff --git a/src/sage/graphs/generators/families.py b/src/sage/graphs/generators/families.py index bdc833343db..5597e05040b 100644 --- a/src/sage/graphs/generators/families.py +++ b/src/sage/graphs/generators/families.py @@ -2,7 +2,7 @@ r""" Families of graphs -The methods defined here appear in sage.graphs.grah_generators. +The methods defined here appear in :mod:`sage.graphs.graph_generators`. AUTHORS: @@ -160,124 +160,6 @@ def IntervalGraph(intervals): return g -def MycielskiGraph(k=1, relabel=True): - r""" - Returns the `k`-th Mycielski Graph. - - The graph `M_k` is triangle-free and has chromatic number - equal to `k`. These graphs show, constructively, that there - are triangle-free graphs with arbitrarily high chromatic - number. - - The Mycielski graphs are built recursively starting with - `M_0`, an empty graph; `M_1`, a single vertex graph; and `M_2` - is the graph `K_2`. `M_{k+1}` is then built from `M_k` - as follows: - - If the vertices of `M_k` are `v_1,\ldots,v_n`, then the - vertices of `M_{k+1}` are - `v_1,\ldots,v_n,w_1,\ldots,w_n,z`. Vertices `v_1,\ldots,v_n` - induce a copy of `M_k`. Vertices `w_1,\ldots,w_n` are an - independent set. Vertex `z` is adjacent to all the - `w_i`-vertices. Finally, vertex `w_i` is adjacent to vertex - `v_j` iff `v_i` is adjacent to `v_j`. - - INPUT: - - - ``k`` Number of steps in the construction process. - - - ``relabel`` Relabel the vertices so their names are the integers - ``range(n)`` where ``n`` is the number of vertices in the graph. - - EXAMPLE: - - The Mycielski graph `M_k` is triangle-free and has chromatic - number equal to `k`. :: - - sage: g = graphs.MycielskiGraph(5) - sage: g.is_triangle_free() - True - sage: g.chromatic_number() - 5 - - The graphs `M_4` is (isomorphic to) the Grotzsch graph. :: - - sage: g = graphs.MycielskiGraph(4) - sage: g.is_isomorphic(graphs.GrotzschGraph()) - True - - REFERENCES: - - - [1] Weisstein, Eric W. "Mycielski Graph." - From MathWorld--A Wolfram Web Resource. - http://mathworld.wolfram.com/MycielskiGraph.html - - """ - g = graph.Graph() - g.name("Mycielski Graph " + str(k)) - - if k<0: - raise ValueError, "parameter k must be a nonnegative integer" - - if k == 0: - return g - - if k == 1: - g.add_vertex(0) - return g - - if k == 2: - g.add_edge(0,1) - return g - - g0 = MycielskiGraph(k-1) - g = MycielskiStep(g0) - g.name("Mycielski Graph " + str(k)) - if relabel: g.relabel() - - return g - -def MycielskiStep(g): - r""" - Perform one iteration of the Mycielski construction. - - See the documentation for ``MycielskiGraph`` which uses this - method. We expose it to all users in case they may find it - useful. - - EXAMPLE. One iteration of the Mycielski step applied to the - 5-cycle yields a graph isomorphic to the Grotzsch graph :: - - sage: g = graphs.CycleGraph(5) - sage: h = graphs.MycielskiStep(g) - sage: h.is_isomorphic(graphs.GrotzschGraph()) - True - """ - - # Make a copy of the input graph g - gg = g.copy() - - # rename a vertex v of gg as (1,v) - renamer = dict( [ (v, (1,v)) for v in g.vertices() ] ) - gg.relabel(renamer) - - # add the w vertices to gg as (2,v) - wlist = [ (2,v) for v in g.vertices() ] - gg.add_vertices(wlist) - - # add the z vertex as (0,0) - gg.add_vertex((0,0)) - - # add the edges from z to w_i - gg.add_edges( [ ( (0,0) , (2,v) ) for v in g.vertices() ] ) - - # make the v_i w_j edges - for v in g.vertices(): - gg.add_edges( [ ((1,v),(2,vv)) for vv in g.neighbors(v) ] ) - - return gg - - def JohnsonGraph(n, k): r""" Returns the Johnson graph with parameters `n, k`. @@ -1233,6 +1115,123 @@ def LCFGraph(n, shift_list, repeats): return graph.Graph(networkx.LCF_graph(n, shift_list, repeats),\ pos=pos_dict, name="LCF Graph") +def MycielskiGraph(k=1, relabel=True): + r""" + Returns the `k`-th Mycielski Graph. + + The graph `M_k` is triangle-free and has chromatic number + equal to `k`. These graphs show, constructively, that there + are triangle-free graphs with arbitrarily high chromatic + number. + + The Mycielski graphs are built recursively starting with + `M_0`, an empty graph; `M_1`, a single vertex graph; and `M_2` + is the graph `K_2`. `M_{k+1}` is then built from `M_k` + as follows: + + If the vertices of `M_k` are `v_1,\ldots,v_n`, then the + vertices of `M_{k+1}` are + `v_1,\ldots,v_n,w_1,\ldots,w_n,z`. Vertices `v_1,\ldots,v_n` + induce a copy of `M_k`. Vertices `w_1,\ldots,w_n` are an + independent set. Vertex `z` is adjacent to all the + `w_i`-vertices. Finally, vertex `w_i` is adjacent to vertex + `v_j` iff `v_i` is adjacent to `v_j`. + + INPUT: + + - ``k`` Number of steps in the construction process. + + - ``relabel`` Relabel the vertices so their names are the integers + ``range(n)`` where ``n`` is the number of vertices in the graph. + + EXAMPLE: + + The Mycielski graph `M_k` is triangle-free and has chromatic + number equal to `k`. :: + + sage: g = graphs.MycielskiGraph(5) + sage: g.is_triangle_free() + True + sage: g.chromatic_number() + 5 + + The graphs `M_4` is (isomorphic to) the Grotzsch graph. :: + + sage: g = graphs.MycielskiGraph(4) + sage: g.is_isomorphic(graphs.GrotzschGraph()) + True + + REFERENCES: + + - [1] Weisstein, Eric W. "Mycielski Graph." + From MathWorld--A Wolfram Web Resource. + http://mathworld.wolfram.com/MycielskiGraph.html + + """ + g = graph.Graph() + g.name("Mycielski Graph " + str(k)) + + if k<0: + raise ValueError, "parameter k must be a nonnegative integer" + + if k == 0: + return g + + if k == 1: + g.add_vertex(0) + return g + + if k == 2: + g.add_edge(0,1) + return g + + g0 = MycielskiGraph(k-1) + g = MycielskiStep(g0) + g.name("Mycielski Graph " + str(k)) + if relabel: g.relabel() + + return g + +def MycielskiStep(g): + r""" + Perform one iteration of the Mycielski construction. + + See the documentation for ``MycielskiGraph`` which uses this + method. We expose it to all users in case they may find it + useful. + + EXAMPLE. One iteration of the Mycielski step applied to the + 5-cycle yields a graph isomorphic to the Grotzsch graph :: + + sage: g = graphs.CycleGraph(5) + sage: h = graphs.MycielskiStep(g) + sage: h.is_isomorphic(graphs.GrotzschGraph()) + True + """ + + # Make a copy of the input graph g + gg = g.copy() + + # rename a vertex v of gg as (1,v) + renamer = dict( [ (v, (1,v)) for v in g.vertices() ] ) + gg.relabel(renamer) + + # add the w vertices to gg as (2,v) + wlist = [ (2,v) for v in g.vertices() ] + gg.add_vertices(wlist) + + # add the z vertex as (0,0) + gg.add_vertex((0,0)) + + # add the edges from z to w_i + gg.add_edges( [ ( (0,0) , (2,v) ) for v in g.vertices() ] ) + + # make the v_i w_j edges + for v in g.vertices(): + gg.add_edges( [ ((1,v),(2,vv)) for vv in g.neighbors(v) ] ) + + return gg + def NKStarGraph(n,k): r""" Returns the (n,k)-star graph. diff --git a/src/sage/graphs/generators/platonic_solids.py b/src/sage/graphs/generators/platonic_solids.py index 573ad95be58..5ad684732f0 100644 --- a/src/sage/graphs/generators/platonic_solids.py +++ b/src/sage/graphs/generators/platonic_solids.py @@ -2,7 +2,7 @@ r""" Platonic solids -The methods defined here appear in sage.graphs.grah_generators. +The methods defined here appear in :mod:`sage.graphs.graph_generators`. """ ########################################################################### @@ -21,10 +21,6 @@ from math import sin, cos, pi from sage.graphs.graph_plot import _circle_embedding, _line_embedding -################################################################################ -# Platonic Solids -################################################################################ - def TetrahedralGraph(): """ Returns a tetrahedral graph (with 4 nodes). diff --git a/src/sage/graphs/generators/random.py b/src/sage/graphs/generators/random.py index 8bcd994d5f8..17208450bd6 100644 --- a/src/sage/graphs/generators/random.py +++ b/src/sage/graphs/generators/random.py @@ -2,8 +2,7 @@ r""" Random Graphs -The methods defined here appear in sage.graphs.grah_generators. - +The methods defined here appear in :mod:`sage.graphs.graph_generators`. """ ########################################################################### # @@ -21,10 +20,6 @@ from math import sin, cos, pi from sage.misc.randstate import current_randstate -################################################################################ -# Random Graphs -################################################################################ - def RandomGNP(n, p, seed=None, fast=True, method='Sage'): r""" Returns a random graph on `n` nodes. Each edge is inserted independently @@ -32,7 +27,7 @@ def RandomGNP(n, p, seed=None, fast=True, method='Sage'): INPUTS: - - ``n`` -- number of nodes of the digraph + - ``n`` -- number of nodes of the graph - ``p`` -- probability of an edge diff --git a/src/sage/graphs/generators/smallgraphs.py b/src/sage/graphs/generators/smallgraphs.py index 3481cb443c4..3433c8b5eca 100644 --- a/src/sage/graphs/generators/smallgraphs.py +++ b/src/sage/graphs/generators/smallgraphs.py @@ -2,7 +2,7 @@ r""" Small graphs -The methods defined here appear in sage.graphs.grah_generators. +The methods defined here appear in :mod:`sage.graphs.graph_generators`. """ #***************************************************************************** # Copyright (C) 2006 Robert L. Miller diff --git a/src/sage/graphs/generators/world_map.py b/src/sage/graphs/generators/world_map.py index 391f70fcf73..2242f3cea79 100644 --- a/src/sage/graphs/generators/world_map.py +++ b/src/sage/graphs/generators/world_map.py @@ -2,7 +2,7 @@ r""" World Map -The methods defined here appear in sage.graphs.grah_generators. +The methods defined here appear in :mod:`sage.graphs.graph_generators`. """ ########################################################################### diff --git a/src/sage/graphs/graph_generators.py b/src/sage/graphs/graph_generators.py index 2442c323658..39a33e1d7a6 100644 --- a/src/sage/graphs/graph_generators.py +++ b/src/sage/graphs/graph_generators.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- r""" -Common graphs +Common Graphs (Graph Generators) All graphs in Sage can be built through the ``graphs`` object : in order to build a complete graph on `15` elements, one can do:: @@ -74,17 +74,6 @@ def __append_to_doc(methods): "WheelGraph"] ) -__doc__ += """ -**Platonic solids** -""" - -__append_to_doc( - ["DodecahedralGraph", - "HexahedralGraph", - "IcosahedralGraph", - "OctahedralGraph", - "TetrahedralGraph"]) - __doc__ += """ **Small Graphs** @@ -147,6 +136,17 @@ def __append_to_doc(methods): "WagnerGraph", "WellsGraph"]) +__doc__ += """ +*Platonic solids* (ordered ascending by number of vertices) +""" + +__append_to_doc( + ["TetrahedralGraph", + "OctahedralGraph", + "HexahedralGraph", + "IcosahedralGraph", + "DodecahedralGraph"]) + __doc__ += """ **Families of graphs** @@ -158,7 +158,6 @@ def __append_to_doc(methods): __append_to_doc( ["BalancedTree", - "benzenoids" "BubbleSortGraph", "CirculantGraph", "cospectral_graphs", @@ -168,6 +167,7 @@ def __append_to_doc(methods): "FoldedCubeGraph", "FriendshipGraph", "fullerenes", + "fusenes", "FuzzyBallGraph", "GeneralizedPetersenGraph", "HanoiTowerGraph", @@ -190,7 +190,7 @@ def __append_to_doc(methods): "trees"]) __doc__ += """ -**Chessboard graphs** +*Chessboard Graphs* """ __append_to_doc( @@ -1193,52 +1193,6 @@ def fusenes(self, hexagon_count, benzenoids=False): G.set_embedding(g) yield(G) -########################################################################### -# Chessboard graphs -########################################################################### - - import sage.graphs.generators.chessboard - ChessboardGraphGenerator = staticmethod(sage.graphs.generators.chessboard.ChessboardGraphGenerator) - BishopGraph = staticmethod(sage.graphs.generators.chessboard.BishopGraph) - KingGraph = staticmethod(sage.graphs.generators.chessboard.KingGraph) - KnightGraph = staticmethod(sage.graphs.generators.chessboard.KnightGraph) - QueenGraph = staticmethod(sage.graphs.generators.chessboard.QueenGraph) - RookGraph = staticmethod(sage.graphs.generators.chessboard.RookGraph) - -########################################################################### -# Families -########################################################################### - - import sage.graphs.generators.families - BalancedTree = staticmethod(sage.graphs.generators.families.BalancedTree) - BubbleSortGraph = staticmethod(sage.graphs.generators.families.BubbleSortGraph) - CirculantGraph = staticmethod(sage.graphs.generators.families.CirculantGraph) - CubeGraph = staticmethod(sage.graphs.generators.families.CubeGraph) - DorogovtsevGoltsevMendesGraph = staticmethod(sage.graphs.generators.families.DorogovtsevGoltsevMendesGraph) - FibonacciTree = staticmethod(sage.graphs.generators.families.FibonacciTree) - FoldedCubeGraph = staticmethod(sage.graphs.generators.families.FoldedCubeGraph) - FriendshipGraph = staticmethod(sage.graphs.generators.families.FriendshipGraph) - FuzzyBallGraph = staticmethod(sage.graphs.generators.families.FuzzyBallGraph) - GeneralizedPetersenGraph = staticmethod(sage.graphs.generators.families.GeneralizedPetersenGraph) - HanoiTowerGraph = staticmethod(sage.graphs.generators.families.HanoiTowerGraph) - HararyGraph = staticmethod(sage.graphs.generators.families.HararyGraph) - HyperStarGraph = staticmethod(sage.graphs.generators.families.HyperStarGraph) - IntervalGraph = staticmethod(sage.graphs.generators.families.IntervalGraph) - JohnsonGraph = staticmethod(sage.graphs.generators.families.JohnsonGraph) - KneserGraph = staticmethod(sage.graphs.generators.families.KneserGraph) - LCFGraph = staticmethod(sage.graphs.generators.families.LCFGraph) - line_graph_forbidden_subgraphs = staticmethod(sage.graphs.generators.families.line_graph_forbidden_subgraphs) - MycielskiGraph = staticmethod(sage.graphs.generators.families.MycielskiGraph) - MycielskiStep = staticmethod(sage.graphs.generators.families.MycielskiStep) - NKStarGraph = staticmethod(sage.graphs.generators.families.NKStarGraph) - NStarGraph = staticmethod(sage.graphs.generators.families.NStarGraph) - OddGraph = staticmethod(sage.graphs.generators.families.OddGraph) - PaleyGraph = staticmethod(sage.graphs.generators.families.PaleyGraph) - PermutationGraph = staticmethod(sage.graphs.generators.families.PermutationGraph) - RingedTree = staticmethod(sage.graphs.generators.families.RingedTree) - SymplecticGraph = staticmethod(sage.graphs.generators.families.SymplecticGraph) - trees = staticmethod(sage.graphs.generators.families.trees) - ########################################################################### # Small Graphs ########################################################################### @@ -1297,6 +1251,59 @@ def fusenes(self, hexagon_count, benzenoids=False): TutteCoxeterGraph = staticmethod(sage.graphs.generators.smallgraphs.TutteCoxeterGraph) WagnerGraph = staticmethod(sage.graphs.generators.smallgraphs.WagnerGraph) +########################################################################### +# Platonic Solids +########################################################################### + import sage.graphs.generators.platonic_solids + DodecahedralGraph = staticmethod(sage.graphs.generators.platonic_solids.DodecahedralGraph) + HexahedralGraph = staticmethod(sage.graphs.generators.platonic_solids.HexahedralGraph) + IcosahedralGraph = staticmethod(sage.graphs.generators.platonic_solids.IcosahedralGraph) + OctahedralGraph = staticmethod(sage.graphs.generators.platonic_solids.OctahedralGraph) + TetrahedralGraph = staticmethod(sage.graphs.generators.platonic_solids.TetrahedralGraph) + +########################################################################### +# Families +########################################################################### + import sage.graphs.generators.families + BalancedTree = staticmethod(sage.graphs.generators.families.BalancedTree) + BubbleSortGraph = staticmethod(sage.graphs.generators.families.BubbleSortGraph) + CirculantGraph = staticmethod(sage.graphs.generators.families.CirculantGraph) + CubeGraph = staticmethod(sage.graphs.generators.families.CubeGraph) + DorogovtsevGoltsevMendesGraph = staticmethod(sage.graphs.generators.families.DorogovtsevGoltsevMendesGraph) + FibonacciTree = staticmethod(sage.graphs.generators.families.FibonacciTree) + FoldedCubeGraph = staticmethod(sage.graphs.generators.families.FoldedCubeGraph) + FriendshipGraph = staticmethod(sage.graphs.generators.families.FriendshipGraph) + FuzzyBallGraph = staticmethod(sage.graphs.generators.families.FuzzyBallGraph) + GeneralizedPetersenGraph = staticmethod(sage.graphs.generators.families.GeneralizedPetersenGraph) + HanoiTowerGraph = staticmethod(sage.graphs.generators.families.HanoiTowerGraph) + HararyGraph = staticmethod(sage.graphs.generators.families.HararyGraph) + HyperStarGraph = staticmethod(sage.graphs.generators.families.HyperStarGraph) + IntervalGraph = staticmethod(sage.graphs.generators.families.IntervalGraph) + JohnsonGraph = staticmethod(sage.graphs.generators.families.JohnsonGraph) + KneserGraph = staticmethod(sage.graphs.generators.families.KneserGraph) + LCFGraph = staticmethod(sage.graphs.generators.families.LCFGraph) + line_graph_forbidden_subgraphs = staticmethod(sage.graphs.generators.families.line_graph_forbidden_subgraphs) + MycielskiGraph = staticmethod(sage.graphs.generators.families.MycielskiGraph) + MycielskiStep = staticmethod(sage.graphs.generators.families.MycielskiStep) + NKStarGraph = staticmethod(sage.graphs.generators.families.NKStarGraph) + NStarGraph = staticmethod(sage.graphs.generators.families.NStarGraph) + OddGraph = staticmethod(sage.graphs.generators.families.OddGraph) + PaleyGraph = staticmethod(sage.graphs.generators.families.PaleyGraph) + PermutationGraph = staticmethod(sage.graphs.generators.families.PermutationGraph) + RingedTree = staticmethod(sage.graphs.generators.families.RingedTree) + SymplecticGraph = staticmethod(sage.graphs.generators.families.SymplecticGraph) + trees = staticmethod(sage.graphs.generators.families.trees) + +########################################################################### +# Chessboard Graphs +########################################################################### + import sage.graphs.generators.chessboard + ChessboardGraphGenerator = staticmethod(sage.graphs.generators.chessboard.ChessboardGraphGenerator) + BishopGraph = staticmethod(sage.graphs.generators.chessboard.BishopGraph) + KingGraph = staticmethod(sage.graphs.generators.chessboard.KingGraph) + KnightGraph = staticmethod(sage.graphs.generators.chessboard.KnightGraph) + QueenGraph = staticmethod(sage.graphs.generators.chessboard.QueenGraph) + RookGraph = staticmethod(sage.graphs.generators.chessboard.RookGraph) ########################################################################### # Basic Graphs @@ -1344,16 +1351,6 @@ def fusenes(self, hexagon_count, benzenoids=False): RandomTreePowerlaw = staticmethod(sage.graphs.generators.random.RandomTreePowerlaw) RandomTree = staticmethod(sage.graphs.generators.random.RandomTree) -########################################################################### -# Platonic Solids -########################################################################### - import sage.graphs.generators.platonic_solids - DodecahedralGraph = staticmethod(sage.graphs.generators.platonic_solids.DodecahedralGraph) - HexahedralGraph = staticmethod(sage.graphs.generators.platonic_solids.HexahedralGraph) - IcosahedralGraph = staticmethod(sage.graphs.generators.platonic_solids.IcosahedralGraph) - OctahedralGraph = staticmethod(sage.graphs.generators.platonic_solids.OctahedralGraph) - TetrahedralGraph = staticmethod(sage.graphs.generators.platonic_solids.TetrahedralGraph) - ########################################################################### # World Map ########################################################################### From 1ab81210d246e879ffb9cc80ed6094fa38b00b8a Mon Sep 17 00:00:00 2001 From: Birk Eisermann Date: Sun, 18 Aug 2013 19:15:54 +0200 Subject: [PATCH 13/85] Trac #14980: part 4, revised basic section --- src/sage/graphs/generators/basic.py | 385 ---------------------- src/sage/graphs/generators/families.py | 332 +++++++++++++++---- src/sage/graphs/generators/smallgraphs.py | 163 +++++++++ src/sage/graphs/graph_generators.py | 81 ++--- 4 files changed, 481 insertions(+), 480 deletions(-) diff --git a/src/sage/graphs/generators/basic.py b/src/sage/graphs/generators/basic.py index bb0559ba0b4..a1f1af88edf 100644 --- a/src/sage/graphs/generators/basic.py +++ b/src/sage/graphs/generators/basic.py @@ -21,273 +21,6 @@ from math import sin, cos, pi from sage.graphs.graph_plot import _circle_embedding, _line_embedding -####################################################################### -# Basic Structures -####################################################################### - -def BarbellGraph(n1, n2): - r""" - Returns a barbell graph with ``2*n1 + n2`` nodes. The argument ``n1`` - must be greater than or equal to 2. - - A barbell graph is a basic structure that consists of a path graph - of order ``n2`` connecting two complete graphs of order ``n1`` each. - - This constructor depends on `NetworkX `_ - numeric labels. In this case, the ``n1``-th node connects to the - path graph from one complete graph and the ``n1 + n2 + 1``-th node - connects to the path graph from the other complete graph. - - INPUT: - - - ``n1`` -- integer `\geq 2`. The order of each of the two - complete graphs. - - - ``n2`` -- nonnegative integer. The order of the path graph - connecting the two complete graphs. - - OUTPUT: - - A barbell graph of order ``2*n1 + n2``. A ``ValueError`` is - returned if ``n1 < 2`` or ``n2 < 0``. - - ALGORITHM: - - Uses `NetworkX `_. - - PLOTTING: - - Upon construction, the position dictionary is filled to - override the spring-layout algorithm. By convention, each barbell - graph will be displayed with the two complete graphs in the - lower-left and upper-right corners, with the path graph connecting - diagonally between the two. Thus the ``n1``-th node will be drawn at a - 45 degree angle from the horizontal right center of the first - complete graph, and the ``n1 + n2 + 1``-th node will be drawn 45 - degrees below the left horizontal center of the second complete graph. - - EXAMPLES: - - Construct and show a barbell graph ``Bar = 4``, ``Bells = 9``:: - - sage: g = graphs.BarbellGraph(9, 4); g - Barbell graph: Graph on 22 vertices - sage: g.show() # long time - - An ``n1 >= 2``, ``n2 >= 0`` barbell graph has order ``2*n1 + n2``. It - has the complete graph on ``n1`` vertices as a subgraph. It also has - the path graph on ``n2`` vertices as a subgraph. :: - - sage: n1 = randint(2, 2*10^2) - sage: n2 = randint(0, 2*10^2) - sage: g = graphs.BarbellGraph(n1, n2) - sage: v = 2*n1 + n2 - sage: g.order() == v - True - sage: K_n1 = graphs.CompleteGraph(n1) - sage: P_n2 = graphs.PathGraph(n2) - sage: s_K = g.subgraph_search(K_n1, induced=True) - sage: s_P = g.subgraph_search(P_n2, induced=True) - sage: K_n1.is_isomorphic(s_K) - True - sage: P_n2.is_isomorphic(s_P) - True - - Create several barbell graphs in a Sage graphics array:: - - sage: g = [] - sage: j = [] - sage: for i in range(6): - ... k = graphs.BarbellGraph(i + 2, 4) - ... g.append(k) - ... - sage: for i in range(2): - ... n = [] - ... for m in range(3): - ... n.append(g[3*i + m].plot(vertex_size=50, vertex_labels=False)) - ... j.append(n) - ... - sage: G = sage.plot.graphics.GraphicsArray(j) - sage: G.show() # long time - - TESTS: - - The input ``n1`` must be `\geq 2`:: - - sage: graphs.BarbellGraph(1, randint(0, 10^6)) - Traceback (most recent call last): - ... - ValueError: Invalid graph description, n1 should be >= 2 - sage: graphs.BarbellGraph(randint(-10^6, 1), randint(0, 10^6)) - Traceback (most recent call last): - ... - ValueError: Invalid graph description, n1 should be >= 2 - - The input ``n2`` must be `\geq 0`:: - - sage: graphs.BarbellGraph(randint(2, 10^6), -1) - Traceback (most recent call last): - ... - ValueError: Invalid graph description, n2 should be >= 0 - sage: graphs.BarbellGraph(randint(2, 10^6), randint(-10^6, -1)) - Traceback (most recent call last): - ... - ValueError: Invalid graph description, n2 should be >= 0 - sage: graphs.BarbellGraph(randint(-10^6, 1), randint(-10^6, -1)) - Traceback (most recent call last): - ... - ValueError: Invalid graph description, n1 should be >= 2 - """ - # sanity checks - if n1 < 2: - raise ValueError("Invalid graph description, n1 should be >= 2") - if n2 < 0: - raise ValueError("Invalid graph description, n2 should be >= 0") - - pos_dict = {} - - for i in range(n1): - x = float(cos((pi / 4) - ((2 * pi) / n1) * i) - (n2 / 2) - 1) - y = float(sin((pi / 4) - ((2 * pi) / n1) * i) - (n2 / 2) - 1) - j = n1 - 1 - i - pos_dict[j] = (x, y) - for i in range(n1, n1 + n2): - x = float(i - n1 - (n2 / 2) + 1) - y = float(i - n1 - (n2 / 2) + 1) - pos_dict[i] = (x, y) - for i in range(n1 + n2, (2 * n1) + n2): - x = float( - cos((5 * (pi / 4)) + ((2 * pi) / n1) * (i - n1 - n2)) - + (n2 / 2) + 2) - y = float( - sin((5 * (pi / 4)) + ((2 * pi) / n1) * (i - n1 - n2)) - + (n2 / 2) + 2) - pos_dict[i] = (x, y) - - import networkx - G = networkx.barbell_graph(n1, n2) - return graph.Graph(G, pos=pos_dict, name="Barbell graph") - - -def BuckyBall(): - r""" - Create the Bucky Ball graph. - - This graph is a 3-regular 60-vertex planar graph. Its vertices - and edges correspond precisely to the carbon atoms and bonds - in buckminsterfullerene. When embedded on a sphere, its 12 - pentagon and 20 hexagon faces are arranged exactly as the - sections of a soccer ball. - - EXAMPLES: - - The Bucky Ball is planar. :: - - sage: g = graphs.BuckyBall() - sage: g.is_planar() - True - - The Bucky Ball can also be created by extracting the 1-skeleton - of the Bucky Ball polyhedron, but this is much slower. :: - - sage: g = polytopes.buckyball().vertex_graph() - sage: g.remove_loops() - sage: h = graphs.BuckyBall() - sage: g.is_isomorphic(h) - True - - The graph is returned along with an attractive embedding. :: - - sage: g = graphs.BuckyBall() - sage: g.plot(vertex_labels=False, vertex_size=10).show() # long time - """ - edges = [(0, 2), (0, 48), (0, 59), (1, 3), (1, 9), (1, 58), - (2, 3), (2, 36), (3, 17), (4, 6), (4, 8), (4, 12), - (5, 7), (5, 9), (5, 16), (6, 7), (6, 20), (7, 21), - (8, 9), (8, 56), (10, 11), (10, 12), (10, 20), (11, 27), - (11, 47), (12, 13), (13, 46), (13, 54), (14, 15), (14, 16), - (14, 21), (15, 25), (15, 41), (16, 17), (17, 40), (18, 19), - (18, 20), (18, 26), (19, 21), (19, 24), (22, 23), (22, 31), - (22, 34), (23, 25), (23, 38), (24, 25), (24, 30), (26, 27), - (26, 30), (27, 29), (28, 29), (28, 31), (28, 35), (29, 44), - (30, 31), (32, 34), (32, 39), (32, 50), (33, 35), (33, 45), - (33, 51), (34, 35), (36, 37), (36, 40), (37, 39), (37, 52), - (38, 39), (38, 41), (40, 41), (42, 43), (42, 46), (42, 55), - (43, 45), (43, 53), (44, 45), (44, 47), (46, 47), (48, 49), - (48, 52), (49, 53), (49, 57), (50, 51), (50, 52), (51, 53), - (54, 55), (54, 56), (55, 57), (56, 58), (57, 59), (58, 59) - ] - g = graph.Graph() - g.add_edges(edges) - g.name("Bucky Ball") - - pos = { - 0 : (1.00000000000000, 0.000000000000000), - 1 : (-1.00000000000000, 0.000000000000000), - 2 : (0.500000000000000, 0.866025403784439), - 3 : (-0.500000000000000, 0.866025403784439), - 4 : (-0.252886764483159, -0.146004241548845), - 5 : (-0.368953972399043, 0.0928336233191176), - 6 : (-0.217853192651371, -0.0480798425451855), - 7 : (-0.255589950938772, 0.0495517623332213), - 8 : (-0.390242139418333, -0.225306404242310), - 9 : (-0.586398703939125, -0.0441575936410641), - 10: (-0.113926229169631, -0.101751920396670), - 11: (-0.0461308635969359, -0.0928422349110366), - 12: (-0.150564961379772, -0.164626477859040), - 13: (-0.0848818904865275, -0.246123271631605), - 14: (-0.170708060452244, 0.196571509298384), - 15: (-0.0672882312715990, 0.212706320404226), - 16: (-0.264873262319233, 0.273106701265196), - 17: (-0.254957754106411, 0.529914971178085), - 18: (-0.103469165775548, 0.00647061768205703), - 19: (-0.113590051906687, 0.0655812470455896), - 20: (-0.145082862532183, -0.0477870484199328), - 21: (-0.179962687765901, 0.103901506225732), - 22: (0.0573383021786124, 0.0863716172289798), - 23: (0.0311566333625530, 0.149538968816603), - 24: (-0.0573383021786121, 0.0863716172289799), - 25: (-0.0311566333625527, 0.149538968816603), - 26: (-0.0517345828877740, 0.00161765442051429), - 27: (-0.0244663616211774, -0.0456122902452611), - 28: (0.0517345828877743, 0.00161765442051431), - 29: (0.0244663616211777, -0.0456122902452611), - 30: (-0.0272682212665964, 0.0439946358247470), - 31: (0.0272682212665968, 0.0439946358247470), - 32: (0.179962687765901, 0.103901506225732), - 33: (0.145082862532184, -0.0477870484199329), - 34: (0.113590051906687, 0.0655812470455895), - 35: (0.103469165775548, 0.00647061768205698), - 36: (0.254957754106411, 0.529914971178085), - 37: (0.264873262319233, 0.273106701265196), - 38: (0.0672882312715993, 0.212706320404226), - 39: (0.170708060452245, 0.196571509298384), - 40: (1.59594559789866e-16, 0.450612808484620), - 41: (2.01227923213310e-16, 0.292008483097691), - 42: (0.0848818904865278, -0.246123271631605), - 43: (0.150564961379773, -0.164626477859040), - 44: (0.0461308635969362, -0.0928422349110366), - 45: (0.113926229169631, -0.101751920396670), - 46: (1.66533453693773e-16, -0.207803012451463), - 47: (1.80411241501588e-16, -0.131162494091179), - 48: (0.586398703939126, -0.0441575936410641), - 49: (0.390242139418333, -0.225306404242310), - 50: (0.255589950938772, 0.0495517623332212), - 51: (0.217853192651372, -0.0480798425451855), - 52: (0.368953972399044, 0.0928336233191175), - 53: (0.252886764483159, -0.146004241548845), - 54: (-0.104080710079810, -0.365940324584313), - 55: (0.104080710079811, -0.365940324584313), - 56: (-0.331440949832714, -0.485757377537020), - 57: (0.331440949832715, -0.485757377537021), - 58: (-0.500000000000000, -0.866025403784438), - 59: (0.500000000000000, -0.866025403784439) - } - - g.set_pos(pos) - - return g - def BullGraph(): r""" Returns a bull graph with 5 nodes. @@ -1148,50 +881,6 @@ def HouseXGraph(): G = networkx.house_x_graph() return graph.Graph(G, pos=pos_dict, name="House Graph") -def KrackhardtKiteGraph(): - """ - Returns a Krackhardt kite graph with 10 nodes. - - The Krackhardt kite graph was originally developed by David - Krackhardt for the purpose of studying social networks. It is used - to show the distinction between: degree centrality, betweeness - centrality, and closeness centrality. For more information read the - plotting section below in conjunction with the example. - - REFERENCES: - - - [1] Kreps, V. (2002). "Social Network Analysis". [Online] Available: - http://www.fsu.edu/~spap/water/network/intro.htm [2007, - January 17] - - This constructor depends on NetworkX numeric labeling. - - PLOTTING: Upon construction, the position dictionary is filled to - override the spring-layout algorithm. By convention, the graph is - drawn left to right, in top to bottom row sequence of [2, 3, 2, 1, - 1, 1] nodes on each row. This places the fourth node (3) in the - center of the kite, with the highest degree. But the fourth node - only connects nodes that are otherwise connected, or those in its - clique (i.e.: Degree Centrality). The eighth (7) node is where the - kite meets the tail. It has degree = 3, less than the average, but - is the only connection between the kite and tail (i.e.: Betweenness - Centrality). The sixth and seventh nodes (5 and 6) are drawn in the - third row and have degree = 5. These nodes have the shortest path - to all other nodes in the graph (i.e.: Closeness Centrality). - Please execute the example for visualization. - - EXAMPLE: Construct and show a Krackhardt kite graph - - :: - - sage: g = graphs.KrackhardtKiteGraph() - sage: g.show() # long time - """ - pos_dict = {0:(-1,4),1:(1,4),2:(-2,3),3:(0,3),4:(2,3),5:(-1,2),6:(1,2),7:(0,1),8:(0,0),9:(0,-1)} - import networkx - G = networkx.krackhardt_kite_graph() - return graph.Graph(G, pos=pos_dict, name="Krackhardt Kite Graph") - def LadderGraph(n): """ Returns a ladder graph with 2\*n nodes. @@ -1483,77 +1172,3 @@ def StarGraph(n): G = networkx.star_graph(n) return graph.Graph(G, pos=pos_dict, name="Star graph") -def WheelGraph(n): - """ - Returns a Wheel graph with n nodes. - - A Wheel graph is a basic structure where one node is connected to - all other nodes and those (outer) nodes are connected cyclically. - - This constructor depends on NetworkX numeric labels. - - PLOTTING: Upon construction, the position dictionary is filled to - override the spring-layout algorithm. By convention, each wheel - graph will be displayed with the first (0) node in the center, the - second node at the top, and the rest following in a - counterclockwise manner. - - With the wheel graph, we see that it doesn't take a very large n at - all for the spring-layout to give a counter-intuitive display. (See - Graphics Array examples below). - - EXAMPLES: We view many wheel graphs with a Sage Graphics Array, - first with this constructor (i.e., the position dictionary - filled):: - - sage: g = [] - sage: j = [] - sage: for i in range(9): - ... k = graphs.WheelGraph(i+3) - ... g.append(k) - ... - sage: for i in range(3): - ... n = [] - ... for m in range(3): - ... n.append(g[3*i + m].plot(vertex_size=50, vertex_labels=False)) - ... j.append(n) - ... - sage: G = sage.plot.graphics.GraphicsArray(j) - sage: G.show() # long time - - Next, using the spring-layout algorithm:: - - sage: import networkx - sage: g = [] - sage: j = [] - sage: for i in range(9): - ... spr = networkx.wheel_graph(i+3) - ... k = Graph(spr) - ... g.append(k) - ... - sage: for i in range(3): - ... n = [] - ... for m in range(3): - ... n.append(g[3*i + m].plot(vertex_size=50, vertex_labels=False)) - ... j.append(n) - ... - sage: G = sage.plot.graphics.GraphicsArray(j) - sage: G.show() # long time - - Compare the plotting:: - - sage: n = networkx.wheel_graph(23) - sage: spring23 = Graph(n) - sage: posdict23 = graphs.WheelGraph(23) - sage: spring23.show() # long time - sage: posdict23.show() # long time - """ - pos_dict = {} - pos_dict[0] = (0,0) - for i in range(1,n): - x = float(cos((pi/2) + ((2*pi)/(n-1))*(i-1))) - y = float(sin((pi/2) + ((2*pi)/(n-1))*(i-1))) - pos_dict[i] = (x,y) - import networkx - G = networkx.wheel_graph(n) - return graph.Graph(G, pos=pos_dict, name="Wheel graph") diff --git a/src/sage/graphs/generators/families.py b/src/sage/graphs/generators/families.py index 5597e05040b..342fe45a674 100644 --- a/src/sage/graphs/generators/families.py +++ b/src/sage/graphs/generators/families.py @@ -25,63 +25,6 @@ from sage.graphs import graph from math import sin, cos, pi -def HararyGraph( k, n ): - r""" - Returns the Harary graph on `n` vertices and connectivity `k`, where - `2 \leq k < n`. - - A `k`-connected graph `G` on `n` vertices requires the minimum degree - `\delta(G)\geq k`, so the minimum number of edges `G` should have is - `\lceil kn/2\rceil`. Harary graphs achieve this lower bound, that is, - Harary graphs are minimal `k`-connected graphs on `n` vertices. - - The construction provided uses the method CirculantGraph. For more - details, see the book D. B. West, Introduction to Graph Theory, 2nd - Edition, Prentice Hall, 2001, p. 150--151; or the `MathWorld article on - Harary graphs `_. - - EXAMPLES: - - Harary graphs `H_{k,n}`:: - - sage: h = graphs.HararyGraph(5,9); h - Harary graph 5, 9: Graph on 9 vertices - sage: h.order() - 9 - sage: h.size() - 23 - sage: h.vertex_connectivity() - 5 - - TESTS: - - Connectivity of some Harary graphs:: - - sage: n=10 - sage: for k in range(2,n): - ... g = graphs.HararyGraph(k,n) - ... if k != g.vertex_connectivity(): - ... print "Connectivity of Harary graphs not satisfied." - """ - if k < 2: - raise ValueError("Connectivity parameter k should be at least 2.") - if k >= n: - raise ValueError("Number of vertices n should be greater than k.") - - if k%2 == 0: - G = CirculantGraph( n, range(1,k/2+1) ) - else: - if n%2 == 0: - G = CirculantGraph( n, range(1,(k-1)/2+1) ) - for i in range(n): - G.add_edge( i, (i+n/2)%n ) - else: - G = HararyGraph( k-1, n ) - for i in range((n-1)/2+1): - G.add_edge( i, (i+(n-1)/2)%n ) - G.name('Harary graph {0}, {1}'.format(k,n)) - return G - def IntervalGraph(intervals): r""" Returns the graph corresponding to the given intervals. @@ -349,6 +292,149 @@ def BalancedTree(r, h): import networkx return graph.Graph(networkx.balanced_tree(r, h), name="Balanced tree") +def BarbellGraph(n1, n2): + r""" + Returns a barbell graph with ``2*n1 + n2`` nodes. The argument ``n1`` + must be greater than or equal to 2. + + A barbell graph is a basic structure that consists of a path graph + of order ``n2`` connecting two complete graphs of order ``n1`` each. + + This constructor depends on `NetworkX `_ + numeric labels. In this case, the ``n1``-th node connects to the + path graph from one complete graph and the ``n1 + n2 + 1``-th node + connects to the path graph from the other complete graph. + + INPUT: + + - ``n1`` -- integer `\geq 2`. The order of each of the two + complete graphs. + + - ``n2`` -- nonnegative integer. The order of the path graph + connecting the two complete graphs. + + OUTPUT: + + A barbell graph of order ``2*n1 + n2``. A ``ValueError`` is + returned if ``n1 < 2`` or ``n2 < 0``. + + ALGORITHM: + + Uses `NetworkX `_. + + PLOTTING: + + Upon construction, the position dictionary is filled to + override the spring-layout algorithm. By convention, each barbell + graph will be displayed with the two complete graphs in the + lower-left and upper-right corners, with the path graph connecting + diagonally between the two. Thus the ``n1``-th node will be drawn at a + 45 degree angle from the horizontal right center of the first + complete graph, and the ``n1 + n2 + 1``-th node will be drawn 45 + degrees below the left horizontal center of the second complete graph. + + EXAMPLES: + + Construct and show a barbell graph ``Bar = 4``, ``Bells = 9``:: + + sage: g = graphs.BarbellGraph(9, 4); g + Barbell graph: Graph on 22 vertices + sage: g.show() # long time + + An ``n1 >= 2``, ``n2 >= 0`` barbell graph has order ``2*n1 + n2``. It + has the complete graph on ``n1`` vertices as a subgraph. It also has + the path graph on ``n2`` vertices as a subgraph. :: + + sage: n1 = randint(2, 2*10^2) + sage: n2 = randint(0, 2*10^2) + sage: g = graphs.BarbellGraph(n1, n2) + sage: v = 2*n1 + n2 + sage: g.order() == v + True + sage: K_n1 = graphs.CompleteGraph(n1) + sage: P_n2 = graphs.PathGraph(n2) + sage: s_K = g.subgraph_search(K_n1, induced=True) + sage: s_P = g.subgraph_search(P_n2, induced=True) + sage: K_n1.is_isomorphic(s_K) + True + sage: P_n2.is_isomorphic(s_P) + True + + Create several barbell graphs in a Sage graphics array:: + + sage: g = [] + sage: j = [] + sage: for i in range(6): + ... k = graphs.BarbellGraph(i + 2, 4) + ... g.append(k) + ... + sage: for i in range(2): + ... n = [] + ... for m in range(3): + ... n.append(g[3*i + m].plot(vertex_size=50, vertex_labels=False)) + ... j.append(n) + ... + sage: G = sage.plot.graphics.GraphicsArray(j) + sage: G.show() # long time + + TESTS: + + The input ``n1`` must be `\geq 2`:: + + sage: graphs.BarbellGraph(1, randint(0, 10^6)) + Traceback (most recent call last): + ... + ValueError: Invalid graph description, n1 should be >= 2 + sage: graphs.BarbellGraph(randint(-10^6, 1), randint(0, 10^6)) + Traceback (most recent call last): + ... + ValueError: Invalid graph description, n1 should be >= 2 + + The input ``n2`` must be `\geq 0`:: + + sage: graphs.BarbellGraph(randint(2, 10^6), -1) + Traceback (most recent call last): + ... + ValueError: Invalid graph description, n2 should be >= 0 + sage: graphs.BarbellGraph(randint(2, 10^6), randint(-10^6, -1)) + Traceback (most recent call last): + ... + ValueError: Invalid graph description, n2 should be >= 0 + sage: graphs.BarbellGraph(randint(-10^6, 1), randint(-10^6, -1)) + Traceback (most recent call last): + ... + ValueError: Invalid graph description, n1 should be >= 2 + """ + # sanity checks + if n1 < 2: + raise ValueError("Invalid graph description, n1 should be >= 2") + if n2 < 0: + raise ValueError("Invalid graph description, n2 should be >= 0") + + pos_dict = {} + + for i in range(n1): + x = float(cos((pi / 4) - ((2 * pi) / n1) * i) - (n2 / 2) - 1) + y = float(sin((pi / 4) - ((2 * pi) / n1) * i) - (n2 / 2) - 1) + j = n1 - 1 - i + pos_dict[j] = (x, y) + for i in range(n1, n1 + n2): + x = float(i - n1 - (n2 / 2) + 1) + y = float(i - n1 - (n2 / 2) + 1) + pos_dict[i] = (x, y) + for i in range(n1 + n2, (2 * n1) + n2): + x = float( + cos((5 * (pi / 4)) + ((2 * pi) / n1) * (i - n1 - n2)) + + (n2 / 2) + 2) + y = float( + sin((5 * (pi / 4)) + ((2 * pi) / n1) * (i - n1 - n2)) + + (n2 / 2) + 2) + pos_dict[i] = (x, y) + + import networkx + G = networkx.barbell_graph(n1, n2) + return graph.Graph(G, pos=pos_dict, name="Barbell graph") + def BubbleSortGraph(n): r""" Returns the bubble sort graph `B(n)`. @@ -981,6 +1067,63 @@ def GeneralizedPetersenGraph(n,k): G.add_edge(i+n, n + (i+k) % n) return graph.Graph(G, pos=pos_dict, name="Generalized Petersen graph (n="+str(n)+",k="+str(k)+")") +def HararyGraph( k, n ): + r""" + Returns the Harary graph on `n` vertices and connectivity `k`, where + `2 \leq k < n`. + + A `k`-connected graph `G` on `n` vertices requires the minimum degree + `\delta(G)\geq k`, so the minimum number of edges `G` should have is + `\lceil kn/2\rceil`. Harary graphs achieve this lower bound, that is, + Harary graphs are minimal `k`-connected graphs on `n` vertices. + + The construction provided uses the method CirculantGraph. For more + details, see the book D. B. West, Introduction to Graph Theory, 2nd + Edition, Prentice Hall, 2001, p. 150--151; or the `MathWorld article on + Harary graphs `_. + + EXAMPLES: + + Harary graphs `H_{k,n}`:: + + sage: h = graphs.HararyGraph(5,9); h + Harary graph 5, 9: Graph on 9 vertices + sage: h.order() + 9 + sage: h.size() + 23 + sage: h.vertex_connectivity() + 5 + + TESTS: + + Connectivity of some Harary graphs:: + + sage: n=10 + sage: for k in range(2,n): + ... g = graphs.HararyGraph(k,n) + ... if k != g.vertex_connectivity(): + ... print "Connectivity of Harary graphs not satisfied." + """ + if k < 2: + raise ValueError("Connectivity parameter k should be at least 2.") + if k >= n: + raise ValueError("Number of vertices n should be greater than k.") + + if k%2 == 0: + G = CirculantGraph( n, range(1,k/2+1) ) + else: + if n%2 == 0: + G = CirculantGraph( n, range(1,(k-1)/2+1) ) + for i in range(n): + G.add_edge( i, (i+n/2)%n ) + else: + G = HararyGraph( k-1, n ) + for i in range((n-1)/2+1): + G.add_edge( i, (i+(n-1)/2)%n ) + G.name('Harary graph {0}, {1}'.format(k,n)) + return G + def HyperStarGraph(n,k): r""" Returns the hyper-star graph HS(n,k). @@ -1837,6 +1980,81 @@ def line_graph_forbidden_subgraphs(): return graphs +def WheelGraph(n): + """ + Returns a Wheel graph with n nodes. + + A Wheel graph is a basic structure where one node is connected to + all other nodes and those (outer) nodes are connected cyclically. + + This constructor depends on NetworkX numeric labels. + + PLOTTING: Upon construction, the position dictionary is filled to + override the spring-layout algorithm. By convention, each wheel + graph will be displayed with the first (0) node in the center, the + second node at the top, and the rest following in a + counterclockwise manner. + + With the wheel graph, we see that it doesn't take a very large n at + all for the spring-layout to give a counter-intuitive display. (See + Graphics Array examples below). + + EXAMPLES: We view many wheel graphs with a Sage Graphics Array, + first with this constructor (i.e., the position dictionary + filled):: + + sage: g = [] + sage: j = [] + sage: for i in range(9): + ... k = graphs.WheelGraph(i+3) + ... g.append(k) + ... + sage: for i in range(3): + ... n = [] + ... for m in range(3): + ... n.append(g[3*i + m].plot(vertex_size=50, vertex_labels=False)) + ... j.append(n) + ... + sage: G = sage.plot.graphics.GraphicsArray(j) + sage: G.show() # long time + + Next, using the spring-layout algorithm:: + + sage: import networkx + sage: g = [] + sage: j = [] + sage: for i in range(9): + ... spr = networkx.wheel_graph(i+3) + ... k = Graph(spr) + ... g.append(k) + ... + sage: for i in range(3): + ... n = [] + ... for m in range(3): + ... n.append(g[3*i + m].plot(vertex_size=50, vertex_labels=False)) + ... j.append(n) + ... + sage: G = sage.plot.graphics.GraphicsArray(j) + sage: G.show() # long time + + Compare the plotting:: + + sage: n = networkx.wheel_graph(23) + sage: spring23 = Graph(n) + sage: posdict23 = graphs.WheelGraph(23) + sage: spring23.show() # long time + sage: posdict23.show() # long time + """ + pos_dict = {} + pos_dict[0] = (0,0) + for i in range(1,n): + x = float(cos((pi/2) + ((2*pi)/(n-1))*(i-1))) + y = float(sin((pi/2) + ((2*pi)/(n-1))*(i-1))) + pos_dict[i] = (x,y) + import networkx + G = networkx.wheel_graph(n) + return graph.Graph(G, pos=pos_dict, name="Wheel graph") + def trees(vertices): r""" Returns a generator of the distinct trees on a fixed number of vertices. diff --git a/src/sage/graphs/generators/smallgraphs.py b/src/sage/graphs/generators/smallgraphs.py index 3433c8b5eca..c24accb87f3 100644 --- a/src/sage/graphs/generators/smallgraphs.py +++ b/src/sage/graphs/generators/smallgraphs.py @@ -1090,6 +1090,125 @@ def BrouwerHaemersGraph(): G.name("Brouwer-Haemers") return G +def BuckyBall(): + r""" + Create the Bucky Ball graph. + + This graph is a 3-regular 60-vertex planar graph. Its vertices + and edges correspond precisely to the carbon atoms and bonds + in buckminsterfullerene. When embedded on a sphere, its 12 + pentagon and 20 hexagon faces are arranged exactly as the + sections of a soccer ball. + + EXAMPLES: + + The Bucky Ball is planar. :: + + sage: g = graphs.BuckyBall() + sage: g.is_planar() + True + + The Bucky Ball can also be created by extracting the 1-skeleton + of the Bucky Ball polyhedron, but this is much slower. :: + + sage: g = polytopes.buckyball().vertex_graph() + sage: g.remove_loops() + sage: h = graphs.BuckyBall() + sage: g.is_isomorphic(h) + True + + The graph is returned along with an attractive embedding. :: + + sage: g = graphs.BuckyBall() + sage: g.plot(vertex_labels=False, vertex_size=10).show() # long time + """ + edges = [(0, 2), (0, 48), (0, 59), (1, 3), (1, 9), (1, 58), + (2, 3), (2, 36), (3, 17), (4, 6), (4, 8), (4, 12), + (5, 7), (5, 9), (5, 16), (6, 7), (6, 20), (7, 21), + (8, 9), (8, 56), (10, 11), (10, 12), (10, 20), (11, 27), + (11, 47), (12, 13), (13, 46), (13, 54), (14, 15), (14, 16), + (14, 21), (15, 25), (15, 41), (16, 17), (17, 40), (18, 19), + (18, 20), (18, 26), (19, 21), (19, 24), (22, 23), (22, 31), + (22, 34), (23, 25), (23, 38), (24, 25), (24, 30), (26, 27), + (26, 30), (27, 29), (28, 29), (28, 31), (28, 35), (29, 44), + (30, 31), (32, 34), (32, 39), (32, 50), (33, 35), (33, 45), + (33, 51), (34, 35), (36, 37), (36, 40), (37, 39), (37, 52), + (38, 39), (38, 41), (40, 41), (42, 43), (42, 46), (42, 55), + (43, 45), (43, 53), (44, 45), (44, 47), (46, 47), (48, 49), + (48, 52), (49, 53), (49, 57), (50, 51), (50, 52), (51, 53), + (54, 55), (54, 56), (55, 57), (56, 58), (57, 59), (58, 59) + ] + g = graph.Graph() + g.add_edges(edges) + g.name("Bucky Ball") + + pos = { + 0 : (1.00000000000000, 0.000000000000000), + 1 : (-1.00000000000000, 0.000000000000000), + 2 : (0.500000000000000, 0.866025403784439), + 3 : (-0.500000000000000, 0.866025403784439), + 4 : (-0.252886764483159, -0.146004241548845), + 5 : (-0.368953972399043, 0.0928336233191176), + 6 : (-0.217853192651371, -0.0480798425451855), + 7 : (-0.255589950938772, 0.0495517623332213), + 8 : (-0.390242139418333, -0.225306404242310), + 9 : (-0.586398703939125, -0.0441575936410641), + 10: (-0.113926229169631, -0.101751920396670), + 11: (-0.0461308635969359, -0.0928422349110366), + 12: (-0.150564961379772, -0.164626477859040), + 13: (-0.0848818904865275, -0.246123271631605), + 14: (-0.170708060452244, 0.196571509298384), + 15: (-0.0672882312715990, 0.212706320404226), + 16: (-0.264873262319233, 0.273106701265196), + 17: (-0.254957754106411, 0.529914971178085), + 18: (-0.103469165775548, 0.00647061768205703), + 19: (-0.113590051906687, 0.0655812470455896), + 20: (-0.145082862532183, -0.0477870484199328), + 21: (-0.179962687765901, 0.103901506225732), + 22: (0.0573383021786124, 0.0863716172289798), + 23: (0.0311566333625530, 0.149538968816603), + 24: (-0.0573383021786121, 0.0863716172289799), + 25: (-0.0311566333625527, 0.149538968816603), + 26: (-0.0517345828877740, 0.00161765442051429), + 27: (-0.0244663616211774, -0.0456122902452611), + 28: (0.0517345828877743, 0.00161765442051431), + 29: (0.0244663616211777, -0.0456122902452611), + 30: (-0.0272682212665964, 0.0439946358247470), + 31: (0.0272682212665968, 0.0439946358247470), + 32: (0.179962687765901, 0.103901506225732), + 33: (0.145082862532184, -0.0477870484199329), + 34: (0.113590051906687, 0.0655812470455895), + 35: (0.103469165775548, 0.00647061768205698), + 36: (0.254957754106411, 0.529914971178085), + 37: (0.264873262319233, 0.273106701265196), + 38: (0.0672882312715993, 0.212706320404226), + 39: (0.170708060452245, 0.196571509298384), + 40: (1.59594559789866e-16, 0.450612808484620), + 41: (2.01227923213310e-16, 0.292008483097691), + 42: (0.0848818904865278, -0.246123271631605), + 43: (0.150564961379773, -0.164626477859040), + 44: (0.0461308635969362, -0.0928422349110366), + 45: (0.113926229169631, -0.101751920396670), + 46: (1.66533453693773e-16, -0.207803012451463), + 47: (1.80411241501588e-16, -0.131162494091179), + 48: (0.586398703939126, -0.0441575936410641), + 49: (0.390242139418333, -0.225306404242310), + 50: (0.255589950938772, 0.0495517623332212), + 51: (0.217853192651372, -0.0480798425451855), + 52: (0.368953972399044, 0.0928336233191175), + 53: (0.252886764483159, -0.146004241548845), + 54: (-0.104080710079810, -0.365940324584313), + 55: (0.104080710079811, -0.365940324584313), + 56: (-0.331440949832714, -0.485757377537020), + 57: (0.331440949832715, -0.485757377537021), + 58: (-0.500000000000000, -0.866025403784438), + 59: (0.500000000000000, -0.866025403784439) + } + + g.set_pos(pos) + + return g + def DoubleStarSnark(): r""" Returns the double star snark. @@ -2613,6 +2732,50 @@ def HoltGraph(): return g +def KrackhardtKiteGraph(): + """ + Returns a Krackhardt kite graph with 10 nodes. + + The Krackhardt kite graph was originally developed by David + Krackhardt for the purpose of studying social networks. It is used + to show the distinction between: degree centrality, betweeness + centrality, and closeness centrality. For more information read the + plotting section below in conjunction with the example. + + REFERENCES: + + - [1] Kreps, V. (2002). "Social Network Analysis". [Online] Available: + http://www.fsu.edu/~spap/water/network/intro.htm [2007, + January 17] + + This constructor depends on NetworkX numeric labeling. + + PLOTTING: Upon construction, the position dictionary is filled to + override the spring-layout algorithm. By convention, the graph is + drawn left to right, in top to bottom row sequence of [2, 3, 2, 1, + 1, 1] nodes on each row. This places the fourth node (3) in the + center of the kite, with the highest degree. But the fourth node + only connects nodes that are otherwise connected, or those in its + clique (i.e.: Degree Centrality). The eighth (7) node is where the + kite meets the tail. It has degree = 3, less than the average, but + is the only connection between the kite and tail (i.e.: Betweenness + Centrality). The sixth and seventh nodes (5 and 6) are drawn in the + third row and have degree = 5. These nodes have the shortest path + to all other nodes in the graph (i.e.: Closeness Centrality). + Please execute the example for visualization. + + EXAMPLE: Construct and show a Krackhardt kite graph + + :: + + sage: g = graphs.KrackhardtKiteGraph() + sage: g.show() # long time + """ + pos_dict = {0:(-1,4),1:(1,4),2:(-2,3),3:(0,3),4:(2,3),5:(-1,2),6:(1,2),7:(0,1),8:(0,0),9:(0,-1)} + import networkx + G = networkx.krackhardt_kite_graph() + return graph.Graph(G, pos=pos_dict, name="Krackhardt Kite Graph") + def LjubljanaGraph(embedding=1): r""" Returns the Ljubljana Graph. diff --git a/src/sage/graphs/graph_generators.py b/src/sage/graphs/graph_generators.py index 39a33e1d7a6..b1b9ab06942 100644 --- a/src/sage/graphs/graph_generators.py +++ b/src/sage/graphs/graph_generators.py @@ -2,11 +2,16 @@ r""" Common Graphs (Graph Generators) -All graphs in Sage can be built through the ``graphs`` object : in order to -build a complete graph on `15` elements, one can do:: +All graphs in Sage can be built through the ``graphs`` object. In order to +build a complete graph on 15 elements, one can do:: sage: g = graphs.CompleteGraph(15) +To get a path with 4 vertices, and the house graph:: + + sage: p = graphs.PathGraph(4) + sage: h = graphs.HouseGraph() + More interestingly, one can get the list of all graphs that Sage knows how to build by typing ``graphs.`` in Sage and then hitting tab. """ @@ -48,9 +53,7 @@ def __append_to_doc(methods): """ __append_to_doc( - ["BarbellGraph", - "BuckyBall", - "BullGraph", + ["BullGraph", "ButterflyGraph", "CircularLadderGraph", "ClawGraph", @@ -64,14 +67,12 @@ def __append_to_doc(methods): "GridGraph", "HouseGraph", "HouseXGraph", - "KrackhardtKiteGraph", "LadderGraph", "LollipopGraph", "PathGraph", "StarGraph", "ToroidalGrid2dGraph", - "Toroidal6RegularGrid2dGraph", - "WheelGraph"] + "Toroidal6RegularGrid2dGraph"] ) __doc__ += """ @@ -88,6 +89,7 @@ def __append_to_doc(methods): "BiggsSmithGraph", "BrinkmannGraph", "BrouwerHaemersGraph", + "BuckyBall", "CameronGraph", "ChvatalGraph", "ClebschGraph", @@ -116,6 +118,7 @@ def __append_to_doc(methods): "HoffmanGraph", "HoffmanSingletonGraph", "HoltGraph", + "KrackhardtKiteGraph", "LjubljanaGraph", "McGeeGraph", "McLaughlinGraph", @@ -158,6 +161,7 @@ def __append_to_doc(methods): __append_to_doc( ["BalancedTree", + "BarbellGraph", "BubbleSortGraph", "CirculantGraph", "cospectral_graphs", @@ -187,7 +191,8 @@ def __append_to_doc(methods): "PermutationGraph", "RingedTree", "SymplecticGraph", - "trees"]) + "trees", + "WheelGraph"]) __doc__ += """ *Chessboard Graphs* @@ -1193,6 +1198,31 @@ def fusenes(self, hexagon_count, benzenoids=False): G.set_embedding(g) yield(G) +########################################################################### +# Basic Graphs +########################################################################### + import sage.graphs.generators.basic + BullGraph = staticmethod(sage.graphs.generators.basic.BullGraph) + ButterflyGraph = staticmethod(sage.graphs.generators.basic.ButterflyGraph) + CircularLadderGraph = staticmethod(sage.graphs.generators.basic.CircularLadderGraph) + ClawGraph = staticmethod(sage.graphs.generators.basic.ClawGraph) + CycleGraph = staticmethod(sage.graphs.generators.basic.CycleGraph) + CompleteGraph = staticmethod(sage.graphs.generators.basic.CompleteGraph) + CompleteBipartiteGraph = staticmethod(sage.graphs.generators.basic.CompleteBipartiteGraph) + CompleteMultipartiteGraph= staticmethod(sage.graphs.generators.basic.CompleteMultipartiteGraph) + DiamondGraph = staticmethod(sage.graphs.generators.basic.DiamondGraph) + EmptyGraph = staticmethod(sage.graphs.generators.basic.EmptyGraph) + Grid2dGraph = staticmethod(sage.graphs.generators.basic.Grid2dGraph) + GridGraph = staticmethod(sage.graphs.generators.basic.GridGraph) + HouseGraph = staticmethod(sage.graphs.generators.basic.HouseGraph) + HouseXGraph = staticmethod(sage.graphs.generators.basic.HouseXGraph) + LadderGraph = staticmethod(sage.graphs.generators.basic.LadderGraph) + LollipopGraph = staticmethod(sage.graphs.generators.basic.LollipopGraph) + PathGraph = staticmethod(sage.graphs.generators.basic.PathGraph) + StarGraph = staticmethod(sage.graphs.generators.basic.StarGraph) + Toroidal6RegularGrid2dGraph = staticmethod(sage.graphs.generators.basic.Toroidal6RegularGrid2dGraph) + ToroidalGrid2dGraph = staticmethod(sage.graphs.generators.basic.ToroidalGrid2dGraph) + ########################################################################### # Small Graphs ########################################################################### @@ -1203,6 +1233,7 @@ def fusenes(self, hexagon_count, benzenoids=False): BiggsSmithGraph = staticmethod(sage.graphs.generators.smallgraphs.BiggsSmithGraph) BrinkmannGraph = staticmethod(sage.graphs.generators.smallgraphs.BrinkmannGraph) BrouwerHaemersGraph = staticmethod(sage.graphs.generators.smallgraphs.BrouwerHaemersGraph) + BuckyBall = staticmethod(sage.graphs.generators.smallgraphs.BuckyBall) CameronGraph = staticmethod(sage.graphs.generators.smallgraphs.CameronGraph) ChvatalGraph = staticmethod(sage.graphs.generators.smallgraphs.ChvatalGraph) ClebschGraph = staticmethod(sage.graphs.generators.smallgraphs.ClebschGraph) @@ -1232,6 +1263,7 @@ def fusenes(self, hexagon_count, benzenoids=False): HoffmanGraph = staticmethod(sage.graphs.generators.smallgraphs.HoffmanGraph) HoffmanSingletonGraph = staticmethod(sage.graphs.generators.smallgraphs.HoffmanSingletonGraph) HoltGraph = staticmethod(sage.graphs.generators.smallgraphs.HoltGraph) + KrackhardtKiteGraph = staticmethod(sage.graphs.generators.smallgraphs.KrackhardtKiteGraph) LjubljanaGraph = staticmethod(sage.graphs.generators.smallgraphs.LjubljanaGraph) McGeeGraph = staticmethod(sage.graphs.generators.smallgraphs.McGeeGraph) McLaughlinGraph = staticmethod(sage.graphs.generators.smallgraphs.McLaughlinGraph) @@ -1266,6 +1298,7 @@ def fusenes(self, hexagon_count, benzenoids=False): ########################################################################### import sage.graphs.generators.families BalancedTree = staticmethod(sage.graphs.generators.families.BalancedTree) + BarbellGraph = staticmethod(sage.graphs.generators.families.BarbellGraph) BubbleSortGraph = staticmethod(sage.graphs.generators.families.BubbleSortGraph) CirculantGraph = staticmethod(sage.graphs.generators.families.CirculantGraph) CubeGraph = staticmethod(sage.graphs.generators.families.CubeGraph) @@ -1293,6 +1326,7 @@ def fusenes(self, hexagon_count, benzenoids=False): RingedTree = staticmethod(sage.graphs.generators.families.RingedTree) SymplecticGraph = staticmethod(sage.graphs.generators.families.SymplecticGraph) trees = staticmethod(sage.graphs.generators.families.trees) + WheelGraph = staticmethod(sage.graphs.generators.families.WheelGraph) ########################################################################### # Chessboard Graphs @@ -1305,35 +1339,6 @@ def fusenes(self, hexagon_count, benzenoids=False): QueenGraph = staticmethod(sage.graphs.generators.chessboard.QueenGraph) RookGraph = staticmethod(sage.graphs.generators.chessboard.RookGraph) -########################################################################### -# Basic Graphs -########################################################################### - import sage.graphs.generators.basic - BarbellGraph = staticmethod(sage.graphs.generators.basic.BarbellGraph) - BuckyBall = staticmethod(sage.graphs.generators.basic.BuckyBall) - BullGraph = staticmethod(sage.graphs.generators.basic.BullGraph) - ButterflyGraph = staticmethod(sage.graphs.generators.basic.ButterflyGraph) - CircularLadderGraph = staticmethod(sage.graphs.generators.basic.CircularLadderGraph) - ClawGraph = staticmethod(sage.graphs.generators.basic.ClawGraph) - CycleGraph = staticmethod(sage.graphs.generators.basic.CycleGraph) - CompleteGraph = staticmethod(sage.graphs.generators.basic.CompleteGraph) - CompleteBipartiteGraph = staticmethod(sage.graphs.generators.basic.CompleteBipartiteGraph) - CompleteMultipartiteGraph= staticmethod(sage.graphs.generators.basic.CompleteMultipartiteGraph) - DiamondGraph = staticmethod(sage.graphs.generators.basic.DiamondGraph) - EmptyGraph = staticmethod(sage.graphs.generators.basic.EmptyGraph) - Grid2dGraph = staticmethod(sage.graphs.generators.basic.Grid2dGraph) - GridGraph = staticmethod(sage.graphs.generators.basic.GridGraph) - HouseGraph = staticmethod(sage.graphs.generators.basic.HouseGraph) - HouseXGraph = staticmethod(sage.graphs.generators.basic.HouseXGraph) - KrackhardtKiteGraph = staticmethod(sage.graphs.generators.basic.KrackhardtKiteGraph) - LadderGraph = staticmethod(sage.graphs.generators.basic.LadderGraph) - LollipopGraph = staticmethod(sage.graphs.generators.basic.LollipopGraph) - PathGraph = staticmethod(sage.graphs.generators.basic.PathGraph) - StarGraph = staticmethod(sage.graphs.generators.basic.StarGraph) - Toroidal6RegularGrid2dGraph = staticmethod(sage.graphs.generators.basic.Toroidal6RegularGrid2dGraph) - ToroidalGrid2dGraph = staticmethod(sage.graphs.generators.basic.ToroidalGrid2dGraph) - WheelGraph = staticmethod(sage.graphs.generators.basic.WheelGraph) - ########################################################################### # Random Graphs ########################################################################### From 935fa83f0c66bcb4c4a3df21e75a3ed5113a8ca2 Mon Sep 17 00:00:00 2001 From: Birk Eisermann Date: Tue, 27 Aug 2013 19:08:18 +0200 Subject: [PATCH 14/85] Trac #14980: part 5, formatting of doctests --- src/sage/graphs/generators/basic.py | 171 ++++++++---------- src/sage/graphs/generators/chessboard.py | 26 +-- src/sage/graphs/generators/degree_sequence.py | 33 ++-- src/sage/graphs/generators/families.py | 44 ++--- src/sage/graphs/generators/platonic_solids.py | 78 ++++---- src/sage/graphs/generators/random.py | 96 ++++------ src/sage/graphs/generators/smallgraphs.py | 83 +++++---- src/sage/graphs/generators/world_map.py | 3 - 8 files changed, 232 insertions(+), 302 deletions(-) diff --git a/src/sage/graphs/generators/basic.py b/src/sage/graphs/generators/basic.py index a1f1af88edf..97602643cbd 100644 --- a/src/sage/graphs/generators/basic.py +++ b/src/sage/graphs/generators/basic.py @@ -185,15 +185,13 @@ def CircularLadderGraph(n): sage: g = [] sage: j = [] sage: for i in range(9): - ... k = graphs.CircularLadderGraph(i+3) - ... g.append(k) - ... + ....: k = graphs.CircularLadderGraph(i+3) + ....: g.append(k) sage: for i in range(3): - ... n = [] - ... for m in range(3): - ... n.append(g[3*i + m].plot(vertex_size=50, vertex_labels=False)) - ... j.append(n) - ... + ....: n = [] + ....: for m in range(3): + ....: n.append(g[3*i + m].plot(vertex_size=50, vertex_labels=False)) + ....: j.append(n) sage: G = sage.plot.graphics.GraphicsArray(j) sage: G.show() # long time """ @@ -278,15 +276,13 @@ def CycleGraph(n): sage: g = [] sage: j = [] sage: for i in range(9): - ... k = graphs.CycleGraph(i+3) - ... g.append(k) - ... + ....: k = graphs.CycleGraph(i+3) + ....: g.append(k) sage: for i in range(3): - ... n = [] - ... for m in range(3): - ... n.append(g[3*i + m].plot(vertex_size=50, vertex_labels=False)) - ... j.append(n) - ... + ....: n = [] + ....: for m in range(3): + ....: n.append(g[3*i + m].plot(vertex_size=50, vertex_labels=False)) + ....: j.append(n) sage: G = sage.plot.graphics.GraphicsArray(j) sage: G.show() # long time @@ -295,16 +291,14 @@ def CycleGraph(n): sage: g = [] sage: j = [] sage: for i in range(9): - ... spr = networkx.cycle_graph(i+3) - ... k = Graph(spr) - ... g.append(k) - ... + ....: spr = networkx.cycle_graph(i+3) + ....: k = Graph(spr) + ....: g.append(k) sage: for i in range(3): - ... n = [] - ... for m in range(3): - ... n.append(g[3*i + m].plot(vertex_size=50, vertex_labels=False)) - ... j.append(n) - ... + ....: n = [] + ....: for m in range(3): + ....: n.append(g[3*i + m].plot(vertex_size=50, vertex_labels=False)) + ....: j.append(n) sage: G = sage.plot.graphics.GraphicsArray(j) sage: G.show() # long time """ @@ -348,15 +342,13 @@ def CompleteGraph(n): sage: g = [] sage: j = [] sage: for i in range(9): - ... k = graphs.CompleteGraph(i+3) - ... g.append(k) - ... + ....: k = graphs.CompleteGraph(i+3) + ....: g.append(k) sage: for i in range(3): - ... n = [] - ... for m in range(3): - ... n.append(g[3*i + m].plot(vertex_size=50, vertex_labels=False)) - ... j.append(n) - ... + ....: n = [] + ....: for m in range(3): + ....: n.append(g[3*i + m].plot(vertex_size=50, vertex_labels=False)) + ....: j.append(n) sage: G = sage.plot.graphics.GraphicsArray(j) sage: G.show() # long time @@ -366,16 +358,14 @@ def CompleteGraph(n): sage: g = [] sage: j = [] sage: for i in range(9): - ... spr = networkx.complete_graph(i+3) - ... k = Graph(spr) - ... g.append(k) - ... + ....: spr = networkx.complete_graph(i+3) + ....: k = Graph(spr) + ....: g.append(k) sage: for i in range(3): - ... n = [] - ... for m in range(3): - ... n.append(g[3*i + m].plot(vertex_size=50, vertex_labels=False)) - ... j.append(n) - ... + ....: n = [] + ....: for m in range(3): + ....: n.append(g[3*i + m].plot(vertex_size=50, vertex_labels=False)) + ....: j.append(n) sage: G = sage.plot.graphics.GraphicsArray(j) sage: G.show() # long time @@ -473,15 +463,13 @@ def CompleteBipartiteGraph(n1, n2): sage: g = [] sage: j = [] sage: for i in range(9): - ... k = graphs.CompleteBipartiteGraph(i+1,4) - ... g.append(k) - ... + ....: k = graphs.CompleteBipartiteGraph(i+1,4) + ....: g.append(k) sage: for i in range(3): - ... n = [] - ... for m in range(3): - ... n.append(g[3*i + m].plot(vertex_size=50, vertex_labels=False)) - ... j.append(n) - ... + ....: n = [] + ....: for m in range(3): + ....: n.append(g[3*i + m].plot(vertex_size=50, vertex_labels=False)) + ....: j.append(n) sage: G = sage.plot.graphics.GraphicsArray(j) sage: G.show() # long time @@ -490,16 +478,14 @@ def CompleteBipartiteGraph(n1, n2): sage: g = [] sage: j = [] sage: for i in range(9): - ... spr = networkx.complete_bipartite_graph(i+1,4) - ... k = Graph(spr) - ... g.append(k) - ... + ....: spr = networkx.complete_bipartite_graph(i+1,4) + ....: k = Graph(spr) + ....: g.append(k) sage: for i in range(3): - ... n = [] - ... for m in range(3): - ... n.append(g[3*i + m].plot(vertex_size=50, vertex_labels=False)) - ... j.append(n) - ... + ....: n = [] + ....: for m in range(3): + ....: n.append(g[3*i + m].plot(vertex_size=50, vertex_labels=False)) + ....: j.append(n) sage: G = sage.plot.graphics.GraphicsArray(j) sage: G.show() # long time @@ -618,19 +604,16 @@ def EmptyGraph(): sage: empty2 = graphs.EmptyGraph() sage: for i in range(5): - ... empty2.add_vertex() # add 5 nodes, labeled 0-4 - ... + ....: empty2.add_vertex() # add 5 nodes, labeled 0-4 0 1 2 3 4 sage: for i in range(3): - ... empty2.add_edge(i,i+1) # add edges {[0:1],[1:2],[2:3]} - ... + ....: empty2.add_edge(i,i+1) # add edges {[0:1],[1:2],[2:3]} sage: for i in range(4)[1:]: - ... empty2.add_edge(4,i) # add edges {[1:4],[2:4],[3:4]} - ... + ....: empty2.add_edge(4,i) # add edges {[1:4],[2:4],[3:4]} sage: empty2.show() # long time """ return graph.Graph(sparse=True) @@ -910,15 +893,13 @@ def LadderGraph(n): sage: g = [] sage: j = [] sage: for i in range(9): - ... k = graphs.LadderGraph(i+2) - ... g.append(k) - ... + ....: k = graphs.LadderGraph(i+2) + ....: g.append(k) sage: for i in range(3): - ... n = [] - ... for m in range(3): - ... n.append(g[3*i + m].plot(vertex_size=50, vertex_labels=False)) - ... j.append(n) - ... + ....: n = [] + ....: for m in range(3): + ....: n.append(g[3*i + m].plot(vertex_size=50, vertex_labels=False)) + ....: j.append(n) sage: G = sage.plot.graphics.GraphicsArray(j) sage: G.show() # long time """ @@ -962,15 +943,13 @@ def LollipopGraph(n1, n2): sage: g = [] sage: j = [] sage: for i in range(6): - ... k = graphs.LollipopGraph(i+3,4) - ... g.append(k) - ... + ....: k = graphs.LollipopGraph(i+3,4) + ....: g.append(k) sage: for i in range(2): - ... n = [] - ... for m in range(3): - ... n.append(g[3*i + m].plot(vertex_size=50, vertex_labels=False)) - ... j.append(n) - ... + ....: n = [] + ....: for m in range(3): + ....: n.append(g[3*i + m].plot(vertex_size=50, vertex_labels=False)) + ....: j.append(n) sage: G = sage.plot.graphics.GraphicsArray(j) sage: G.show() # long time """ @@ -1130,15 +1109,13 @@ def StarGraph(n): sage: g = [] sage: j = [] sage: for i in range(9): - ... k = graphs.StarGraph(i+3) - ... g.append(k) - ... + ....: k = graphs.StarGraph(i+3) + ....: g.append(k) sage: for i in range(3): - ... n = [] - ... for m in range(3): - ... n.append(g[3*i + m].plot(vertex_size=50, vertex_labels=False)) - ... j.append(n) - ... + ....: n = [] + ....: for m in range(3): + ....: n.append(g[3*i + m].plot(vertex_size=50, vertex_labels=False)) + ....: j.append(n) sage: G = sage.plot.graphics.GraphicsArray(j) sage: G.show() # long time @@ -1149,16 +1126,14 @@ def StarGraph(n): sage: g = [] sage: j = [] sage: for i in range(9): - ... spr = networkx.star_graph(i+3) - ... k = Graph(spr) - ... g.append(k) - ... + ....: spr = networkx.star_graph(i+3) + ....: k = Graph(spr) + ....: g.append(k) sage: for i in range(3): - ... n = [] - ... for m in range(3): - ... n.append(g[3*i + m].plot(vertex_size=50, vertex_labels=False)) - ... j.append(n) - ... + ....: n = [] + ....: for m in range(3): + ....: n.append(g[3*i + m].plot(vertex_size=50, vertex_labels=False)) + ....: j.append(n) sage: G = sage.plot.graphics.GraphicsArray(j) sage: G.show() # long time """ diff --git a/src/sage/graphs/generators/chessboard.py b/src/sage/graphs/generators/chessboard.py index 3eeb7099768..5a71747f7a6 100644 --- a/src/sage/graphs/generators/chessboard.py +++ b/src/sage/graphs/generators/chessboard.py @@ -285,13 +285,13 @@ def QueenGraph(dim_list, radius=None, relabel=False): The Queen Graph can be obtained from the Rook Graph and the Bishop Graph:: sage: for d in xrange(3,12): # long time - ... for r in xrange(1,d+1): - ... G = graphs.QueenGraph([d,d],radius=r) - ... H = graphs.RookGraph([d,d],radius=r) - ... B = graphs.BishopGraph([d,d],radius=r) - ... H.add_edges(B.edges()) - ... if not G.is_isomorphic(H): - ... print "that's not good!" + ....: for r in xrange(1,d+1): + ....: G = graphs.QueenGraph([d,d],radius=r) + ....: H = graphs.RookGraph([d,d],radius=r) + ....: B = graphs.BishopGraph([d,d],radius=r) + ....: H.add_edges(B.edges()) + ....: if not G.is_isomorphic(H): + ....: print "that's not good!" """ G, dimstr = ChessboardGraphGenerator(dim_list, @@ -520,12 +520,12 @@ def BishopGraph(dim_list, radius=None, relabel=False): The Bishop Graph can be obtained from Knight Graphs:: sage: for d in xrange(3,12): # long time - ... H = Graph() - ... for r in xrange(1,d+1): - ... B = graphs.BishopGraph([d,d],radius=r) - ... H.add_edges( graphs.KnightGraph([d,d],one=r,two=r).edges() ) - ... if not B.is_isomorphic(H): - ... print "that's not good!" + ....: H = Graph() + ....: for r in xrange(1,d+1): + ....: B = graphs.BishopGraph([d,d],radius=r) + ....: H.add_edges( graphs.KnightGraph([d,d],one=r,two=r).edges() ) + ....: if not B.is_isomorphic(H): + ....: print "that's not good!" """ G, dimstr = ChessboardGraphGenerator(dim_list, diff --git a/src/sage/graphs/generators/degree_sequence.py b/src/sage/graphs/generators/degree_sequence.py index 2c7a145c776..02117185b20 100644 --- a/src/sage/graphs/generators/degree_sequence.py +++ b/src/sage/graphs/generators/degree_sequence.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- r""" -Degree Sequence +Graphs with a given degree sequence The methods defined here appear in :mod:`sage.graphs.graph_generators`. """ @@ -17,15 +17,9 @@ # import from Sage library from sage.graphs.graph import Graph -from sage.graphs import graph -from math import sin, cos, pi from sage.misc.randstate import current_randstate -################################################################################ -# Graphs with a given degree sequence -################################################################################ - def DegreeSequence(deg_sequence): """ Returns a graph with the given degree sequence. Raises a NetworkX @@ -35,11 +29,10 @@ def DegreeSequence(deg_sequence): which constructs a simple graph by connecting vertices of highest degree to other vertices of highest degree, resorting the remaining vertices by degree and repeating the process. See Theorem 1.4 in - [1]. + [CharLes1996]_. INPUT: - - ``deg_sequence`` - a list of integers with each entry corresponding to the degree of a different vertex. @@ -68,11 +61,11 @@ def DegreeSequence(deg_sequence): REFERENCE: - - [1] Chartrand, G. and Lesniak, L. Graphs and Digraphs. + .. [CharLes1996] Chartrand, G. and Lesniak, L.: Graphs and Digraphs. Chapman and Hall/CRC, 1996. """ import networkx - return graph.Graph(networkx.havel_hakimi_graph([int(i) for i in deg_sequence])) + return Graph(networkx.havel_hakimi_graph([int(i) for i in deg_sequence])) def DegreeSequenceBipartite(s1 ,s2 ): r""" @@ -126,7 +119,6 @@ def DegreeSequenceBipartite(s1 ,s2 ): """ from sage.combinat.integer_vector import gale_ryser_theorem - from sage.graphs.graph import Graph from sage.graphs.bipartite_graph import BipartiteGraph s1 = sorted(s1, reverse = True) @@ -150,7 +142,6 @@ def DegreeSequenceConfigurationModel(deg_sequence, seed=None): INPUT: - - ``deg_sequence`` - a list of integers with each entry corresponding to the expected degree of a different vertex. @@ -177,13 +168,13 @@ def DegreeSequenceConfigurationModel(deg_sequence, seed=None): REFERENCE: - - [1] Newman, M.E.J. The Structure and function of complex + .. [Newman2003] Newman, M.E.J. The Structure and function of complex networks, SIAM Review vol. 45, no. 2 (2003), pp. 167-256. """ if seed is None: seed = current_randstate().long_seed() import networkx - return graph.Graph(networkx.configuration_model([int(i) for i in deg_sequence], seed=seed), loops=True, multiedges=True, sparse=True) + return Graph(networkx.configuration_model([int(i) for i in deg_sequence], seed=seed), loops=True, multiedges=True, sparse=True) def DegreeSequenceTree(deg_sequence): """ @@ -195,7 +186,6 @@ def DegreeSequenceTree(deg_sequence): INPUT: - - ``deg_sequence`` - a list of integers with each entry corresponding to the expected degree of a different vertex. @@ -206,7 +196,7 @@ def DegreeSequenceTree(deg_sequence): sage: G.show() # long time """ import networkx - return graph.Graph(networkx.degree_sequence_tree([int(i) for i in deg_sequence])) + return Graph(networkx.degree_sequence_tree([int(i) for i in deg_sequence])) def DegreeSequenceExpected(deg_sequence, seed=None): """ @@ -219,7 +209,6 @@ def DegreeSequenceExpected(deg_sequence, seed=None): INPUT: - - ``deg_sequence`` - a list of integers with each entry corresponding to the expected degree of a different vertex. @@ -235,11 +224,11 @@ def DegreeSequenceExpected(deg_sequence, seed=None): REFERENCE: - - [1] Chung, Fan and Lu, L. Connected components in random - graphs with given expected degree - sequences. Ann. Combinatorics (6), 2002 pp. 125-145. + .. [ChungLu2002] Chung, Fan and Lu, L. Connected components in random + graphs with given expected degree sequences. + Ann. Combinatorics (6), 2002 pp. 125-145. """ if seed is None: seed = current_randstate().long_seed() import networkx - return graph.Graph(networkx.expected_degree_graph([int(i) for i in deg_sequence], seed=seed), loops=True) + return Graph(networkx.expected_degree_graph([int(i) for i in deg_sequence], seed=seed), loops=True) diff --git a/src/sage/graphs/generators/families.py b/src/sage/graphs/generators/families.py index 342fe45a674..13cadd521a3 100644 --- a/src/sage/graphs/generators/families.py +++ b/src/sage/graphs/generators/families.py @@ -136,7 +136,7 @@ def JohnsonGraph(n, k): True """ - g=graph.Graph(name="Johnson graph with parameters "+str(n)+","+str(k)) + g = Graph(name="Johnson graph with parameters "+str(n)+","+str(k)) from sage.combinat.subset import Set, Subsets S = Set(range(n)) @@ -191,7 +191,7 @@ def KneserGraph(n,k): if not (k>0 and k<=n): raise ValueError, "Parameter k should be a strictly positive integer inferior to n" - g=graph.Graph(name="Kneser graph with parameters "+str(n)+","+str(k)) + g = Graph(name="Kneser graph with parameters "+str(n)+","+str(k)) from sage.combinat.subset import Subsets if k>n/2: @@ -290,7 +290,7 @@ def BalancedTree(r, h): Balanced tree: Graph on 0 vertices """ import networkx - return graph.Graph(networkx.balanced_tree(r, h), name="Balanced tree") + return Graph(networkx.balanced_tree(r, h), name="Balanced tree") def BarbellGraph(n1, n2): r""" @@ -433,7 +433,7 @@ def BarbellGraph(n1, n2): import networkx G = networkx.barbell_graph(n1, n2) - return graph.Graph(G, pos=pos_dict, name="Barbell graph") + return Graph(G, pos=pos_dict, name="Barbell graph") def BubbleSortGraph(n): r""" @@ -495,7 +495,7 @@ def BubbleSortGraph(n): "Invalid number of symbols to permute, n should be >= 1") if n == 1: from sage.graphs.generators.basic import CompleteGraph - return graph.Graph(CompleteGraph(n), name="Bubble sort") + return Graph(CompleteGraph(n), name="Bubble sort") from sage.combinat.permutation import Permutations #create set from which to permute label_set = [str(i) for i in xrange(1, n + 1)] @@ -515,7 +515,7 @@ def BubbleSortGraph(n): v[i], v[i + 1] = v[i + 1], v[i] #add adjacency dict d[''.join(v)] = tmp_dict - return graph.Graph(d, name="Bubble sort") + return Graph(d, name="Bubble sort") def CirculantGraph(n, adjacency): r""" @@ -620,7 +620,7 @@ def CirculantGraph(n, adjacency): if not isinstance(adjacency,list): adjacency=[adjacency] - G=graph.Graph(n, name="Circulant graph ("+str(adjacency)+")") + G = Graph(n, name="Circulant graph ("+str(adjacency)+")") _circle_embedding(G, range(n)) for v in G: @@ -703,7 +703,7 @@ def CubeGraph(n): p,pn = pn,{} # construct the graph - r = graph.Graph(name="%d-Cube"%n) + r = Graph(name="%d-Cube"%n) r.add_vertices(d.keys()) for u,L in d.iteritems(): for v in L: @@ -730,7 +730,7 @@ def DorogovtsevGoltsevMendesGraph(n): (2002). """ import networkx - return graph.Graph(networkx.dorogovtsev_goltsev_mendes_graph(n),\ + return Graph(networkx.dorogovtsev_goltsev_mendes_graph(n),\ name="Dorogovtsev-Goltsev-Mendes Graph, %d-th generation"%n) def FoldedCubeGraph(n): @@ -893,7 +893,7 @@ def FriendshipGraph(n): edge_dict.setdefault(N - 2, [0, N - 1]) pos_dict.setdefault(N - 2, [RR(cos(d * (N-2))), RR(sin(d * (N-2)))]) pos_dict.setdefault(N - 1, [0, 0]) - return graph.Graph(edge_dict, pos=pos_dict, name="Friendship graph") + return Graph(edge_dict, pos=pos_dict, name="Friendship graph") def FuzzyBallGraph(partition, q): r""" @@ -973,7 +973,7 @@ def FibonacciTree(n): - Harald Schilly and Yann Laigle-Chapuy (2010-03-25) """ - T = graph.Graph(name="Fibonacci-Tree-%d"%n) + T = Graph(name="Fibonacci-Tree-%d"%n) if n == 1: T.add_vertex(0) if n < 2: return T @@ -1052,7 +1052,7 @@ def GeneralizedPetersenGraph(n,k): if (k < 1 or k>((n-1)/2)): raise ValueError("k must be in 1<= k <=floor((n-1)/2)") pos_dict = {} - G=Graph() + G = Graph() for i in range(n): x = float(cos((pi/2) + ((2*pi)/n)*i)) y = float(sin((pi/2) + ((2*pi)/n)*i)) @@ -1065,7 +1065,7 @@ def GeneralizedPetersenGraph(n,k): G.add_edge(i, (i+1) % n) G.add_edge(i, i+n) G.add_edge(i+n, n + (i+k) % n) - return graph.Graph(G, pos=pos_dict, name="Generalized Petersen graph (n="+str(n)+",k="+str(k)+")") + return Graph(G, pos=pos_dict, name="Generalized Petersen graph (n="+str(n)+",k="+str(k)+")") def HararyGraph( k, n ): r""" @@ -1166,7 +1166,7 @@ def HyperStarGraph(n,k): L[i]='1' comb_to_str[tuple(c)] = ''.join(L) - g=graph.Graph(name="HS(%d,%d)"%(n,k)) + g = Graph(name="HS(%d,%d)"%(n,k)) g.add_vertices(comb_to_str.values()) for c in Combinations(range(1,n),k): # 0 is not in c @@ -1255,8 +1255,8 @@ def LCFGraph(n, shift_list, repeats): x = float(cos(pi/2 + ((2*pi)/n)*i)) y = float(sin(pi/2 + ((2*pi)/n)*i)) pos_dict[i] = [x,y] - return graph.Graph(networkx.LCF_graph(n, shift_list, repeats),\ - pos=pos_dict, name="LCF Graph") + return Graph(networkx.LCF_graph(n, shift_list, repeats),\ + pos=pos_dict, name="LCF Graph") def MycielskiGraph(k=1, relabel=True): r""" @@ -1311,7 +1311,7 @@ def MycielskiGraph(k=1, relabel=True): http://mathworld.wolfram.com/MycielskiGraph.html """ - g = graph.Graph() + g = Graph() g.name("Mycielski Graph " + str(k)) if k<0: @@ -1436,7 +1436,7 @@ def NKStarGraph(n,k): tmp_dict[vert] = None v[0] = tmp_bit d["".join(v)] = tmp_dict - return graph.Graph(d, name="(%d,%d)-star"%(n,k)) + return Graph(d, name="(%d,%d)-star"%(n,k)) def NStarGraph(n): r""" @@ -1485,7 +1485,7 @@ def NStarGraph(n): #swap back v[0], v[i] = v[i], v[0] d["".join(v)] = tmp_dict - return graph.Graph(d, name = "%d-star"%n) + return Graph(d, name = "%d-star"%n) def OddGraph(n): r""" @@ -1547,7 +1547,7 @@ def PaleyGraph(q): from sage.rings.finite_rings.constructor import FiniteField assert q.is_prime_power(), "Parameter q must be a prime power" assert mod(q,4)==1, "Parameter q must be congruent to 1 mod 4" - g = graph.Graph([FiniteField(q,'a'), lambda i,j: (i-j).is_square()], + g = Graph([FiniteField(q,'a'), lambda i,j: (i-j).is_square()], loops=False, name = "Paley graph with parameter %d"%q) return g @@ -1839,7 +1839,7 @@ def HanoiTowerGraph(pegs, disks, labels=True, positions=True): for freea, freeb in Subsets(emptypegs, 2): edges.append([freea*nverts+state,freeb*nverts+state]) - H = graph.Graph({}, loops=False, multiedges=False) + H = Graph({}, loops=False, multiedges=False) H.add_edges(edges) @@ -2053,7 +2053,7 @@ def WheelGraph(n): pos_dict[i] = (x,y) import networkx G = networkx.wheel_graph(n) - return graph.Graph(G, pos=pos_dict, name="Wheel graph") + return Graph(G, pos=pos_dict, name="Wheel graph") def trees(vertices): r""" diff --git a/src/sage/graphs/generators/platonic_solids.py b/src/sage/graphs/generators/platonic_solids.py index 5ad684732f0..710269c9fe3 100644 --- a/src/sage/graphs/generators/platonic_solids.py +++ b/src/sage/graphs/generators/platonic_solids.py @@ -17,9 +17,7 @@ # import from Sage library from sage.graphs.graph import Graph -from sage.graphs import graph from math import sin, cos, pi -from sage.graphs.graph_plot import _circle_embedding, _line_embedding def TetrahedralGraph(): """ @@ -59,16 +57,16 @@ def TetrahedralGraph(): sage: g = [tetra_pos, tetra_spring, wheel, complete] sage: j = [] sage: for i in range(2): - ... n = [] - ... for m in range(2): - ... n.append(g[i + m].plot(vertex_size=50, vertex_labels=False)) - ... j.append(n) + ....: n = [] + ....: for m in range(2): + ....: n.append(g[i + m].plot(vertex_size=50, vertex_labels=False)) + ....: j.append(n) sage: G = sage.plot.graphics.GraphicsArray(j) sage: G.show() # long time """ import networkx G = networkx.tetrahedral_graph() - return graph.Graph(G, name="Tetrahedron", pos = + return Graph(G, name="Tetrahedron", pos = { 0 : (0, 0), 1 : (0, 1), 2 : (cos(3.5*pi/3), sin(3.5*pi/3)), @@ -106,20 +104,17 @@ def HexahedralGraph(): sage: g = [] sage: j = [] sage: for i in range(9): - ... k = graphs.HexahedralGraph() - ... g.append(k) - ... + ....: k = graphs.HexahedralGraph() + ....: g.append(k) sage: for i in range(3): - ... n = [] - ... for m in range(3): - ... n.append(g[3*i + m].plot(vertex_size=50, vertex_labels=False)) - ... j.append(n) - ... + ....: n = [] + ....: for m in range(3): + ....: n.append(g[3*i + m].plot(vertex_size=50, vertex_labels=False)) + ....: j.append(n) sage: G = sage.plot.graphics.GraphicsArray(j) sage: G.show() # long time """ - return graph.Graph({0:[1,3,4], 1:[2,5], 2:[3,6], 3:[7], 4:[5,7],\ - 5:[6], 6:[7]}, + return Graph({0:[1,3,4], 1:[2,5], 2:[3,6], 3:[7], 4:[5,7], 5:[6], 6:[7]}, name="Hexahedron", pos = { 0 : (0,0), @@ -164,15 +159,13 @@ def OctahedralGraph(): sage: g = [] sage: j = [] sage: for i in range(9): - ... k = graphs.OctahedralGraph() - ... g.append(k) - ... + ....: k = graphs.OctahedralGraph() + ....: g.append(k) sage: for i in range(3): - ... n = [] - ... for m in range(3): - ... n.append(g[3*i + m].plot(vertex_size=50, vertex_labels=False)) - ... j.append(n) - ... + ....: n = [] + ....: for m in range(3): + ....: n.append(g[3*i + m].plot(vertex_size=50, vertex_labels=False)) + ....: j.append(n) sage: G = sage.plot.graphics.GraphicsArray(j) sage: G.show() # long time """ @@ -190,8 +183,7 @@ def OctahedralGraph(): i = i + .25 pos[v] = (r2*cos(i*2*pi/3),r2*sin(i*2*pi/3)) - - return graph.Graph(G, name="Octahedron", pos=pos) + return Graph(G, name="Octahedron", pos=pos) def IcosahedralGraph(): """ @@ -226,15 +218,13 @@ def IcosahedralGraph(): sage: g = [] sage: j = [] sage: for i in range(9): - ... k = graphs.IcosahedralGraph() - ... g.append(k) - ... + ....: k = graphs.IcosahedralGraph() + ....: g.append(k) sage: for i in range(3): - ... n = [] - ... for m in range(3): - ... n.append(g[3*i + m].plot(vertex_size=50, vertex_labels=False)) - ... j.append(n) - ... + ....: n = [] + ....: for m in range(3): + ....: n.append(g[3*i + m].plot(vertex_size=50, vertex_labels=False)) + ....: j.append(n) sage: G = sage.plot.graphics.GraphicsArray(j) sage: G.show() # long time """ @@ -252,7 +242,7 @@ def IcosahedralGraph(): i = i + .5 pos[v] = (r2*cos(i*pi/3),r2*sin(i*pi/3)) - return graph.Graph(G, name="Icosahedron", pos = pos) + return Graph(G, name="Icosahedron", pos = pos) def DodecahedralGraph(): """ @@ -285,15 +275,13 @@ def DodecahedralGraph(): sage: g = [] sage: j = [] sage: for i in range(9): - ... k = graphs.DodecahedralGraph() - ... g.append(k) - ... + ....: k = graphs.DodecahedralGraph() + ....: g.append(k) sage: for i in range(3): - ... n = [] - ... for m in range(3): - ... n.append(g[3*i + m].plot(vertex_size=50, vertex_labels=False)) - ... j.append(n) - ... + ....: n = [] + ....: for m in range(3): + ....: n.append(g[3*i + m].plot(vertex_size=50, vertex_labels=False)) + ....: j.append(n) sage: G = sage.plot.graphics.GraphicsArray(j) sage: G.show() # long time """ @@ -322,5 +310,5 @@ def DodecahedralGraph(): i = i + .75 pos[v] = (r4*cos(i*2*pi/5),r4*sin(i*2*pi/5)) - return graph.Graph(G, name="Dodecahedron", pos=pos) + return Graph(G, name="Dodecahedron", pos=pos) diff --git a/src/sage/graphs/generators/random.py b/src/sage/graphs/generators/random.py index 17208450bd6..42604a3389b 100644 --- a/src/sage/graphs/generators/random.py +++ b/src/sage/graphs/generators/random.py @@ -16,8 +16,6 @@ # import from Sage library from sage.graphs.graph import Graph -from sage.graphs import graph -from math import sin, cos, pi from sage.misc.randstate import current_randstate def RandomGNP(n, p, seed=None, fast=True, method='Sage'): @@ -67,8 +65,7 @@ def RandomGNP(n, p, seed=None, fast=True, method='Sage'): sage: graphs.RandomGNP(6, .4).edges(labels=False) [(0, 1), (0, 5), (1, 2), (2, 4), (3, 4), (3, 5), (4, 5)] - We plot a random graph on 12 nodes with probability - `p = .71`:: + We plot a random graph on 12 nodes with probability `p = .71`:: sage: gnp = graphs.RandomGNP(12,.71) sage: gnp.show() # long time @@ -78,15 +75,13 @@ def RandomGNP(n, p, seed=None, fast=True, method='Sage'): sage: g = [] sage: j = [] sage: for i in range(9): - ... k = graphs.RandomGNP(i+3,.43) - ... g.append(k) - ... + ....: k = graphs.RandomGNP(i+3,.43) + ....: g.append(k) sage: for i in range(3): - ... n = [] - ... for m in range(3): - ... n.append(g[3*i + m].plot(vertex_size=50, vertex_labels=False)) - ... j.append(n) - ... + ....: n = [] + ....: for m in range(3): + ....: n.append(g[3*i + m].plot(vertex_size=50, vertex_labels=False)) + ....: j.append(n) sage: G = sage.plot.graphics.GraphicsArray(j) sage: G.show() # long time sage: graphs.RandomGNP(4,1) @@ -121,7 +116,7 @@ def RandomGNP(n, p, seed=None, fast=True, method='Sage'): G = networkx.fast_gnp_random_graph(n, p, seed=seed) else: G = networkx.gnp_random_graph(n, p, seed=seed) - return graph.Graph(G) + return Graph(G) elif method in ['Sage', 'sage']: # We use the Sage generator from sage.graphs.graph_generators_pyx import RandomGNP as sageGNP @@ -167,15 +162,13 @@ def RandomBarabasiAlbert(n, m, seed=None): sage: g = [] sage: j = [] sage: for i in range(1,10): - ... k = graphs.RandomBarabasiAlbert(i+3, 3) - ... g.append(k) - ... + ....: k = graphs.RandomBarabasiAlbert(i+3, 3) + ....: g.append(k) sage: for i in range(3): - ... n = [] - ... for m in range(3): - ... n.append(g[3*i + m].plot(vertex_size=50, vertex_labels=False)) - ... j.append(n) - ... + ....: n = [] + ....: for m in range(3): + ....: n.append(g[3*i + m].plot(vertex_size=50, vertex_labels=False)) + ....: j.append(n) sage: G = sage.plot.graphics.GraphicsArray(j) sage: G.show() # long time @@ -183,7 +176,7 @@ def RandomBarabasiAlbert(n, m, seed=None): if seed is None: seed = current_randstate().long_seed() import networkx - return graph.Graph(networkx.barabasi_albert_graph(n,m,seed=seed)) + return Graph(networkx.barabasi_albert_graph(n,m,seed=seed)) def RandomBipartite(n1,n2, p): r""" @@ -225,7 +218,6 @@ def RandomBipartite(n1,n2, p): raise ValueError, "n1 and n2 should be integers strictly greater than 0" from numpy.random import uniform - from sage.graphs.all import Graph g=Graph(name="Random bipartite graph of size "+str(n1) +"+"+str(n2)+" with edge probability "+str(p)) @@ -256,7 +248,6 @@ def RandomGNM(n, m, dense=False, seed=None): INPUT: - - ``n`` - number of vertices. - ``m`` - number of edges. @@ -285,15 +276,13 @@ def RandomGNM(n, m, dense=False, seed=None): sage: g = [] sage: j = [] sage: for i in range(9): - ... k = graphs.RandomGNM(i+3, i^2-i) - ... g.append(k) - ... + ....: k = graphs.RandomGNM(i+3, i^2-i) + ....: g.append(k) sage: for i in range(3): - ... n = [] - ... for m in range(3): - ... n.append(g[3*i + m].plot(vertex_size=50, vertex_labels=False)) - ... j.append(n) - ... + ....: n = [] + ....: for m in range(3): + ....: n.append(g[3*i + m].plot(vertex_size=50, vertex_labels=False)) + ....: j.append(n) sage: G = sage.plot.graphics.GraphicsArray(j) sage: G.show() # long time """ @@ -301,9 +290,9 @@ def RandomGNM(n, m, dense=False, seed=None): seed = current_randstate().long_seed() import networkx if dense: - return graph.Graph(networkx.dense_gnm_random_graph(n, m, seed=seed)) + return Graph(networkx.dense_gnm_random_graph(n, m, seed=seed)) else: - return graph.Graph(networkx.gnm_random_graph(n, m, seed=seed)) + return Graph(networkx.gnm_random_graph(n, m, seed=seed)) def RandomNewmanWattsStrogatz(n, k, p, seed=None): """ @@ -320,7 +309,6 @@ def RandomNewmanWattsStrogatz(n, k, p, seed=None): INPUT: - - ``n`` - number of vertices. - ``k`` - each vertex is connected to its k nearest @@ -345,14 +333,14 @@ def RandomNewmanWattsStrogatz(n, k, p, seed=None): REFERENCE: - - [1] Newman, M.E.J., Watts, D.J. and Strogatz, S.H. Random + .. [NWS99] Newman, M.E.J., Watts, D.J. and Strogatz, S.H. Random graph models of social networks. Proc. Nat. Acad. Sci. USA 99, 2566-2572. """ if seed is None: seed = current_randstate().long_seed() import networkx - return graph.Graph(networkx.newman_watts_strogatz_graph(n, k, p, seed=seed)) + return Graph(networkx.newman_watts_strogatz_graph(n, k, p, seed=seed)) def RandomHolmeKim(n, m, p, seed=None): """ @@ -362,7 +350,6 @@ def RandomHolmeKim(n, m, p, seed=None): INPUT: - - ``n`` - number of vertices. - ``m`` - number of random edges to add for each new @@ -404,14 +391,13 @@ def RandomHolmeKim(n, m, p, seed=None): REFERENCE: - - [1] Holme, P. and Kim, B.J. Growing scale-free networks with - tunable clustering, Phys. Rev. E (2002). vol 65, no 2, - 026107. + .. [HolmeKim2002] Holme, P. and Kim, B.J. Growing scale-free networks + with tunable clustering, Phys. Rev. E (2002). vol 65, no 2, 026107. """ if seed is None: seed = current_randstate().long_seed() import networkx - return graph.Graph(networkx.powerlaw_cluster_graph(n, m, p, seed=seed)) + return Graph(networkx.powerlaw_cluster_graph(n, m, p, seed=seed)) def RandomInterval(n): """ @@ -475,7 +461,6 @@ def RandomLobster(n, p, q, seed=None): INPUT: - - ``n`` - expected number of vertices in the backbone - ``p`` - probability of adding an edge to the @@ -501,7 +486,7 @@ def RandomLobster(n, p, q, seed=None): if seed is None: seed = current_randstate().long_seed() import networkx - return graph.Graph(networkx.random_lobster(n, p, q, seed=seed)) + return Graph(networkx.random_lobster(n, p, q, seed=seed)) def RandomTree(n): """ @@ -534,12 +519,12 @@ def RandomTree(n): Ensuring that we encounter no unexpected surprise :: sage: all( graphs.RandomTree(10).is_tree() - ... for i in range(100) ) + ....: for i in range(100) ) True """ from sage.misc.prandom import randint - g = graph.Graph() + g = Graph() # create random Prufer code code = [ randint(0,n-1) for i in xrange(n-2) ] @@ -582,7 +567,6 @@ def RandomTreePowerlaw(n, gamma=3, tries=100, seed=None): INPUT: - - ``n`` - number of vertices - ``gamma`` - exponent of power law @@ -605,13 +589,13 @@ def RandomTreePowerlaw(n, gamma=3, tries=100, seed=None): sage: G = graphs.RandomTreePowerlaw(15, 2) sage: if G: - ... G.show() # random output, long time + ....: G.show() # random output, long time """ if seed is None: seed = current_randstate().long_seed() import networkx try: - return graph.Graph(networkx.random_powerlaw_tree(n, gamma, seed=seed, tries=tries)) + return Graph(networkx.random_powerlaw_tree(n, gamma, seed=seed, tries=tries)) except networkx.NetworkXError: return False @@ -624,7 +608,6 @@ def RandomRegular(d, n, seed=None): INPUT: - - ``n`` - number of vertices - ``d`` - degree @@ -644,17 +627,17 @@ def RandomRegular(d, n, seed=None): sage: G = graphs.RandomRegular(3, 20) sage: if G: - ... G.show() # random output, long time + ....: G.show() # random output, long time REFERENCES: - - [1] Kim, Jeong Han and Vu, Van H. Generating random regular + .. [KimVu2003] Kim, Jeong Han and Vu, Van H. Generating random regular graphs. Proc. 35th ACM Symp. on Thy. of Comp. 2003, pp 213-222. ACM Press, San Diego, CA, USA. http://doi.acm.org/10.1145/780542.780576 - - [2] Steger, A. and Wormald, N. Generating random regular - graphs quickly. Prob. and Comp. 8 (1999), pp 377-396. + .. [StegerWormald1999] Steger, A. and Wormald, N. Generating random + regular graphs quickly. Prob. and Comp. 8 (1999), pp 377-396. """ if seed is None: seed = current_randstate().long_seed() @@ -662,7 +645,7 @@ def RandomRegular(d, n, seed=None): try: N = networkx.random_regular_graph(d, n, seed=seed) if N is False: return False - return graph.Graph(N, sparse=True) + return Graph(N, sparse=True) except StandardError: return False @@ -672,7 +655,6 @@ def RandomShell(constructor, seed=None): INPUT: - - ``constructor`` - a list of 3-tuples (n,m,d), each representing a shell @@ -696,5 +678,5 @@ def RandomShell(constructor, seed=None): if seed is None: seed = current_randstate().long_seed() import networkx - return graph.Graph(networkx.random_shell_graph(constructor, seed=seed)) + return Graph(networkx.random_shell_graph(constructor, seed=seed)) diff --git a/src/sage/graphs/generators/smallgraphs.py b/src/sage/graphs/generators/smallgraphs.py index c24accb87f3..e74feef47b4 100644 --- a/src/sage/graphs/generators/smallgraphs.py +++ b/src/sage/graphs/generators/smallgraphs.py @@ -18,7 +18,6 @@ # import from Sage library from sage.graphs.graph import Graph -from sage.graphs import graph from math import sin, cos, pi from sage.graphs.graph_plot import _circle_embedding, _line_embedding @@ -413,15 +412,15 @@ def HallJankoGraph(from_string=True): sage: nu = set(g.neighbors(0)) sage: for v in range(1, 100): - ... if v in nu: - ... expected = 14 - ... else: - ... expected = 12 - ... nv = set(g.neighbors(v)) - ... nv.discard(0) - ... if len(nu & nv) != expected: - ... print "Something is wrong here!!!" - ... break + ....: if v in nu: + ....: expected = 14 + ....: else: + ....: expected = 12 + ....: nv = set(g.neighbors(v)) + ....: nv.discard(0) + ....: if len(nu & nv) != expected: + ....: print "Something is wrong here!!!" + ....: break Some other properties that we know how to check:: @@ -483,7 +482,7 @@ def HallJankoGraph(from_string=True): "HB`CQCp[WFQGgIQgkJQ{rLbc{Nc@APsdLRt@PSt\\WUtt_Wn") if from_string: - g = graph.Graph(string, loops = False, multiedges = False) + g = Graph(string, loops = False, multiedges = False) else: # The following construction is due to version 3 of the ATLAS of @@ -509,7 +508,7 @@ def HallJankoGraph(from_string=True): gap.eval("G := Group([g1,g2]);") edges = gap('Orbit(G,[1,5],OnSets)').sage() - g = graph.Graph([(int(u), int(v)) for u,v in edges]) + g = Graph([(int(u), int(v)) for u,v in edges]) g.relabel() _circle_embedding(g, range(100)) @@ -749,7 +748,7 @@ def Balaban11Cage(embedding = 1): "165": ["162", "163", "164"], "175": ["172", "173", "174"] } - return graph.Graph(edge_dict, pos=pos_dict, name="Balaban 11-cage") + return Graph(edge_dict, pos=pos_dict, name="Balaban 11-cage") elif embedding == 2 or embedding == 3: L = [44, 26, -47, -15, 35, -39, 11, -27, 38, -37, 43, 14, 28, 51, @@ -862,7 +861,7 @@ def BidiakisCube(): 9: [-1, 0], 10: [-0.866025403784439, 0.5], 11: [-0.5, 0.866025403784439]} - return graph.Graph(edge_dict, pos=pos_dict, name="Bidiakis cube") + return Graph(edge_dict, pos=pos_dict, name="Bidiakis cube") def BiggsSmithGraph(embedding=1): r""" @@ -1039,7 +1038,7 @@ def BrinkmannGraph(): 18: [-0.781831482468030, -0.623489801858733], 19: [-0.974927912181824, 0.222520933956315], 20: [-0.433883739117558, 0.900968867902419]} - return graph.Graph(edge_dict, pos=pos_dict, name="Brinkmann graph") + return Graph(edge_dict, pos=pos_dict, name="Brinkmann graph") def BrouwerHaemersGraph(): r""" @@ -1138,7 +1137,7 @@ def BuckyBall(): (48, 52), (49, 53), (49, 57), (50, 51), (50, 52), (51, 53), (54, 55), (54, 56), (55, 57), (56, 58), (57, 59), (58, 59) ] - g = graph.Graph() + g = Graph() g.add_edges(edges) g.name("Bucky Ball") @@ -1265,7 +1264,7 @@ def DoubleStarSnark(): , 29: [25, 22, 15] } - g = graph.Graph(d, pos={}, name="Double star snark") + g = Graph(d, pos={}, name="Double star snark") _circle_embedding(g, range(15), radius=2) _circle_embedding(g, range(15, 30), radius=1.4) @@ -1363,7 +1362,7 @@ def ChvatalGraph(): pos_dict[10] = (0.5, 0) pos_dict[11] = (-0.5, 0) - return graph.Graph(networkx.chvatal_graph(), pos=pos_dict, name="Chvatal graph") + return Graph(networkx.chvatal_graph(), pos=pos_dict, name="Chvatal graph") def ClebschGraph(): r""" @@ -1382,7 +1381,7 @@ def ClebschGraph(): 2 sage: g.show(figsize=[10, 10]) # long time """ - g = graph.Graph(pos={}) + g = Graph(pos={}) x = 0 for i in range(8): g.add_edge(x % 16, (x + 1) % 16) @@ -1419,7 +1418,7 @@ def CoxeterGraph(): 4 sage: g.show(figsize=[10, 10]) # long time """ - g = graph.Graph({ + g = Graph({ 27: [6, 22, 14], 24: [0, 7, 18], 25: [8, 15, 2], @@ -1521,7 +1520,7 @@ def DurerGraph(): 9: [-1, 0], 10: [-0.5, -0.866025403784439], 11: [0.5, -0.866025403784439]} - return graph.Graph(edge_dict, pos=pos_dict, name="Durer graph") + return Graph(edge_dict, pos=pos_dict, name="Durer graph") def DyckGraph(): """ @@ -1614,7 +1613,7 @@ def DyckGraph(): 0O27: [0O16, 0O10, 0O37], 0O37: [0O27, 0O34, 0O32], } - return graph.Graph(edge_dict, pos=pos_dict, name="Dyck graph") + return Graph(edge_dict, pos=pos_dict, name="Dyck graph") def EllinghamHorton54Graph(): r""" @@ -1741,7 +1740,7 @@ def EllinghamHorton78Graph(): sage: g.show(figsize=[10, 10]) # not tested - too long """ - g = graph.Graph({ + g = Graph({ 0: [1, 5, 60], 1: [2, 12], 2: [3, 7], 3: [4, 14], 4: [5, 9], 5: [6], 6: [7, 11], 7: [15], 8: [9, 13, 22], 9: [10], 10: [11, 72], 11: [12], 12: [13], 13: [14], 14: [72], @@ -1851,7 +1850,7 @@ def ErreraGraph(): 11: [13], 13: [15], 14: [16]} - return graph.Graph(edge_dict, name="Errera graph") + return Graph(edge_dict, name="Errera graph") def FlowerSnark(): """ @@ -1893,7 +1892,7 @@ def FlowerSnark(): x = float(cos((pi/2) + ((2*pi)/5)*i)) y = float(sin((pi/2) + ((2*pi)/5)*i)) pos_dict[i] = (x,y) - return graph.Graph({0:[1,14,15],1:[2,11],2:[3,7],3:[2,4,16],4:[5,14], \ + return Graph({0:[1,14,15],1:[2,11],2:[3,7],3:[2,4,16],4:[5,14], \ 5:[6,10],6:[5,7,17],8:[7,9,13],9:[10,18],11:[10,12], \ 12:[13,19],13:[14],15:[19],16:[15,17],18:[17,19]}, \ pos=pos_dict, name="Flower Snark") @@ -2033,7 +2032,7 @@ def FranklinGraph(): 9: [-1, 0], 10: [-0.5, -0.866025403784439], 11: [0.5, -0.866025403784439]} - return graph.Graph(edge_dict, pos=pos_dict, name="Franklin graph") + return Graph(edge_dict, pos=pos_dict, name="Franklin graph") def FruchtGraph(): """ @@ -2076,7 +2075,7 @@ def FruchtGraph(): pos_dict[11] = (0,0) import networkx G = networkx.frucht_graph() - return graph.Graph(G, pos=pos_dict, name="Frucht graph") + return Graph(G, pos=pos_dict, name="Frucht graph") def GoldnerHararyGraph(): r""" @@ -2145,7 +2144,7 @@ def GoldnerHararyGraph(): 9: (-0.5, -0.5), 10: (0, 0)} - return graph.Graph(edge_dict, pos = pos, name="Goldner-Harary graph") + return Graph(edge_dict, pos = pos, name="Goldner-Harary graph") def GrayGraph(embedding=1): r""" @@ -2244,7 +2243,7 @@ def GrotzschGraph(): sage: ag.is_isomorphic(DihedralGroup(5)) True """ - g = graph.Graph() + g = Graph() g.add_vertices(range(11)) edges = []; @@ -2315,7 +2314,7 @@ def HeawoodGraph(): pos_dict[i] = (x,y) import networkx G = networkx.heawood_graph() - return graph.Graph(G, pos=pos_dict, name="Heawood graph") + return Graph(G, pos=pos_dict, name="Heawood graph") def HerschelGraph(): r""" @@ -2384,7 +2383,7 @@ def HerschelGraph(): 8: [-0.5, -0.866025403784439], 9: [0.5, -0.866025403784439], 10: [0, 0]} - return graph.Graph(edge_dict, pos=pos_dict, name="Herschel graph") + return Graph(edge_dict, pos=pos_dict, name="Herschel graph") def HigmanSimsGraph(relabel=True): r""" @@ -2466,7 +2465,7 @@ def HigmanSimsGraph(relabel=True): - Rob Beezer (2009-10-24) """ - HS = graph.Graph() + HS = Graph() HS.name('Higman-Sims graph') # Four groups of either five pentagons, or five pentagrams @@ -2597,7 +2596,7 @@ def HoffmanSingletonGraph(): (-0.904..., 0.425...) """ - H = graph.Graph({ \ + H = Graph({ \ 'q00':['q01'], 'q01':['q02'], 'q02':['q03'], 'q03':['q04'], 'q04':['q00'], \ 'q10':['q11'], 'q11':['q12'], 'q12':['q13'], 'q13':['q14'], 'q14':['q10'], \ 'q20':['q21'], 'q21':['q22'], 'q22':['q23'], 'q23':['q24'], 'q24':['q20'], \ @@ -2666,7 +2665,7 @@ def HoffmanGraph(): sage: g.automorphism_group().cardinality() 48 """ - g = graph.Graph({ + g = Graph({ 0: [1, 7, 8, 13], 1: [2, 9, 14], 2: [3, 8, 10], @@ -2717,7 +2716,7 @@ def HoltGraph(): sage: g.automorphism_group().cardinality() 54 """ - g = graph.Graph(loops=False, name = "Holt graph", pos={}) + g = Graph(loops=False, name = "Holt graph", pos={}) for x in range(9): for y in range(3): g.add_edge((x,y),((4*x+1)%9,(y-1)%3)) @@ -2774,7 +2773,7 @@ def KrackhardtKiteGraph(): pos_dict = {0:(-1,4),1:(1,4),2:(-2,3),3:(0,3),4:(2,3),5:(-1,2),6:(1,2),7:(0,1),8:(0,0),9:(0,-1)} import networkx G = networkx.krackhardt_kite_graph() - return graph.Graph(G, pos=pos_dict, name="Krackhardt Kite Graph") + return Graph(G, pos=pos_dict, name="Krackhardt Kite Graph") def LjubljanaGraph(embedding=1): r""" @@ -3101,7 +3100,7 @@ def MoserSpindle(): 4: [1.90211303259031, 0.618033988749895], 5: [1, 0], 6: [-1, 0]} - return graph.Graph(edge_dict, pos=pos_dict, name="Moser spindle") + return Graph(edge_dict, pos=pos_dict, name="Moser spindle") def NauruGraph(embedding=2): @@ -3176,7 +3175,7 @@ def PappusGraph(): (2/3.0)*float(sin(pi/2 + ((2*pi)/6)*i))] pos_dict[12 + i] = [(1/3.0)*float(cos(pi/2 + ((2*pi)/6)*i)),\ (1/3.0)*float(sin(pi/2 + ((2*pi)/6)*i))] - return graph.Graph({0:[1,5,6],1:[2,7],2:[3,8],3:[4,9],4:[5,10],\ + return Graph({0:[1,5,6],1:[2,7],2:[3,8],3:[4,9],4:[5,10],\ 5:[11],6:[13,17],7:[12,14],8:[13,15],9:[14,16],\ 10:[15,17],11:[12,16],12:[15],13:[16],14:[17]},\ pos=pos_dict, name="Pappus Graph") @@ -3315,8 +3314,8 @@ def ShrikhandeGraph(): sage: G.is_regular(6) True sage: set([ len([x for x in G.neighbors(i) if x in G.neighbors(j)]) - ... for i in range(G.order()) - ... for j in range(i) ]) + ....: for i in range(G.order()) + ....: for j in range(i) ]) set([2]) It is non-planar, and both Hamiltonian and Eulerian:: @@ -3379,7 +3378,7 @@ def ShrikhandeGraph(): 0O17: [0O11, 0O12, 0O14, 0O15, 0O06, 0O00] } - return graph.Graph(edge_dict, pos=pos_dict, name="Shrikhande graph") + return Graph(edge_dict, pos=pos_dict, name="Shrikhande graph") def SylvesterGraph(): """ @@ -3480,7 +3479,7 @@ def ThomsenGraph(): pos_dict = {0:(-1,1),1:(0,1),2:(1,1),3:(-1,0),4:(0,0),5:(1,0)} import networkx G = networkx.complete_bipartite_graph(3,3) - return graph.Graph(G, pos=pos_dict, name="Thomsen graph") + return Graph(G, pos=pos_dict, name="Thomsen graph") def Tutte12Cage(): r""" diff --git a/src/sage/graphs/generators/world_map.py b/src/sage/graphs/generators/world_map.py index 2242f3cea79..364e7c583d4 100644 --- a/src/sage/graphs/generators/world_map.py +++ b/src/sage/graphs/generators/world_map.py @@ -17,8 +17,6 @@ # import from Sage library from sage.graphs.graph import Graph -from sage.graphs import graph -from math import sin, cos, pi def WorldMap(): """ @@ -46,7 +44,6 @@ def WorldMap(): .. [CIA] CIA Factbook 09 https://www.cia.gov/library/publications/the-world-factbook/ """ - from sage.graphs.all import Graph edges = [ ('Afghanistan', 'China', None), ('Afghanistan', 'Iran', None), ('Afghanistan', 'Uzbekistan', None), ('Albania', 'Greece', None), From ca7d67b92855c6570855bf2006d3b008b04b10e4 Mon Sep 17 00:00:00 2001 From: Frederic Chapoton Date: Tue, 9 Jul 2013 21:13:41 +0200 Subject: [PATCH 15/85] Trac #14861: correct broken links --- src/sage/calculus/test_sympy.py | 2 +- src/sage/combinat/designs/block_design.py | 4 ++-- src/sage/combinat/designs/incidence_structures.py | 6 +++--- src/sage/combinat/posets/lattices.py | 2 +- src/sage/combinat/posets/posets.py | 2 +- src/sage/combinat/q_analogues.py | 2 +- src/sage/combinat/tamari_lattices.py | 4 ++-- src/sage/combinat/words/finite_word.py | 2 +- src/sage/functions/transcendental.py | 4 ++-- src/sage/geometry/lattice_polytope.py | 4 ++-- src/sage/geometry/polyhedron/base_ZZ.py | 4 ++-- src/sage/graphs/digraph_generators.py | 4 ++-- src/sage/graphs/generators/basic.py | 2 +- src/sage/graphs/generic_graph.py | 2 +- src/sage/graphs/graph.py | 7 +++---- src/sage/graphs/graph_database.py | 4 ++-- src/sage/groups/matrix_gps/finitely_generated.py | 4 ++-- src/sage/interfaces/maxima.py | 4 ++-- src/sage/modular/arithgroup/arithgroup_perm.py | 9 ++++----- src/sage/rings/polynomial/pbori.pyx | 2 +- src/sage/rings/polynomial/polynomial_modn_dense_ntl.pyx | 2 +- src/sage/schemes/toric/chow_group.py | 4 ++-- 22 files changed, 39 insertions(+), 41 deletions(-) diff --git a/src/sage/calculus/test_sympy.py b/src/sage/calculus/test_sympy.py index b38bfa47e7c..9bb41f44eff 100644 --- a/src/sage/calculus/test_sympy.py +++ b/src/sage/calculus/test_sympy.py @@ -3,7 +3,7 @@ A Sample Session using SymPy In this first part, we do all of the examples in the SymPy tutorial -(http://code.google.com/p/sympy/wiki/Tutorial), but using Sage +(https://github.com/sympy/sympy/wiki/Tutorial), but using Sage instead of SymPy. :: diff --git a/src/sage/combinat/designs/block_design.py b/src/sage/combinat/designs/block_design.py index be7cb02d10b..d91e44feaae 100644 --- a/src/sage/combinat/designs/block_design.py +++ b/src/sage/combinat/designs/block_design.py @@ -22,10 +22,10 @@ REFERENCES: .. [1] Block design from wikipedia, - http://en.wikipedia.org/wiki/Block_design + :wikipedia:`Block_design` .. [2] What is a block design?, - http://designtheory.org/library/extrep/html/node4.html (in 'The + http://designtheory.org/library/extrep/extrep-1.1-html/node4.html (in 'The External Representation of Block Designs' by Peter J. Cameron, Peter Dobcsanyi, John P. Morgan, Leonard H. Soicher) diff --git a/src/sage/combinat/designs/incidence_structures.py b/src/sage/combinat/designs/incidence_structures.py index a1494095746..44e2e24cbd5 100644 --- a/src/sage/combinat/designs/incidence_structures.py +++ b/src/sage/combinat/designs/incidence_structures.py @@ -7,8 +7,8 @@ REFERENCES: .. [1] Block designs and incidence structures from wikipedia, - http://en.wikipedia.org/wiki/Block_design - http://en.wikipedia.org/wiki/Incidence_structure + :wikipedia:`Block_design` + :wikipedia:`Incidence_structure` .. [2] E. Assmus, J. Key, Designs and their codes, CUP, 1992. @@ -249,7 +249,7 @@ def block_design_checker(self, t, v, k, lmbda, type=None): """ This is *not* a wrapper for GAP Design's IsBlockDesign. The GAP Design function IsBlockDesign - http://www.gap-system.org/Manuals/pkg/design/htm/CHAP004.htmSSEC001.1 + http://www.gap-system.org/Manuals/pkg/design/htm/CHAP004.htm apparently simply checks the record structure and no mathematical properties. Instead, the function below checks some necessary (but not sufficient) "easy" identities arising from the identity. diff --git a/src/sage/combinat/posets/lattices.py b/src/sage/combinat/posets/lattices.py index 6357352c74e..ed0f131d20a 100644 --- a/src/sage/combinat/posets/lattices.py +++ b/src/sage/combinat/posets/lattices.py @@ -529,7 +529,7 @@ def is_modular(L): A lattice is modular if it is both upper semimodular and lower semimodular. - See :wikipedia:`Modular lattice` + See :wikipedia:`Modular_lattice` See also :meth:`is_upper_semimodular` and :meth:`is_lower_semimodular` diff --git a/src/sage/combinat/posets/posets.py b/src/sage/combinat/posets/posets.py index a22db8beacc..0bd689a0b22 100644 --- a/src/sage/combinat/posets/posets.py +++ b/src/sage/combinat/posets/posets.py @@ -3075,7 +3075,7 @@ def comparability_graph(self): r""" Returns the comparability graph of ``self``. - See :wikipedia:`Comparability graph` + See :wikipedia:`Comparability_graph` .. SEEALSO:: :meth:`incomparability_graph`, :mod:`sage.graphs.comparability` diff --git a/src/sage/combinat/q_analogues.py b/src/sage/combinat/q_analogues.py index f18ea5bb54e..1b705efb4dc 100644 --- a/src/sage/combinat/q_analogues.py +++ b/src/sage/combinat/q_analogues.py @@ -106,7 +106,7 @@ def q_binomial(n, k, q=None, algorithm='auto'): \binom{n}{k}_q = \frac{(1-q^n)(1-q^{n-1}) \cdots (1-q^{n-k+1})} {(1-q)(1-q^2)\cdots (1-q^k)}. - See :wikipedia:`Gaussian binomial coefficient` + See :wikipedia:`Gaussian_binomial_coefficient` If `q` is unspecified, then the variable is the generator `q` for a univariate polynomial ring over the integers. diff --git a/src/sage/combinat/tamari_lattices.py b/src/sage/combinat/tamari_lattices.py index a7e21b81520..411b2ac992b 100644 --- a/src/sage/combinat/tamari_lattices.py +++ b/src/sage/combinat/tamari_lattices.py @@ -169,7 +169,7 @@ def GeneralizedTamariLattice(a,b,m=1): When the slope `m` is `0`, two paths are comparable if and only if one is always above the other. - The usual :wikipedia:`Tamari lattice` of index `b` is the special + The usual :wikipedia:`Tamari lattice` of index `b` is the special case `a=b+1` and `m=1`. Other special cases give the `m`-Tamari lattices studied in [BMFPR]_. @@ -225,7 +225,7 @@ def TamariLattice(n): The elements of the lattice are :func:`Dyck paths` in the `(n+1 \times n)`-rectangle. - See :wikipedia:`Tamari lattice` for mathematical background. + See :wikipedia:`Tamari lattice` for mathematical background. EXAMPLES:: diff --git a/src/sage/combinat/words/finite_word.py b/src/sage/combinat/words/finite_word.py index b9bee326c0f..8652eee0df3 100644 --- a/src/sage/combinat/words/finite_word.py +++ b/src/sage/combinat/words/finite_word.py @@ -4874,7 +4874,7 @@ def charge(self, check=True): [3] A. Lascoux, B. Leclerc, and J.Y. Thibon. *The Plactic Monoid*. Survey article available at - [http://www.combinatorics.net/lascoux/articles/plactic.ps] + [http://www-igm.univ-mlv.fr/~jyt/ARTICLES/plactic.ps] TESTS:: diff --git a/src/sage/functions/transcendental.py b/src/sage/functions/transcendental.py index 794436946ad..f1342e26d4e 100644 --- a/src/sage/functions/transcendental.py +++ b/src/sage/functions/transcendental.py @@ -18,7 +18,7 @@ #***************************************************************************** import sys -import sage.libs.pari.all +import sage.libs.pari.all from sage.libs.pari.all import pari import sage.rings.complex_field as complex_field import sage.rings.real_double as real_double @@ -169,7 +169,7 @@ def zeta_symmetric(s): REFERENCE: - I copied the definition of xi from - http://www.math.ubc.ca/~pugh/RiemannZeta/RiemannZetaLong.html + http://web.viu.ca/pughg/RiemannZeta/RiemannZetaLong.html """ if not (is_ComplexNumber(s) or is_RealNumber(s)): s = ComplexField()(s) diff --git a/src/sage/geometry/lattice_polytope.py b/src/sage/geometry/lattice_polytope.py index de056d2952f..7ea5e9157a7 100644 --- a/src/sage/geometry/lattice_polytope.py +++ b/src/sage/geometry/lattice_polytope.py @@ -25,10 +25,10 @@ This Sage module uses Package for Analyzing Lattice Polytopes (PALP), which is a program written in C by Maximilian Kreuzer and Harald Skarke, which is freely available under the GNU license -terms at http://tph16.tuwien.ac.at/~kreuzer/CY/. Moreover, PALP is +terms at http://hep.itp.tuwien.ac.at/~kreuzer/CY/. Moreover, PALP is included standard with Sage. -PALP is described in the paper math.SC/0204356. Its distribution +PALP is described in the paper :arxiv:`math.SC/0204356`. Its distribution also contains the application nef.x, which was created by Erwin Riegler and computes nef-partitions and Hodge data for toric complete intersections. diff --git a/src/sage/geometry/polyhedron/base_ZZ.py b/src/sage/geometry/polyhedron/base_ZZ.py index 5f4bb345c6c..4b1acd05717 100644 --- a/src/sage/geometry/polyhedron/base_ZZ.py +++ b/src/sage/geometry/polyhedron/base_ZZ.py @@ -198,7 +198,7 @@ def has_IP_property(self): "PALP: A Package for Analyzing Lattice Polytopes with Applications to Toric Geometry" Comput.Phys.Commun. 157 (2004) 87-106 - http://arxiv.org/abs/math/0204356 + :arxiv:`math/0204356` """ return self.is_compact() and self.interior_contains(self.ambient_space().zero()) @@ -377,7 +377,7 @@ def Minkowski_decompositions(self): (A 1-dimensional polyhedron in ZZ^2 defined as the convex hull of 2 vertices, A 1-dimensional polyhedron in ZZ^2 defined as the convex hull of 2 vertices)) - Example from http://cgi.di.uoa.gr/~amantzaf/geo/_ :: + Example from http://cgi.di.uoa.gr/~amantzaf/geo/ :: sage: Q = Polyhedron(vertices=[(4,0), (6,0), (0,3), (4,3)]) sage: R = Polyhedron(vertices=[(0,0), (5,0), (8,4), (3,2)]) diff --git a/src/sage/graphs/digraph_generators.py b/src/sage/graphs/digraph_generators.py index 44e9121cb9f..dd4e8844ce2 100644 --- a/src/sage/graphs/digraph_generators.py +++ b/src/sage/graphs/digraph_generators.py @@ -323,7 +323,7 @@ def TransitiveTournament(self, n): In this tournament there is an edge from `i` to `j` if `i`_ numeric labeling. For more information, see this - `Wikipedia article on the bull graph `_. + :wikipedia:`Wikipedia article on the bull graph `_. PLOTTING: diff --git a/src/sage/graphs/generic_graph.py b/src/sage/graphs/generic_graph.py index ece378d591a..13e11753170 100644 --- a/src/sage/graphs/generic_graph.py +++ b/src/sage/graphs/generic_graph.py @@ -4517,7 +4517,7 @@ def edge_disjoint_spanning_trees(self,k, root=None, solver = None, verbose = 0): .. [KaisPacking] Thomas Kaiser A short proof of the tree-packing theorem - http://arxiv.org/abs/0911.2809 + :arxiv:`0911.2809` .. [SchrijverCombOpt] Alexander Schrijver Combinatorial optimization: polyhedra and efficiency diff --git a/src/sage/graphs/graph.py b/src/sage/graphs/graph.py index 3bc857aa4af..1af226879cf 100644 --- a/src/sage/graphs/graph.py +++ b/src/sage/graphs/graph.py @@ -4351,7 +4351,7 @@ def centrality_betweenness(self, k=None, normalized=True, weight=None, .. [Brandes2003] Ulrik Brandes. (2003). Faster Evaluation of Shortest-Path Based Centrality Indices. [Online] Available: - http://citeseer.nj.nec.com/brandes00faster.html + http://citeseer.ist.psu.edu/viewdoc/summary?doi=10.1.1.43.1504 EXAMPLES:: @@ -5717,7 +5717,7 @@ def cores(self, k = None, with_labels=False): REFERENCE: .. [WPkcore] K-core. Wikipedia. (2007). [Online] Available: - http://en.wikipedia.org/wiki/K-core + :wikipedia:`K-core` .. [PSW1996] Boris Pittel, Joel Spencer and Nicholas Wormald. Sudden Emergence of a Giant k-Core in a Random @@ -5727,8 +5727,7 @@ def cores(self, k = None, with_labels=False): .. [BZ] Vladimir Batagelj and Matjaz Zaversnik. An `O(m)` Algorithm for Cores Decomposition of - Networks. arXiv:cs/0310049v1. [Online] Available: - http://arxiv.org/abs/cs/0310049 + Networks. :arxiv:`cs/0310049v1`. EXAMPLES:: diff --git a/src/sage/graphs/graph_database.py b/src/sage/graphs/graph_database.py index 4c7a01350f5..47f91dc3aa0 100644 --- a/src/sage/graphs/graph_database.py +++ b/src/sage/graphs/graph_database.py @@ -35,7 +35,7 @@ REFERENCES: - Data provided by Jason Grout (Brigham Young University). [Online] - Available: http://math.byu.edu/~grout/graphs/ + Available: http://artsci.drake.edu/grout/graphs/ """ ################################################################################ @@ -703,7 +703,7 @@ def __init__(self): - Data provided by Jason Grout (Brigham Young University). [Online] Available: - http://math.byu.edu/~grout/graphs/ + http://artsci.drake.edu/grout/graphs/ EXAMPLE:: diff --git a/src/sage/groups/matrix_gps/finitely_generated.py b/src/sage/groups/matrix_gps/finitely_generated.py index 5dd40124931..0a099288831 100644 --- a/src/sage/groups/matrix_gps/finitely_generated.py +++ b/src/sage/groups/matrix_gps/finitely_generated.py @@ -567,7 +567,7 @@ def module_composition_factors(self, algorithm=None): more verbose version. For more on MeatAxe notation, see - http://www.gap-system.org/Manuals/doc/htm/ref/CHAP067.htm + http://www.gap-system.org/Manuals/doc/ref/chap69.html """ from sage.misc.sage_eval import sage_eval F = self.base_ring() @@ -662,7 +662,7 @@ def invariant_generators(self): 1993. - S. King, "Minimal Generating Sets of non-modular invariant - rings of finite groups", :arXiv:`math/0703035`. + rings of finite groups", :arxiv:`math/0703035`. """ from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.interfaces.singular import singular diff --git a/src/sage/interfaces/maxima.py b/src/sage/interfaces/maxima.py index e90e920982b..b968f74b85e 100644 --- a/src/sage/interfaces/maxima.py +++ b/src/sage/interfaces/maxima.py @@ -10,7 +10,7 @@ group `S_n`. (However, the commands for group invariants, and the corresponding Maxima documentation, are in French.) For many links to Maxima documentation see -http://maxima.sourceforge.net/docs.shtml/. +http://maxima.sourceforge.net/documentation.html. AUTHORS: @@ -110,7 +110,7 @@ -------- We follow the tutorial at -http://maxima.sourceforge.net/docs/intromax/. +http://maxima.sourceforge.net/docs/intromax/intromax.html. :: diff --git a/src/sage/modular/arithgroup/arithgroup_perm.py b/src/sage/modular/arithgroup/arithgroup_perm.py index 0e61c788df9..66e2c4b5372 100644 --- a/src/sage/modular/arithgroup/arithgroup_perm.py +++ b/src/sage/modular/arithgroup/arithgroup_perm.py @@ -55,22 +55,21 @@ .. [Go09] Alexey G. Gorinov, "Combinatorics of double cosets and fundamental domains for the subgroups of the modular group", preprint - http://arxiv.org/abs/0901.1340 + :arxiv:`0901.1340` .. [KSV11] Ian Kiming, Matthias Schuett and Helena Verrill, "Lifts of projective congruence groups", J. London Math. Soc. (2011) 83 (1): 96-120, http://dx.doi.org/10.1112/jlms/jdq062. Arxiv version: - http://arxiv.org/abs/0905.4798. + :arxiv:`0905.4798`. .. [Kul91] Ravi Kulkarni "An arithmetic geometric method in the study of the subgroups of the modular group", American Journal of Mathematics 113 (1991), no 6, 1053-1133 -.. [Kur08] Chris Kurth, "K Farey package for Sage", - http://www.public.iastate.edu/~kurthc/research/index.html +.. [Kur08] Chris Kurth, "K Farey package for Sage" .. [KuLo] Chris Kurth and Ling Long, "Computations with finite index subgroups - of `{\rm PSL}_2(\ZZ)` using Farey symbols" + of `{\rm PSL}_2(\ZZ)` using Farey symbols", :arxiv:`0710.1835` .. [Ve] Helena Verrill, "Fundamental domain drawer", Java program, http://www.math.lsu.edu/~verrill/ diff --git a/src/sage/rings/polynomial/pbori.pyx b/src/sage/rings/polynomial/pbori.pyx index 7db067add95..c498a11e3ad 100644 --- a/src/sage/rings/polynomial/pbori.pyx +++ b/src/sage/rings/polynomial/pbori.pyx @@ -179,7 +179,7 @@ REFERENCES: .. [BD07] Michael Brickenstein, Alexander Dreyer\; *PolyBoRi: A Groebner basis framework for Boolean polynomials*; pre-print available at - http://www.itwm.fraunhofer.de/zentral/download/berichte/bericht122.pdf + http://www.itwm.fraunhofer.de/fileadmin/ITWM-Media/Zentral/Pdf/Berichte_ITWM/2007/bericht122.pdf """ include "sage/ext/interrupt.pxi" diff --git a/src/sage/rings/polynomial/polynomial_modn_dense_ntl.pyx b/src/sage/rings/polynomial/polynomial_modn_dense_ntl.pyx index 135dbae856b..4eb661cef80 100644 --- a/src/sage/rings/polynomial/polynomial_modn_dense_ntl.pyx +++ b/src/sage/rings/polynomial/polynomial_modn_dense_ntl.pyx @@ -534,7 +534,7 @@ def small_roots(self, X=None, beta=1.0, epsilon=None, **kwds): Alexander May. *New RSA Vulnerabilities Using Lattice Reduction Methods.* PhD thesis, University of Paderborn, 2003. - http://www.informatik.tu-darmstadt.de/KP/publications/03/bp.ps + http://www.cs.uni-paderborn.de/uploads/tx_sibibtex/bp.pdf """ from sage.misc.misc import verbose from sage.matrix.constructor import Matrix diff --git a/src/sage/schemes/toric/chow_group.py b/src/sage/schemes/toric/chow_group.py index ca2c4a36358..d7568f01440 100644 --- a/src/sage/schemes/toric/chow_group.py +++ b/src/sage/schemes/toric/chow_group.py @@ -42,13 +42,13 @@ REFERENCES: .. [wp:ChowRing] - http://en.wikipedia.org/wiki/Chow_ring + :wikipedia:`Chow_ring` .. [FMSS1] Fulton, MacPherson, Sottile, Sturmfels: *Intersection theory on spherical varieties*, J. of Alg. Geometry 4 (1995), 181-193. - http://www.math.tamu.edu/~frank.sottile/ps/spherical.ps.gz + http://www.math.tamu.edu/~frank.sottile/research/ps/spherical.ps.gz .. [FultonChow] Chapter 5.1 "Chow Groups" of Fulton, William: From 27e27aa09954535339846bacf9470e4ff72466a9 Mon Sep 17 00:00:00 2001 From: Frederic Chapoton Date: Fri, 26 Jul 2013 09:01:30 +0200 Subject: [PATCH 16/85] Trac #14861: correct the remaining broken links --- src/sage/graphs/generators/smallgraphs.py | 3 +-- src/sage/plot/plot3d/implicit_plot3d.py | 3 ++- src/sage/plot/plot3d/parametric_plot3d.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sage/graphs/generators/smallgraphs.py b/src/sage/graphs/generators/smallgraphs.py index e74feef47b4..146d45c2574 100644 --- a/src/sage/graphs/generators/smallgraphs.py +++ b/src/sage/graphs/generators/smallgraphs.py @@ -2744,8 +2744,7 @@ def KrackhardtKiteGraph(): REFERENCES: - [1] Kreps, V. (2002). "Social Network Analysis". [Online] Available: - http://www.fsu.edu/~spap/water/network/intro.htm [2007, - January 17] + http://www.orgnet.com/sna.html This constructor depends on NetworkX numeric labeling. diff --git a/src/sage/plot/plot3d/implicit_plot3d.py b/src/sage/plot/plot3d/implicit_plot3d.py index b69d5d7d961..8e0e2108841 100644 --- a/src/sage/plot/plot3d/implicit_plot3d.py +++ b/src/sage/plot/plot3d/implicit_plot3d.py @@ -45,7 +45,8 @@ def implicit_plot3d(f, xrange, yrange, zrange, **kwds): sage: implicit_plot3d((x^2 + y^2 + z^2), (x, -2, 2), (y, -2, 2), (z, -2, 2), plot_points=60, contour=[1,3,5], \ ... region=lambda x,y,z: x<=0.2 or y>=0.2 or z<=0.2).show(viewer='tachyon') - A very pretty example from http://iat.ubalt.edu/summers/math/platsol.htm:: + A very pretty example, attributed to Douglas Summers-Stay (`archived page + `_):: sage: T = RDF(golden_ratio) sage: p = 2 - (cos(x + T*y) + cos(x - T*y) + cos(y + T*z) + cos(y - T*z) + cos(z - T*x) + cos(z + T*x)) diff --git a/src/sage/plot/plot3d/parametric_plot3d.py b/src/sage/plot/plot3d/parametric_plot3d.py index 736bf5f61a9..e1edfb404a5 100644 --- a/src/sage/plot/plot3d/parametric_plot3d.py +++ b/src/sage/plot/plot3d/parametric_plot3d.py @@ -428,7 +428,7 @@ def parametric_plot3d(f, urange, vrange=None, plot_points="automatic", boundary_ sage: parametric_plot3d([fx, fy, fz], (u, -pi, pi), (v, -pi, pi), plot_points = [50,50], frame=False, color="red") Kuen's surface - (http://www.math.umd.edu/research/bianchi/Gifccsurfs/ccsurfs.html):: + (http://virtualmathmuseum.org/Surface/kuen/kuen.html):: sage: fx = (2*(cos(u) + u*sin(u))*sin(v))/(1+ u^2*sin(v)^2) sage: fy = (2*(sin(u) - u*cos(u))*sin(v))/(1+ u^2*sin(v)^2) From e189120ce9e01892114423a1d57eee9b4655f92e Mon Sep 17 00:00:00 2001 From: Frederic Chapoton Date: Mon, 29 Jul 2013 14:08:37 +0200 Subject: [PATCH 17/85] Trac #14861: pari modern link --- src/sage/graphs/generators/basic.py | 2 +- src/sage/libs/pari/gen.pyx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sage/graphs/generators/basic.py b/src/sage/graphs/generators/basic.py index 2e69aeb370c..b7f7123a841 100644 --- a/src/sage/graphs/generators/basic.py +++ b/src/sage/graphs/generators/basic.py @@ -28,7 +28,7 @@ def BullGraph(): A bull graph is named for its shape. It's a triangle with horns. This constructor depends on `NetworkX `_ numeric labeling. For more information, see this - :wikipedia:`Wikipedia article on the bull graph `_. + :wikipedia:`Wikipedia article on the bull graph `. PLOTTING: diff --git a/src/sage/libs/pari/gen.pyx b/src/sage/libs/pari/gen.pyx index dfe00ab5876..24b4435b021 100644 --- a/src/sage/libs/pari/gen.pyx +++ b/src/sage/libs/pari/gen.pyx @@ -6910,7 +6910,7 @@ cdef class gen(sage.structure.element.RingElement): REFERENCES: .. [PariUsers] User's Guide to PARI/GP, - http://pari.math.u-bordeaux.fr/pub/pari/manuals/2.4.2/users.pdf + http://pari.math.u-bordeaux.fr/pub/pari/manuals/2.5.1/users.pdf """ cdef long n sig_on() From 4bd28c7a53f9a7141ff9f734bc8b44a8ca564d19 Mon Sep 17 00:00:00 2001 From: Frederic Chapoton Date: Thu, 25 Jul 2013 15:43:15 +0200 Subject: [PATCH 18/85] Trac #13686: cleanup of r version --- src/sage/interfaces/r.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/interfaces/r.py b/src/sage/interfaces/r.py index 59a92855e5c..30d7f026298 100644 --- a/src/sage/interfaces/r.py +++ b/src/sage/interfaces/r.py @@ -2046,7 +2046,7 @@ def r_version(): EXAMPLES:: - sage: r.version() + sage: r_version() ((2, 15, 2), 'R version 2.15.2 (2012-10-26)') """ return r.version() From 8cb52895c34e169208d7f5ee864acbd1eb262d00 Mon Sep 17 00:00:00 2001 From: Uros Slana Date: Wed, 28 Aug 2013 00:00:07 +0200 Subject: [PATCH 19/85] Trac #15035: removing redundant set/iter conversions in graph packend --- src/sage/graphs/base/c_graph.pyx | 3 +++ src/sage/graphs/comparability.pyx | 4 ++-- src/sage/graphs/generic_graph.py | 20 +++++++++++++------- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/sage/graphs/base/c_graph.pyx b/src/sage/graphs/base/c_graph.pyx index a8240e38828..4e658820cb0 100644 --- a/src/sage/graphs/base/c_graph.pyx +++ b/src/sage/graphs/base/c_graph.pyx @@ -1699,6 +1699,9 @@ class CGraphBackend(GenericGraphBackend): sage: list(P._backend.iterator_nbrs(0)) [1, 4, 5] """ + if not self._directed: + return self.iterator_out_nbrs(v) + return iter(set(self.iterator_in_nbrs(v)) | set(self.iterator_out_nbrs(v))) diff --git a/src/sage/graphs/comparability.pyx b/src/sage/graphs/comparability.pyx index 5a9eb4b7213..f2830a27417 100644 --- a/src/sage/graphs/comparability.pyx +++ b/src/sage/graphs/comparability.pyx @@ -248,7 +248,7 @@ def greedy_is_comparability(g, no_certificate = False, equivalence_class = False sage: is_comparability(g) False sage: is_comparability(g, no_certificate = True) - (False, [9, 4, 3, 2, 7, 9]) + (False, [9, 6, 1, 0, 4, 9]) But the Bull graph is:: @@ -348,7 +348,7 @@ def greedy_is_comparability_with_certificate(g, certificate = False): sage: is_comparability(g) False sage: is_comparability(g, certificate = True) - (False, [9, 4, 3, 2, 7, 9]) + (False, [9, 6, 1, 0, 4, 9]) But the Bull graph is:: diff --git a/src/sage/graphs/generic_graph.py b/src/sage/graphs/generic_graph.py index 13e11753170..902315b0236 100644 --- a/src/sage/graphs/generic_graph.py +++ b/src/sage/graphs/generic_graph.py @@ -916,12 +916,18 @@ def to_dictionary(self, edge_labels=False, multiple_edges=False): EXAMPLES:: - sage: graphs.PetersenGraph().to_dictionary() - {0: [1, 4, 5], 1: [0, 2, 6], - 2: [1, 3, 7], 3: [8, 2, 4], - 4: [0, 9, 3], 5: [0, 8, 7], - 6: [8, 1, 9], 7: [9, 2, 5], - 8: [3, 5, 6], 9: [4, 6, 7]} + sage: g = graphs.PetersenGraph().to_dictionary() + sage: [(key, sorted(g[key])) for key in g] + [(0, [1, 4, 5]), + (1, [0, 2, 6]), + (2, [1, 3, 7]), + (3, [2, 4, 8]), + (4, [0, 3, 9]), + (5, [0, 7, 8]), + (6, [1, 8, 9]), + (7, [2, 5, 9]), + (8, [3, 5, 6]), + (9, [4, 6, 7])] sage: graphs.PetersenGraph().to_dictionary(multiple_edges=True) {0: [1, 4, 5], 1: [0, 2, 6], 2: [1, 3, 7], 3: [2, 4, 8], @@ -8254,7 +8260,7 @@ def neighbor_iterator(self, vertex): return iter(set(self.neighbor_out_iterator(vertex)) \ | set(self.neighbor_in_iterator(vertex))) else: - return iter(set(self._backend.iterator_nbrs(vertex))) + return self._backend.iterator_nbrs(vertex) def vertices(self, key=None, boundary_first=False): r""" From c83356157e38f5d47b0410741a7d111ded8e9098 Mon Sep 17 00:00:00 2001 From: Nathann Cohen Date: Wed, 28 Aug 2013 11:31:49 +0200 Subject: [PATCH 20/85] Trac #15035: Graph.is_hamiltonian does not like non-integer vertices --- src/sage/graphs/generic_graph.py | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/sage/graphs/generic_graph.py b/src/sage/graphs/generic_graph.py index 902315b0236..2b338a9606f 100644 --- a/src/sage/graphs/generic_graph.py +++ b/src/sage/graphs/generic_graph.py @@ -5928,7 +5928,6 @@ def traveling_salesman_problem(self, use_edge_labels = False, solver = None, con except MIPSolverException: raise ValueError("The given graph is not hamiltonian") - while True: # We build the DiGraph representing the current solution h = DiGraph() @@ -5961,7 +5960,7 @@ def traveling_salesman_problem(self, use_edge_labels = False, solver = None, con from sage.graphs.all import Graph b = p.new_variable(binary = True) - B = lambda u,v : b[(u,v)] if u Date: Fri, 23 Aug 2013 13:56:40 +0200 Subject: [PATCH 21/85] =?UTF-8?q?Trac=20#14341:=20More=20doctests=20from?= =?UTF-8?q?=20the=20book=20"Calcul=20math=C3=A9matique=20avec=20Sage"--Cha?= =?UTF-8?q?p.=20"programmation"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../french_book/programmation_doctest.py | 707 ++++++++++++++++++ 1 file changed, 707 insertions(+) create mode 100644 src/sage/tests/french_book/programmation_doctest.py diff --git a/src/sage/tests/french_book/programmation_doctest.py b/src/sage/tests/french_book/programmation_doctest.py new file mode 100644 index 00000000000..bb35e606904 --- /dev/null +++ b/src/sage/tests/french_book/programmation_doctest.py @@ -0,0 +1,707 @@ +## -*- encoding: utf-8 -*- +""" +Doctests from French Sage book +Test file for chapter "Programmation" ("Programming") + +Tests extracted from ./programmation.tex. + +Sage example in ./programmation.tex, line 67:: + + sage: 2*3; 3*4; 4*5 # un commentaire, 3 résultats + 6 + 12 + 20 + +Sage example in ./programmation.tex, line 78:: + + sage: 123 + \ + ....: 345 + 468 + +Sage example in ./programmation.tex, line 113:: + + sage: import keyword; keyword.kwlist + ['and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', + 'elif', 'else', 'except', 'exec', 'finally', 'for', 'from', + 'global', 'if', 'import', 'in', 'is', 'lambda', 'not', 'or', 'pass', + 'print', 'raise', 'return', 'try', 'while', 'with', 'yield'] + +Sage example in ./programmation.tex, line 189:: + + sage: y = 3; y = 3 * y + 1; y = 3 * y + 1; y + 31 + +Sage example in ./programmation.tex, line 205:: + + sage: a, b = 10, 20 # (a, b) = (10, 20) et [10, 20] possibles + sage: a, b = b, a + sage: a, b + (20, 10) + +Sage example in ./programmation.tex, line 214:: + + sage: temp = a; a = b; b = temp # est équivalent à : a, b = b, a + +Sage example in ./programmation.tex, line 221:: + + sage: x, y = var('x, y'); a = x ; b = y + sage: a, b + (x, y) + sage: a = a + b ; b = a - b ; a = a - b + sage: a, b + (y, x) + +Sage example in ./programmation.tex, line 237:: + + sage: 2 + 2 == 2^2, 3 * 3 == 3^3 + (True, False) + +Sage example in ./programmation.tex, line 276:: + + sage: for k in [1..5]: + ....: print 7*k # bloc qui contient une seule instruction + 7 + 14 + 21 + 28 + 35 + +Sage example in ./programmation.tex, line 372:: + + sage: S = 0 ; k = 0 # La somme S commence à 0 + sage: while e^k <= 10^6: # e^13 <= 10^6 < e^14 + ....: S = S + k^2 # ajout des carrés k^2 + ....: k = k + 1 + +Sage example in ./programmation.tex, line 378:: + + sage: S + 819 + +Sage example in ./programmation.tex, line 403:: + + sage: x = 10^4; u = 1; n = 0 # invariant : u = 2^n + sage: while u <= x: n = n+1; u = 2*u # ou n += 1; u *= 2 + sage: n + 14 + +Sage example in ./programmation.tex, line 449:: + + sage: U = 1.0 # ou U = 1. ou U = 1.000 + sage: for n in [1..20]: + ....: U = 1 / (1 + U^2) + sage: U + 0.682360434761105 + +Sage example in ./programmation.tex, line 492:: + + sage: S = 0 ; n = 10 + sage: for k in [1..n]: + ....: S = S + (2*k) * (2*k+1) + sage: S + 1650 + +Sage example in ./programmation.tex, line 502:: + + sage: n, k = var('n, k') ; res = sum(2*k*(2*k+1), k, 1, n) + sage: res, factor(res) # résultat développé puis factorisé + (4/3*n^3 + 3*n^2 + 5/3*n, 1/3*(4*n + 5)*(n + 1)*n) + +Sage example in ./programmation.tex, line 574:: + + sage: U = 2.0; V = 50.0; + sage: while V-U >= 1.0e-6: # 1.0e-6 signifie 1.0*10^-6 + ....: temp = U + ....: U = 2 * U * V / (U + V) + ....: V = (temp + V) / 2 + sage: U, V + (9.99999999989..., 10.0000000001...) + +Sage example in ./programmation.tex, line 635:: + + sage: U = 0.0 # la somme S0 est vide, de valeur nulle + sage: V = -1.0 # S1 = -1/1^3 + sage: n = 0 # U et V contiennent S(2n) et S(2n+1) + sage: while U-V >= 1.0e-6: + ....: n = n+1 # n += 1 est équivalent + ....: U = V + 1/(2*n)^3 # passage de S(2n-1) à S(2n) + ....: V = U - 1/(2*n+1)^3 # passage de S(2n) à S(2n+1) + sage: V, U + (-0.901543155458595, -0.901542184868447) + +Sage example in ./programmation.tex, line 807:: + + sage: u = 6 ; n = 0 + sage: while u != 1: # test "différent de" <> aussi possible + ....: if u % 2 == 0: # l'opérateur % donne le reste euclidien + ....: u = u//2 # // : quotient de la division euclidienne + ....: else: + ....: u = 3*u+1 + ....: n = n+1 + sage: n + 8 + +Sage example in ./programmation.tex, line 883:: + + sage: def fct2 (x, y): + ....: return x^2 + y^2 + sage: a = var('a') + sage: fct2 (a, 2*a) + 5*a^2 + +Sage example in ./programmation.tex, line 908:: + + sage: def essai (u): + ....: t = u^2 + ....: return t*(t+1) + sage: t = 1 ; u = 2 + sage: essai(3), t, u + (90, 1, 2) + +Sage example in ./programmation.tex, line 918:: + + sage: a = b = 1 + sage: def f(): global a; a = b = 2 + sage: f(); a, b + (2, 1) + +Sage example in ./programmation.tex, line 928:: + + sage: def MoyAH (u, v): + ....: u, v = min(u, v), max(u, v) + ....: while v-u > 2.0e-8: + ....: u, v = 2*u*v/(u+v), (u+v)/2 + ....: return (u+v) / 2 + +Sage example in ./programmation.tex, line 935:: + + sage: MoyAH (1., 2.) + 1.41421... + sage: MoyAH # correspond à une fonction + + +Sage example in ./programmation.tex, line 990:: + + sage: def fact1 (n): + ....: res = 1 + ....: for k in [1..n]: res = res*k + ....: return res + +Sage example in ./programmation.tex, line 996:: + + sage: def fact2 (n): + ....: if n == 0: return 1 + ....: else: return n*fact2(n-1) + +Sage example in ./programmation.tex, line 1013:: + + sage: def fib1 (n): + ....: if n == 0 or n == 1: return n + ....: else: + ....: U = 0 ; V = 1 # les termes initiaux u0 et u1 + ....: for k in [2..n]: W = U+V ; U = V ; V = W + ....: return V + sage: fib1(8) + 21 + +Sage example in ./programmation.tex, line 1037:: + + sage: def fib2 (n): + ....: if 0 <= n <= 1: return n # pour n = 0 ou n = 1 + ....: else: return fib2(n-1) + fib2(n-2) + +Sage example in ./programmation.tex, line 1079:: + + sage: a = 2; n = 6; res = 1 # 1 est le neutre du produit + sage: for k in [1..n]: res = res*a + sage: res # La valeur de res est 2^6 + 64 + +Sage example in ./programmation.tex, line 1150:: + + sage: def puiss1 (a, n): + ....: if n == 0: return 1 + ....: elif n % 2 == 0: b = puiss1 (a, n//2); return b*b + ....: else: return a * puiss1(a, n-1) + +Sage example in ./programmation.tex, line 1156:: + + sage: puiss1 (2, 11) # a pour résultat 2^11 + 2048 + +Sage example in ./programmation.tex, line 1177:: + + sage: def puiss2 (u, k): + ....: v = 1 + ....: while k != 0: + ....: if k % 2 == 0: u = u*u ; k = k//2 + ....: else: v = v*u ; k = k-1 + ....: return v + +Sage example in ./programmation.tex, line 1185:: + + sage: puiss2 (2, 10) # a pour résultat 2^10 + 1024 + +Sage example in ./programmation.tex, line 1238:: + + sage: def fib3 (n): + ....: A = matrix ([[0, 1], [1, 1]]) ; X0 = vector ([0, 1]) + ....: return (A^n*X0)[0] + +Sage example in ./programmation.tex, line 1243:: + + sage: def fib4 (n): + ....: return (matrix([[0,1], [1,1]])^n * vector([0,1]))[0] + +Sage example in ./programmation.tex, line 1257:: + + sage: print 2^2, 3^3, 4^4 ; print 5^5, 6^6 + 4 27 256 + 3125 46656 + +Sage example in ./programmation.tex, line 1265:: + + sage: for k in [1..10]: print '+', k, + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + +Sage example in ./programmation.tex, line 1273:: + + sage: print 10, 0.5 ; print 10+0.5 ; print 10.0, 5 + 10 0.500000000000000 + 10.5000000000000 + 10.0000000000000 5 + sage: print 10+0, 5 ; print str(10)+str(0.5) + 10 5 + 100.500000000000000 + +Sage example in ./programmation.tex, line 1294:: + + sage: for k in [1..6]: print '%2d^4 = %4d' % (k, k^4) + 1^4 = 1 + 2^4 = 16 + 3^4 = 81 + 4^4 = 256 + 5^4 = 625 + 6^4 = 1296 + +Sage example in ./programmation.tex, line 1344:: + + sage: L = [10, 20, 30] + sage: L + [10, 20, 30] + sage: [] # [] est la liste vide + [] + +Sage example in ./programmation.tex, line 1361:: + + sage: L[1], len(L), len([]) + (20, 3, 0) + +Sage example in ./programmation.tex, line 1368:: + + sage: L[2] = 33 + sage: L + [10, 20, 33] + +Sage example in ./programmation.tex, line 1375:: + + sage: L = [11, 22, 33] + sage: L[-1], L[-2], L[-3] + (33, 22, 11) + +Sage example in ./programmation.tex, line 1388:: + + sage: L = [0, 11, 22, 33, 44, 55] + sage: L[2:4] + [22, 33] + sage: L[-4:4] + [22, 33] + sage: L[2:-2] + [22, 33] + sage: L[:4] + [0, 11, 22, 33] + sage: L[4:] + [44, 55] + +Sage example in ./programmation.tex, line 1404:: + + sage: L = [0, 11, 22, 33, 44, 55, 66, 77] + sage: L[2:6] = [12, 13, 14] # remplace [22, 33, 44, 55] + +Sage example in ./programmation.tex, line 1429:: + + sage: L = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19] + sage: L[3:len(L)-5] == L[3-len(L):-5] + True + sage: [5 in L, 6 in L] + [True, False] + +Sage example in ./programmation.tex, line 1448:: + + sage: L = [1, 2, 3] ; L + [10, 20, 30] + [1, 2, 3, 10, 20, 30] + sage: 4 * [1, 2, 3] + [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3] + +Sage example in ./programmation.tex, line 1467:: + + sage: L = 5*[10, 20, 30] ; L[:3]+L[3:] == L + True + +Sage example in ./programmation.tex, line 1476:: + + sage: [1..3, 7, 10..13] + [1, 2, 3, 7, 10, 11, 12, 13] + +Sage example in ./programmation.tex, line 1493:: + + sage: map (cos, [0, pi/6, pi/4, pi/3, pi/2]) + [1, 1/2*sqrt(3), 1/2*sqrt(2), 1/2, 0] + +Sage example in ./programmation.tex, line 1501:: + + sage: map (lambda t: cos(t), [0, pi/6, pi/4, pi/3, pi/2]) + [1, 1/2*sqrt(3), 1/2*sqrt(2), 1/2, 0] + +Sage example in ./programmation.tex, line 1526:: + + sage: map (lambda t: N(cos(t)), [0, pi/6, pi/4, pi/3, pi/2]) + [1.00000000000000, 0.866025403784439, 0.707106781186548, + 0.500000000000000, 0.000000000000000] + +Sage example in ./programmation.tex, line 1538:: + + sage: map (N, map (cos, [0, pi/6, pi/4, pi/3, pi/2])) + [1.00000000000000, 0.866025403784439, 0.707106781186548, + 0.500000000000000, 0.000000000000000] + +Sage example in ./programmation.tex, line 1543:: + + sage: map (compose(N, cos), [0, pi/6, pi/4, pi/3, pi/2]) + [1.00000000000000, 0.866025403784439, 0.707106781186548, + 0.500000000000000, 0.000000000000000] + +Sage example in ./programmation.tex, line 1552:: + + sage: filter (is_prime, [1..55]) + [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53] + +Sage example in ./programmation.tex, line 1562:: + + sage: p = 37 ; filter (lambda n: n^4 % p == 7, [0..p-1]) + [3, 18, 19, 34] + +Sage example in ./programmation.tex, line 1571:: + + sage: map(lambda n:2*n+1, [0..15]) + [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31] + sage: [2*n+1 for n in [0..15]] + [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31] + +Sage example in ./programmation.tex, line 1580:: + + sage: filter (is_prime, [1..55]) + [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53] + sage: [p for p in [1..55] if is_prime(p)] + [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53] + +Sage example in ./programmation.tex, line 1590:: + + sage: filter (is_prime, [4*n+1 for n in [0..20]]) + [5, 13, 17, 29, 37, 41, 53, 61, 73] + sage: [n^2 for n in [1..20] if is_prime(n)] + [4, 9, 25, 49, 121, 169, 289, 361] + +Sage example in ./programmation.tex, line 1609:: + + sage: reduce (lambda x, y: 10*x+y, [1, 2, 3, 4]) + 1234 + +Sage example in ./programmation.tex, line 1614:: + + sage: reduce (lambda x, y: 10*x+y, [9, 8, 7, 6], 1) + 19876 + +Sage example in ./programmation.tex, line 1621:: + + sage: L = [2*n+1 for n in [0..9]] + sage: reduce (lambda x, y: x*y, L, 1) + 654729075 + +Sage example in ./programmation.tex, line 1672:: + + sage: prod ([2*n+1 for n in [0..9]], 1) # une liste avec for + 654729075 + sage: prod ( 2*n+1 for n in [0..9]) # sans liste + 654729075 + sage: prod (n for n in [0..19] if n%2 == 1) + 654729075 + +Sage example in ./programmation.tex, line 1686:: + + sage: def fct (x): return 4/x == 2 + sage: all (fct(x) for x in [2, 1, 0]) + False + sage: any (fct(x) for x in [2, 1, 0]) + True + +Sage example in ./programmation.tex, line 1704:: + + sage: [[x, y] for x in [1..2] for y in [6..8]] + [[1, 6], [1, 7], [1, 8], [2, 6], [2, 7], [2, 8]] + +Sage example in ./programmation.tex, line 1709:: + + sage: [[[x, y] for x in [1..2]] for y in [6..8]] + [[[1, 6], [2, 6]], [[1, 7], [2, 7]], [[1, 8], [2, 8]]] + +Sage example in ./programmation.tex, line 1716:: + + sage: map (lambda x, y: [x, y], [1..3], [6..8]) + [[1, 6], [2, 7], [3, 8]] + +Sage example in ./programmation.tex, line 1723:: + + sage: L = [[1, 2, [3]], [4, [5, 6]], [7, [8, [9]]]] + sage: flatten (L, max_level = 1) + [1, 2, [3], 4, [5, 6], 7, [8, [9]]] + sage: flatten (L, max_level = 2) + [1, 2, 3, 4, 5, 6, 7, 8, [9]] + sage: flatten (L) # équivaut à flatten (L, max_level = 3) + [1, 2, 3, 4, 5, 6, 7, 8, 9] + +Sage example in ./programmation.tex, line 1740:: + + sage: x = var('x') + sage: factor(diff(x*exp(x), [x, x])) + (x + 2)*e^x + sage: map(lambda n: factor(diff(x*exp(x), n*[x])), [0..6]) + [x*e^x, (x + 1)*e^x, (x + 2)*e^x, (x + 3)*e^x, (x + 4)*e^x, + (x + 5)*e^x, (x + 6)*e^x] + sage: [factor (diff (x*exp(x), n*[x])) for n in [0..6]] + [x*e^x, (x + 1)*e^x, (x + 2)*e^x, (x + 3)*e^x, (x + 4)*e^x, + (x + 5)*e^x, (x + 6)*e^x] + +Sage example in ./programmation.tex, line 1774:: + + sage: L = [1, 8, 5, 2, 9] ; L.reverse() ; L + [9, 2, 5, 8, 1] + sage: L.sort() ; L + [1, 2, 5, 8, 9] + sage: L.sort(reverse = True) ; L + [9, 8, 5, 2, 1] + +Sage example in ./programmation.tex, line 1818:: + + sage: def alpha (P, Q): # len(P) = len(Q) par hypothèse + ....: i = 0 + ....: while True: + ....: if i == len(P): return int(0) + ....: elif P[i] < Q[i]: return int(-1) + ....: elif P[i] > Q[i]: return int(1) + ....: else: i = i+1 + sage: alpha ([2, 3, 4, 6, 5], [2, 3, 4, 5, 6]) + 1 + +Sage example in ./programmation.tex, line 1835:: + + sage: L = [[2, 2, 5], [2, 3, 4], [3, 2, 4], [3, 3, 3],\ + ....: [1, 1, 2], [1, 2, 7]] + sage: L.sort (cmp = alpha) ; L + [[1, 1, 2], [1, 2, 7], [2, 2, 5], [2, 3, 4], [3, 2, 4], [3, 3, 3]] + +Sage example in ./programmation.tex, line 1856:: + + sage: def homogLex (P, Q): + ....: sp = sum (P) ; sq = sum (Q) + ....: if sp < sq: return int(-1) + ....: elif sp > sq: return int(1) + ....: else: return alpha (P, Q) + +Sage example in ./programmation.tex, line 1863:: + + sage: homogLex ([2, 3, 4, 6, 4], [2, 3, 4, 5, 6]) + -1 + +Sage example in ./programmation.tex, line 1914:: + + sage: def fct1(L): + ....: return [filter (lambda n: n % 2 == 0, L), + ....: filter (lambda n: n % 2 == 1, L)] + +Sage example in ./programmation.tex, line 1919:: + + sage: fct1([1..10]) + [[2, 4, 6, 8, 10], [1, 3, 5, 7, 9]] + +Sage example in ./programmation.tex, line 1926:: + + sage: def fct2 (L): + ....: res0 = [] ; res1 = [] + ....: for k in L: + ....: if k%2 == 0: res0.append(k) # ou res0[len(res0):] = [k] + ....: else: res1.append(k) # ou res1[len(res1):] = [k] + ....: return [res0, res1] + +Sage example in ./programmation.tex, line 1936:: + + sage: def fct3a (L, res0, res1): + ....: if L == []: return [res0, res1] + ....: elif L[0]%2 == 0: return fct3a(L[1:], res0+[L[0]], res1) + ....: else: return fct3a (L[1:], res0, res1+[L[0]]) + +Sage example in ./programmation.tex, line 1942:: + + sage: def fct3 (L): return fct3a (L, [], []) + +Sage example in ./programmation.tex, line 1955:: + + sage: def sousSuites (L): + ....: if L == []: return [] + ....: res = [] ; debut = 0 ; k = 1 + ....: while k < len(L): # 2 termes consécutifs sont définis + ....: if L[k-1] > L[k]: + ....: res.append (L[debut:k]) ; debut = k + ....: k = k+1 + ....: res.append (L[debut:k]) + ....: return res + +Sage example in ./programmation.tex, line 1966:: + + sage: sousSuites([1, 4, 1, 5]) + [[1, 4], [1, 5]] + sage: sousSuites([4, 1, 5, 1]) + [[4], [1, 5], [1]] + +Sage example in ./programmation.tex, line 1991:: + + sage: S = 'Ceci est une chaîne de caractères.' + +Sage example in ./programmation.tex, line 2001:: + + sage: S = 'Ceci est une chaîne de caractères.'; S + 'Ceci est une cha\xc3\xaene de caract\xc3\xa8res.' + sage: print S + Ceci est une chaîne de caractères. + +Sage example in ./programmation.tex, line 2026:: + + sage: S='un deux trois quatre cinq six sept'; L=S.split(); L + ['un', 'deux', 'trois', 'quatre', 'cinq', 'six', 'sept'] + +Sage example in ./programmation.tex, line 2052:: + + sage: L1 = [11, 22, 33] ; L2 = L1 + sage: L1[1] = 222 ; L2.sort() ; L1, L2 + ([11, 33, 222], [11, 33, 222]) + sage: L1[2:3] = []; L2[0:0] = [6, 7, 8] + sage: L1, L2 + ([6, 7, 8, 11, 33], [6, 7, 8, 11, 33]) + +Sage example in ./programmation.tex, line 2088:: + + sage: L1 = [11, 22, 33] ; L2 = L1 ; L3 = L1[:] + sage: [L1 is L2, L2 is L1, L1 is L3, L1 == L3] + [True, True, False, True] + +Sage example in ./programmation.tex, line 2096:: + + sage: La = [1, 2, 3] ; L1 = [1, La] ; L2 = copy(L1) + sage: L1[1][0] = 5 # [1, [5, 2, 3]] pour L1 et L2 + sage: [L1 == L2, L1 is L2, L1[1] is L2[1]] + [True, False, True] + +Sage example in ./programmation.tex, line 2141:: + + sage: def lexInverse (P, Q): + ....: P1 = copy(P) ; P1.reverse() + ....: Q1 = copy(Q) ; Q1.reverse() + ....: return - alpha (P1, Q1) + +Sage example in ./programmation.tex, line 2202:: + + sage: S0 = (); S1 = (1, ); S2 = (1, 2) + sage: [1 in S1, 1 == (1)] + [True, True] + +Sage example in ./programmation.tex, line 2214:: + + sage: S1 = (1, 4, 9, 16, 25); [k for k in S1] + [1, 4, 9, 16, 25] + +Sage example in ./programmation.tex, line 2221:: + + sage: L1 = [0..4]; L2 = [5..9] + sage: zip(L1, L2) + [(0, 5), (1, 6), (2, 7), (3, 8), (4, 9)] + sage: map(lambda x, y:(x, y), L1, L2) + [(0, 5), (1, 6), (2, 7), (3, 8), (4, 9)] + +Sage example in ./programmation.tex, line 2238:: + + sage: E=Set([1, 2, 4, 8, 2, 2, 2]); F=Set([7, 5, 3, 1]); E, F + ({8, 1, 2, 4}, {1, 3, 5, 7}) + +Sage example in ./programmation.tex, line 2252:: + + sage: E = Set([1, 2, 4, 8, 2, 2, 2]); F = Set([7, 5, 3, 1]) + sage: 5 in E, 5 in F, E + F == F | E + (False, True, True) + sage: E & F, E - F, E ^^ F + ({1}, {8, 2, 4}, {2, 3, 4, 5, 7, 8}) + +Sage example in ./programmation.tex, line 2267:: + + sage: E = Set([1, 2, 4, 8, 2, 2, 2]) + sage: [E[k] for k in [0..len(E)-1]], [t for t in E] + ([8, 1, 2, 4], [8, 1, 2, 4]) + +Sage example in ./programmation.tex, line 2275:: + + sage: def inclus (E, F): return E+F == F + +Sage example in ./programmation.tex, line 2283:: + + sage: Set([Set([]), Set([1]), Set([2]), Set([1, 2])]) + {{1, 2}, {}, {2}, {1}} + sage: Set([ (), (1, ), (2, ), (1, 2) ]) + {(1, 2), (2,), (), (1,)} + +Sage example in ./programmation.tex, line 2292:: + + sage: def Parties (EE): + ....: if EE == Set([]): return Set([EE]) + ....: else: + ....: return avecOuSansElt (EE[0], Parties(Set(EE[1:]))) + +Sage example in ./programmation.tex, line 2298:: + + sage: def avecOuSansElt (a, E): + ....: return Set (map (lambda F: Set([a])+F, E)) + E + +Sage example in ./programmation.tex, line 2302:: + + sage: Parties(Set([1, 2, 3])) + {{3}, {1, 2}, {}, {2, 3}, {1}, {1, 3}, {1, 2, 3}, {2}} + +Sage example in ./programmation.tex, line 2324:: + + sage: D={}; D['un']=1; D['deux']=2; D['trois']=3; D['dix']=10 + sage: D['deux'] + D['trois'] + 5 + +Sage example in ./programmation.tex, line 2354:: + + sage: D = {'a0':'b0', 'a1':'b1', 'a2':'b2', 'a3':'b0',\ + ....: 'a4':'b3', 'a5':'b3'} + sage: E = Set(D.keys()) ; Imf = Set(D.values()) + sage: Imf == Set(map (lambda t:D[t], E)) # est équivalent + True + +Sage example in ./programmation.tex, line 2381:: + + sage: def injective(D): + ....: return len(D) == len (Set(D.values())) + +""" From a3dcfecebcf7a13e6a289f3fbf48294b89dd07f5 Mon Sep 17 00:00:00 2001 From: Travis Scrimshaw Date: Thu, 22 Aug 2013 10:26:59 -0700 Subject: [PATCH 22/85] Trac #13871: Implemented virtual Cartan types --- .../en/reference/combinat/root_systems.rst | 1 + .../combinat/crystals/kirillov_reshetikhin.py | 66 ++-- src/sage/combinat/root_system/cartan_type.py | 74 ++++- src/sage/combinat/root_system/type_B.py | 15 + .../combinat/root_system/type_BC_affine.py | 14 + .../combinat/root_system/type_B_affine.py | 16 + src/sage/combinat/root_system/type_C.py | 16 +- .../combinat/root_system/type_C_affine.py | 16 + src/sage/combinat/root_system/type_F.py | 12 + .../combinat/root_system/type_F_affine.py | 12 + src/sage/combinat/root_system/type_G.py | 12 + .../combinat/root_system/type_G_affine.py | 12 + src/sage/combinat/root_system/type_dual.py | 37 +++ src/sage/combinat/root_system/type_folded.py | 296 ++++++++++++++++++ src/sage/combinat/root_system/type_relabel.py | 20 ++ 15 files changed, 586 insertions(+), 33 deletions(-) create mode 100644 src/sage/combinat/root_system/type_folded.py diff --git a/src/doc/en/reference/combinat/root_systems.rst b/src/doc/en/reference/combinat/root_systems.rst index b1b4473ee19..8909123f2b0 100644 --- a/src/doc/en/reference/combinat/root_systems.rst +++ b/src/doc/en/reference/combinat/root_systems.rst @@ -8,6 +8,7 @@ Root Systems ../sage/combinat/root_system/dynkin_diagram ../sage/combinat/root_system/cartan_matrix ../sage/combinat/root_system/coxeter_matrix + ../sage/combinat/root_system/type_folded ../sage/combinat/root_system/root_system ../sage/combinat/root_system/plot diff --git a/src/sage/combinat/crystals/kirillov_reshetikhin.py b/src/sage/combinat/crystals/kirillov_reshetikhin.py index 7e46f200db9..546f2da472e 100644 --- a/src/sage/combinat/crystals/kirillov_reshetikhin.py +++ b/src/sage/combinat/crystals/kirillov_reshetikhin.py @@ -136,43 +136,25 @@ def KirillovReshetikhinCrystalFromLSPaths(cartan_type, r, s=1): def KirillovReshetikhinCrystal(cartan_type, r, s): r""" - Returns the Kirillov-Reshetikhin crystal `B^{r,s}` of the given type. + Return the Kirillov-Reshetikhin crystal `B^{r,s}` of the given type. For more information about general crystals see :mod:`sage.combinat.crystals`. Many Kirillov-Reshetikhin crystals are constructed from a classical crystal together with an automorphism `p` on the level of crystals which - corresponds to a Dynkin diagram automorphism mapping node 0 to some other node i. + corresponds to a Dynkin diagram automorphism mapping node 0 to some other node `i`. The action of `f_0` and `e_0` is then constructed using `f_0 = p^{-1} \circ f_i \circ p`. For example, for type `A_n^{(1)}` the Kirillov-Reshetikhin crystal `B^{r,s}` - is obtained from the classical crystal `B(s\omega_r)` using the - promotion operator. For other types, see - - [1] M. Shimozono - "Affine type A crystal structure on tensor products of rectangles, - Demazure characters, and nilpotent varieties", - J. Algebraic Combin. 15 (2002), no. 2, 151-187 - (arXiv:math.QA/9804039) - - [2] A. Schilling, "Combinatorial structure of Kirillov-Reshetikhin crystals of - type `D_n(1)`, `B_n(1)`, `A_{2n-1}(2)`", J. Algebra 319 (2008) 2938-2962 - (arXiv:0704.2046 [math.QA]) - - [3] B. Jones, A. Schilling, - ""Affine structures and a tableau model for `E_6` crystals", - preprint arXiv:0909.2442 [math.CO] + is obtained from the classical crystal `B(s \omega_r)` using the + promotion operator. For other types, see [Shimozono02]_, [Schilling08]_, + and [JS2010]_. Other Kirillov-Reshetikhin crystals are constructed using similarity methods. - See Section 4 of + See Section 4 of [FOS09]_. - [4] G. Fourier, M. Okado, A. Schilling, - "Kirillov-Reshetikhin crystals for nonexceptional types", - Advances in Mathematics 222 Issue 3 (2009) 1080-1116 - (arXiv:0810.5067 [math.RT]) - - For an implementation of Kirillov-Reshetikhin crystals for `s=1` from + For an implementation of Kirillov-Reshetikhin crystals for `s = 1` from crystals of LS paths, see :meth:`KirillovReshetikhinCrystalFromLSPaths`. INPUT: @@ -226,12 +208,7 @@ def KirillovReshetikhinCrystal(cartan_type, r, s): sage: type(K.module_generators[0]) - - The following gives some tests with regards to Lemma 3.11 in - - [5] C. Lecouvey, M. Okado, M. Shimozono, - "Affine crystals, one-dimensional sums and parabolic Lusztig `q`-analogues' - preprint arXiv:1002.3715 + The following gives some tests with regards to Lemma 3.11 in [LOS12]_. TESTS:: @@ -302,6 +279,33 @@ def KirillovReshetikhinCrystal(cartan_type, r, s): [[[3, -3, -3]]] sage: [b for b in K if b.Epsilon() == 2*Lambda[0]] # long time [[[1]]] + + REFERENCES: + + .. [Shimozono02] M. Shimozono + *Affine type A crystal structure on tensor products of rectangles, + Demazure characters, and nilpotent varieties*, + J. Algebraic Combin. **15** (2002). no. 2. 151-187. + :arxiv:`math.QA/9804039`. + + .. [Schilling08] A. Schilling. "Combinatorial structure of + Kirillov-Reshetikhin crystals of type `D_n(1)`, `B_n(1)`, `A_{2n-1}(2)`". + J. Algebra. **319** (2008). 2938-2962. :arxiv:`0704.2046`. + + .. [JS2010] B. Jones, A. Schilling. + "Affine structures and a tableau model for `E_6` crystals", + J. Algebra. **324** (2010). 2512-2542. + :doi:`10.1016/j.bbr.2011.03.031`, :arxiv:`0909.2442`. + + .. [FOS09] G. Fourier, M. Okado, A. Schilling. + *Kirillov-Reshetikhin crystals for nonexceptional types*. + Advances in Mathematics. **222** (2009). Issue 3. 1080-1116. + :arxiv:`0810.5067`. + + .. [LOS12] C. Lecouvey, M. Okado, M. Shimozono. + "Affine crystals, one-dimensional sums and parabolic Lusztig + `q`-analogues". Mathematische Zeitschrift. **271** (2012). Issue 3-4. + 819-865. :doi:`10.1007/s00209-011-0892-9`, :arxiv:`1002.3715`. """ ct = CartanType(cartan_type) assert ct.is_affine() diff --git a/src/sage/combinat/root_system/cartan_type.py b/src/sage/combinat/root_system/cartan_type.py index 130b7232ae3..592904fe8e4 100644 --- a/src/sage/combinat/root_system/cartan_type.py +++ b/src/sage/combinat/root_system/cartan_type.py @@ -526,6 +526,14 @@ def __call__(self, *args): ['D', 4] .. SEEALSO:: :func:`~sage.combinat.root_system.cartan_type.CartanType` + + TESTS: + + Check that this is compatible with :class:`CartanTypeFolded`:: + + sage: fct = CartanType(['C', 4, 1]).as_folding() + sage: CartanType(fct) + ['C', 4, 1] """ if len(args) == 1: t = args[0] @@ -1230,6 +1238,71 @@ def root_system(self): from sage.combinat.root_system.root_system import RootSystem return RootSystem(self) + def as_folding(self, folding_of=None, sigma=None): + r""" + Return ``self`` realized as a folded Cartan type. + + For finite and affine types, this is realized by the Dynkin + diagram foldings: + + .. MATH:: + + \begin{array}{ccl} + C_n^{(1)}, A_{2n}^{(2)}, A_{2n}^{(2)\dagger}, D_{n+1}^{(2)} + & \hookrightarrow & A_{2n-1}^{(1)}, \\ + A_{2n-1}^{(2)}, B_n^{(1)} & \hookrightarrow & D_{n+1}^{(1)}, \\ + E_6^{(2)}, F_4^{(1)} & \hookrightarrow & E_6^{(1)}, \\ + D_4^{(3)}, G_2^{(1)} & \hookrightarrow & D_4^{(1)}, \\ + C_n & \hookrightarrow & A_{2n-1}, \\ + B_n & \hookrightarrow & D_{n+1}, \\ + F_4 & \hookrightarrow & E_6, \\ + G_2 & \hookrightarrow & D_4. + \end{array} + + For general types, this returns ``self`` as a folded type of ``self`` + with `\sigma` as the identity map. + + For more information on these foldings and folded Cartan types, see + :class:`sage.combinat.root_system.type_folded.CartanTypeFolded`. + + If the optional inputs ``folding_of`` and ``sigma`` are specified, then + this returns the folded Cartan type of ``self`` in ``folding_of`` given + by the automorphism ``sigma``. + + EXAMPLES:: + + sage: CartanType(['B', 3, 1]).as_folding() + ['B', 3, 1] as a folding of ['D', 4, 1] + sage: CartanType(['F', 4]).as_folding() + ['F', 4] as a folding of ['E', 6] + sage: CartanType(['BC', 3, 2]).as_folding() + ['BC', 3, 2] as a folding of ['A', 5, 1] + sage: CartanType(['D', 4, 3]).as_folding() + ['G', 2, 1]^* relabelled by {0: 0, 1: 2, 2: 1} as a folding of ['D', 4, 1] + """ + from sage.combinat.root_system.type_folded import CartanTypeFolded + if folding_of is None and sigma is None: + return self._default_folded_cartan_type() + if folding_of is None or sigma is None: + raise ValueError("Both folding_of and sigma must be given") + return CartanTypeFolded(self, folding_of, sigma) + + def _default_folded_cartan_type(self): + """ + Return the default folded Cartan type. + + In general, this just returns ``self`` in ``self`` with `\sigma` as + the identity map. + + EXAMPLES:: + + sage: D = CartanMatrix([[2, -3], [-2, 2]]).dynkin_diagram() + sage: D._default_folded_cartan_type() + Dynkin diagram of rank 2 as a folding of Dynkin diagram of rank 2 + """ + from sage.combinat.root_system.type_folded import CartanTypeFolded + return CartanTypeFolded(self, self, [[i] for i in self.index_set()]) + global_options = CartanTypeOptions class CartanType_crystallographic(CartanType_abstract): @@ -1448,7 +1521,6 @@ def symmetrizer(self): sage: print T.ascii_art(lambda i: alpha[i].scalar(alpha[i])) O---O---O---O=<=O 2 2 2 2 4 - """ from sage.matrix.constructor import matrix, diagonal_matrix m = self.cartan_matrix() diff --git a/src/sage/combinat/root_system/type_B.py b/src/sage/combinat/root_system/type_B.py index 295979b1f7c..dff2ac783e2 100644 --- a/src/sage/combinat/root_system/type_B.py +++ b/src/sage/combinat/root_system/type_B.py @@ -294,6 +294,21 @@ def _latex_dynkin_diagram(self, label=lambda x: x, node_dist=2, dual=False): ret += "\\draw[fill=white] (%s cm, 0) circle (.25cm) node[below=4pt]{$%s$};"%((n-1)*node_dist, label(n)) return ret + def _default_folded_cartan_type(self): + """ + Return the default folded Cartan type. + + EXAMPLES:: + + sage: CartanType(['B', 3])._default_folded_cartan_type() + ['B', 3] as a folding of ['D', 4] + """ + from sage.combinat.root_system.type_folded import CartanTypeFolded + n = self.n + return CartanTypeFolded(self, ['D', n+1], + [[i] for i in range(1, n)] + [[n, n+1]]) + # For unpickling backward compatibility (Sage <= 4.1) from sage.structure.sage_object import register_unpickle_override register_unpickle_override('sage.combinat.root_system.type_B', 'ambient_space', AmbientSpace) + diff --git a/src/sage/combinat/root_system/type_BC_affine.py b/src/sage/combinat/root_system/type_BC_affine.py index 1e69f127c48..30b76459a10 100644 --- a/src/sage/combinat/root_system/type_BC_affine.py +++ b/src/sage/combinat/root_system/type_BC_affine.py @@ -249,3 +249,17 @@ def classical(self): import cartan_type return cartan_type.CartanType(["C", self.n]) + def _default_folded_cartan_type(self): + """ + Return the default folded Cartan type. + + EXAMPLES:: + + sage: CartanType(['BC', 3, 2])._default_folded_cartan_type() + ['BC', 3, 2] as a folding of ['A', 5, 1] + """ + from sage.combinat.root_system.type_folded import CartanTypeFolded + n = self.n + return CartanTypeFolded(self, ['A', 2*n - 1, 1], + [[0]] + [[i, 2*n-i] for i in range(1, n)] + [[n]]) + diff --git a/src/sage/combinat/root_system/type_B_affine.py b/src/sage/combinat/root_system/type_B_affine.py index 6df3161e3e8..c11da7e1036 100644 --- a/src/sage/combinat/root_system/type_B_affine.py +++ b/src/sage/combinat/root_system/type_B_affine.py @@ -197,3 +197,19 @@ def ascii_art(self, label = lambda x: x): ret += " ".join("%s"%label(i) for i in range(1,n+1)) return ret + def _default_folded_cartan_type(self): + """ + Return the default folded Cartan type. + + EXAMPLES:: + + sage: CartanType(['B', 4, 1])._default_folded_cartan_type() + ['B', 4, 1] as a folding of ['D', 5, 1] + """ + from sage.combinat.root_system.type_folded import CartanTypeFolded + n = self.n + if n == 1: + return CartanTypeFolded(self, ['A', 1, 1], [[0], [1]]) + return CartanTypeFolded(self, ['D', n + 1, 1], + [[i] for i in range(n)] + [[n, n+1]]) + diff --git a/src/sage/combinat/root_system/type_C.py b/src/sage/combinat/root_system/type_C.py index 5142bbd1557..5a692562548 100644 --- a/src/sage/combinat/root_system/type_C.py +++ b/src/sage/combinat/root_system/type_C.py @@ -11,7 +11,7 @@ #***************************************************************************** import ambient_space -class AmbientSpace(ambient_space.AmbientSpace): +class AmbientSpace(ambient_space.AmbientSpace): """ EXAMPLES:: @@ -265,6 +265,20 @@ def ascii_art(self, label = lambda x: x): """ return self.dual().ascii_art(label = label).replace("=>=", "=<=") + def _default_folded_cartan_type(self): + """ + Return the default folded Cartan type. + + EXAMPLES:: + + sage: CartanType(['C', 3])._default_folded_cartan_type() + ['C', 3] as a folding of ['A', 5] + """ + from sage.combinat.root_system.type_folded import CartanTypeFolded + n = self.n + return CartanTypeFolded(self, ['A', 2*n-1], + [[i, 2*n-i] for i in range(1, n)] + [[n]]) + # For unpickling backward compatibility (Sage <= 4.1) from sage.structure.sage_object import register_unpickle_override register_unpickle_override('sage.combinat.root_system.type_C', 'ambient_space', AmbientSpace) diff --git a/src/sage/combinat/root_system/type_C_affine.py b/src/sage/combinat/root_system/type_C_affine.py index 17b1bba746d..3f7296558e7 100644 --- a/src/sage/combinat/root_system/type_C_affine.py +++ b/src/sage/combinat/root_system/type_C_affine.py @@ -165,3 +165,19 @@ def ascii_art(self, label = lambda x: x): ret += " ".join("%s"%label(i) for i in range(1,n+1)) return ret + def _default_folded_cartan_type(self): + """ + Return the default folded Cartan type. + + EXAMPLES:: + + sage: CartanType(['C', 3, 1])._default_folded_cartan_type() + ['C', 3, 1] as a folding of ['A', 5, 1] + """ + from sage.combinat.root_system.type_folded import CartanTypeFolded + n = self.n + if n == 1: + return CartanTypeFolded(self, ['A', 1, 1], [[0], [1]]) + return CartanTypeFolded(self, ['A', 2*n-1, 1], + [[0]] + [[i, 2*n-i] for i in range(1, n)] + [[n]]) + diff --git a/src/sage/combinat/root_system/type_F.py b/src/sage/combinat/root_system/type_F.py index dd2a8510292..cdf3b3fc273 100644 --- a/src/sage/combinat/root_system/type_F.py +++ b/src/sage/combinat/root_system/type_F.py @@ -330,6 +330,18 @@ def dual(self): """ return self.relabel({1:4, 2:3, 3:2, 4:1}) + def _default_folded_cartan_type(self): + """ + Return the default folded Cartan type. + + EXAMPLES:: + + sage: CartanType(['F', 4])._default_folded_cartan_type() + ['F', 4] as a folding of ['E', 6] + """ + from sage.combinat.root_system.type_folded import CartanTypeFolded + return CartanTypeFolded(self, ['E', 6], [[2], [4], [3, 5], [1, 6]]) + # For unpickling backward compatibility (Sage <= 4.1) from sage.structure.sage_object import register_unpickle_override register_unpickle_override('sage.combinat.root_system.type_F', 'ambient_space', AmbientSpace) diff --git a/src/sage/combinat/root_system/type_F_affine.py b/src/sage/combinat/root_system/type_F_affine.py index aef7795bc3f..f4421dd83a8 100644 --- a/src/sage/combinat/root_system/type_F_affine.py +++ b/src/sage/combinat/root_system/type_F_affine.py @@ -118,3 +118,15 @@ def ascii_art(self, label = lambda x: x): special_str = 'O' return special_str + "---O---O=>=O---O\n%s %s %s %s %s"%tuple(label(i) for i in (0,1,2,3,4)) + def _default_folded_cartan_type(self): + """ + Return the default folded Cartan type. + + EXAMPLES:: + + sage: CartanType(['F', 4, 1])._default_folded_cartan_type() + ['F', 4, 1] as a folding of ['E', 6, 1] + """ + from sage.combinat.root_system.type_folded import CartanTypeFolded + return CartanTypeFolded(self, ['E', 6, 1], [[0], [2], [4], [3, 5], [1, 6]]) + diff --git a/src/sage/combinat/root_system/type_G.py b/src/sage/combinat/root_system/type_G.py index aab18c18774..681d10dfc8b 100644 --- a/src/sage/combinat/root_system/type_G.py +++ b/src/sage/combinat/root_system/type_G.py @@ -236,6 +236,18 @@ def dual(self): """ return self.relabel({1:2, 2:1}) + def _default_folded_cartan_type(self): + """ + Return the default folded Cartan type. + + EXAMPLES:: + + sage: CartanType(['G', 2])._default_folded_cartan_type() + ['G', 2] as a folding of ['D', 4] + """ + from sage.combinat.root_system.type_folded import CartanTypeFolded + return CartanTypeFolded(self, ['D', 4], [[1, 3, 4], [2]]) + # For unpickling backward compatibility (Sage <= 4.1) from sage.structure.sage_object import register_unpickle_override register_unpickle_override('sage.combinat.root_system.type_G', 'ambient_space', AmbientSpace) diff --git a/src/sage/combinat/root_system/type_G_affine.py b/src/sage/combinat/root_system/type_G_affine.py index d024fb6ef92..3abec30671a 100644 --- a/src/sage/combinat/root_system/type_G_affine.py +++ b/src/sage/combinat/root_system/type_G_affine.py @@ -115,3 +115,15 @@ def ascii_art(self, label = lambda x: x): special_str = 'O' return " 3\nO=<=O---" + special_str + "\n%s %s %s"%tuple(label(i) for i in (1,2,0)) + def _default_folded_cartan_type(self): + """ + Return the default folded Cartan type. + + EXAMPLES:: + + sage: CartanType(['G', 2, 1])._default_folded_cartan_type() + ['G', 2, 1] as a folding of ['D', 4, 1] + """ + from sage.combinat.root_system.type_folded import CartanTypeFolded + return CartanTypeFolded(self, ['D', 4, 1], [[0], [1, 3, 4], [2]]) + diff --git a/src/sage/combinat/root_system/type_dual.py b/src/sage/combinat/root_system/type_dual.py index 1e68f5994d7..6f7b5911a86 100644 --- a/src/sage/combinat/root_system/type_dual.py +++ b/src/sage/combinat/root_system/type_dual.py @@ -617,3 +617,40 @@ def _latex_(self): else: return "{%s}^%s"%(result, self.global_options('dual_latex')) + def _default_folded_cartan_type(self): + """ + Return the default folded Cartan type. + + EXAMPLES:: + + sage: CartanType(['A', 6, 2]).dual()._default_folded_cartan_type() + ['BC', 3, 2]^* as a folding of ['A', 5, 1] + sage: CartanType(['A', 5, 2])._default_folded_cartan_type() + ['B', 3, 1]^* as a folding of ['D', 4, 1] + sage: CartanType(['D', 4, 2])._default_folded_cartan_type() + ['C', 3, 1]^* as a folding of ['A', 5, 1] + sage: CartanType(['E', 6, 2])._default_folded_cartan_type() + ['F', 4, 1]^* as a folding of ['E', 6, 1] + sage: CartanType(['G', 2, 1]).dual()._default_folded_cartan_type() + ['G', 2, 1]^* as a folding of ['D', 4, 1] + """ + from sage.combinat.root_system.type_folded import CartanTypeFolded + letter = self._dual.type() + if letter == 'BC': # A_{2n}^{(2)\dagger} + n = self._dual.classical().rank() + return CartanTypeFolded(self, ['A', 2*n - 1, 1], + [[0]] + [[i, 2*n-i] for i in range(1, n)] + [[n]]) + if letter == 'B': # A_{2n-1}^{(2)} + n = self._dual.classical().rank() + return CartanTypeFolded(self, ['D', n + 1, 1], + [[i] for i in range(n)] + [[n, n+1]]) + if letter == 'C': # D_{n+1}^{(2)} + n = self._dual.classical().rank() + return CartanTypeFolded(self, ['A', 2*n-1, 1], + [[0]] + [[i, 2*n-i] for i in range(1, n)] + [[n]]) + if letter == 'F': # E_6^{(2)} + return CartanTypeFolded(self, ['E', 6, 1], [[0], [2], [4], [3, 5], [1, 6]]) + if letter == 'G': # D_4^{(3)} + return CartanTypeFolded(self, ['D', 4, 1], [[0], [1, 3, 4], [2]]) + return super(CartanType, self)._default_folded_cartan_type() + diff --git a/src/sage/combinat/root_system/type_folded.py b/src/sage/combinat/root_system/type_folded.py new file mode 100644 index 00000000000..7b3fbf21de6 --- /dev/null +++ b/src/sage/combinat/root_system/type_folded.py @@ -0,0 +1,296 @@ +r""" +Folded Cartan Types + +AUTHORS: + +- Travis Scrimshaw (2013-01-12) - Initial version +""" +#***************************************************************************** +# Copyright (C) 2013 Travis Scrimshaw +# +# Distributed under the terms of the GNU General Public License (GPL) +# +# http://www.gnu.org/licenses/ +#***************************************************************************** + +from sage.misc.cachefunc import cached_method +from sage.structure.sage_object import SageObject +from sage.structure.unique_representation import UniqueRepresentation +from sage.sets.family import Family +from sage.combinat.root_system.cartan_type import CartanType + +class CartanTypeFolded(SageObject, UniqueRepresentation): + r""" + A Cartan type realized from a (Dynkin) diagram folding. + + Given a Cartan type `X`, we say `\hat{X}` is a folded Cartan + type of `X` if there exists a diagram folding of the Dynkin + diagram of `\hat{X}` onto `X`. + + A folding of a simply-laced Dynkin diagram `D` with index set `I` is an + automorphism `\sigma` of `D` where all nodes any orbit of `\sigma` are not + connected. The resulting Dynkin diagram `\hat{D}` is induced by + `I / \sigma` where we identify edges in `\hat{D}` which are not incident + and add a `k`-edge if we identify `k` incident edges and the arrow is + pointing towards the indicent note. We denote the index set of `\hat{D}` + by `\hat{I}`, and by abuse of notation, we denote the folding by `\sigma`. + + We also have scaling factors `\gamma_i` for `i \in \hat{I}` and defined + as the unique numbers such that the map + `\Lambda_j \mapsto \gamma_j \sum_{i \in \sigma^{-1}(j)} \Lambda_i` + is the smallest proper embedding of the weight lattice of `X` to `\hat{X}`. + + If the Cartan type is simply laced, the default folding is the one + induced from the identity map on `D`. + + If `X` is affine type, the default embeddings we consider here are: + + .. MATH:: + + \begin{array}{ccl} + C_n^{(1)}, A_{2n}^{(2)}, A_{2n}^{(2)\dagger}, D_{n+1}^{(2)} + & \hookrightarrow & A_{2n-1}^{(1)}, \\ + A_{2n-1}^{(2)}, B_n^{(1)} & \hookrightarrow & D_{n+1}^{(1)}, \\ + E_6^{(2)}, F_4^{(1)} & \hookrightarrow & E_6^{(1)}, \\ + D_4^{(3)}, G_2^{(1)} & \hookrightarrow & D_4^{(1)}, + \end{array} + + and were chosen based on virtual crystals. In particular, the diagram + foldings extend to crystal morphisms and gives a realization of + Kirillov-Reshetikhin crystals for non-simply-laced types as simply-laced + types. See [OSShimo03]_ and [FOS09]_ for more details. Here we can compute + `\gamma_i = \max(c) / c_i` where `(c_i)_i` are the translation factors + of the root system. In a more type-dependent way, we can define `\gamma_i` + as follows: + + 1. There exists a unique arrow (multiple bond) in `X`. + + a. Suppose the arrow points towards 0. Then `\gamma_i = 1` for all + `i \in I`. + b. Otherwise `\gamma_i` is the order of `\sigma` for all `i` in the + connected component of 0 after removing the arrow, else + `\gamma_i = 1`. + + 2. There is not a unique arrow. Thus `\hat{X} = A_{2n-1}^{(1)}` and + `\gamma_i = 1` for all `1 \leq i \leq n-1`. If `i \in \{0, n\}`, then + `\gamma_i = 2` if the arrow incident to `i` points away and is `1` + otherwise. + + We note that `\gamma_i` only depends upon `X`. + + If the Cartan type is finite, then we consider the classical + foldings/embeddings induced by the above affine foldings/embeddings: + + .. MATH:: + + \begin{aligned} + C_n & \hookrightarrow A_{2n-1}, \\ + B_n & \hookrightarrow D_{n+1}, \\ + F_4 & \hookrightarrow E_6, \\ + G_2 & \hookrightarrow D_4. + \end{aligned} + + For more information on Cartan types, see + :mod:`sage.combinat.root_system.cartan_type`. + + Other foldings may be constructed by passing in an optional + ``folding_of`` second argument. See below. + + INPUT: + + - ``cartan_type`` -- the Cartan type `X` to create the folded type + + - ``folding_of`` -- the Cartan type `\hat{X}` which `X` is a folding of + + - ``orbit`` -- the orbit of the Dynkin diagram automorphism `\sigma` + given as a list of lists where the `a`-th list corresponds to the `a`-th + entry in `I` or a dictionary with keys in `I` and values as lists + + .. NOTE:: + + If `X` is an affine type, we assume the special node is fixed + under `\sigma`. + + EXAMPLES:: + + sage: fct = CartanType(['C',4,1]).as_folding(); fct + ['C', 4, 1] as a folding of ['A', 7, 1] + sage: fct.scaling_factors() + Finite family {0: 2, 1: 1, 2: 1, 3: 1, 4: 2} + sage: fct.folding_orbit() + Finite family {0: (0,), 1: (1, 7), 2: (2, 6), 3: (3, 5), 4: (4,)} + + A simply laced Cartan type can be considered as a virtual type of + itself:: + + sage: fct = CartanType(['A',4,1]).as_folding(); fct + ['A', 4, 1] as a folding of ['A', 4, 1] + sage: fct.scaling_factors() + Finite family {0: 1, 1: 1, 2: 1, 3: 1, 4: 1} + sage: fct.folding_orbit() + Finite family {0: (0,), 1: (1,), 2: (2,), 3: (3,), 4: (4,)} + + Finite types:: + + sage: fct = CartanType(['C',4]).as_folding(); fct + ['C', 4] as a folding of ['A', 7] + sage: fct.scaling_factors() + Finite family {1: 1, 2: 1, 3: 1, 4: 2} + sage: fct.folding_orbit() + Finite family {1: (1, 7), 2: (2, 6), 3: (3, 5), 4: (4,)} + + sage: fct = CartanType(['F',4]).dual().as_folding(); fct + ['F', 4] relabelled by {1: 4, 2: 3, 3: 2, 4: 1} as a folding of ['E', 6] + sage: fct.scaling_factors() + Finite family {1: 1, 2: 1, 3: 2, 4: 2} + sage: fct.folding_orbit() + Finite family {1: (1, 6), 2: (3, 5), 3: (4,), 4: (2,)} + + REFERENCES: + + - :wikipedia:`Dynkin_diagram#Folding` + + .. [OSShimo03] M. Okado, A. Schilling, M. Shimozono. + "Virtual crystals and fermionic formulas for type `D_{n+1}^{(2)}`, + `A_{2n}^{(2)}`, and `C_n^{(1)}`". Representation Theory. **7** (2003). + 101-163. :doi:`10.1.1.192.2095`, :arxiv:`0810.5067`. + """ + @staticmethod + def __classcall_private__(cls, cartan_type, virtual, orbit): + """ + Normalize input to ensure a unique representation. + + EXAMPLES:: + + sage: from sage.combinat.root_system.type_folded import CartanTypeFolded + sage: sigma_list = [[0], [1,5], [2,4], [3]] + sage: fct1 = CartanTypeFolded(['C',3,1], ['A',5,1], sigma_list) + sage: sigma_tuple = tuple(map(tuple, sigma_list)) + sage: fct2 = CartanTypeFolded(CartanType(['C',3,1]), CartanType(['A',5,1]), sigma_tuple) + sage: fct3 = CartanTypeFolded('C3~', 'A5~', {0:[0], 2:[2,4], 1:[1,5], 3:[3]}) + sage: fct1 is fct2 and fct2 is fct3 + True + """ + if isinstance(cartan_type, CartanTypeFolded): + return cartan_type + cartan_type = CartanType(cartan_type) + virtual = CartanType(virtual) + if isinstance(orbit, dict): + i_set = cartan_type.index_set() + orb = [None]*len(i_set) + for k,v in orbit.iteritems(): + orb[i_set.index(k)] = tuple(v) + orbit = tuple(orb) + else: + orbit = tuple(map(tuple, orbit)) + return super(CartanTypeFolded, cls).__classcall__(cls, cartan_type, virtual, orbit) + + def __init__(self, cartan_type, folding_of, orbit): + """ + Initialize ``self``. + + EXAMPLES:: + + sage: fct = CartanType(['C',4,1]).as_folding() + sage: TestSuite(fct).run() + """ + self._cartan_type = cartan_type + self._folding = folding_of + self._orbit = orbit + + def _repr_(self): + """ + Return a string representation of ``self``. + + EXAMPLES:: + + sage: CartanType(['C',4,1]).as_folding() + ['C', 4, 1] as a folding of ['A', 7, 1] + """ + return "{} as a folding of {}".format(self._cartan_type, self._folding) + + def _latex_(self): + r""" + Return a latex representation of ``self``. + + EXAMPLES:: + + sage: fct = CartanType(['C', 4, 1]).as_folding() + sage: latex(fct) + C_{4}^{(1)} \hookrightarrow A_{7}^{(1)} + """ + return self._cartan_type._latex_() + " \\hookrightarrow " + self._folding._latex_() + + def cartan_type(self): + """ + Return the Cartan type of ``self``. + + EXAMPLES:: + + sage: fct = CartanType(['C', 4, 1]).as_folding() + sage: fct.cartan_type() + ['C', 4, 1] + """ + return self._cartan_type + + def folding_of(self): + """ + Return the Cartan type of the virtual space. + + EXAMPLES:: + + sage: fct = CartanType(['C', 4, 1]).as_folding() + sage: fct.folding_of() + ['A', 7, 1] + """ + return self._folding + + @cached_method + def folding_orbit(self): + """ + Return the orbits under the automorphism `\sigma` as a + dictionary (of tuples). + + EXAMPLES:: + + sage: fct = CartanType(['C', 4, 1]).as_folding() + sage: fct.folding_orbit() + Finite family {0: (0,), 1: (1, 7), 2: (2, 6), 3: (3, 5), 4: (4,)} + """ + return Family({i:tuple(self._orbit[pos]) + for pos,i in enumerate(self._cartan_type.index_set())}) + + @cached_method + def scaling_factors(self): + """ + Return the scaling factors of ``self``. + + EXAMPLES:: + + sage: fct = CartanType(['C', 4, 1]).as_folding() + sage: fct.scaling_factors() + Finite family {0: 2, 1: 1, 2: 1, 3: 1, 4: 2} + sage: fct = CartanType(['BC', 4, 2]).as_folding() + sage: fct.scaling_factors() + Finite family {0: 1, 1: 1, 2: 1, 3: 1, 4: 2} + sage: fct = CartanType(['BC', 4, 2]).dual().as_folding() + sage: fct.scaling_factors() + Finite family {0: 2, 1: 1, 2: 1, 3: 1, 4: 1} + sage: CartanType(['BC', 4, 2]).relabel({0:4, 1:3, 2:2, 3:1, 4:0}).as_folding().scaling_factors() + Finite family {0: 2, 1: 1, 2: 1, 3: 1, 4: 1} + """ + if self._cartan_type.is_finite(): + L = self._cartan_type.root_system().ambient_space() + def f(i): + root = L.simple_root(i) + coroot = L.simple_coroot(i) + return root.leading_coefficient() / coroot.leading_coefficient() + index_set = self._cartan_type.index_set() + min_f = min(f(j) for j in index_set) + return Family(dict( (i, int(f(i) / min_f)) for i in index_set )) + elif self._cartan_type.is_affine(): + c = self._cartan_type.translation_factors() + cmax = max(c) + return Family(dict( (i, int(cmax / c[i])) + for i in self._cartan_type.index_set() )) + diff --git a/src/sage/combinat/root_system/type_relabel.py b/src/sage/combinat/root_system/type_relabel.py index 42500b210c2..57b578b1e6d 100644 --- a/src/sage/combinat/root_system/type_relabel.py +++ b/src/sage/combinat/root_system/type_relabel.py @@ -405,6 +405,26 @@ def type(self): """ return self._type.type() + def _default_folded_cartan_type(self): + """ + Return the default folded Cartan type. + + EXAMPLES:: + + sage: fct = CartanType(['D', 4, 3])._default_folded_cartan_type(); fct + ['G', 2, 1]^* relabelled by {0: 0, 1: 2, 2: 1} as a folding of ['D', 4, 1] + sage: fct.folding_orbit() + Finite family {0: (0,), 1: (2,), 2: (1, 3, 4)} + sage: CartanType(['G',2,1]).dual()._default_folded_cartan_type().folding_orbit() + Finite family {0: (0,), 1: (1, 3, 4), 2: (2,)} + sage: CartanType(['C',3,1]).relabel({0:1, 1:0, 2:3, 3:2}).as_folding().scaling_factors() + Finite family {0: 1, 1: 2, 2: 2, 3: 1} + """ + from sage.combinat.root_system.type_folded import CartanTypeFolded + vct = self._type._default_folded_cartan_type() + sigma = vct.folding_orbit() + return CartanTypeFolded(self, vct._folding, + {self._relabelling[i]: sigma[i] for i in self._type.index_set()}) ########################################################################### From fe138a8dcb337eb95b06693e0046b9b3b6f3b142 Mon Sep 17 00:00:00 2001 From: CETHop Date: Thu, 29 Aug 2013 09:56:52 +0200 Subject: [PATCH 23/85] Trac #15109: unused modules sage.matrix.matrix_domain_* removed --- src/module_list.py | 23 --- src/sage/matrix/matrix_domain_dense.pyx | 213 ----------------------- src/sage/matrix/matrix_domain_sparse.pyx | 4 - 3 files changed, 240 deletions(-) delete mode 100644 src/sage/matrix/matrix_domain_dense.pyx delete mode 100644 src/sage/matrix/matrix_domain_sparse.pyx diff --git a/src/module_list.py b/src/module_list.py index c56b07b88a6..07e65669e3f 100755 --- a/src/module_list.py +++ b/src/module_list.py @@ -994,18 +994,9 @@ def uname_specific(name, value, alternative): language = "c++", libraries=['ntl', 'gmp']), - #Extension('sage.matrix.matrix_cyclo_sparse', - # sources = ['sage/matrix/matrix_cyclo_sparse.pyx']), - Extension('sage.matrix.matrix_dense', sources = ['sage/matrix/matrix_dense.pyx']), - #Extension('sage.matrix.matrix_domain_dense', - # sources = ['sage/matrix/matrix_domain_dense.pyx']), - - #Extension('sage.matrix.matrix_domain_sparse', - # sources = ['sage/matrix/matrix_domain_sparse.pyx']), - Extension('sage.matrix.matrix_double_dense', sources = ['sage/matrix/matrix_double_dense.pyx'], libraries=[BLAS, BLAS2], @@ -1076,12 +1067,6 @@ def uname_specific(name, value, alternative): depends = singular_depends, extra_compile_args = givaro_extra_compile_args), - #Extension('sage.matrix.matrix_pid_dense', - # sources = ['sage/matrix/matrix_pid_dense.pyx']), - - #Extension('sage.matrix.matrix_pid_sparse', - # sources = ['sage/matrix/matrix_pid_sparse.pyx']), - Extension('sage.matrix.matrix_rational_dense', sources = ['sage/matrix/matrix_rational_dense.pyx'], libraries = ['pari', 'gmp']), @@ -1115,9 +1100,6 @@ def uname_specific(name, value, alternative): Extension('sage.matrix.strassen', sources = ['sage/matrix/strassen.pyx']), - #Extension('sage.matrix.padics.matrix_padic_capped_relative_dense', - # sources = ['sage/matrix/padics/matrix_padic_capped_relative_dense.pyx']), - ################################ ## ## sage.matroids @@ -1562,11 +1544,6 @@ def uname_specific(name, value, alternative): libraries = ['mpfr', 'pari', 'gmp'], depends = numpy_depends), - #Extension('sage.rings.real_rqdf', - # sources = ["sage/rings/real_rqdf.pyx"], - # libraries = ['qd', 'm', 'stdc++','gmp','mpfr' ], - # language='c++'), - Extension('sage.rings.residue_field', sources = ['sage/rings/residue_field.pyx']), diff --git a/src/sage/matrix/matrix_domain_dense.pyx b/src/sage/matrix/matrix_domain_dense.pyx deleted file mode 100644 index 9d9f3dcab0f..00000000000 --- a/src/sage/matrix/matrix_domain_dense.pyx +++ /dev/null @@ -1,213 +0,0 @@ -"""nodoctest -Matrices over a domain -""" - -######################################################################## -# Copyright (C) 2005 William Stein -# -# Distributed under the terms of the GNU General Public License (GPL) -# -# This code is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# The full text of the GPL is available at: -# -# http://www.gnu.org/licenses/ -######################################################################## - - -cimport matrix -import matrix - -import sage.structure.sequence - - -cdef class Matrix_domain_dense(matrix.Matrix): - - - def charpoly(self, *args, **kwds): - r""" - Return the characteristic polynomial of self, as a polynomial - over the base ring. - - ALGORITHM: Use \code{self.matrix_over_field()} to obtain the - corresponding matrix over a field, then call the - \code{charpoly} function on it. - - EXAMPLES: - First a matrix over $\Z$: - sage: A = MatrixSpace(IntegerRing(),2)( [[1,2], [3,4]] ) - sage: f = A.charpoly('x') - sage: f - x^2 - 5*x - 2 - sage: f.parent() - Univariate Polynomial Ring in x over Integer Ring - - We compute the characteristic polynomial of a matrix over - the polynomial ring $\Z[a]$: - sage: R = PolynomialRing(IntegerRing(),'a'); a = R.gen() - sage: M = MatrixSpace(R,2)([[a,1], [a,a+1]]) - sage: M - [ a 1] - [ a a + 1] - sage: f = M.charpoly('x') - sage: f - x^2 + (-2*a - 1)*x + a^2 - sage: f.parent() - Univariate Polynomial Ring in x over Univariate Polynomial Ring in a over Integer Ring - sage: M.trace() - 2*a + 1 - sage: M.determinant() - a^2 - - We compute the characteristic polynomial of a matrix over the - multi-variate polynomial ring $\Z[x,y]$: - sage: R = PolynomialRing(IntegerRing(),2); x,y = R.gens() - sage: A = MatrixSpace(R,2)([x, y, x^2, y^2]) - sage: f = A.charpoly('x') - sage: f - x^2 + (-1*x1^2 - x0)*x + x0*x1^2 - x0^2*x1 - - It's a little difficult to distinguish the variables. To fix this, - we rename the indeterminate $Z$: - sage: f.parent()._assign_names("Z") - sage: f - Z^2 + (-1*x1^2 - x0)*Z + x0*x1^2 - x0^2*x1 - - We can pass parameters in, which are passed on to the charpoly - function for matrices over a field. - sage: A = 1000*MatrixSpace(ZZ,10)(range(100)) - sage: A.charpoly(bound=2) - x^10 + 14707*x^9 - 21509*x^8 - sage: A = 1000*MatrixSpace(ZZ,10)(range(100)) - sage: A.charpoly('x') - x^10 - 495000*x^9 - 8250000000*x^8 - """ - f = self.matrix_over_field(copy=True).charpoly(*args, **kwds) - return f.base_extend(self.base_ring()) - - def determinant(self): - """ - Return the determinant of this matrix. - - INPUT: - -- a square matrix - - ALGORITHM: Find the characteristic polynomial and take its - constant term (up to sign). - - EXAMPLES: - We create a matrix over $\Z[x,y]$ and compute its determinant. - sage: R = PolynomialRing(IntegerRing(),2); x,y = R.gens() - sage: A = MatrixSpace(R,2)([x, y, x**2, y**2]) - sage: A.determinant() - x0*x1^2 - x0^2*x1 - """ - if self.nrows() != self.ncols(): - raise ArithmeticError("Matrix must be square, but is %sx%s"%( - self.nrows(), self.ncols())) - # Use stupid slow but completely general method. - d = (-1)**self.nrows() * self.charpoly('x')[0] - return self.base_ring()(d) - - def is_invertible(self): - r""" - Return True if this matrix is invertible. - - EXAMPLES: - The following matrix is invertible over $\Q$ but not over $\Z$. - sage: A = MatrixSpace(IntegerRing(), 2)(range(4)) - sage: A.is_invertible() - False - sage: A.matrix_over_field().is_invertible() - True - - The inverse function is a constructor for matrices over the - fraction field, so it can work even if A is not invertible. - sage: ~A # inverse of A - [-3/2 1/2] - [ 1 0] - - The next matrix is invertible over $\Z$. - sage: A = MatrixSpace(IntegerRing(),2)([1,10,0,-1]) - sage: A.is_invertible() - True - sage: ~A # compute the inverse - [ 1 10] - [ 0 -1] - - The following nontrivial matrix is invertible over $\Z[x]$. - sage: R = PolynomialRing(IntegerRing()) - sage: x = R.gen() - sage: A = MatrixSpace(R,2)([1,x,0,-1]) - sage: A.is_invertible() - True - sage: ~A - [ 1 x] - [ 0 -1] - """ - return self.is_square() and self.determinant().is_unit() - - def __invert__(self): - r""" - Return this inverse of this matrix, as a matrix over the fraction field. - - Raises a \code{ZeroDivisionError} if the matrix has zero - determinant, and raises an \code{ArithmeticError}, if the - inverse doesn't exist because the matrix is nonsquare. - - EXAMPLES: - sage: A = MatrixSpace(IntegerRing(), 2)([1,1,3,5]) - sage: ~A - [ 5/2 -1/2] - [-3/2 1/2] - - Even if the inverse lies in the base field, the result is still a matrix - over the fraction field. - sage: I = MatrixSpace(IntegerRing(),2)( 1 ) # identity matrix - sage: ~I - [1 0] - [0 1] - sage: (~I).parent() - Full MatrixSpace of 2 by 2 dense matrices over Rational Field - - TESTS: - sage: MatrixSpace(IntegerRing(), 0)().inverse() - [] - """ - return ~self.matrix_over_field() - - - def matrix_over_field(self, copy=False): - """ - Return this matrix, but with entries viewed as elements - of the fraction field of the base ring. - - EXAMPLES: - sage: A = MatrixSpace(IntegerRing(),2)([1,2,3,4]) - sage: B = A.matrix_over_field() - sage: B - [1 2] - [3 4] - sage: B.parent() - Full MatrixSpace of 2 by 2 dense matrices over Rational Field - """ - return self.change_ring(self.base_ring().fraction_field(), copy=copy) - - def _singular_(self, singular=None): - """ - Tries to coerce this matrix to a singular matrix. - """ - if singular is None: - from sage.interfaces.all import singular as singular_default - singular = singular_default - try: - self.base_ring()._singular_(singular) - except (NotImplementedError, AttributeError): - raise TypeError("Cannot coerce to Singular") - - return singular.matrix(self.nrows(),self.ncols(),singular(self.list())) - - diff --git a/src/sage/matrix/matrix_domain_sparse.pyx b/src/sage/matrix/matrix_domain_sparse.pyx deleted file mode 100644 index b95fe60b63b..00000000000 --- a/src/sage/matrix/matrix_domain_sparse.pyx +++ /dev/null @@ -1,4 +0,0 @@ -cimport matrix - -cdef class Matrix_domain_sparse(matrix.Matrix): - pass From cfd68b5ba672f8de94c313df1680a02e9290ae72 Mon Sep 17 00:00:00 2001 From: Jeroen Demeyer Date: Sat, 31 Aug 2013 00:13:05 +0200 Subject: [PATCH 24/85] Trac #15124: Add pari_catch_sig_on() macro --- src/sage/libs/pari/gen.pxd | 5 +- src/sage/libs/pari/gen.pyx | 921 +++++++++++----------- src/sage/libs/pari/misc.h | 9 - src/sage/libs/pari/pari_err.h | 23 +- src/sage/libs/pari/pari_err.pxi | 11 +- src/sage/matrix/matrix_integer_dense.pyx | 25 +- src/sage/matrix/matrix_rational_dense.pyx | 50 +- src/sage/rings/complex_double.pyx | 5 +- src/sage/rings/real_mpfr.pyx | 3 +- 9 files changed, 515 insertions(+), 537 deletions(-) diff --git a/src/sage/libs/pari/gen.pxd b/src/sage/libs/pari/gen.pxd index 71bb762053a..9032b0ab68d 100644 --- a/src/sage/libs/pari/gen.pxd +++ b/src/sage/libs/pari/gen.pxd @@ -1,6 +1,9 @@ include 'decl.pxi' cimport sage.structure.element +cimport sage.structure.parent_base + +cdef void _pari_trap "_pari_trap"(long errno, long retries) except * cdef class gen(sage.structure.element.RingElement): cdef GEN g @@ -15,8 +18,6 @@ cdef class gen(sage.structure.element.RingElement): cdef long get_var(self, v) cdef GEN get_nf(self) except NULL -cimport sage.structure.parent_base - cdef class PariInstance(sage.structure.parent_base.ParentWithBase): cdef gen PARI_ZERO, PARI_ONE, PARI_TWO cdef gen new_gen(self, GEN x) diff --git a/src/sage/libs/pari/gen.pyx b/src/sage/libs/pari/gen.pyx index 24b4435b021..6327e0cd1e3 100644 --- a/src/sage/libs/pari/gen.pyx +++ b/src/sage/libs/pari/gen.pyx @@ -361,11 +361,11 @@ pari_instance = PariInstance(16000000, 500000) P = pari_instance # shorthand notation # PariInstance.__init__ must not create gen objects because their parent is not constructed yet -sig_on() +pari_catch_sig_on() pari_instance.PARI_ZERO = pari_instance.new_gen_noclear(gen_0) pari_instance.PARI_ONE = pari_instance.new_gen_noclear(gen_1) pari_instance.PARI_TWO = pari_instance.new_gen_noclear(gen_2) -sig_off() +pari_catch_sig_off() # Also a copy of PARI accessible from external pure python code. pari = pari_instance @@ -436,7 +436,7 @@ cdef class gen(sage.structure.element.RingElement): sage_free( self.b) def __repr__(self): - sig_on() + pari_catch_sig_on() return P.new_gen_to_string(self.g) def __hash__(self): @@ -449,9 +449,9 @@ cdef class gen(sage.structure.element.RingElement): """ cdef long h - sig_on() + pari_catch_sig_on() h = hash_GEN(self.g) - sig_off() + pari_catch_sig_off() return h def _testclass(self): @@ -530,7 +530,7 @@ cdef class gen(sage.structure.element.RingElement): return sage.libs.pari.gen_py.pari, (s,) cpdef ModuleElement _add_(self, ModuleElement right): - sig_on() + pari_catch_sig_on() return P.new_gen(gadd(self.g, (right).g)) def _add_unsafe(gen self, gen right): @@ -559,7 +559,7 @@ cdef class gen(sage.structure.element.RingElement): return w cpdef ModuleElement _sub_(self, ModuleElement right): - sig_on() + pari_catch_sig_on() return P.new_gen(gsub(self.g, ( right).g)) def _sub_unsafe(gen self, gen right): @@ -588,7 +588,7 @@ cdef class gen(sage.structure.element.RingElement): return w cpdef RingElement _mul_(self, RingElement right): - sig_on() + pari_catch_sig_on() return P.new_gen(gmul(self.g, (right).g)) def _mul_unsafe(gen self, gen right): @@ -617,7 +617,7 @@ cdef class gen(sage.structure.element.RingElement): return w cpdef RingElement _div_(self, RingElement right): - sig_on() + pari_catch_sig_on() return P.new_gen(gdiv(self.g, (right).g)) def _div_unsafe(gen self, gen right): @@ -662,7 +662,7 @@ cdef class gen(sage.structure.element.RingElement): sage: n._add_one() x^3 + 1 """ - sig_on() + pari_catch_sig_on() return P.new_gen(gaddsg(1, self.g)) def __mod__(self, other): @@ -671,14 +671,14 @@ cdef class gen(sage.structure.element.RingElement): if isinstance(other, gen) and isinstance(self, gen): selfgen = self othergen = other - sig_on() + pari_catch_sig_on() return P.new_gen(gmod(selfgen.g, othergen.g)) return sage.structure.element.bin_op(self, other, operator.mod) def __pow__(self, n, m): t0GEN(self) t1GEN(n) - sig_on() + pari_catch_sig_on() # Note: the prec parameter here has no effect when t0,t1 are # real; the precision of the result is the minimum of the # precisions of t0 and t1. In any case the 3rd parameter to @@ -686,7 +686,7 @@ cdef class gen(sage.structure.element.RingElement): return P.new_gen(gpow(t0, t1, prec)) def __neg__(gen self): - sig_on() + pari_catch_sig_on() return P.new_gen(gneg(self.g)) def __xor__(gen self, n): @@ -694,15 +694,15 @@ cdef class gen(sage.structure.element.RingElement): "in Python, and has the wrong precedence." def __rshift__(gen self, long n): - sig_on() + pari_catch_sig_on() return P.new_gen(gshift(self.g, -n)) def __lshift__(gen self, long n): - sig_on() + pari_catch_sig_on() return P.new_gen(gshift(self.g, n)) def __invert__(gen self): - sig_on() + pari_catch_sig_on() return P.new_gen(ginv(self.g)) ########################################### @@ -710,7 +710,7 @@ cdef class gen(sage.structure.element.RingElement): ########################################### def getattr(self, attr): t0GEN(str(self) + '.' + str(attr)) - sig_on() + pari_catch_sig_on() return self.new_gen(t0) def mod(self): @@ -730,7 +730,7 @@ cdef class gen(sage.structure.element.RingElement): """ if typ(self.g) != t_INTMOD and typ(self.g) != t_POLMOD: raise TypeError("Not an INTMOD or POLMOD in mod()") - sig_on() + pari_catch_sig_on() # The hardcoded 1 below refers to the position in the internal # representation of a INTMOD or POLDMOD where the modulus is # stored. @@ -773,9 +773,9 @@ cdef class gen(sage.structure.element.RingElement): """ cdef GEN nf cdef long nftyp - sig_on() + pari_catch_sig_on() nf = get_nf(self.g, &nftyp) - sig_off() + pari_catch_sig_off() if not nf: raise TypeError("Not a PARI number field") return nf @@ -810,7 +810,7 @@ cdef class gen(sage.structure.element.RingElement): TypeError: Not a PARI number field """ cdef GEN nf = self.get_nf() - sig_on() + pari_catch_sig_on() return self.new_gen(nf_get_pol(nf)) def nf_get_diff(self): @@ -829,7 +829,7 @@ cdef class gen(sage.structure.element.RingElement): [12, 0, 0, 0; 0, 12, 8, 0; 0, 0, 4, 0; 0, 0, 0, 4] """ cdef GEN nf = self.get_nf() - sig_on() + pari_catch_sig_on() # Very bad code, but there doesn't seem to be a better way return self.new_gen(gel(gel(nf, 5), 5)) @@ -878,7 +878,7 @@ cdef class gen(sage.structure.element.RingElement): [1, y, y^3 - 4*y, y^2 - 2] """ cdef GEN nf = self.get_nf() - sig_on() + pari_catch_sig_on() return self.new_gen(nf_get_zk(nf)) def bnf_get_no(self): @@ -891,7 +891,7 @@ cdef class gen(sage.structure.element.RingElement): sage: K.pari_bnf().bnf_get_no() 8 """ - sig_on() + pari_catch_sig_on() return self.new_gen(bnf_get_no(self.g)) def bnf_get_cyc(self): @@ -907,7 +907,7 @@ cdef class gen(sage.structure.element.RingElement): sage: K.pari_bnf().bnf_get_cyc() [4, 2] """ - sig_on() + pari_catch_sig_on() return self.new_gen(bnf_get_cyc(self.g)) def bnf_get_gen(self): @@ -925,7 +925,7 @@ cdef class gen(sage.structure.element.RingElement): sage: map(lambda J: K.ideal(J), G) [Fractional ideal (3, a + 2), Fractional ideal (2, a + 1)] """ - sig_on() + pari_catch_sig_on() return self.new_gen(bnf_get_gen(self.g)) def bnf_get_reg(self): @@ -940,7 +940,7 @@ cdef class gen(sage.structure.element.RingElement): sage: K.pari_bnf().bnf_get_reg() 2.66089858019037... """ - sig_on() + pari_catch_sig_on() return self.new_gen(bnf_get_reg(self.g)) def pr_get_p(self): @@ -958,7 +958,7 @@ cdef class gen(sage.structure.element.RingElement): sage: F[0,0].pr_get_p() 5 """ - sig_on() + pari_catch_sig_on() return self.new_gen(pr_get_p(self.g)) def pr_get_e(self): @@ -979,9 +979,9 @@ cdef class gen(sage.structure.element.RingElement): 1 """ cdef long e - sig_on() + pari_catch_sig_on() e = pr_get_e(self.g) - sig_off() + pari_catch_sig_off() return e def pr_get_f(self): @@ -1002,9 +1002,9 @@ cdef class gen(sage.structure.element.RingElement): 1 """ cdef long f - sig_on() + pari_catch_sig_on() f = pr_get_f(self.g) - sig_off() + pari_catch_sig_off() return f def pr_get_gen(self): @@ -1028,7 +1028,7 @@ cdef class gen(sage.structure.element.RingElement): [-2, 1]~ i - 2 """ - sig_on() + pari_catch_sig_on() return self.new_gen(pr_get_gen(self.g)) def bid_get_cyc(self): @@ -1046,7 +1046,7 @@ cdef class gen(sage.structure.element.RingElement): sage: J.bid_get_cyc() [4, 2] """ - sig_on() + pari_catch_sig_on() return self.new_gen(bid_get_cyc(self.g)) def bid_get_gen(self): @@ -1073,7 +1073,7 @@ cdef class gen(sage.structure.element.RingElement): ... PariError: (5) """ - sig_on() + pari_catch_sig_on() return self.new_gen(bid_get_gen(self.g)) def __getitem__(gen self, n): @@ -1398,7 +1398,7 @@ cdef class gen(sage.structure.element.RingElement): cdef long l cdef Py_ssize_t ii, jj, step - sig_on() + pari_catch_sig_on() try: if isinstance(y, gen): x = y @@ -1455,7 +1455,7 @@ cdef class gen(sage.structure.element.RingElement): (self.g)[i+1] = (x.g) return finally: - sig_off() + pari_catch_sig_off() def __len__(gen self): return glength(self.g) @@ -1515,7 +1515,7 @@ cdef class gen(sage.structure.element.RingElement): return gcmp_sage(left.g, (right).g) def __copy__(gen self): - sig_on() + pari_catch_sig_on() return P.new_gen(gcopy(self.g)) ########################################### @@ -1692,12 +1692,12 @@ cdef class gen(sage.structure.element.RingElement): if typ(g) != t_VEC: raise TypeError, "gen must be of PARI type t_VEC" - sig_on() + pari_catch_sig_on() L = glength(g) v = [] for n from 0 <= n < L: v.append(gtolong( (g[n+1]))) - sig_off() + pari_catch_sig_off() return v def python_list_small(gen self): @@ -1829,9 +1829,9 @@ cdef class gen(sage.structure.element.RingElement): Return Python float. """ cdef double d - sig_on() + pari_catch_sig_on() d = gtodouble(self.g) - sig_off() + pari_catch_sig_off() return d def __complex__(self): @@ -1858,10 +1858,10 @@ cdef class gen(sage.structure.element.RingElement): PariError: incorrect type (11) """ cdef double re, im - sig_on() + pari_catch_sig_on() re = gtodouble(greal(self.g)) im = gtodouble(gimag(self.g)) - sig_off() + pari_catch_sig_off() return complex(re, im) def __nonzero__(self): @@ -1914,9 +1914,9 @@ cdef class gen(sage.structure.element.RingElement): False """ t0GEN(b) - sig_on() + pari_catch_sig_on() cdef int ret = gequal(a.g, t0) - sig_off() + pari_catch_sig_off() return ret != 0 def gequal0(gen a): @@ -1936,9 +1936,9 @@ cdef class gen(sage.structure.element.RingElement): sage: pari(GF(3^20,'t')(0)).gequal0() True """ - sig_on() + pari_catch_sig_on() cdef int ret = gequal0(a.g) - sig_off() + pari_catch_sig_off() return ret != 0 def gequal_long(gen a, long b): @@ -1963,9 +1963,9 @@ cdef class gen(sage.structure.element.RingElement): sage: c.gequal_long(-3) False """ - sig_on() + pari_catch_sig_on() cdef int ret = gequalsg(b, a.g) - sig_off() + pari_catch_sig_off() return ret != 0 @@ -2006,9 +2006,9 @@ cdef class gen(sage.structure.element.RingElement): False """ cdef bint t - sig_on() + pari_catch_sig_on() t = (signe(gisprime(self.g, flag)) != 0) - sig_off() + pari_catch_sig_off() return t def qfbhclassno(gen n): @@ -2049,7 +2049,7 @@ cdef class gen(sage.structure.element.RingElement): 3 """ - sig_on() + pari_catch_sig_on() return P.new_gen(hclassno(n.g)) def ispseudoprime(gen self, flag=0): @@ -2086,9 +2086,9 @@ cdef class gen(sage.structure.element.RingElement): False """ cdef long z - sig_on() + pari_catch_sig_on() z = ispseudoprime(self.g, flag) - sig_off() + pari_catch_sig_off() return (z != 0) def ispower(gen self, k=None): @@ -2136,20 +2136,20 @@ cdef class gen(sage.structure.element.RingElement): cdef GEN x if k is None: - sig_on() + pari_catch_sig_on() n = gisanypower(self.g, &x) if n == 0: - sig_off() + pari_catch_sig_off() return 1, self else: return n, P.new_gen(x) else: k = int(k) t0GEN(k) - sig_on() + pari_catch_sig_on() n = ispower(self.g, t0, &x) if n == 0: - sig_off() + pari_catch_sig_off() return False, None else: return k, P.new_gen(x) @@ -2164,7 +2164,7 @@ cdef class gen(sage.structure.element.RingElement): respect to v (to main variable if v is omitted). """ t0GEN(y) - sig_on() + pari_catch_sig_on() return P.new_gen(divrem(x.g, t0, P.get_var(var))) def lex(gen x, y): @@ -2173,7 +2173,7 @@ cdef class gen(sage.structure.element.RingElement): if xy) """ t0GEN(y) - sig_on() + pari_catch_sig_on() return lexcmp(x.g, t0) def max(gen x, y): @@ -2181,7 +2181,7 @@ cdef class gen(sage.structure.element.RingElement): max(x,y): Return the maximum of x and y. """ t0GEN(y) - sig_on() + pari_catch_sig_on() return P.new_gen(gmax(x.g, t0)) def min(gen x, y): @@ -2189,28 +2189,28 @@ cdef class gen(sage.structure.element.RingElement): min(x,y): Return the minimum of x and y. """ t0GEN(y) - sig_on() + pari_catch_sig_on() return P.new_gen(gmin(x.g, t0)) def shift(gen x, long n): """ shift(x,n): shift x left n bits if n=0, right -n bits if n0. """ - sig_on() + pari_catch_sig_on() return P.new_gen(gshift(x.g, n)) def shiftmul(gen x, long n): """ shiftmul(x,n): Return the product of x by `2^n`. """ - sig_on() + pari_catch_sig_on() return P.new_gen(gmul2n(x.g, n)) def moebius(gen x): """ moebius(x): Moebius function of x. """ - sig_on() + pari_catch_sig_on() return P.new_gen(gmoebius(x.g)) def sign(gen x): @@ -2220,7 +2220,7 @@ cdef class gen(sage.structure.element.RingElement): """ # Pari throws an error if you attempt to take the sign of # a complex number. - sig_on() + pari_catch_sig_on() return gsigne(x.g) def vecmax(gen x): @@ -2228,7 +2228,7 @@ cdef class gen(sage.structure.element.RingElement): vecmax(x): Return the maximum of the elements of the vector/matrix x. """ - sig_on() + pari_catch_sig_on() return P.new_gen(vecmax(x.g)) @@ -2237,7 +2237,7 @@ cdef class gen(sage.structure.element.RingElement): vecmin(x): Return the maximum of the elements of the vector/matrix x. """ - sig_on() + pari_catch_sig_on() return P.new_gen(vecmin(x.g)) @@ -2290,7 +2290,7 @@ cdef class gen(sage.structure.element.RingElement): See also :meth:`Vec` (create a row vector) for more examples and :meth:`Colrev` (create a column in reversed order). """ - sig_on() + pari_catch_sig_on() return P.new_gen(_Vec_append(gtocol(x.g), gen_0, n)) def Colrev(gen x, long n = 0): @@ -2331,7 +2331,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari([1,2,3,4]).Colrev(-6) [4, 3, 2, 1, 0, 0]~ """ - sig_on() + pari_catch_sig_on() # Create a non-reversed column vector cdef GEN v = _Vec_append(gtocol(x.g), gen_0, n) # Reverse it in-place @@ -2363,7 +2363,7 @@ cdef class gen(sage.structure.element.RingElement): sage: w.type() 't_LIST' """ - sig_on() + pari_catch_sig_on() return P.new_gen(gtolist(x.g)) def Mat(gen x): @@ -2426,7 +2426,7 @@ cdef class gen(sage.structure.element.RingElement): sage: v.Mat() [1, 2; 3, 4] """ - sig_on() + pari_catch_sig_on() return P.new_gen(gtomat(x.g)) def Mod(gen x, y): @@ -2487,7 +2487,7 @@ cdef class gen(sage.structure.element.RingElement): 't_POLMOD' """ t0GEN(y) - sig_on() + pari_catch_sig_on() return P.new_gen(gmodulo(x.g,t0)) def Pol(self, v=-1): @@ -2544,7 +2544,7 @@ cdef class gen(sage.structure.element.RingElement): sage: v.Pol() [1, 3]~*x + [2, 4]~ """ - sig_on() + pari_catch_sig_on() return P.new_gen(gtopoly(self.g, P.get_var(v))) def Polrev(self, v=-1): @@ -2584,7 +2584,7 @@ cdef class gen(sage.structure.element.RingElement): sage: v.Polrev() [2, 4]~*x + [1, 3]~ """ - sig_on() + pari_catch_sig_on() return P.new_gen(gtopolyrev(self.g, P.get_var(v))) def Qfb(gen a, b, c, D=0): @@ -2635,7 +2635,7 @@ cdef class gen(sage.structure.element.RingElement): PariError: (5) """ t0GEN(b); t1GEN(c); t2GEN(D) - sig_on() + pari_catch_sig_on() return P.new_gen(Qfb0(a.g, t0, t1, t2, prec)) @@ -2692,7 +2692,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari('1/x').Ser(seriesprecision = 1) x^-1 + O(x^0) """ - sig_on() + pari_catch_sig_on() return P.new_gen(gtoser(x.g, P.get_var(v), seriesprecision)) @@ -2729,7 +2729,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari('["bc","ab","bc"]').Set() ["\"ab\"", "\"bc\""] """ - sig_on() + pari_catch_sig_on() return P.new_gen(gtoset(x.g)) @@ -2766,7 +2766,7 @@ cdef class gen(sage.structure.element.RingElement): 't_STR' """ cdef char* c - sig_on() + pari_catch_sig_on() c = GENtostr(self.g) v = self.new_gen(strtoGENstr(c)) pari_free(c) @@ -2805,7 +2805,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari([83, 97, 103, 101]).Strchr() "Sage" """ - sig_on() + pari_catch_sig_on() return P.new_gen(Strchr(x.g)) def Strexpand(gen x): @@ -2819,7 +2819,7 @@ cdef class gen(sage.structure.element.RingElement): """ if typ(x.g) != t_VEC: raise TypeError, "x must be of type t_VEC." - sig_on() + pari_catch_sig_on() return P.new_gen(Strexpand(x.g)) @@ -2854,7 +2854,7 @@ cdef class gen(sage.structure.element.RingElement): """ if typ(x.g) != t_VEC: x = P.vector(1, [x]) - sig_on() + pari_catch_sig_on() return P.new_gen(Strtex(x.g)) def printtex(gen x): @@ -2915,7 +2915,7 @@ cdef class gen(sage.structure.element.RingElement): See also :meth:`Col` (create a column vector) and :meth:`Vecrev` (create a vector in reversed order). """ - sig_on() + pari_catch_sig_on() return P.new_gen(_Vec_append(gtovec(x.g), gen_0, n)) def Vecrev(gen x, long n = 0): @@ -2962,7 +2962,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari([1,2,3,4]).Vecrev(-6) [4, 3, 2, 1, 0, 0] """ - sig_on() + pari_catch_sig_on() return P.new_gen(_Vec_append(gtovecrev(x.g), gen_0, -n)) def Vecsmall(gen x, long n = 0): @@ -3004,7 +3004,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari([1,2,3]).Vecsmall(-6) Vecsmall([0, 0, 0, 1, 2, 3]) """ - sig_on() + pari_catch_sig_on() return P.new_gen(_Vec_append(gtovecsmall(x.g), 0, n)) def binary(gen x): @@ -3044,7 +3044,7 @@ cdef class gen(sage.structure.element.RingElement): """ if typ(x.g) != t_INT: raise TypeError, "x (=%s) must be of type t_INT, but is of type %s."%(x,x.type()) - sig_on() + pari_catch_sig_on() return P.new_gen(binaire(x.g)) def bitand(gen x, y): @@ -3084,7 +3084,7 @@ cdef class gen(sage.structure.element.RingElement): -1 """ t0GEN(y) - sig_on() + pari_catch_sig_on() return P.new_gen(gbitand(x.g, t0)) @@ -3130,7 +3130,7 @@ cdef class gen(sage.structure.element.RingElement): sage: -570 % 2^10 454 """ - sig_on() + pari_catch_sig_on() return P.new_gen(gbitneg(x.g,n)) @@ -3164,7 +3164,7 @@ cdef class gen(sage.structure.element.RingElement): 4 """ t0GEN(y) - sig_on() + pari_catch_sig_on() return P.new_gen(gbitnegimply(x.g, t0)) @@ -3199,7 +3199,7 @@ cdef class gen(sage.structure.element.RingElement): 13 """ t0GEN(y) - sig_on() + pari_catch_sig_on() return P.new_gen(gbitor(x.g, t0)) @@ -3239,9 +3239,9 @@ cdef class gen(sage.structure.element.RingElement): sage: [pari(-3).bittest(n) for n in range(10)] [True, False, True, True, True, True, True, True, True, True] """ - sig_on() + pari_catch_sig_on() b = bool(bittest(x.g, n)) - sig_off() + pari_catch_sig_off() return b def bitxor(gen x, y): @@ -3273,7 +3273,7 @@ cdef class gen(sage.structure.element.RingElement): 6 """ t0GEN(y) - sig_on() + pari_catch_sig_on() return P.new_gen(gbitxor(x.g, t0)) @@ -3316,7 +3316,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari(x^2+5*x+2.5).ceil() x^2 + 5*x + 2.50000000000000 """ - sig_on() + pari_catch_sig_on() return P.new_gen(gceil(x.g)) def centerlift(gen x, v=-1): @@ -3354,7 +3354,7 @@ cdef class gen(sage.structure.element.RingElement): sage: f.centerlift('y') Mod(x - y, x^2 + 1) """ - sig_on() + pari_catch_sig_on() return P.new_gen(centerlift0(x.g, P.get_var(v))) @@ -3401,7 +3401,7 @@ cdef class gen(sage.structure.element.RingElement): ... PariError: (5) """ - sig_on() + pari_catch_sig_on() return P.new_gen(compo(x.g, n)) def conj(gen x): @@ -3433,7 +3433,7 @@ cdef class gen(sage.structure.element.RingElement): ... PariError: incorrect type (11) """ - sig_on() + pari_catch_sig_on() return P.new_gen(gconj(x.g)) def conjvec(gen x): @@ -3457,7 +3457,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari('Mod(x,x^3-3)').conjvec() [1.44224957030741, -0.721124785153704 + 1.24902476648341*I, -0.721124785153704 - 1.24902476648341*I]~ """ - sig_on() + pari_catch_sig_on() return P.new_gen(conjvec(x.g, prec)) def denominator(gen x): @@ -3487,7 +3487,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari('[2/3, 5/8, 7/3, 1/5]').denominator() 120 """ - sig_on() + pari_catch_sig_on() return P.new_gen(denom(x.g)) def floor(gen x): @@ -3530,7 +3530,7 @@ cdef class gen(sage.structure.element.RingElement): ... PariError: incorrect type (11) """ - sig_on() + pari_catch_sig_on() return P.new_gen(gfloor(x.g)) def frac(gen x): @@ -3556,7 +3556,7 @@ cdef class gen(sage.structure.element.RingElement): ... PariError: incorrect type (11) """ - sig_on() + pari_catch_sig_on() return P.new_gen(gfrac(x.g)) def imag(gen x): @@ -3587,7 +3587,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari('[1,2,3] + [4*I,5,6]').imag() [4, 0, 0] """ - sig_on() + pari_catch_sig_on() return P.new_gen(gimag(x.g)) def length(self): @@ -3626,7 +3626,7 @@ cdef class gen(sage.structure.element.RingElement): ??? more examples """ - sig_on() + pari_catch_sig_on() if v == -1: return P.new_gen(lift(x.g)) return P.new_gen(lift0(x.g, P.get_var(v))) @@ -3642,7 +3642,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari(100).numbpart() 190569292 """ - sig_on() + pari_catch_sig_on() return P.new_gen(numbpart(x.g)) def numerator(gen x): @@ -3659,7 +3659,7 @@ cdef class gen(sage.structure.element.RingElement): EXAMPLES: """ - sig_on() + pari_catch_sig_on() return P.new_gen(numer(x.g)) @@ -3684,7 +3684,7 @@ cdef class gen(sage.structure.element.RingElement): EXAMPLES: """ - sig_on() + pari_catch_sig_on() return P.new_gen(numtoperm(n, k.g)) @@ -3744,7 +3744,7 @@ cdef class gen(sage.structure.element.RingElement): sage: y.padicprime().type() 't_INT' """ - sig_on() + pari_catch_sig_on() return P.new_gen(gel(x.g, 2)) def permtonum(gen x): @@ -3769,7 +3769,7 @@ cdef class gen(sage.structure.element.RingElement): """ if typ(x.g) != t_VEC: raise TypeError, "x (=%s) must be of type t_VEC, but is of type %s."%(x,x.type()) - sig_on() + pari_catch_sig_on() return P.new_gen(permtonum(x.g)) def precision(gen x, long n=-1): @@ -3791,7 +3791,7 @@ cdef class gen(sage.structure.element.RingElement): """ if n <= -1: return precision(x.g) - sig_on() + pari_catch_sig_on() return P.new_gen(precision0(x.g, n)) def random(gen N): @@ -3815,7 +3815,7 @@ cdef class gen(sage.structure.element.RingElement): """ if typ(N.g) != t_INT: raise TypeError, "x (=%s) must be of type t_INT, but is of type %s."%(N,N.type()) - sig_on() + pari_catch_sig_on() return P.new_gen(genrand(N.g)) def real(gen x): @@ -3832,7 +3832,7 @@ cdef class gen(sage.structure.element.RingElement): EXAMPLES: """ - sig_on() + pari_catch_sig_on() return P.new_gen(greal(x.g)) def round(gen x, estimate=False): @@ -3885,7 +3885,7 @@ cdef class gen(sage.structure.element.RingElement): cdef int n cdef long e cdef gen y - sig_on() + pari_catch_sig_on() if not estimate: return P.new_gen(ground(x.g)) y = P.new_gen(grndtoi(x.g, &e)) @@ -3929,7 +3929,7 @@ cdef class gen(sage.structure.element.RingElement): sage: y.type() 't_REAL' """ - sig_on() + pari_catch_sig_on() return P.new_gen(simplify(x.g)) def sizeword(gen x): @@ -4088,7 +4088,7 @@ cdef class gen(sage.structure.element.RingElement): """ cdef long e cdef gen y - sig_on() + pari_catch_sig_on() if not estimate: return P.new_gen(gtrunc(x.g)) y = P.new_gen(gcvtoi(x.g, &e)) @@ -4166,9 +4166,9 @@ cdef class gen(sage.structure.element.RingElement): """ cdef long v t0GEN(p) - sig_on() + pari_catch_sig_on() v = ggval(x.g, t0) - sig_off() + pari_catch_sig_off() return v def _valp(gen x): @@ -4190,7 +4190,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari('x')._valp() # random -35184372088832 """ - # This is a simple macro, so we don't need sig_on() + # This is a simple macro, so we don't need pari_catch_sig_on() return valp(x.g) def variable(gen x): @@ -4220,7 +4220,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari('y0+z0').variable() y0 """ - sig_on() + pari_catch_sig_on() return P.new_gen(gpolvar(x.g)) @@ -4252,7 +4252,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari('x-1.2*x^2').abs() 1.20000000000000*x^2 - x """ - sig_on() + pari_catch_sig_on() # the prec parameter here has no effect return P.new_gen(gabs(x.g, prec)) @@ -4279,7 +4279,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari(1.1+i).acos() 0.849343054245252 - 1.09770986682533*I """ - sig_on() + pari_catch_sig_on() return P.new_gen(gacos(x.g, pbw(precision))) def acosh(gen x, precision=0): @@ -4304,7 +4304,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari(i).acosh() 0.881373587019543 + 1.57079632679490*I """ - sig_on() + pari_catch_sig_on() return P.new_gen(gach(x.g, pbw(precision))) def agm(gen x, y, precision=0): @@ -4334,7 +4334,7 @@ cdef class gen(sage.structure.element.RingElement): -0.964731722290876 + 1.15700282952632*I """ t0GEN(y) - sig_on() + pari_catch_sig_on() return P.new_gen(agm(x.g, t0, pbw(precision))) def arg(gen x, precision=0): @@ -4352,7 +4352,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari(2+i).arg() 0.463647609000806 """ - sig_on() + pari_catch_sig_on() return P.new_gen(garg(x.g, pbw(precision))) def asin(gen x, precision=0): @@ -4374,7 +4374,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari(2).asin() 1.57079632679490 - 1.31695789692482*I """ - sig_on() + pari_catch_sig_on() return P.new_gen(gasin(x.g, pbw(precision))) def asinh(gen x, precision=0): @@ -4395,7 +4395,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari(2+i).asinh() 1.52857091948100 + 0.427078586392476*I """ - sig_on() + pari_catch_sig_on() return P.new_gen(gash(x.g, pbw(precision))) def atan(gen x, precision=0): @@ -4416,7 +4416,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari(1.5+i).atan() 1.10714871779409 + 0.255412811882995*I """ - sig_on() + pari_catch_sig_on() return P.new_gen(gatan(x.g, pbw(precision))) def atanh(gen x, precision=0): @@ -4438,7 +4438,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari(2).atanh() 0.549306144334055 - 1.57079632679490*I """ - sig_on() + pari_catch_sig_on() return P.new_gen(gath(x.g, pbw(precision))) def bernfrac(gen x): @@ -4455,7 +4455,7 @@ cdef class gen(sage.structure.element.RingElement): sage: [pari(n).bernfrac() for n in range(10)] [1, -1/2, 1/6, 0, -1/30, 0, 1/42, 0, -1/30, 0] """ - sig_on() + pari_catch_sig_on() return P.new_gen(bernfrac(x)) def bernreal(gen x): @@ -4469,7 +4469,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari(18).bernreal() 54.9711779448622 """ - sig_on() + pari_catch_sig_on() # the argument prec has no effect return P.new_gen(bernreal(x, prec)) @@ -4491,7 +4491,7 @@ cdef class gen(sage.structure.element.RingElement): sage: [pari(2*n).bernfrac() for n in range(9)] [1, 1/6, -1/30, 1/42, -1/30, 5/66, -691/2730, 7/6, -3617/510] """ - sig_on() + pari_catch_sig_on() return P.new_gen(bernvec(x)) def besselh1(gen nu, x, precision=0): @@ -4511,7 +4511,7 @@ cdef class gen(sage.structure.element.RingElement): 0.486091260585891 - 0.160400393484924*I """ t0GEN(x) - sig_on() + pari_catch_sig_on() return P.new_gen(hbessel1(nu.g, t0, pbw(precision))) def besselh2(gen nu, x, precision=0): @@ -4531,7 +4531,7 @@ cdef class gen(sage.structure.element.RingElement): 0.486091260585891 + 0.160400393484924*I """ t0GEN(x) - sig_on() + pari_catch_sig_on() return P.new_gen(hbessel2(nu.g, t0, pbw(precision))) def besselj(gen nu, x, precision=0): @@ -4554,7 +4554,7 @@ cdef class gen(sage.structure.element.RingElement): 0.486091260585891 """ t0GEN(x) - sig_on() + pari_catch_sig_on() return P.new_gen(jbessel(nu.g, t0, pbw(precision))) def besseljh(gen nu, x, precision=0): @@ -4579,7 +4579,7 @@ cdef class gen(sage.structure.element.RingElement): 0.412710032209716 # 64-bit """ t0GEN(x) - sig_on() + pari_catch_sig_on() return P.new_gen(jbesselh(nu.g, t0, pbw(precision))) def besseli(gen nu, x, precision=0): @@ -4605,7 +4605,7 @@ cdef class gen(sage.structure.element.RingElement): 1.12539407613913 + 2.08313822670661*I """ t0GEN(x) - sig_on() + pari_catch_sig_on() return P.new_gen(ibessel(nu.g, t0, pbw(precision))) def besselk(gen nu, x, long flag=0, precision=0): @@ -4648,7 +4648,7 @@ cdef class gen(sage.structure.element.RingElement): 3.74224603319728 E-132 + 2.49071062641525 E-134*I """ t0GEN(x) - sig_on() + pari_catch_sig_on() return P.new_gen(kbessel(nu.g, t0, pbw(precision))) def besseln(gen nu, x, precision=0): @@ -4669,7 +4669,7 @@ cdef class gen(sage.structure.element.RingElement): -0.280775566958244 - 0.486708533223726*I """ t0GEN(x) - sig_on() + pari_catch_sig_on() return P.new_gen(nbessel(nu.g, t0, pbw(precision))) def cos(gen x, precision=0): @@ -4691,7 +4691,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari('x+O(x^8)').cos() 1 - 1/2*x^2 + 1/24*x^4 - 1/720*x^6 + 1/40320*x^8 + O(x^9) """ - sig_on() + pari_catch_sig_on() return P.new_gen(gcos(x.g, pbw(precision))) def cosh(gen x, precision=0): @@ -4713,7 +4713,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari('x+O(x^8)').cosh() 1 + 1/2*x^2 + 1/24*x^4 + 1/720*x^6 + O(x^8) """ - sig_on() + pari_catch_sig_on() return P.new_gen(gch(x.g, pbw(precision))) def cotan(gen x, precision=0): @@ -4740,7 +4740,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari(x).cotan() # random -8.17674825 E15 """ - sig_on() + pari_catch_sig_on() return P.new_gen(gcotan(x.g, pbw(precision))) def dilog(gen x, precision=0): @@ -4762,7 +4762,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari(1+i).dilog() 0.616850275068085 + 1.46036211675312*I """ - sig_on() + pari_catch_sig_on() return P.new_gen(dilog(x.g, pbw(precision))) def eint1(gen x, long n=0, precision=0): @@ -4789,7 +4789,7 @@ cdef class gen(sage.structure.element.RingElement): EXAMPLES: """ - sig_on() + pari_catch_sig_on() if n <= 0: return P.new_gen(eint1(x.g, pbw(precision))) else: @@ -4815,7 +4815,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari(1).erfc() 0.157299207050285 """ - sig_on() + pari_catch_sig_on() return P.new_gen(gerfc(x.g, pbw(precision))) def eta(gen x, flag=0, precision=0): @@ -4843,7 +4843,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari(i).eta() 0.998129069925959 """ - sig_on() + pari_catch_sig_on() if flag == 1: return P.new_gen(trueeta(x.g, pbw(precision))) return P.new_gen(eta(x.g, pbw(precision))) @@ -4866,7 +4866,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari('x+O(x^8)').exp() 1 + x + 1/2*x^2 + 1/6*x^3 + 1/24*x^4 + 1/120*x^5 + 1/720*x^6 + 1/5040*x^7 + O(x^8) """ - sig_on() + pari_catch_sig_on() return P.new_gen(gexp(self.g, pbw(precision))) def gamma(gen s, precision=0): @@ -4895,7 +4895,7 @@ cdef class gen(sage.structure.element.RingElement): ... PariError: (5) """ - sig_on() + pari_catch_sig_on() return P.new_gen(ggamma(s.g, pbw(precision))) def gammah(gen s, precision=0): @@ -4917,7 +4917,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari(1+i).gammah() 0.575315188063452 + 0.0882106775440939*I """ - sig_on() + pari_catch_sig_on() return P.new_gen(ggamd(s.g, pbw(precision))) def hyperu(gen a, b, x, precision=0): @@ -4937,7 +4937,7 @@ cdef class gen(sage.structure.element.RingElement): """ t0GEN(b) t1GEN(x) - sig_on() + pari_catch_sig_on() return P.new_gen(hyperu(a.g, t0, t1, pbw(precision))) def incgam(gen s, x, y=None, precision=0): @@ -4957,7 +4957,7 @@ cdef class gen(sage.structure.element.RingElement): -0.0458297859919946 + 0.0433696818726677*I """ t0GEN(x) - sig_on() + pari_catch_sig_on() if y is None: return P.new_gen(incgam(s.g, t0, pbw(precision))) else: @@ -4987,7 +4987,7 @@ cdef class gen(sage.structure.element.RingElement): 0.864664716763387 """ t0GEN(x) - sig_on() + pari_catch_sig_on() return P.new_gen(incgamc(s.g, t0, pbw(precision))) def log(gen x, precision=0): @@ -5030,7 +5030,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari(i).log() 0.E-19 + 1.57079632679490*I """ - sig_on() + pari_catch_sig_on() return P.new_gen(glog(x.g, pbw(precision))) def lngamma(gen x, precision=0): @@ -5073,7 +5073,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari(100).log_gamma() 359.134205369575 """ - sig_on() + pari_catch_sig_on() return P.new_gen(glngamma(x.g, pbw(precision))) def polylog(gen x, long m, flag=0, precision=0): @@ -5101,7 +5101,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari(10).polylog(3,2) -0.400459056163451 """ - sig_on() + pari_catch_sig_on() return P.new_gen(polylog0(m, x.g, flag, pbw(precision))) def psi(gen x, precision=0): @@ -5121,7 +5121,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari(1).psi() -0.577215664901533 """ - sig_on() + pari_catch_sig_on() return P.new_gen(gpsi(x.g, pbw(precision))) def sin(gen x, precision=0): @@ -5141,7 +5141,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari(1+i).sin() 1.29845758141598 + 0.634963914784736*I """ - sig_on() + pari_catch_sig_on() return P.new_gen(gsin(x.g, pbw(precision))) def sinh(gen x, precision=0): @@ -5161,7 +5161,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari(1+i).sinh() 0.634963914784736 + 1.29845758141598*I """ - sig_on() + pari_catch_sig_on() return P.new_gen(gsh(x.g, pbw(precision))) def sqr(gen x): @@ -5187,7 +5187,7 @@ cdef class gen(sage.structure.element.RingElement): sage: x = pari("1+O(2^5)"); x*x 1 + O(2^6) """ - sig_on() + pari_catch_sig_on() return P.new_gen(gsqr(x.g)) @@ -5205,7 +5205,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari(2).sqrt() 1.41421356237310 """ - sig_on() + pari_catch_sig_on() return P.new_gen(gsqrt(x.g, pbw(precision))) def sqrtn(gen x, n, precision=0): @@ -5264,7 +5264,7 @@ cdef class gen(sage.structure.element.RingElement): # TODO: ??? lots of good examples in the PARI docs ??? cdef GEN zetan t0GEN(n) - sig_on() + pari_catch_sig_on() ans = P.new_gen_noclear(gsqrtn(x.g, t0, &zetan, pbw(precision))) return ans, P.new_gen(zetan) @@ -5285,7 +5285,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari(i).tan() 0.E-19 + 0.761594155955765*I """ - sig_on() + pari_catch_sig_on() return P.new_gen(gtan(x.g, pbw(precision))) def tanh(gen x, precision=0): @@ -5310,7 +5310,7 @@ cdef class gen(sage.structure.element.RingElement): sage: result.imag() 1.55740772465490 """ - sig_on() + pari_catch_sig_on() return P.new_gen(gth(x.g, pbw(precision))) def teichmuller(gen x): @@ -5325,7 +5325,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari('2+O(7^5)').teichmuller() 2 + 4*7 + 6*7^2 + 3*7^3 + O(7^5) """ - sig_on() + pari_catch_sig_on() return P.new_gen(teich(x.g)) def theta(gen q, z, precision=0): @@ -5344,7 +5344,7 @@ cdef class gen(sage.structure.element.RingElement): 1.63202590295260 """ t0GEN(z) - sig_on() + pari_catch_sig_on() return P.new_gen(theta(q.g, t0, pbw(precision))) def thetanullk(gen q, long k, precision=0): @@ -5361,7 +5361,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari(0.5).thetanullk(1) 0.548978532560341 """ - sig_on() + pari_catch_sig_on() return P.new_gen(thetanullk(q.g, k, pbw(precision))) def weber(gen x, flag=0, precision=0): @@ -5392,7 +5392,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari(i).weber(2) 1.09050773266526 """ - sig_on() + pari_catch_sig_on() return P.new_gen(weber0(x.g, flag, pbw(precision))) def zeta(gen s, precision=0): @@ -5442,7 +5442,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari('1+5*7+2*7^2+O(7^3)').zeta() 4*7^-2 + 5*7^-1 + O(7^0) """ - sig_on() + pari_catch_sig_on() return P.new_gen(gzeta(s.g, pbw(precision))) ########################################### @@ -5453,7 +5453,7 @@ cdef class gen(sage.structure.element.RingElement): cdef gen u, v, g cdef GEN U, V, G t0GEN(y) - sig_on() + pari_catch_sig_on() G = gbezout(x.g, t0, &U, &V) g = P.new_gen_noclear(G) u = P.new_gen_noclear(U) @@ -5481,7 +5481,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari('2+x+O(x^2)').binomial(3) 1/3*x + O(x^2) """ - sig_on() + pari_catch_sig_on() return P.new_gen(binomial(x.g, k)) def contfrac(gen x, b=0, long lmax=0): @@ -5493,7 +5493,7 @@ cdef class gen(sage.structure.element.RingElement): expansion. """ t0GEN(b) - sig_on() + pari_catch_sig_on() return P.new_gen(contfrac0(x.g, t0, lmax)) def contfracpnqn(gen x, b=0, long lmax=0): @@ -5501,7 +5501,7 @@ cdef class gen(sage.structure.element.RingElement): contfracpnqn(x): [p_n,p_n-1; q_n,q_n-1] corresponding to the continued fraction x. """ - sig_on() + pari_catch_sig_on() return P.new_gen(pnqn(x.g)) def ffgen(gen T, v=-1): @@ -5527,7 +5527,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari(x^2+x+1).ffgen('a') a """ - sig_on() + pari_catch_sig_on() return P.new_gen(ffgen(T.g, P.get_var(v))) def ffinit(gen p, long n, v=-1): @@ -5553,7 +5553,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari(2003).ffinit(3) Mod(1, 2003)*x^3 + Mod(1, 2003)*x^2 + Mod(1993, 2003)*x + Mod(1995, 2003) """ - sig_on() + pari_catch_sig_on() return P.new_gen(ffinit(p.g, n, P.get_var(v))) def fibonacci(gen x): @@ -5567,7 +5567,7 @@ cdef class gen(sage.structure.element.RingElement): sage: [pari(n).fibonacci() for n in range(10)] [0, 1, 1, 2, 3, 5, 8, 13, 21, 34] """ - sig_on() + pari_catch_sig_on() return P.new_gen(fibo(long(x))) @@ -5579,7 +5579,7 @@ cdef class gen(sage.structure.element.RingElement): and y must be polynomials) """ t0GEN(y) - sig_on() + pari_catch_sig_on() return P.new_gen(ggcd0(x.g, t0)) def issquare(gen x, find_root=False): @@ -5590,14 +5590,14 @@ cdef class gen(sage.structure.element.RingElement): """ cdef GEN G, t cdef gen g - sig_on() + pari_catch_sig_on() if find_root: t = gissquareall(x.g, &G) v = bool(P.new_gen_noclear(t)) if v: return v, P.new_gen(G) else: - sig_off() + pari_catch_sig_off() return v, None else: return P.new_gen(gissquare(x.g)) @@ -5612,9 +5612,9 @@ cdef class gen(sage.structure.element.RingElement): sage: pari(20).issquarefree() False """ - sig_on() + pari_catch_sig_on() t = bool(issquarefree(self.g)) - sig_off() + pari_catch_sig_off() return t def lcm(gen x, y): @@ -5625,7 +5625,7 @@ cdef class gen(sage.structure.element.RingElement): 30 """ t0GEN(y) - sig_on() + pari_catch_sig_on() return P.new_gen(glcm(x.g, t0)) def numdiv(gen n): @@ -5637,7 +5637,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari(10).numdiv() 4 """ - sig_on() + pari_catch_sig_on() return P.new_gen(gnumbdiv(n.g)) def phi(gen n): @@ -5647,7 +5647,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari(10).phi() 4 """ - sig_on() + pari_catch_sig_on() return P.new_gen(geulerphi(n.g)) def primepi(gen self): @@ -5672,11 +5672,11 @@ cdef class gen(sage.structure.element.RingElement): 41581 """ global num_primes - sig_on() + pari_catch_sig_on() if self > num_primes: P.init_primes(self + 10) if signe(self.g) != 1: - sig_off() + pari_catch_sig_off() return P.PARI_ZERO return P.new_gen(primepi(self.g)) @@ -5689,7 +5689,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari(10).sumdiv() 18 """ - sig_on() + pari_catch_sig_on() return P.new_gen(sumdiv(n.g)) def sumdivk(gen n, long k): @@ -5701,7 +5701,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari(10).sumdivk(2) 130 """ - sig_on() + pari_catch_sig_on() return P.new_gen(sumdivk(n.g, k)) def xgcd(gen x, y): @@ -5789,7 +5789,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari([0,x,0,2*x,1]).ellinit(flag=1) [0, x, 0, 2*x, 1, 4*x, 4*x, 4, -4*x^2 + 4*x, 16*x^2 - 96*x, -64*x^3 + 576*x^2 - 864, 64*x^4 - 576*x^3 + 576*x^2 - 432, (256*x^6 - 4608*x^5 + 27648*x^4 - 55296*x^3)/(4*x^4 - 36*x^3 + 36*x^2 - 27)] """ - sig_on() + pari_catch_sig_on() return P.new_gen(ellinit0(self.g, flag, pbw(precision))) def ellglobalred(self): @@ -5824,7 +5824,7 @@ cdef class gen(sage.structure.element.RingElement): sage: e.ellglobalred() [17, [1, 0, 0, 0], 4] """ - sig_on() + pari_catch_sig_on() return self.new_gen(ellglobalred(self.g)) def elladd(self, z0, z1): @@ -5860,7 +5860,7 @@ cdef class gen(sage.structure.element.RingElement): [-3/4, -15/8] """ t0GEN(z0); t1GEN(z1) - sig_on() + pari_catch_sig_on() return self.new_gen(addell(self.g, t0, t1)) def ellak(self, n): @@ -5898,7 +5898,7 @@ cdef class gen(sage.structure.element.RingElement): 0 """ t0GEN(n) - sig_on() + pari_catch_sig_on() return self.new_gen(akell(self.g, t0)) @@ -5932,7 +5932,7 @@ cdef class gen(sage.structure.element.RingElement): sage: type(v[0]) """ - sig_on() + pari_catch_sig_on() cdef GEN g if python_ints: g = anell(self.g, n) @@ -5954,7 +5954,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari(E).ellanalyticrank() [2, 1.51863300057685] """ - sig_on() + pari_catch_sig_on() return self.new_gen(ellanalyticrank(self.g, 0, pbw(precision))) def ellap(self, p): @@ -5993,7 +5993,7 @@ cdef class gen(sage.structure.element.RingElement): 0 """ t0GEN(p) - sig_on() + pari_catch_sig_on() return self.new_gen(ellap(self.g, t0)) @@ -6047,7 +6047,7 @@ cdef class gen(sage.structure.element.RingElement): """ # 1. make a table of primes up to n. - sig_on() + pari_catch_sig_on() if n < 2: return self.new_gen(zerovec(0)) cdef GEN g @@ -6090,7 +6090,7 @@ cdef class gen(sage.structure.element.RingElement): 0.418188984498861 """ t0GEN(z0); t1GEN(z1) - sig_on() + pari_catch_sig_on() # the prec argument has no effect return self.new_gen(bilhell(self.g, t0, t1, prec)) @@ -6122,7 +6122,7 @@ cdef class gen(sage.structure.element.RingElement): [1, -1, 0, 4, 3] """ t0GEN(ch) - sig_on() + pari_catch_sig_on() return self.new_gen(ellchangecurve(self.g, t0)) def elleta(self): @@ -6143,7 +6143,7 @@ cdef class gen(sage.structure.element.RingElement): sage: w1*eta2-w2*eta1 == pari(2*pi*I) True """ - sig_on() + pari_catch_sig_on() # the prec argument has no effect return self.new_gen(elleta(self.g, prec)) @@ -6191,7 +6191,7 @@ cdef class gen(sage.structure.element.RingElement): 0.476711659343740 """ t0GEN(a) - sig_on() + pari_catch_sig_on() return self.new_gen(ellheight0(self.g, t0, flag, pbw(precision))) def ellheightmatrix(self, x): @@ -6219,7 +6219,7 @@ cdef class gen(sage.structure.element.RingElement): [0.476711659343740, 0.418188984498861; 0.418188984498861, 0.686667083305587] """ t0GEN(x) - sig_on() + pari_catch_sig_on() # the argument prec has no effect return self.new_gen(mathell(self.g, t0, prec)) @@ -6246,9 +6246,9 @@ cdef class gen(sage.structure.element.RingElement): True """ t0GEN(x) - sig_on() + pari_catch_sig_on() t = bool(oncurve(self.g, t0) == 1) - sig_off() + pari_catch_sig_off() return t def elllocalred(self, p): @@ -6403,7 +6403,7 @@ cdef class gen(sage.structure.element.RingElement): [2, -10, [1, 96, 1, 316], 4] """ t0GEN(p) - sig_on() + pari_catch_sig_on() return self.new_gen(elllocalred(self.g, t0)) def elllseries(self, s, A=1): @@ -6445,7 +6445,7 @@ cdef class gen(sage.structure.element.RingElement): 0.402838047956645 """ t0GEN(s); t1GEN(A) - sig_on() + pari_catch_sig_on() # the argument prec has no effect return self.new_gen(elllseries(self.g, t0, t1, prec)) @@ -6481,7 +6481,7 @@ cdef class gen(sage.structure.element.RingElement): cdef GEN x, y cdef gen model, change cdef pari_sp t - sig_on() + pari_catch_sig_on() x = ellminimalmodel(self.g, &y) change = self.new_gen_noclear(y) model = self.new_gen(x) @@ -6515,7 +6515,7 @@ cdef class gen(sage.structure.element.RingElement): 0 """ t0GEN(x) - sig_on() + pari_catch_sig_on() return self.new_gen(orderell(self.g, t0)) def ellordinate(self, x): @@ -6546,7 +6546,7 @@ cdef class gen(sage.structure.element.RingElement): [-2*z - 7*z^2 - 23*z^3 + O(z^4), -1 + 2*z + 7*z^2 + 23*z^3 + O(z^4)] """ t0GEN(x) - sig_on() + pari_catch_sig_on() # the prec argument has no effect return self.new_gen(ellordinate(self.g, t0, prec)) @@ -6573,7 +6573,7 @@ cdef class gen(sage.structure.element.RingElement): 0 """ t0GEN(P) - sig_on() + pari_catch_sig_on() return self.new_gen(zell(self.g, t0, pbw(precision))) def ellpow(self, z, n): @@ -6615,27 +6615,27 @@ cdef class gen(sage.structure.element.RingElement): TESTS:: sage: for D in [-7, -8, -11, -12, -16, -19, -27, -28]: # long time (1s) - ... hcpol = hilbert_class_polynomial(D) - ... j = hcpol.roots(multiplicities=False)[0] - ... t = (1728-j)/(27*j) - ... E = EllipticCurve([4*t,16*t^2]) - ... P = E.point([0, 4*t]) - ... assert(E.j_invariant() == j) - ... # - ... # Compute some CM number and its minimal polynomial - ... # - ... cm = pari('cm = (3*quadgen(%s)+2)'%D) - ... cm_minpoly = pari('minpoly(cm)') - ... # - ... # Evaluate cm_minpoly(cm)(P), which should be zero - ... # - ... e = pari(E) # Convert E to PARI - ... P2 = e.ellpow(P, cm_minpoly[2]*cm + cm_minpoly[1]) - ... P0 = e.elladd(e.ellpow(P, cm_minpoly[0]), e.ellpow(P2, cm)) - ... assert(P0 == E(0)) + ....: hcpol = hilbert_class_polynomial(D) + ....: j = hcpol.roots(multiplicities=False)[0] + ....: t = (1728-j)/(27*j) + ....: E = EllipticCurve([4*t,16*t^2]) + ....: P = E.point([0, 4*t]) + ....: assert(E.j_invariant() == j) + ....: # + ....: # Compute some CM number and its minimal polynomial + ....: # + ....: cm = pari('cm = (3*quadgen(%s)+2)'%D) + ....: cm_minpoly = pari('minpoly(cm)') + ....: # + ....: # Evaluate cm_minpoly(cm)(P), which should be zero + ....: # + ....: e = pari(E) # Convert E to PARI + ....: P2 = e.ellpow(P, cm_minpoly[2]*cm + cm_minpoly[1]) + ....: P0 = e.elladd(e.ellpow(P, cm_minpoly[0]), e.ellpow(P2, cm)) + ....: assert(P0 == E(0)) """ t0GEN(z); t1GEN(n) - sig_on() + pari_catch_sig_on() return self.new_gen(powell(self.g, t0, t1)) def ellrootno(self, p=1): @@ -6671,9 +6671,9 @@ cdef class gen(sage.structure.element.RingElement): """ cdef long rootno t0GEN(p) - sig_on() + pari_catch_sig_on() rootno = ellrootno(self.g, t0) - sig_off() + pari_catch_sig_off() return rootno def ellsigma(self, z, flag=0): @@ -6690,7 +6690,7 @@ cdef class gen(sage.structure.element.RingElement): 1.43490215804166 + 1.80307856719256*I """ t0GEN(z) - sig_on() + pari_catch_sig_on() # the prec argument has no effect return self.new_gen(ellsigma(self.g, t0, flag, prec)) @@ -6717,11 +6717,11 @@ cdef class gen(sage.structure.element.RingElement): [0, 0] """ t0GEN(z0); t1GEN(z1) - sig_on() + pari_catch_sig_on() return self.new_gen(subell(self.g, t0, t1)) def elltaniyama(self): - sig_on() + pari_catch_sig_on() return self.new_gen(taniyama(self.g)) def elltors(self, flag=0): @@ -6766,7 +6766,7 @@ cdef class gen(sage.structure.element.RingElement): sage: e.elltors() [12, [6, 2], [[-2, 8], [3, -2]]] """ - sig_on() + pari_catch_sig_on() return self.new_gen(elltors0(self.g, flag)) def ellzeta(self, z): @@ -6800,7 +6800,7 @@ cdef class gen(sage.structure.element.RingElement): -0.350122658523049 - 0.350122658523049*I """ t0GEN(z) - sig_on() + pari_catch_sig_on() # the prec argument has no effect return self.new_gen(ellzeta(self.g, t0, prec)) @@ -6839,7 +6839,7 @@ cdef class gen(sage.structure.element.RingElement): dprec = prec_words_to_dec(z.precision()) except AttributeError: dprec = prec - sig_on() + pari_catch_sig_on() # the prec argument has no effect return self.new_gen(pointell(self.g, t0, dprec)) @@ -6889,7 +6889,7 @@ cdef class gen(sage.structure.element.RingElement): dprec = prec_words_to_dec(self.precision()) except AttributeError: dprec = prec - sig_on() + pari_catch_sig_on() return P.new_gen(jell(self.g, dprec)) @@ -6913,62 +6913,62 @@ cdef class gen(sage.structure.element.RingElement): http://pari.math.u-bordeaux.fr/pub/pari/manuals/2.5.1/users.pdf """ cdef long n - sig_on() + pari_catch_sig_on() n = bnfcertify(self.g) - sig_off() + pari_catch_sig_off() return n def bnfinit(self, long flag=0, tech=None): if tech is None: - sig_on() + pari_catch_sig_on() return P.new_gen(bnfinit0(self.g, flag, 0, prec)) else: t0GEN(tech) - sig_on() + pari_catch_sig_on() return P.new_gen(bnfinit0(self.g, flag, t0, prec)) def bnfisintnorm(self, x): t0GEN(x) - sig_on() + pari_catch_sig_on() return self.new_gen(bnfisintnorm(self.g, t0)) def bnfisnorm(self, x, long flag=0): t0GEN(x) - sig_on() + pari_catch_sig_on() return self.new_gen(bnfisnorm(self.g, t0, flag)) def bnfisprincipal(self, x, long flag=1): t0GEN(x) - sig_on() + pari_catch_sig_on() return self.new_gen(bnfisprincipal0(self.g, t0, flag)) def bnfnarrow(self): - sig_on() + pari_catch_sig_on() return self.new_gen(buchnarrow(self.g)) def bnfsunit(bnf, S, long precision=0): t0GEN(S) - sig_on() + pari_catch_sig_on() return bnf.new_gen(bnfsunit(bnf.g, t0, pbw(precision))) def bnfunit(self): - sig_on() + pari_catch_sig_on() return self.new_gen(bnf_get_fu(self.g)) def bnfisunit(self, x): t0GEN(x) - sig_on() + pari_catch_sig_on() return self.new_gen(bnfisunit(self.g, t0)) def dirzetak(self, n): t0GEN(n) - sig_on() + pari_catch_sig_on() return self.new_gen(dirzetak(self.g, t0)) def galoisapply(self, aut, x): t0GEN(aut) t1GEN(x) - sig_on() + pari_catch_sig_on() return self.new_gen(galoisapply(self.g, t0, t1)) def galoisinit(self, den=None): @@ -6977,41 +6977,41 @@ cdef class gen(sage.structure.element.RingElement): for meaning of den """ if den is None: - sig_on() + pari_catch_sig_on() return self.new_gen(galoisinit(self.g, NULL)) else: t0GEN(den) - sig_on() + pari_catch_sig_on() return self.new_gen(galoisinit(self.g, t0)) def galoispermtopol(self, perm): t0GEN(perm) - sig_on() + pari_catch_sig_on() return self.new_gen(galoispermtopol(self.g, t0)) def galoisfixedfield(self, perm, long flag=0, v=-1): t0GEN(perm); - sig_on() + pari_catch_sig_on() return self.new_gen(galoisfixedfield(self.g, t0, flag, P.get_var(v))) def idealred(self, I, vdir=0): t0GEN(I); t1GEN(vdir) - sig_on() + pari_catch_sig_on() return self.new_gen(idealred0(self.g, t0, t1 if vdir else NULL)) def idealadd(self, x, y): t0GEN(x); t1GEN(y) - sig_on() + pari_catch_sig_on() return self.new_gen(idealadd(self.g, t0, t1)) def idealaddtoone(self, x, y): t0GEN(x); t1GEN(y) - sig_on() + pari_catch_sig_on() return self.new_gen(idealaddtoone0(self.g, t0, t1)) def idealappr(self, x, long flag=0): t0GEN(x) - sig_on() + pari_catch_sig_on() return self.new_gen(idealappr(self.g, t0)) def idealcoprime(self, x, y): @@ -7035,32 +7035,32 @@ cdef class gen(sage.structure.element.RingElement): [5/43, 9/43, -1/43]~ """ t0GEN(x); t1GEN(y) - sig_on() + pari_catch_sig_on() return self.new_gen(idealcoprime(self.g, t0, t1)) def idealdiv(self, x, y, long flag=0): t0GEN(x); t1GEN(y) - sig_on() + pari_catch_sig_on() return self.new_gen(idealdiv0(self.g, t0, t1, flag)) def idealfactor(self, x): t0GEN(x) - sig_on() + pari_catch_sig_on() return self.new_gen(idealfactor(self.g, t0)) def idealhnf(self, a, b=None): t0GEN(a) if b is None: - sig_on() + pari_catch_sig_on() return self.new_gen(idealhnf(self.g, t0)) else: t1GEN(b) - sig_on() + pari_catch_sig_on() return self.new_gen(idealhnf0(self.g, t0, t1)) def idealintersection(self, x, y): t0GEN(x); t1GEN(y) - sig_on() + pari_catch_sig_on() return self.new_gen(idealintersect(self.g, t0, t1)) def ideallist(self, long bound, long flag = 4): @@ -7087,7 +7087,7 @@ cdef class gen(sage.structure.element.RingElement): sage: L[64] # 4 ideals of norm 65. [[65, 8; 0, 1], [65, 47; 0, 1], [65, 18; 0, 1], [65, 57; 0, 1]] """ - sig_on() + pari_catch_sig_on() return self.new_gen(ideallist0(self.g, bound, flag)) def ideallog(self, x, bid): @@ -7119,12 +7119,12 @@ cdef class gen(sage.structure.element.RingElement): [25]~ """ t0GEN(x); t1GEN(bid) - sig_on() + pari_catch_sig_on() return self.new_gen(ideallog(self.g, t0, t1)) def idealmul(self, x, y, long flag=0): t0GEN(x); t1GEN(y) - sig_on() + pari_catch_sig_on() if flag == 0: return self.new_gen(idealmul(self.g, t0, t1)) else: @@ -7132,7 +7132,7 @@ cdef class gen(sage.structure.element.RingElement): def idealnorm(self, x): t0GEN(x) - sig_on() + pari_catch_sig_on() return self.new_gen(idealnorm(self.g, t0)) def idealprimedec(nf, p): @@ -7152,7 +7152,7 @@ cdef class gen(sage.structure.element.RingElement): 5 """ t0GEN(p) - sig_on() + pari_catch_sig_on() return nf.new_gen(idealprimedec(nf.g, t0)) def idealstar(self, I, long flag=1): @@ -7192,33 +7192,33 @@ cdef class gen(sage.structure.element.RingElement): [[[43, 9, 5; 0, 1, 0; 0, 0, 1], [0]], [42, [42]], Mat([[43, [9, 1, 0]~, 1, 1, [-5, -9, 1]~], 1]), [[[[42], [[3, 0, 0]~], [[3, 0, 0]~], [Vecsmall([])], 1]], [[], [], []]], Mat(1)] """ t0GEN(I) - sig_on() + pari_catch_sig_on() return self.new_gen(idealstar0(self.g, t0, flag)) def idealtwoelt(self, x, a=None): t0GEN(x) if a is None: - sig_on() + pari_catch_sig_on() return self.new_gen(idealtwoelt0(self.g, t0, NULL)) else: t1GEN(a) - sig_on() + pari_catch_sig_on() return self.new_gen(idealtwoelt0(self.g, t0, t1)) def idealval(self, x, p): cdef long v t0GEN(x); t1GEN(p) - sig_on() + pari_catch_sig_on() v = idealval(self.g, t0, t1) - sig_off() + pari_catch_sig_off() return v def elementval(self, x, p): cdef long v t0GEN(x); t1GEN(p) - sig_on() + pari_catch_sig_on() v = nfval(self.g, t0, t1) - sig_off() + pari_catch_sig_off() return v def modreverse(self): @@ -7227,7 +7227,7 @@ cdef class gen(sage.structure.element.RingElement): EXAMPLES: """ - sig_on() + pari_catch_sig_on() return self.new_gen(modreverse(self.g)) def nfbasis(self, long flag=0, fa=0): @@ -7274,7 +7274,7 @@ cdef class gen(sage.structure.element.RingElement): t0GEN(fa) if typ(t0) != t_MAT: t0 = 0 - sig_on() + pari_catch_sig_on() return self.new_gen(nfbasis0(self.g, flag, t0)) def nfbasis_d(self, long flag=0, fa=0): @@ -7304,7 +7304,7 @@ cdef class gen(sage.structure.element.RingElement): t0GEN(fa) if typ(t0) != t_MAT: t0 = 0 - sig_on() + pari_catch_sig_on() B = self.new_gen_noclear(nfbasis(self.g, &disc, flag, t0)) D = self.new_gen(disc); return B,D @@ -7340,7 +7340,7 @@ cdef class gen(sage.structure.element.RingElement): -5/3*y^2 + 5/3*y - 1/6 """ t0GEN(x) - sig_on() + pari_catch_sig_on() return nf.new_gen(basistoalg(nf.g, t0)) def nfbasistoalg_lift(nf, x): @@ -7373,7 +7373,7 @@ cdef class gen(sage.structure.element.RingElement): -5/3*y^2 + 5/3*y - 1/6 """ t0GEN(x) - sig_on() + pari_catch_sig_on() return nf.new_gen(gel(basistoalg(nf.g, t0), 2)) def nfdisc(self, long flag=0, p=0): @@ -7408,7 +7408,7 @@ cdef class gen(sage.structure.element.RingElement): g = _p.g else: g = NULL - sig_on() + pari_catch_sig_on() return self.new_gen(nfdisc0(self.g, flag, g)) def nfeltdiveuc(self, x, y): @@ -7425,7 +7425,7 @@ cdef class gen(sage.structure.element.RingElement): [2, -2]~ """ t0GEN(x); t1GEN(y) - sig_on() + pari_catch_sig_on() return self.new_gen(nfdiveuc(self.g, t0, t1)) def nfeltreduce(self, x, I): @@ -7445,12 +7445,12 @@ cdef class gen(sage.structure.element.RingElement): True """ t0GEN(x); t1GEN(I) - sig_on() + pari_catch_sig_on() return self.new_gen(nfreduce(self.g, t0, t1)) def nffactor(self, x): t0GEN(x) - sig_on() + pari_catch_sig_on() return self.new_gen(nffactor(self.g, t0)) def nfgenerator(self): @@ -7485,10 +7485,10 @@ cdef class gen(sage.structure.element.RingElement): t1GEN(b) if p: t2GEN(p) - sig_on() + pari_catch_sig_on() r = nfhilbert0(self.g, t0, t1, t2) else: - sig_on() + pari_catch_sig_on() r = nfhilbert(self.g, t0, t1) P.clear_stack() return r @@ -7557,7 +7557,7 @@ cdef class gen(sage.structure.element.RingElement): - Aly Deines (2012-09-19) """ t0GEN(x) - sig_on() + pari_catch_sig_on() return self.new_gen(nfhnf(self.g,t0)) @@ -7615,14 +7615,14 @@ cdef class gen(sage.structure.element.RingElement): else: raise err - # NOTE: because of the way sig_on() and Cython exceptions work, this + # NOTE: because of the way pari_catch_sig_on() and Cython exceptions work, this # function MUST NOT be folded into nfinit() above. It has to be a # seperate function. def _nfinit_with_prec(self, long flag, long precision): """ See ``self.nfinit()``. """ - sig_on() + pari_catch_sig_on() return P.new_gen(nfinit0(self.g, flag, pbw(precision))) def nfisisom(self, gen other): @@ -7662,7 +7662,7 @@ cdef class gen(sage.structure.element.RingElement): sage: F._pari_().nfisisom(H._pari_()) 0 """ - sig_on() + pari_catch_sig_on() return P.new_gen(nfisisom(self.g, other.g)) def nfrootsof1(self): @@ -7678,7 +7678,7 @@ cdef class gen(sage.structure.element.RingElement): sage: nf.nfrootsof1() [4, -x] """ - sig_on() + pari_catch_sig_on() return P.new_gen(rootsof1(self.g)) def nfsubfields(self, long d=0): @@ -7696,37 +7696,37 @@ cdef class gen(sage.structure.element.RingElement): - ``d`` - C long integer """ - sig_on() + pari_catch_sig_on() return self.new_gen(nfsubfields(self.g, d)) def rnfcharpoly(self, T, a, v='x'): t0GEN(T); t1GEN(a); t2GEN(v) - sig_on() + pari_catch_sig_on() return self.new_gen(rnfcharpoly(self.g, t0, t1, gvar(t2))) def rnfdisc(self, x): t0GEN(x) - sig_on() + pari_catch_sig_on() return self.new_gen(rnfdiscf(self.g, t0)) def rnfeltabstorel(self, x): t0GEN(x) - sig_on() + pari_catch_sig_on() return self.new_gen(rnfelementabstorel(self.g, t0)) def rnfeltreltoabs(self, x): t0GEN(x) - sig_on() + pari_catch_sig_on() return self.new_gen(rnfelementreltoabs(self.g, t0)) def rnfequation(self, poly, long flag=0): t0GEN(poly) - sig_on() + pari_catch_sig_on() return self.new_gen(rnfequation0(self.g, t0, flag)) def rnfidealabstorel(self, x): t0GEN(x) - sig_on() + pari_catch_sig_on() return self.new_gen(rnfidealabstorel(self.g, t0)) def rnfidealdown(self, x): @@ -7751,27 +7751,27 @@ cdef class gen(sage.structure.element.RingElement): [2, 0; 0, 2] """ t0GEN(x) - sig_on() + pari_catch_sig_on() return self.new_gen(rnfidealdown(self.g, t0)) def rnfidealhnf(self, x): t0GEN(x) - sig_on() + pari_catch_sig_on() return self.new_gen(rnfidealhermite(self.g, t0)) def rnfidealnormrel(self, x): t0GEN(x) - sig_on() + pari_catch_sig_on() return self.new_gen(rnfidealnormrel(self.g, t0)) def rnfidealreltoabs(self, x): t0GEN(x) - sig_on() + pari_catch_sig_on() return self.new_gen(rnfidealreltoabs(self.g, t0)) def rnfidealtwoelt(self, x): t0GEN(x) - sig_on() + pari_catch_sig_on() return self.new_gen(rnfidealtwoelement(self.g, t0)) def rnfinit(self, poly): @@ -7787,14 +7787,14 @@ cdef class gen(sage.structure.element.RingElement): sage: L = K.rnfinit(g) """ t0GEN(poly) - sig_on() + pari_catch_sig_on() return P.new_gen(rnfinit(self.g, t0)) def rnfisfree(self, poly): t0GEN(poly) - sig_on() + pari_catch_sig_on() r = rnfisfree(self.g, t0) - sig_off() + pari_catch_sig_off() return r def quadhilbert(self): @@ -7814,7 +7814,7 @@ cdef class gen(sage.structure.element.RingElement): ... PariError: (5) """ - sig_on() + pari_catch_sig_on() # Precision argument is only used for real quadratic extensions # and will be automatically increased by PARI if needed. return P.new_gen(quadhilbert(self.g, DEFAULTPREC)) @@ -7842,16 +7842,16 @@ cdef class gen(sage.structure.element.RingElement): sage: pari("4*x^3 - 2*x/3 + 2/5").content() 2/15 """ - sig_on() + pari_catch_sig_on() return self.new_gen(content(self.g)) def deriv(self, v=-1): - sig_on() + pari_catch_sig_on() return self.new_gen(deriv(self.g, self.get_var(v))) def eval(self, x): t0GEN(x) - sig_on() + pari_catch_sig_on() return self.new_gen(poleval(self.g, t0)) def __call__(self, x): @@ -7872,7 +7872,7 @@ cdef class gen(sage.structure.element.RingElement): [x + Mod(-4*a, 8*a^2 - 1), 1; x + Mod(4*a, 8*a^2 - 1), 1] """ t0GEN(t) - sig_on() + pari_catch_sig_on() return self.new_gen(polfnf(self.g, t0)) def factorpadic(self, p, long r=20, long flag=0): @@ -7882,7 +7882,7 @@ cdef class gen(sage.structure.element.RingElement): (use round 4) or 1 (use Buchmann-Lenstra) """ t0GEN(p) - sig_on() + pari_catch_sig_on() return self.new_gen(factorpadic0(self.g, t0, r, flag)) def factormod(self, p, long flag=0): @@ -7893,7 +7893,7 @@ cdef class gen(sage.structure.element.RingElement): irreducible factors are given. """ t0GEN(p) - sig_on() + pari_catch_sig_on() return self.new_gen(factormod0(self.g, t0, flag)) def intformal(self, y=-1): @@ -7901,7 +7901,7 @@ cdef class gen(sage.structure.element.RingElement): x.intformal(y): formal integration of x with respect to the main variable of y, or to the main variable of x if y is omitted """ - sig_on() + pari_catch_sig_on() return self.new_gen(integ(self.g, self.get_var(y))) def padicappr(self, a): @@ -7910,7 +7910,7 @@ cdef class gen(sage.structure.element.RingElement): p """ t0GEN(a) - sig_on() + pari_catch_sig_on() return self.new_gen(padicappr(self.g, t0)) def newtonpoly(self, p): @@ -7925,7 +7925,7 @@ cdef class gen(sage.structure.element.RingElement): [1, 1, -1/3, -1/3, -1/3, -1/3, -1/3, -1/3] """ t0GEN(p) - sig_on() + pari_catch_sig_on() return self.new_gen(newtonpoly(self.g, t0)) def polcoeff(self, long n, var=-1): @@ -7944,39 +7944,39 @@ cdef class gen(sage.structure.element.RingElement): sage: f.polcoeff(1, "y") x """ - sig_on() + pari_catch_sig_on() return self.new_gen(polcoeff0(self.g, n, self.get_var(var))) def polcompositum(self, pol2, long flag=0): t0GEN(pol2) - sig_on() + pari_catch_sig_on() return self.new_gen(polcompositum0(self.g, t0, flag)) def poldegree(self, var=-1): """ f.poldegree(var=x): Return the degree of this polynomial. """ - sig_on() + pari_catch_sig_on() n = poldegree(self.g, self.get_var(var)) - sig_off() + pari_catch_sig_off() return n def poldisc(self, var=-1): """ f.poldist(var=x): Return the discriminant of this polynomial. """ - sig_on() + pari_catch_sig_on() return self.new_gen(poldisc0(self.g, self.get_var(var))) def poldiscreduced(self): - sig_on() + pari_catch_sig_on() return self.new_gen(reduceddiscsmith(self.g)) def polgalois(self): """ f.polgalois(): Galois group of the polynomial f """ - sig_on() + pari_catch_sig_on() return self.new_gen(polgalois(self.g, prec)) def nfgaloisconj(self, long flag=0, denom=None, long precision=0): @@ -8005,7 +8005,7 @@ cdef class gen(sage.structure.element.RingElement): t0GEN(denom) else: t0 = NULL - sig_on() + pari_catch_sig_on() return self.new_gen(galoisconj0(self.g, flag, t0, pbw(precision))) def nfroots(self, poly): @@ -8027,7 +8027,7 @@ cdef class gen(sage.structure.element.RingElement): [Mod(-zz, zz^4 + 2), Mod(zz, zz^4 + 2)] """ t0GEN(poly) - sig_on() + pari_catch_sig_on() return self.new_gen(nfroots(self.g, t0)) def polhensellift(self, y, p, long e): @@ -8038,7 +8038,7 @@ cdef class gen(sage.structure.element.RingElement): """ t0GEN(y) t1GEN(p) - sig_on() + pari_catch_sig_on() return self.new_gen(polhensellift(self.g, t0, t1, e)) def polisirreducible(self): @@ -8046,7 +8046,7 @@ cdef class gen(sage.structure.element.RingElement): f.polisirreducible(): Returns True if f is an irreducible non-constant polynomial, or False if f is reducible or constant. """ - sig_on() + pari_catch_sig_on() return bool(self.new_gen(gisirreducible(self.g))) @@ -8057,33 +8057,33 @@ cdef class gen(sage.structure.element.RingElement): to the main variable of self if v is omitted, with respect to the variable v otherwise """ - sig_on() + pari_catch_sig_on() return self.new_gen(pollead(self.g, self.get_var(v))) def polrecip(self): - sig_on() + pari_catch_sig_on() return self.new_gen(polrecip(self.g)) def polred(self, flag=0, fa=None): if fa is None: - sig_on() + pari_catch_sig_on() return self.new_gen(polred0(self.g, flag, NULL)) else: t0GEN(fa) - sig_on() + pari_catch_sig_on() return self.new_gen(polred0(self.g, flag, t0)) def polredabs(self, flag=0): - sig_on() + pari_catch_sig_on() return self.new_gen(polredabs0(self.g, flag)) def polredbest(self, flag=0): - sig_on() + pari_catch_sig_on() return self.new_gen(polredbest(self.g, flag)) def polresultant(self, y, var=-1, flag=0): t0GEN(y) - sig_on() + pari_catch_sig_on() return self.new_gen(polresultant0(self.g, t0, self.get_var(var), flag)) def polroots(self, flag=0, precision=0): @@ -8092,54 +8092,54 @@ cdef class gen(sage.structure.element.RingElement): optional, and can be 0: default, uses Schonhage's method modified by Gourdon, or 1: uses a modified Newton method. """ - sig_on() + pari_catch_sig_on() return self.new_gen(roots0(self.g, flag, pbw(precision))) def polrootsmod(self, p, flag=0): t0GEN(p) - sig_on() + pari_catch_sig_on() return self.new_gen(rootmod0(self.g, t0, flag)) def polrootspadic(self, p, r=20): t0GEN(p) - sig_on() + pari_catch_sig_on() return self.new_gen(rootpadic(self.g, t0, r)) def polrootspadicfast(self, p, r=20): t0GEN(p) - sig_on() + pari_catch_sig_on() return self.new_gen(rootpadicfast(self.g, t0, r)) def polsturm(self, a, b): t0GEN(a) t1GEN(b) - sig_on() + pari_catch_sig_on() n = sturmpart(self.g, t0, t1) - sig_off() + pari_catch_sig_off() return n def polsturm_full(self): - sig_on() + pari_catch_sig_on() n = sturmpart(self.g, NULL, NULL) - sig_off() + pari_catch_sig_off() return n def polsylvestermatrix(self, g): t0GEN(g) - sig_on() + pari_catch_sig_on() return self.new_gen(sylvestermatrix(self.g, t0)) def polsym(self, long n): - sig_on() + pari_catch_sig_on() return self.new_gen(polsym(self.g, n)) def serconvol(self, g): t0GEN(g) - sig_on() + pari_catch_sig_on() return self.new_gen(convol(self.g, t0)) def serlaplace(self): - sig_on() + pari_catch_sig_on() return self.new_gen(laplace(self.g)) def serreverse(self): @@ -8160,22 +8160,22 @@ cdef class gen(sage.structure.element.RingElement): sage: g.subst('x',f) x + O(x^4) """ - sig_on() + pari_catch_sig_on() return self.new_gen(recip(self.g)) def thueinit(self, flag=0): - sig_on() + pari_catch_sig_on() return self.new_gen(thueinit(self.g, flag, prec)) def rnfisnorminit(self, polrel, long flag=2): t0GEN(polrel) - sig_on() + pari_catch_sig_on() return self.new_gen(rnfisnorminit(self.g, t0, flag)) def rnfisnorm(self, T, long flag=0): t0GEN(T) - sig_on() + pari_catch_sig_on() return self.new_gen(rnfisnorm(t0, self.g, flag)) ########################################### @@ -8198,11 +8198,11 @@ cdef class gen(sage.structure.element.RingElement): """ t0GEN(y) if z is None: - sig_on() + pari_catch_sig_on() return P.new_gen(shallowextract(self.g, t0)) else: t1GEN(z) - sig_on() + pari_catch_sig_on() return P.new_gen(extract0(self.g, t0, t1)) def ncols(self): @@ -8215,9 +8215,9 @@ cdef class gen(sage.structure.element.RingElement): 8 """ cdef long n - sig_on() + pari_catch_sig_on() n = glength(self.g) - sig_off() + pari_catch_sig_off() return n def nrows(self): @@ -8230,14 +8230,14 @@ cdef class gen(sage.structure.element.RingElement): 19 """ cdef long n - sig_on() + pari_catch_sig_on() # if this matrix has no columns # then it has no rows. if self.ncols() == 0: - sig_off() + pari_catch_sig_off() return 0 n = glength((self.g[1])) - sig_off() + pari_catch_sig_off() return n def mattranspose(self): @@ -8249,7 +8249,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari('[1,2,3; 4,5,6; 7,8,9]').mattranspose() [1, 4, 7; 2, 5, 8; 3, 6, 9] """ - sig_on() + pari_catch_sig_on() return self.new_gen(gtrans(self.g)).Mat() def matadjoint(self): @@ -8263,7 +8263,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari('[a,b,c; d,e,f; g,h,i]').matadjoint() [(i*e - h*f), (-i*b + h*c), (f*b - e*c); (-i*d + g*f), i*a - g*c, -f*a + d*c; (h*d - g*e), -h*a + g*b, e*a - d*b] """ - sig_on() + pari_catch_sig_on() return self.new_gen(adj(self.g)).Mat() def qflll(self, long flag=0): @@ -8278,7 +8278,7 @@ cdef class gen(sage.structure.element.RingElement): but x may have polynomial coefficients, 8: same as 0 but x may have polynomial coefficients. """ - sig_on() + pari_catch_sig_on() return self.new_gen(qflll0(self.g,flag)).Mat() def qflllgram(self, long flag=0): @@ -8291,7 +8291,7 @@ cdef class gen(sage.structure.element.RingElement): 8: lllgramgen, same as qflllgram when the coefficients are polynomials. """ - sig_on() + pari_catch_sig_on() return self.new_gen(qflllgram0(self.g,flag)).Mat() def lllgram(self): @@ -8312,7 +8312,7 @@ cdef class gen(sage.structure.element.RingElement): """ t0GEN(B) t1GEN(max) - sig_on() + pari_catch_sig_on() return self.new_gen(qfminim0(self.g,t0,t1,flag,precdl)) def qfrep(self, B, long flag=0): @@ -8323,7 +8323,7 @@ cdef class gen(sage.structure.element.RingElement): return a t_VECSMALL instead of a t_VEC. """ t0GEN(B) - sig_on() + pari_catch_sig_on() return self.new_gen(qfrep0(self.g,t0,flag)) def matsolve(self, B): @@ -8350,7 +8350,7 @@ cdef class gen(sage.structure.element.RingElement): [1/2; 1/2] """ t0GEN(B) - sig_on() + pari_catch_sig_on() return self.new_gen(gauss(self.g,t0)) def matsolvemod(self, D, B, long flag = 0): @@ -8397,7 +8397,7 @@ cdef class gen(sage.structure.element.RingElement): """ t0GEN(D) t1GEN(B) - sig_on() + pari_catch_sig_on() return self.new_gen(matsolvemod0(self.g, t0, t1, flag)) def matker(self, long flag=0): @@ -8426,7 +8426,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari('[1,2,3;4,5,6;7,8,9]*Mod(1,2)').matker() [Mod(1, 2); Mod(0, 2); Mod(1, 2)] """ - sig_on() + pari_catch_sig_on() return self.new_gen(matker0(self.g, flag)) def matkerint(self, long flag=0): @@ -8452,7 +8452,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari('[2,1;2,1]').matkerint(1) [1; -2] """ - sig_on() + pari_catch_sig_on() return self.new_gen(matkerint0(self.g, flag)) def matdet(self, long flag=0): @@ -8474,7 +8474,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari('[1,2; 3,4]').matdet(1) -2 """ - sig_on() + pari_catch_sig_on() return self.new_gen(det0(self.g, flag)) def trace(self): @@ -8486,7 +8486,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari('[1,2; 3,4]').trace() 5 """ - sig_on() + pari_catch_sig_on() return self.new_gen(gtrace(self.g)) def mathnf(self, flag=0): @@ -8512,7 +8512,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari('[1,2,3; 4,5,6; 7,8,9]').mathnf() [6, 1; 3, 1; 0, 1] """ - sig_on() + pari_catch_sig_on() return self.new_gen(mathnf0(self.g, flag)) def mathnfmod(self, d): @@ -8546,7 +8546,7 @@ cdef class gen(sage.structure.element.RingElement): [1, 0, 0; 0, 2, 0; 0, 0, 6] """ t0GEN(d) - sig_on() + pari_catch_sig_on() return self.new_gen(hnfmod(self.g, t0)) def mathnfmodid(self, d): @@ -8575,7 +8575,7 @@ cdef class gen(sage.structure.element.RingElement): [1, 0, 0; 0, 1, 0; 0, 0, 6] """ t0GEN(d) - sig_on() + pari_catch_sig_on() return self.new_gen(hnfmodid(self.g, t0)) def matsnf(self, flag=0): @@ -8592,7 +8592,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari('[1,2,3; 4,5,6; 7,8,9]').matsnf() [0, 3, 1] """ - sig_on() + pari_catch_sig_on() return self.new_gen(matsnf0(self.g, flag)) def matfrobenius(self, flag=0): @@ -8634,7 +8634,7 @@ cdef class gen(sage.structure.element.RingElement): - Martin Albrect (2006-04-02) """ - sig_on() + pari_catch_sig_on() return self.new_gen(matfrobenius(self.g, flag, 0)) @@ -8686,14 +8686,14 @@ cdef class gen(sage.structure.element.RingElement): """ cdef int r if limit == -1 and typ(self.g) == t_INT and proof: - sig_on() + pari_catch_sig_on() r = factorint_withproof_sage(&t0, self.g, ten_to_15) z = P.new_gen(t0) if not r: return z else: return _factor_int_when_pari_factor_failed(self, z) - sig_on() + pari_catch_sig_on() return P.new_gen(factor0(self.g, limit)) @@ -8705,18 +8705,18 @@ cdef class gen(sage.structure.element.RingElement): cdef long ret t0GEN(y) t1GEN(p) - sig_on() + pari_catch_sig_on() ret = hilbert0(x.g, t0, t1) - sig_off() + pari_catch_sig_off() return ret def chinese(self, y): t0GEN(y) - sig_on() + pari_catch_sig_on() return P.new_gen(chinese(self.g, t0)) def order(self): - sig_on() + pari_catch_sig_on() return P.new_gen(order(self.g)) def znprimroot(self): @@ -8746,14 +8746,14 @@ cdef class gen(sage.structure.element.RingElement): sage: pari(2*109^10).znprimroot() Mod(236736367459211723407, 473472734918423446802) """ - sig_on() + pari_catch_sig_on() return P.new_gen(znprimroot0(self.g)) def __abs__(self): return self.abs() def norm(gen self): - sig_on() + pari_catch_sig_on() return P.new_gen(gnorm(self.g)) def nextprime(gen self, bint add_one=0): @@ -8773,7 +8773,7 @@ cdef class gen(sage.structure.element.RingElement): sage: pari(2^100).nextprime() 1267650600228229401496703205653 """ - sig_on() + pari_catch_sig_on() if add_one: return P.new_gen(gnextprime(gaddsg(1,self.g))) return P.new_gen(gnextprime(self.g)) @@ -8814,9 +8814,9 @@ cdef class gen(sage.structure.element.RingElement): sage: f.subst("x", "I") 0 """ - sig_on() + pari_catch_sig_on() cdef long n = P.get_var(var) - sig_off() + pari_catch_sig_off() if varn(self.g) == n: return self if typ(self.g) != t_POL and typ(self.g) != t_SER: @@ -8850,13 +8850,13 @@ cdef class gen(sage.structure.element.RingElement): cdef long n n = P.get_var(var) t0GEN(z) - sig_on() + pari_catch_sig_on() return P.new_gen(gsubst(self.g, n, t0)) def substpol(self, y, z): t0GEN(y) t1GEN(z) - sig_on() + pari_catch_sig_on() return self.new_gen(gsubstpol(self.g, t0, t1)) def nf_subst(self, z): @@ -8898,17 +8898,17 @@ cdef class gen(sage.structure.element.RingElement): """ cdef GEN nf = self.get_nf() t0GEN(z) - sig_on() + pari_catch_sig_on() return P.new_gen(gsubst(self.g, nf_get_varn(nf), t0)) def taylor(self, v=-1): - sig_on() + pari_catch_sig_on() return self.new_gen(tayl(self.g, self.get_var(v), precdl)) def thue(self, rhs, ne): t0GEN(rhs) t1GEN(ne) - sig_on() + pari_catch_sig_on() return self.new_gen(thue(self.g, t0, t1)) def charpoly(self, var=-1, flag=0): @@ -8918,13 +8918,13 @@ cdef class gen(sage.structure.element.RingElement): Lagrange interpolation) or 2 (use Hessenberg form), 0 being the default. """ - sig_on() + pari_catch_sig_on() return P.new_gen(charpoly0(self.g, P.get_var(var), flag)) def kronecker(gen self, y): t0GEN(y) - sig_on() + pari_catch_sig_on() return P.new_gen(gkronecker(self.g, t0)) @@ -8996,7 +8996,7 @@ cdef class gen(sage.structure.element.RingElement): t0GEN(ya) t1GEN(x) cdef GEN dy, g - sig_on() + pari_catch_sig_on() g = polint(self.g, t0, t1, &dy) dif = self.new_gen_noclear(dy) return self.new_gen(g), dif @@ -9016,26 +9016,26 @@ cdef class gen(sage.structure.element.RingElement): sage: pari.set_real_precision(n) 210 """ - sig_on() + pari_catch_sig_on() return self.new_gen(algdep(self.g, n)) def concat(self, y): t0GEN(y) - sig_on() + pari_catch_sig_on() return self.new_gen(concat(self.g, t0)) def lindep(self, flag=0): - sig_on() + pari_catch_sig_on() return self.new_gen(lindep0(self.g, flag)) def listinsert(self, obj, long n): t0GEN(obj) - sig_on() + pari_catch_sig_on() return self.new_gen(listinsert(self.g, t0, n)) def listput(self, obj, long n): t0GEN(obj) - sig_on() + pari_catch_sig_on() return self.new_gen(listput(self.g, t0, n)) @@ -9078,7 +9078,7 @@ cdef class gen(sage.structure.element.RingElement): sage: om.elleisnum(100) 2.15314248576078 E50 """ - sig_on() + pari_catch_sig_on() # the argument prec has no effect return self.new_gen(elleisnum(self.g, k, flag, prec)) @@ -9148,7 +9148,7 @@ cdef class gen(sage.structure.element.RingElement): [13.9658695257485 + 0.E-18*I, 50.5619300880073 ... E-18*I] """ t0GEN(z) - sig_on() + pari_catch_sig_on() cdef long dprec dprec = gprecision(t0) if dprec: @@ -9179,7 +9179,7 @@ cdef class gen(sage.structure.element.RingElement): True """ t0GEN(y) - sig_on() + pari_catch_sig_on() return self.new_gen(ellchangepoint(self.g, t0)) def debug(gen self, long depth = -1): @@ -9197,9 +9197,9 @@ cdef class gen(sage.structure.element.RingElement): real = gen_0 imag = [&=0000000004c5ef90] REAL(lg=4):0400000000000004 (+,expo=0):6000000000000000 8000000000000000 0000000000000000 """ - sig_on() + pari_catch_sig_on() dbgGEN(self.g, depth) - sig_off() + pari_catch_sig_off() return @@ -9295,8 +9295,8 @@ cdef class PariInstance(sage.structure.parent_base.ParentWithBase): pari_init_opts(10000, maxprime, INIT_JMPm | INIT_DFTm) num_primes = maxprime - # NOTE: sig_on() can only come AFTER pari_init_opts()! - sig_on() + # NOTE: pari_catch_sig_on() can only come AFTER pari_init_opts()! + pari_catch_sig_on() # Free the PARI stack and allocate our own (using Cython) pari_free(bot); bot = 0 @@ -9316,7 +9316,7 @@ cdef class PariInstance(sage.structure.parent_base.ParentWithBase): pariOut.putch = sage_putchar pariOut.puts = sage_puts pariOut.flush = sage_flush - sig_off() + pari_catch_sig_off() def __dealloc__(self): """ @@ -9406,9 +9406,9 @@ cdef class PariInstance(sage.structure.parent_base.ParentWithBase): k = GP_DATA.fmt.sigd s = str(n) - sig_on() + pari_catch_sig_on() sd_realprecision(s, 2) - sig_off() + pari_catch_sig_off() return int(k) # Python int def get_real_precision(self): @@ -9441,19 +9441,19 @@ cdef class PariInstance(sage.structure.parent_base.ParentWithBase): cdef gen new_gen(self, GEN x): """ Create a new gen, then free the \*entire\* stack and call - sig_off(). + pari_catch_sig_off(). """ cdef gen g g = _new_gen(x) global mytop, avma avma = mytop - sig_off() + pari_catch_sig_off() return g cdef object new_gen_to_string(self, GEN x): """ Converts a gen to a Python string, free the \*entire\* stack and call - sig_off(). This is meant to be used in place of new_gen(). + pari_catch_sig_off(). This is meant to be used in place of new_gen(). """ cdef char* c cdef int n @@ -9462,16 +9462,16 @@ cdef class PariInstance(sage.structure.parent_base.ParentWithBase): pari_free(c) global mytop, avma avma = mytop - sig_off() + pari_catch_sig_off() return s cdef void clear_stack(self): """ - Clear the entire PARI stack and call sig_off(). + Clear the entire PARI stack and call pari_catch_sig_off(). """ global mytop, avma avma = mytop - sig_off() + pari_catch_sig_off() cdef void set_mytop_to_avma(self): global mytop, avma @@ -9480,7 +9480,7 @@ cdef class PariInstance(sage.structure.parent_base.ParentWithBase): cdef gen new_gen_noclear(self, GEN x): """ Create a new gen, but don't free any memory on the stack and don't - call sig_off(). + call pari_catch_sig_off(). """ z = _new_gen(x) return z @@ -9506,7 +9506,7 @@ cdef class PariInstance(sage.structure.parent_base.ParentWithBase): sage: a5.__hash__() == b5.__hash__() True """ - sig_on() + pari_catch_sig_on() return self.new_gen(self._new_GEN_from_mpz_t(value)) cdef inline GEN _new_GEN_from_mpz_t(self, mpz_t value): @@ -9514,7 +9514,7 @@ cdef class PariInstance(sage.structure.parent_base.ParentWithBase): Create a new PARI ``t_INT`` from a ``mpz_t``. For internal use only; this directly uses the PARI stack. - One should call ``sig_on()`` before and ``sig_off()`` after. + One should call ``pari_catch_sig_on()`` before and ``pari_catch_sig_off()`` after. """ cdef unsigned long limbs = mpz_size(value) @@ -9526,7 +9526,7 @@ cdef class PariInstance(sage.structure.parent_base.ParentWithBase): return z cdef gen new_gen_from_int(self, int value): - sig_on() + pari_catch_sig_on() return self.new_gen(stoi(value)) cdef gen new_gen_from_mpq_t(self, mpq_t value): @@ -9556,7 +9556,7 @@ cdef class PariInstance(sage.structure.parent_base.ParentWithBase): sage: a5.__hash__() == b5.__hash__() True """ - sig_on() + pari_catch_sig_on() return self.new_gen(self._new_GEN_from_mpq_t(value)) cdef inline GEN _new_GEN_from_mpq_t(self, mpq_t value): @@ -9564,7 +9564,7 @@ cdef class PariInstance(sage.structure.parent_base.ParentWithBase): Create a new PARI ``t_INT`` or ``t_FRAC`` from a ``mpq_t``. For internal use only; this directly uses the PARI stack. - One should call ``sig_on()`` before and ``sig_off()`` after. + One should call ``pari_catch_sig_on()`` before and ``pari_catch_sig_off()`` after. """ cdef GEN num = self._new_GEN_from_mpz_t(mpq_numref(value)) if mpz_cmpabs_ui(mpq_denref(value), 1) == 0: @@ -9582,7 +9582,7 @@ cdef class PariInstance(sage.structure.parent_base.ParentWithBase): cdef GEN z cdef int i - sig_on() + pari_catch_sig_on() z = cgetg(length + 2, t_POL) z[1] = evalvarn(varnum) if length != 0: @@ -9598,7 +9598,7 @@ cdef class PariInstance(sage.structure.parent_base.ParentWithBase): cdef gen new_gen_from_padic(self, long ordp, long relprec, mpz_t prime, mpz_t p_pow, mpz_t unit): cdef GEN z - sig_on() + pari_catch_sig_on() z = cgetg(5, t_PADIC) z[1] = evalprecp(relprec) + evalvalp(ordp) set_gel(z, 2, self._new_GEN_from_mpz_t(prime)) @@ -9641,7 +9641,7 @@ cdef class PariInstance(sage.structure.parent_base.ParentWithBase): # of precision (that's the number of mantissa bits in an IEEE # double). - sig_on() + pari_catch_sig_on() if x == 0: return self.new_gen(real_0_bit(-53)) else: @@ -9660,7 +9660,7 @@ cdef class PariInstance(sage.structure.parent_base.ParentWithBase): t0GEN(re) t1GEN(im) cdef GEN cp - sig_on() + pari_catch_sig_on() cp = cgetg(3, t_COMPLEX) set_gel(cp, 1, t0) set_gel(cp, 2, t1) @@ -9740,24 +9740,24 @@ cdef class PariInstance(sage.structure.parent_base.ParentWithBase): # Check basic Python types if PyInt_Check(s): - sig_on() + pari_catch_sig_on() return self.new_gen(stoi(PyInt_AS_LONG(s))) if PyBool_Check(s): return self.PARI_ONE if s else self.PARI_ZERO cdef mpz_t mpz_int cdef GEN g if PyLong_Check(s): - sig_on() + pari_catch_sig_on() mpz_init(mpz_int) mpz_set_pylong(mpz_int, s) g = self._new_GEN_from_mpz_t(mpz_int) mpz_clear(mpz_int) return self.new_gen(g) if PyFloat_Check(s): - sig_on() + pari_catch_sig_on() return self.new_gen(dbltor(PyFloat_AS_DOUBLE(s))) if PyComplex_Check(s): - sig_on() + pari_catch_sig_on() g = cgetg(3, t_COMPLEX) set_gel(g, 1, dbltor(PyComplex_RealAsDouble(s))) set_gel(g, 2, dbltor(PyComplex_ImagAsDouble(s))) @@ -9772,10 +9772,10 @@ cdef class PariInstance(sage.structure.parent_base.ParentWithBase): return v t = str(s) - sig_str('evaluating PARI string') + pari_catch_sig_str('evaluating PARI string') g = gp_read_str(t) if g == gnil: - sig_off() + pari_catch_sig_off() return None return self.new_gen(g) @@ -9785,7 +9785,7 @@ cdef class PariInstance(sage.structure.parent_base.ParentWithBase): from a ``mpz_t**``. For internal use only; this directly uses the PARI stack. - One should call ``sig_on()`` before and ``sig_off()`` after. + One should call ``pari_catch_sig_on()`` before and ``pari_catch_sig_off()`` after. """ cdef GEN x cdef GEN A = zeromatcopy(nr, nc) @@ -9805,7 +9805,7 @@ cdef class PariInstance(sage.structure.parent_base.ParentWithBase): Normal Form because Sage and PARI use different definitions. For internal use only; this directly uses the PARI stack. - One should call ``sig_on()`` before and ``sig_off()`` after. + One should call ``pari_catch_sig_on()`` before and ``pari_catch_sig_off()`` after. """ cdef GEN x cdef GEN A = zeromatcopy(nc, nr) @@ -9823,7 +9823,7 @@ cdef class PariInstance(sage.structure.parent_base.ParentWithBase): sage: matrix(ZZ,2,[1..6])._pari_() # indirect doctest [1, 2, 3; 4, 5, 6] """ - sig_on() + pari_catch_sig_on() cdef GEN g if permute_for_hnf: g = self._new_GEN_from_mpz_t_matrix_rotate90(B, nr, nc) @@ -9849,7 +9849,7 @@ cdef class PariInstance(sage.structure.parent_base.ParentWithBase): sage: matrix(QQ,2,[1..6])._pari_() # indirect doctest [1, 2, 3; 4, 5, 6] """ - sig_on() + pari_catch_sig_on() cdef GEN g = self._new_GEN_from_mpq_t_matrix(B, nr, nc) return self.new_gen(g) @@ -9936,9 +9936,9 @@ cdef class PariInstance(sage.structure.parent_base.ParentWithBase): global diffptr, num_primes if M <= num_primes: return - sig_on() + pari_catch_sig_on() tmpptr = initprimes(M) - sig_off() + pari_catch_sig_off() pari_free( diffptr) num_primes = M diffptr = tmpptr @@ -9977,7 +9977,7 @@ cdef class PariInstance(sage.structure.parent_base.ParentWithBase): sage: pari('mysquare(12)') 144 """ - sig_on() + pari_catch_sig_on() return self.new_gen(gp_read_file(filename)) @@ -10034,7 +10034,7 @@ cdef class PariInstance(sage.structure.parent_base.ParentWithBase): """ if n >= 2: self.nth_prime(n) - sig_on() + pari_catch_sig_on() return self.new_gen(primes(n)) def primes_up_to_n(self, long n): @@ -10071,7 +10071,7 @@ cdef class PariInstance(sage.structure.parent_base.ParentWithBase): if n <= 0: raise ValueError, "nth prime meaningless for non-positive n (=%s)"%n cdef GEN g - sig_on() + pari_catch_sig_on() g = prime(n) return self.new_gen(g) @@ -10094,7 +10094,7 @@ cdef class PariInstance(sage.structure.parent_base.ParentWithBase): sage: pari.euler(precision=100).python() 0.577215664901532860606512090082... """ - sig_on() + pari_catch_sig_on() return self.new_gen(mpeuler(pbw(precision))) def pi(self, precision=0): @@ -10109,7 +10109,7 @@ cdef class PariInstance(sage.structure.parent_base.ParentWithBase): sage: pari.pi(precision=100).python() 3.1415926535897932384626433832... """ - sig_on() + pari_catch_sig_on() return self.new_gen(mppi(pbw(precision))) def pollegendre(self, long n, v=-1): @@ -10126,7 +10126,7 @@ cdef class PariInstance(sage.structure.parent_base.ParentWithBase): sage: pari.pollegendre(0) 1 """ - sig_on() + pari_catch_sig_on() return self.new_gen(pollegendre(n, self.get_var(v))) def poltchebi(self, long n, v=-1): @@ -10143,7 +10143,7 @@ cdef class PariInstance(sage.structure.parent_base.ParentWithBase): sage: pari.poltchebi(0) 1 """ - sig_on() + pari_catch_sig_on() return self.new_gen(polchebyshev1(n, self.get_var(v))) def factorial(self, long n): @@ -10161,7 +10161,7 @@ cdef class PariInstance(sage.structure.parent_base.ParentWithBase): sage: pari.factorial(25) 15511210043330985984000000 """ - sig_on() + pari_catch_sig_on() return self.new_gen(mpfact(n)) def polcyclo(self, long n, v=-1): @@ -10178,7 +10178,7 @@ cdef class PariInstance(sage.structure.parent_base.ParentWithBase): sage: pari.polcyclo(1) x - 1 """ - sig_on() + pari_catch_sig_on() return self.new_gen(polcyclo(n, self.get_var(v))) def polcyclo_eval(self, long n, v): @@ -10193,7 +10193,7 @@ cdef class PariInstance(sage.structure.parent_base.ParentWithBase): 17 """ t0GEN(v) - sig_on() + pari_catch_sig_on() return self.new_gen(polcyclo_eval(n, t0)) def polsubcyclo(self, long n, long d, v=-1): @@ -10215,7 +10215,7 @@ cdef class PariInstance(sage.structure.parent_base.ParentWithBase): [] """ cdef gen plist - sig_on() + pari_catch_sig_on() plist = self.new_gen(polsubcyclo(n, d, self.get_var(v))) if typ(plist.g) != t_VEC: return pari.vector(1, [plist]) @@ -10224,7 +10224,7 @@ cdef class PariInstance(sage.structure.parent_base.ParentWithBase): #return self.new_gen(polsubcyclo(n, d, self.get_var(v))) def polzagier(self, long n, long m): - sig_on() + pari_catch_sig_on() return self.new_gen(polzag(n, m)) def setrand(self, seed): @@ -10263,9 +10263,9 @@ cdef class PariInstance(sage.structure.parent_base.ParentWithBase): PariError: incorrect type (11) """ t0GEN(seed) - sig_on() + pari_catch_sig_on() setrand(t0) - sig_off() + pari_catch_sig_off() def getrand(self): """ @@ -10284,7 +10284,7 @@ cdef class PariInstance(sage.structure.parent_base.ParentWithBase): sage: a == pari.getrand() True """ - sig_on() + pari_catch_sig_on() return self.new_gen(getrand()) def vector(self, long n, entries=None): @@ -10314,7 +10314,7 @@ cdef class PariInstance(sage.structure.parent_base.ParentWithBase): cdef gen _empty_vector(self, long n): cdef gen v - sig_on() + pari_catch_sig_on() v = self.new_gen(zerovec(n)) return v @@ -10327,7 +10327,7 @@ cdef class PariInstance(sage.structure.parent_base.ParentWithBase): cdef gen A cdef gen x - sig_on() + pari_catch_sig_on() # The gtomat is very important!! Without sage/PARI will segfault. # I do not know why. -- William Stein A = self.new_gen(gtomat(zeromat(m,n))) @@ -10587,23 +10587,18 @@ class PariError (RuntimeError): # THE TRY CODE IS NOT REENTRANT -- NO CALLS TO PARI FROM HERE !!! # - Gonzalo Tornario -cdef public void _pari_trap "_pari_trap" (long errno, long retries) except *: - """ - TESTS:: - - """ +cdef void _pari_trap "_pari_trap"(long errno, long retries) except *: if retries > 100: - sig_off() - raise RuntimeError, "_pari_trap recursion too deep" + pari_catch_sig_off() + raise RuntimeError("_pari_trap recursion too deep") if errno == errpile: P.allocatemem(silent=True) elif errno == user: - sig_off() + pari_catch_sig_off() raise RuntimeError("PARI user exception") else: - sig_off() - raise PariError, errno - + pari_catch_sig_off() + raise PariError(errno) def vecsmall_to_intlist(gen v): diff --git a/src/sage/libs/pari/misc.h b/src/sage/libs/pari/misc.h index 59b4a9ca2f6..81536a94519 100644 --- a/src/sage/libs/pari/misc.h +++ b/src/sage/libs/pari/misc.h @@ -5,15 +5,6 @@ #define SAGE_LIBS_PARI_MISC_H #include -#include "interrupt.h" - - -/***************************************** - Interrupts and PARI exception handling - *****************************************/ -#define _pari_sig_on() sig_on(); _pari_catch; -#define _pari_sig_str(s) sig_str(s); _pari_catch; -#define _pari_sig_off() _pari_endcatch; sig_off(); inline int strcmp_to_cmp(int f) { diff --git a/src/sage/libs/pari/pari_err.h b/src/sage/libs/pari/pari_err.h index ba633b556a3..af1ca9896de 100644 --- a/src/sage/libs/pari/pari_err.h +++ b/src/sage/libs/pari/pari_err.h @@ -2,22 +2,22 @@ #include "interrupt.h" +/***************************************** + Interrupts and PARI exception handling + *****************************************/ +#define pari_catch_sig_on() sig_on(); _pari_catch; +#define pari_catch_sig_str(s) sig_str(s); _pari_catch; +#define pari_catch_sig_off() _pari_endcatch; sig_off(); + + // global catch variable ! // this means that the code is not reentrant -- beware ! // THAT MEANS NO CALLING TO PARI from inside the trap.... // Should replace by a stack, that would work. static volatile long sage_pari_catcherr = 0; -#define _pari_raise(errno) { \ - PyErr_SetObject(PyExc_PariError, PyInt_FromLong(errno)); \ - } - -#define _pari_endcatch { \ - err_leave(sage_pari_catcherr); \ - } - /* Careful with pari_retries, it must be declared volatile! - * Also note that "if (pari_errno=setjmp(...))" is not legal C/C++ + * Also note that "pari_errno = setjmp(...)" is not legal C. */ #define _pari_catch \ jmp_buf _pari_catch_env; \ @@ -35,3 +35,8 @@ static volatile long sage_pari_catcherr = 0; } \ sage_pari_catcherr = err_catch(CATCH_ALL, &_pari_catch_env); \ } + +#define _pari_endcatch { \ + err_leave(sage_pari_catcherr); \ + } + diff --git a/src/sage/libs/pari/pari_err.pxi b/src/sage/libs/pari/pari_err.pxi index ab6bf6ef1a8..a7097c0e40a 100644 --- a/src/sage/libs/pari/pari_err.pxi +++ b/src/sage/libs/pari/pari_err.pxi @@ -4,10 +4,9 @@ cdef extern from 'interrupt.h': pass -cdef extern from 'pari_err.h': - int _pari_catch - int _pari_endcatch - int sig_on "_pari_sig_on" () except 0 - int sig_str "_pari_sig_str" (char *) except 0 - void sig_off "_pari_sig_off" () +cdef extern from 'sage/libs/pari/pari_err.h': + int pari_catch_sig_on() except 0 + int pari_catch_sig_str(char *) except 0 + void pari_catch_sig_off() +from sage.libs.pari.gen cimport _pari_trap diff --git a/src/sage/matrix/matrix_integer_dense.pyx b/src/sage/matrix/matrix_integer_dense.pyx index 8e910ac4b2c..02d7cac4da6 100644 --- a/src/sage/matrix/matrix_integer_dense.pyx +++ b/src/sage/matrix/matrix_integer_dense.pyx @@ -63,16 +63,8 @@ from sage.matrix.matrix_rational_dense cimport Matrix_rational_dense from sage.libs.pari.gen cimport gen, PariInstance from sage.libs.pari.gen import pari -cdef extern from 'pari/pari.h': - GEN zeromat(long m, long n) - GEN mathnf0(GEN x,long flag) - GEN det0(GEN a,long flag) - GEN gcoeff(GEN,long,long) - GEN gtomat(GEN x) - GEN gel(GEN,long) - long glength(GEN x) - GEN ginv(GEN x) - long rank(GEN x) +include "sage/libs/pari/decl.pxi" +include "sage/libs/pari/pari_err.pxi" cdef extern from "convert.h": cdef void t_INT_to_ZZ( mpz_t value, long *g ) @@ -4883,7 +4875,7 @@ cdef class Matrix_integer_dense(matrix_dense.Matrix_dense): # dense or sparse 0 """ cdef PariInstance P = sage.libs.pari.gen.pari - sig_on() + pari_catch_sig_on() cdef GEN d = det0(pari_GEN(self), flag) # now convert d to a Sage integer e cdef Integer e = Integer() @@ -4903,7 +4895,7 @@ cdef class Matrix_integer_dense(matrix_dense.Matrix_dense): # dense or sparse 2 """ cdef PariInstance P = sage.libs.pari.gen.pari - sig_on() + pari_catch_sig_on() cdef long r = rank(pari_GEN(self)) P.clear_stack() return r @@ -4971,11 +4963,11 @@ cdef class Matrix_integer_dense(matrix_dense.Matrix_dense): # dense or sparse """ cdef PariInstance P = sage.libs.pari.gen.pari cdef GEN A - sig_on() + pari_catch_sig_on() A = P._new_GEN_from_mpz_t_matrix_rotate90(self._matrix, self._nrows, self._ncols) cdef GEN H = mathnf0(A, flag) B = self.extract_hnf_from_pari_matrix(H, flag, include_zero_rows) - P.clear_stack() # This calls sig_off() + P.clear_stack() # This calls pari_catch_sig_off() return B @@ -5035,7 +5027,10 @@ cdef class Matrix_integer_dense(matrix_dense.Matrix_dense): # dense or sparse cdef PariInstance P = sage.libs.pari.gen.pari cdef gen H = P.integer_matrix(self._matrix, self._nrows, self._ncols, 1) H = H.mathnf(flag) - return self.extract_hnf_from_pari_matrix(H.g, flag, include_zero_rows) + pari_catch_sig_on() + B = self.extract_hnf_from_pari_matrix(H.g, flag, include_zero_rows) + P.clear_stack() # This calls pari_catch_sig_off() + return B cdef extract_hnf_from_pari_matrix(self, GEN H, int flag, bint include_zero_rows): # Throw away the transformation matrix (yes, we should later diff --git a/src/sage/matrix/matrix_rational_dense.pyx b/src/sage/matrix/matrix_rational_dense.pyx index 23550c5c8fe..bcd52acd029 100644 --- a/src/sage/matrix/matrix_rational_dense.pyx +++ b/src/sage/matrix/matrix_rational_dense.pyx @@ -79,18 +79,10 @@ from sage.misc.misc import verbose, get_verbose, prod ######################################################### # PARI C library from sage.libs.pari.gen cimport gen, PariInstance -from sage.libs.pari.gen import pari -cdef extern from 'pari/pari.h': - GEN zeromat(long m, long n) - GEN det0(GEN a,long flag) - GEN gcoeff(GEN,long,long) - GEN gtomat(GEN x) - GEN gel(GEN,long) - long glength(GEN x) - GEN ginv(GEN x) - int gcmp0(GEN x) - long rank(GEN x) - GEN gmul(GEN x, GEN y) +from sage.libs.pari.gen import pari, PariError + +include "sage/libs/pari/decl.pxi" +include "sage/libs/pari/pari_err.pxi" cdef extern from "convert.h": void t_FRAC_to_QQ ( mpq_t value, GEN g ) @@ -726,11 +718,10 @@ cdef class Matrix_rational_dense(matrix_dense.Matrix_dense): mpq_mul(t1, self._entries[1], self._entries[2]) mpq_sub(det, det, t1) i = mpq_cmp_si(det, 0, 1) - sig_off() if i == 0: mpq_clear(det); mpq_clear(t1) + sig_off() raise ZeroDivisionError("input matrix must be nonsingular" ) - sig_on() # d/det mpq_div(A._entries[0], self._entries[3], det) # -b/det @@ -752,7 +743,11 @@ cdef class Matrix_rational_dense(matrix_dense.Matrix_dense): else: algorithm = "iml" if algorithm == "pari": - return self._invert_pari() + try: + return self._invert_pari() + except PariError: + # Assume the error is because the matrix is not invertible. + raise ZeroDivisionError("input matrix must be nonsingular") elif algorithm == "iml": AZ, denom = self._clear_denom() B, d = AZ._invert_iml(check_invertible=check_invertible) @@ -2575,7 +2570,7 @@ cdef class Matrix_rational_dense(matrix_dense.Matrix_dense): if self._nrows != self._ncols: raise ValueError("self must be a square matrix") cdef PariInstance P = pari - sig_on() + pari_catch_sig_on() cdef GEN d = det0(pari_GEN(self), flag) # now convert d to a Sage rational cdef Rational e = Rational() @@ -2593,7 +2588,7 @@ cdef class Matrix_rational_dense(matrix_dense.Matrix_dense): 2 """ cdef PariInstance P = pari - sig_on() + pari_catch_sig_on() cdef long r = rank(pari_GEN(self)) P.clear_stack() return r @@ -2623,7 +2618,7 @@ cdef class Matrix_rational_dense(matrix_dense.Matrix_dense): # This case is easy, since the answer must be the 0 matrix. return self.matrix_space(self._nrows, right._ncols).zero_matrix().__copy__() cdef PariInstance P = pari - sig_on() + pari_catch_sig_on() cdef GEN M = gmul(pari_GEN(self), pari_GEN(right)) A = new_matrix_from_pari_GEN(self.matrix_space(self._nrows, right._ncols), M) P.clear_stack() @@ -2631,32 +2626,27 @@ cdef class Matrix_rational_dense(matrix_dense.Matrix_dense): def _invert_pari(self): """ - Return the inverse of this matrix computed using pari. + Return the inverse of this matrix computed using PARI. EXAMPLES:: sage: matrix(QQ,2,[1,2,3,4])._invert_pari() [ -2 1] [ 3/2 -1/2] + sage: matrix(QQ,2,[1,2,2,4])._invert_pari() + Traceback (most recent call last): + ... + PariError: non invertible matrix in gauss (16) """ if self._nrows != self._ncols: raise ValueError("self must be a square matrix") cdef PariInstance P = pari cdef GEN M, d - sig_on() + pari_catch_sig_on() M = pari_GEN(self) - - # unfortunately I can't get signal handling to be good enough - # to properly catch error (and clean up) when trying to - # compute inverse, so we have to compute rank. This does add - # time... (!) :-( - # - # TODO: fix this in #10126 -- Jeroen Demeyer - if rank(M) < self._nrows: - P.clear_stack() - raise ZeroDivisionError("input matrix must be nonsingular") d = ginv(M) + # Convert matrix back to Sage. A = new_matrix_from_pari_GEN(self._parent, d) P.clear_stack() diff --git a/src/sage/rings/complex_double.pyx b/src/sage/rings/complex_double.pyx index f8f6c5fccd3..d31fadc3806 100644 --- a/src/sage/rings/complex_double.pyx +++ b/src/sage/rings/complex_double.pyx @@ -68,6 +68,7 @@ from sage.misc.randstate cimport randstate, current_randstate include 'sage/ext/interrupt.pxi' include 'sage/ext/stdsage.pxi' +include 'sage/libs/pari/pari_err.pxi' cdef extern from "": double complex csqrt(double complex) @@ -1023,7 +1024,7 @@ cdef class ComplexDoubleElement(FieldElement): """ cdef sage.libs.pari.gen.PariInstance P P = sage.libs.pari.gen.pari - sig_on() + pari_catch_sig_on() return P.new_gen(self._gen()) ####################################################################### @@ -2223,7 +2224,7 @@ cdef class ComplexDoubleElement(FieldElement): """ cdef sage.libs.pari.gen.PariInstance P P = sage.libs.pari.gen.pari - sig_on() + pari_catch_sig_on() f = P.new_gen(algdep0(self._gen(), n, 0)) from polynomial.polynomial_ring_constructor import PolynomialRing from integer_ring import ZZ diff --git a/src/sage/rings/real_mpfr.pyx b/src/sage/rings/real_mpfr.pyx index 962cb5bd658..6494cf9d0cd 100644 --- a/src/sage/rings/real_mpfr.pyx +++ b/src/sage/rings/real_mpfr.pyx @@ -123,6 +123,7 @@ import re include 'sage/ext/interrupt.pxi' include "sage/ext/stdsage.pxi" include "sage/ext/random.pxi" +include 'sage/libs/pari/pari_err.pxi' cimport sage.rings.ring import sage.rings.ring @@ -2850,7 +2851,7 @@ cdef class RealNumber(sage.structure.element.RingElement): # by using internal interfaces of MPFR, which are documented # as subject-to-change. - sig_on() + pari_catch_sig_on() if mpfr_nan_p(self.value) or mpfr_inf_p(self.value): raise ValueError, 'Cannot convert NaN or infinity to Pari float' From 4a9ae34406cfc85fa54179cf4ecd59b46502e47f Mon Sep 17 00:00:00 2001 From: Jeroen Demeyer Date: Fri, 30 Aug 2013 17:22:43 +0200 Subject: [PATCH 25/85] Trac #15125: Various improvements to element_pari_ffelt.pyx --- src/sage/libs/pari/decl.pxi | 285 +++++++++++++++++- .../rings/finite_rings/element_pari_ffelt.pyx | 182 ++++++----- 2 files changed, 382 insertions(+), 85 deletions(-) diff --git a/src/sage/libs/pari/decl.pxi b/src/sage/libs/pari/decl.pxi index ad327c9575d..ddbd662fd19 100644 --- a/src/sage/libs/pari/decl.pxi +++ b/src/sage/libs/pari/decl.pxi @@ -36,11 +36,12 @@ cdef extern from 'pari/paricfg.h': cdef extern from 'pari/pari.h': ctypedef long* GEN - # PARI types: these are actually an enum type, but I can't get Pyrex to "properly" - # wrap enums. It doesn't matter as long as they are treated as ints by pyrex. + # PARI types: these are actually an enum type, but that doesn't + # matter for Cython. extern int t_INT, t_REAL, t_INTMOD, t_FRAC, t_FFELT, t_COMPLEX, t_PADIC, t_QUAD, \ t_POLMOD, t_POL, t_SER, t_RFRAC, t_QFR, t_QFI, t_VEC, t_COL, \ - t_MAT, t_LIST, t_STR, t_VECSMALL, t_CLOSURE + t_MAT, t_LIST, t_STR, t_VECSMALL, t_CLOSURE, \ + t_FF_FpXQ, t_FF_Flxq, t_FF_F2xq # PARI stack ctypedef unsigned long pari_sp @@ -112,15 +113,275 @@ cdef extern from 'pari/pari.h': extern int INIT_JMPm, INIT_SIGm, INIT_DFTm extern int new_galois_format, precdl - # level1.h (incomplete!) - - GEN cgetg_copy(long lx, GEN x) - GEN cgetg(long x, long y) - GEN cgeti(long x) - GEN cgetr(long x) - long itos(GEN x) - GEN real_0_bit(long bitprec) - GEN stoi(long s) + # level1.h + + ulong Fl_add(ulong a, ulong b, ulong p) + long Fl_center(ulong u, ulong p, ulong ps2) + ulong Fl_div(ulong a, ulong b, ulong p) + ulong Fl_mul(ulong a, ulong b, ulong p) + ulong Fl_neg(ulong x, ulong p) + ulong Fl_sqr(ulong a, ulong p) + ulong Fl_sub(ulong a, ulong b, ulong p) + GEN absi(GEN x) + GEN absr(GEN x) + int absrnz_equal1(GEN x) + int absrnz_equal2n(GEN x) + GEN addii(GEN x, GEN y) + void addiiz(GEN x, GEN y, GEN z) + GEN addir(GEN x, GEN y) + void addirz(GEN x, GEN y, GEN z) + GEN addis(GEN x, long s) + GEN addri(GEN x, GEN y) + void addriz(GEN x, GEN y, GEN z) + GEN addrr(GEN x, GEN y) + void addrrz(GEN x, GEN y, GEN z) + GEN addrs(GEN x, long s) + GEN addsi(long x, GEN y) + void addsiz(long s, GEN y, GEN z) + void addsrz(long s, GEN y, GEN z) + GEN addss(long x, long y) + void addssz(long s, long y, GEN z) + GEN adduu(ulong x, ulong y) + void affgr(GEN x, GEN y) + void affii(GEN x, GEN y) + void affiz(GEN x, GEN y) + void affrr_fixlg(GEN y, GEN z) + void affsi(long s, GEN x) + void affsr(long s, GEN x) + void affsz(long x, GEN y) + void affui(ulong s, GEN x) + void affur(ulong s, GEN x) + GEN cgetg(long x, long y) + GEN cgetg_copy(GEN x, long *plx) + GEN cgeti(long x) + GEN cgetineg(long x) + GEN cgetipos(long x) + GEN cgetr(long x) + int cmpir(GEN x, GEN y) + int cmpis(GEN x, long y) + int cmpiu(GEN x, ulong y) + int cmpri(GEN x, GEN y) + int cmprs(GEN x, long y) + int cmpsi(long x, GEN y) + int cmpsr(long x, GEN y) + int cmpui(ulong x, GEN y) + GEN cxtofp(GEN x, long prec) + GEN divii(GEN a, GEN b) + void diviiz(GEN x, GEN y, GEN z) + void divirz(GEN x, GEN y, GEN z) + void divisz(GEN x, long s, GEN z) + void divriz(GEN x, GEN y, GEN z) + void divrrz(GEN x, GEN y, GEN z) + void divrsz(GEN y, long s, GEN z) + GEN divsi_rem(long x, GEN y, long *rem) + void divsiz(long x, GEN y, GEN z) + void divsrz(long s, GEN y, GEN z) + GEN divss(long x, long y) + GEN divss_rem(long x, long y, long *rem) + void divssz(long x, long y, GEN z) + int dvdii(GEN x, GEN y) + int dvdiiz(GEN x, GEN y, GEN z) + int dvdis(GEN x, long y) + int dvdisz(GEN x, long y, GEN z) + int dvdiu(GEN x, ulong y) + int dvdiuz(GEN x, ulong y, GEN z) + int dvdsi(long x, GEN y) + int dvdui(ulong x, GEN y) + void dvmdiiz(GEN x, GEN y, GEN z, GEN t) + GEN dvmdis(GEN x, long y, GEN *z) + void dvmdisz(GEN x, long y, GEN z, GEN t) + long dvmdsBIL(long n, long *r) + GEN dvmdsi(long x, GEN y, GEN *z) + void dvmdsiz(long x, GEN y, GEN z, GEN t) + GEN dvmdss(long x, long y, GEN *z) + void dvmdssz(long x, long y, GEN z, GEN t) + ulong dvmduBIL(ulong n, ulong *r) + int equalis(GEN x, long y) + int equaliu(GEN x, ulong y) + int equalsi(long x, GEN y) + int equalui(ulong x, GEN y) + long evalexpo(long x) + long evallg(long x) + long evalvalp(long x) + long expi(GEN x) + long expu(ulong x) + void fixlg(GEN z, long ly) + GEN fractor(GEN x, long prec) + GEN icopy(GEN x) + GEN icopy_avma(GEN x, pari_sp av) + GEN itor(GEN x, long prec) + long itos(GEN x) + long itos_or_0(GEN x) + ulong itou(GEN x) + ulong itou_or_0(GEN x) + GEN leafcopy(GEN x) + double maxdd(double x, double y) + long maxss(long x, long y) + long maxuu(ulong x, ulong y) + double mindd(double x, double y) + long minss(long x, long y) + long minuu(ulong x, ulong y) + long mod16(GEN x) + long mod2(GEN x) + ulong mod2BIL(GEN x) + long mod32(GEN x) + long mod4(GEN x) + long mod64(GEN x) + long mod8(GEN x) + GEN modis(GEN x, long y) + void modisz(GEN y, long s, GEN z) + GEN modsi(long x, GEN y) + void modsiz(long s, GEN y, GEN z) + GEN modss(long x, long y) + void modssz(long s, long y, GEN z) + GEN mpabs(GEN x) + GEN mpadd(GEN x, GEN y) + void mpaddz(GEN x, GEN y, GEN z) + void mpaff(GEN x, GEN y) + GEN mpceil(GEN x) + int mpcmp(GEN x, GEN y) + GEN mpcopy(GEN x) + GEN mpdiv(GEN x, GEN y) + long mpexpo(GEN x) + GEN mpfloor(GEN x) + GEN mpmul(GEN x, GEN y) + void mpmulz(GEN x, GEN y, GEN z) + GEN mpneg(GEN x) + int mpodd(GEN x) + GEN mpround(GEN x) + GEN mpshift(GEN x,long s) + GEN mpsqr(GEN x) + GEN mpsub(GEN x, GEN y) + void mpsubz(GEN x, GEN y, GEN z) + GEN mptrunc(GEN x) + void muliiz(GEN x, GEN y, GEN z) + void mulirz(GEN x, GEN y, GEN z) + GEN mulis(GEN x, long s) + GEN muliu(GEN x, ulong s) + GEN mulri(GEN x, GEN s) + void mulriz(GEN x, GEN y, GEN z) + void mulrrz(GEN x, GEN y, GEN z) + GEN mulrs(GEN x, long s) + GEN mulru(GEN x, ulong s) + void mulsiz(long s, GEN y, GEN z) + void mulsrz(long s, GEN y, GEN z) + void mulssz(long s, long y, GEN z) + GEN negi(GEN x) + GEN negr(GEN x) + GEN new_chunk(size_t x) + GEN rcopy(GEN x) + GEN rdivii(GEN x, GEN y, long prec) + void rdiviiz(GEN x, GEN y, GEN z) + GEN rdivis(GEN x, long y, long prec) + GEN rdivsi(long x, GEN y, long prec) + GEN rdivss(long x, long y, long prec) + GEN real2n(long n, long prec) + GEN real_0(long prec) + GEN real_0_bit(long bitprec) + GEN real_1(long prec) + GEN real_m1(long prec) + GEN remii(GEN a, GEN b) + void remiiz(GEN x, GEN y, GEN z) + GEN remis(GEN x, long y) + void remisz(GEN y, long s, GEN z) + GEN remsi(long x, GEN y) + void remsiz(long s, GEN y, GEN z) + GEN remss(long x, long y) + void remssz(long s, long y, GEN z) + GEN rtor(GEN x, long prec) + long sdivsi(long x, GEN y) + long sdivsi_rem(long x, GEN y, long *rem) + long sdivss_rem(long x, long y, long *rem) + void setabssign(GEN x) + void shift_left(GEN z2, GEN z1, long min, long M, ulong f, ulong sh) + void shift_right(GEN z2, GEN z1, long min, long M, ulong f, ulong sh) + ulong shiftl(ulong x, ulong y) + ulong shiftlr(ulong x, ulong y) + GEN shiftr(GEN x, long n) + long smodis(GEN x, long y) + long smodss(long x, long y) + void stackdummy(pari_sp av, pari_sp ltop) + GEN stoi(long x) + GEN stor(long x, long prec) + GEN subii(GEN x, GEN y) + void subiiz(GEN x, GEN y, GEN z) + GEN subir(GEN x, GEN y) + void subirz(GEN x, GEN y, GEN z) + GEN subis(GEN x, long y) + void subisz(GEN y, long s, GEN z) + GEN subri(GEN x, GEN y) + void subriz(GEN x, GEN y, GEN z) + GEN subrr(GEN x, GEN y) + void subrrz(GEN x, GEN y, GEN z) + GEN subrs(GEN x, long y) + void subrsz(GEN y, long s, GEN z) + GEN subsi(long x, GEN y) + void subsiz(long s, GEN y, GEN z) + void subsrz(long s, GEN y, GEN z) + GEN subss(long x, long y) + void subssz(long x, long y, GEN z) + GEN subuu(ulong x, ulong y) + void togglesign(GEN x) + void togglesign_safe(GEN *px) + void affectsign(GEN x, GEN y) + void affectsign_safe(GEN x, GEN *py) + GEN truedivii(GEN a,GEN b) + GEN truedivis(GEN a, long b) + GEN truedivsi(long a, GEN b) + ulong udivui_rem(ulong x, GEN y, ulong *rem) + ulong umodui(ulong x, GEN y) + GEN utoi(ulong x) + GEN utoineg(ulong x) + GEN utoipos(ulong x) + GEN utor(ulong s, long prec) + GEN uutoi(ulong x, ulong y) + GEN uutoineg(ulong x, ulong y) + long vali(GEN x) + + # F2x.c + + GEN F2c_to_ZC(GEN x) + GEN F2m_to_ZM(GEN z) + void F2v_add_inplace(GEN x, GEN y) + GEN F2x_1_add(GEN y) + GEN F2x_add(GEN x, GEN y) + long F2x_degree(GEN x) + GEN F2x_deriv(GEN x) + GEN F2x_divrem(GEN x, GEN y, GEN *pr) + GEN F2x_extgcd(GEN a, GEN b, GEN *ptu, GEN *ptv) + GEN F2x_gcd(GEN a, GEN b) + GEN F2x_mul(GEN x, GEN y) + GEN F2x_rem(GEN x, GEN y) + GEN F2x_sqr(GEN x) + GEN F2x_to_F2v(GEN x, long n) + GEN F2x_to_Flx(GEN x) + GEN F2x_to_ZX(GEN x) + GEN F2xC_to_ZXC(GEN x) + GEN F2xV_to_F2m(GEN v, long n) + GEN F2xq_conjvec(GEN x, GEN T) + GEN F2xq_div(GEN x,GEN y,GEN T) + GEN F2xq_inv(GEN x, GEN T) + GEN F2xq_invsafe(GEN x, GEN T) + GEN F2xq_log(GEN a, GEN g, GEN ord, GEN T) + GEN F2xq_matrix_pow(GEN y, long n, long m, GEN P) + GEN F2xq_mul(GEN x, GEN y, GEN pol) + GEN F2xq_order(GEN a, GEN ord, GEN T) + GEN F2xq_pow(GEN x, GEN n, GEN pol) + GEN F2xq_powers(GEN x, long l, GEN T) + GEN F2xq_sqr(GEN x,GEN pol) + GEN F2xq_sqrt(GEN a, GEN T) + GEN F2xq_sqrtn(GEN a, GEN n, GEN T, GEN *zeta) + ulong F2xq_trace(GEN x, GEN T) + GEN Flm_to_F2m(GEN x) + GEN Flv_to_F2v(GEN x) + GEN Flx_to_F2x(GEN x) + GEN Z_to_F2x(GEN x, long sv) + GEN ZM_to_F2m(GEN x) + GEN ZV_to_F2v(GEN x) + GEN ZX_to_F2x(GEN x) + GEN ZXX_to_F2xX(GEN B, long v) + GEN gener_F2xq(GEN T, GEN *po) + GEN random_F2x(long d, long vs) # Flx.c diff --git a/src/sage/rings/finite_rings/element_pari_ffelt.pyx b/src/sage/rings/finite_rings/element_pari_ffelt.pyx index 60688454159..5193cf5b3cd 100644 --- a/src/sage/rings/finite_rings/element_pari_ffelt.pyx +++ b/src/sage/rings/finite_rings/element_pari_ffelt.pyx @@ -20,6 +20,7 @@ AUTHORS: include "sage/ext/stdsage.pxi" include "sage/ext/interrupt.pxi" +include "sage/libs/pari/pari_err.pxi" from element_base cimport FinitePolyExtElement from integer_mod import IntegerMod_abstract @@ -42,18 +43,13 @@ cdef PariInstance pari = sage.libs.pari.gen.pari cdef extern from "sage/libs/pari/misc.h": int gcmp_sage(GEN x, GEN y) -cdef extern GEN Flx_to_F2x(GEN x) -cdef extern from "pari/paripriv.h": - extern int t_FF_FpXQ, t_FF_Flxq, t_FF_F2xq - - -cdef GEN INT_to_FFELT(GEN g, GEN x): +cdef GEN _INT_to_FFELT(GEN g, GEN x) except NULL: """ Convert the t_INT `x` to an element of the field of definition of the t_FFELT `g`. - This function must be called within sig_on() ... sig_off(). + This function must be called within pari_catch_sig_on() ... pari_catch_sig_off(). """ cdef GEN f, p = gel(g, 4), result cdef long t @@ -77,7 +73,7 @@ cdef GEN INT_to_FFELT(GEN g, GEN x): set_gel(f, 1, gmael(g, 2, 1)) f[2] = itos(x) else: - sig_off() + pari_catch_sig_off() raise TypeError("unknown PARI finite field type") result = cgetg(5, t_FFELT) result[1] = t @@ -124,6 +120,14 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): sage: a - a == K(0) True sage: TestSuite(a).run() + + Test creating elements from basic Python types:: + + sage: K. = FiniteField(7^20, impl='pari_ffelt') + sage: K(int(8)) + 1 + sage: K(long(-2^300)) + 6 """ def __init__(FiniteFieldElement_pari_ffelt self, object parent, object x): @@ -170,7 +174,7 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): cdef void construct(FiniteFieldElement_pari_ffelt self, GEN g): """ Initialise ``self`` to the FFELT ``g``, reset the PARI stack, - and call sig_off(). + and call pari_catch_sig_off(). This should be called exactly once on every instance. """ @@ -188,7 +192,7 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): if isinstance(x, FiniteFieldElement_pari_ffelt): if self._parent is (x)._parent: - sig_on() + pari_catch_sig_on() self.construct((x).val) else: # This is where we *would* do coercion from one finite field to another... @@ -196,36 +200,36 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): elif isinstance(x, Integer): g = (self._parent._gen_pari).g - sig_on() + pari_catch_sig_on() x_GEN = pari._new_GEN_from_mpz_t(x + mpz_t_offset) - self.construct(INT_to_FFELT(g, x_GEN)) + self.construct(_INT_to_FFELT(g, x_GEN)) elif isinstance(x, int) or isinstance(x, long): g = (self._parent._gen_pari).g - sig_on() - x_GEN = stoi(x) - self.construct(INT_to_FFELT(g, x_GEN)) + pari_catch_sig_on() + x_GEN = (pari(x)).g + self.construct(_INT_to_FFELT(g, x_GEN)) elif isinstance(x, IntegerMod_abstract): if self._parent.characteristic().divides(x.modulus()): g = (self._parent._gen_pari).g x = Integer(x) - sig_on() + pari_catch_sig_on() x_GEN = pari._new_GEN_from_mpz_t(x + mpz_t_offset) - self.construct(INT_to_FFELT(g, x_GEN)) + self.construct(_INT_to_FFELT(g, x_GEN)) else: raise TypeError("no coercion defined") elif x is None: g = (self._parent._gen_pari).g - sig_on() + pari_catch_sig_on() self.construct(FF_zero(g)) elif isinstance(x, pari_gen): g = (self._parent._gen_pari).g x_GEN = (x).g - sig_on() + pari_catch_sig_on() if gequal0(x_GEN): self.construct(FF_zero(g)) return @@ -237,14 +241,14 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): if t == t_FFELT and FF_samefield(x_GEN, g): self.construct(x_GEN) elif t == t_INT: - self.construct(INT_to_FFELT(g, x_GEN)) + self.construct(_INT_to_FFELT(g, x_GEN)) elif t == t_INTMOD and gequal0(modii(gel(x_GEN, 1), FF_p_i(g))): - self.construct(INT_to_FFELT(g, gel(x_GEN, 2))) + self.construct(_INT_to_FFELT(g, gel(x_GEN, 2))) elif t == t_FRAC and not gequal0(modii(gel(x_GEN, 2), FF_p_i(g))): - self.construct(FF_div(INT_to_FFELT(g, gel(x_GEN, 1)), - INT_to_FFELT(g, gel(x_GEN, 2)))) + self.construct(FF_div(_INT_to_FFELT(g, gel(x_GEN, 1)), + _INT_to_FFELT(g, gel(x_GEN, 2)))) else: - sig_off() + pari_catch_sig_off() raise TypeError("no coercion defined") elif (isinstance(x, FreeModuleElement) @@ -254,7 +258,7 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): n = len(x) while n > 0 and x[n - 1] == 0: n -= 1 - sig_on() + pari_catch_sig_on() if n == 0: self.construct(FF_zero(g)) return @@ -272,7 +276,7 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): if t == t_FF_F2xq: f = Flx_to_F2x(f) else: - sig_off() + pari_catch_sig_off() raise TypeError("unknown PARI finite field type") result = cgetg(5, t_FFELT) result[1] = t @@ -322,7 +326,7 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): sage: c^20 # indirect doctest c^4 + 2*c^3 """ - sig_on() + pari_catch_sig_on() return pari.new_gen_to_string(self.val) def __hash__(FiniteFieldElement_pari_ffelt self): @@ -345,8 +349,7 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): TEST:: - sage: K = FiniteField(10007^10, 'a', impl='pari_ffelt') - sage: a = K.gen() + sage: K. = FiniteField(10007^10, impl='pari_ffelt') sage: loads(a.dumps()) == a True """ @@ -358,8 +361,7 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): TESTS:: - sage: k = FiniteField(3^3, 'a', impl='pari_ffelt') - sage: a = k.gen() + sage: k. = FiniteField(3^3, impl='pari_ffelt') sage: a a sage: b = copy(a); b @@ -370,7 +372,7 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): False """ cdef FiniteFieldElement_pari_ffelt x = self._new() - sig_on() + pari_catch_sig_on() x.construct(self.val) return x @@ -380,16 +382,16 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): TESTS:: - sage: a = FiniteField(3^3, 'a', impl='pari_ffelt').gen() + sage: k. = FiniteField(3^3, impl='pari_ffelt') sage: a == 1 False - sage: a**0 == 1 + sage: a^0 == 1 True sage: a == a True - sage: a < a**2 + sage: a < a^2 True - sage: a > a**2 + sage: a > a^2 False """ return gcmp_sage(self.val, (other).val) @@ -447,7 +449,7 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): a^2 + a """ cdef FiniteFieldElement_pari_ffelt x = self._new() - sig_on() + pari_catch_sig_on() x.construct(FF_add((self).val, (right).val)) return x @@ -463,7 +465,7 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): 0 """ cdef FiniteFieldElement_pari_ffelt x = self._new() - sig_on() + pari_catch_sig_on() x.construct(FF_sub((self).val, (right).val)) return x @@ -479,7 +481,7 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): a^15 + 2*a^12 + a^11 + 2*a^10 + 2 """ cdef FiniteFieldElement_pari_ffelt x = self._new() - sig_on() + pari_catch_sig_on() x.construct(FF_mul((self).val, (right).val)) return x @@ -497,7 +499,7 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): if FF_equal0((right).val): raise ZeroDivisionError cdef FiniteFieldElement_pari_ffelt x = self._new() - sig_on() + pari_catch_sig_on() x.construct(FF_div((self).val, (right).val)) return x @@ -567,7 +569,7 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): 2*a """ cdef FiniteFieldElement_pari_ffelt x = self._new() - sig_on() + pari_catch_sig_on() x.construct(FF_neg_i((self).val)) return x @@ -577,7 +579,7 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): EXAMPLE:: - sage: a = FiniteField(3^2, 'a', impl='pari_ffelt').gen() + sage: k. = FiniteField(3^2, impl='pari_ffelt') sage: ~a a + 2 sage: (a+1)*a @@ -588,7 +590,7 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): if FF_equal0(self.val): raise ZeroDivisionError cdef FiniteFieldElement_pari_ffelt x = self._new() - sig_on() + pari_catch_sig_on() x.construct(FF_inv((self).val)) return x @@ -617,7 +619,7 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): raise ZeroDivisionError exp = Integer(exp) # or convert to Z/(q - 1)Z if we are in F_q... cdef FiniteFieldElement_pari_ffelt x = self._new() - sig_on() + pari_catch_sig_on() x.construct(FF_pow(self.val, ((pari(exp))).g)) return x @@ -629,9 +631,14 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): EXAMPLES:: - sage: k = FiniteField(3^2, 'a', impl='pari_ffelt') - sage: k.gen().polynomial() + sage: k. = FiniteField(3^2, impl='pari_ffelt') + sage: pol = a.polynomial() + sage: pol a + sage: parent(pol) + Univariate Polynomial Ring in a over Finite Field of size 3 + + :: sage: k = FiniteField(3^4, 'alpha', impl='pari_ffelt') sage: a = k.gen() @@ -642,7 +649,7 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): sage: (a**2 + 1).polynomial().parent() Univariate Polynomial Ring in alpha over Finite Field of size 3 """ - sig_on() + pari_catch_sig_on() return self._parent.polynomial_ring()(pari.new_gen(FF_to_FpXQ_i(self.val))) def charpoly(FiniteFieldElement_pari_ffelt self, object var='x'): @@ -660,7 +667,7 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): sage: a.charpoly('y') y^2 + 1 """ - sig_on() + pari_catch_sig_on() return self._parent.polynomial_ring(var)(pari.new_gen(FF_charpoly(self.val))) def is_square(FiniteFieldElement_pari_ffelt self): @@ -670,19 +677,17 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): EXAMPLES:: - sage: k = FiniteField(3^2, 'a', impl='pari_ffelt') - sage: a = k.gen() + sage: k. = FiniteField(3^2, impl='pari_ffelt') sage: a.is_square() False sage: (a**2).is_square() True - sage: k = FiniteField(2^2, 'a', impl='pari_ffelt') - sage: a = k.gen() + sage: k. = FiniteField(2^2, impl='pari_ffelt') sage: (a**2).is_square() True - sage: k = FiniteField(17^5, 'a', impl='pari_ffelt'); a = k.gen() + sage: k. = FiniteField(17^5, impl='pari_ffelt') sage: (a**2).is_square() True sage: a.is_square() @@ -691,9 +696,9 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): True """ cdef long i - sig_on() + pari_catch_sig_on() i = FF_issquare(self.val) - sig_off() + pari_catch_sig_off() return bool(i) def sqrt(FiniteFieldElement_pari_ffelt self, extend=False, all=False): @@ -753,7 +758,7 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): raise NotImplementedError cdef GEN s cdef FiniteFieldElement_pari_ffelt x, mx - sig_on() + pari_catch_sig_on() if FF_issquareall(self.val, &s): x = self._new() x.construct(s) @@ -762,12 +767,12 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): elif gequal0(x.val) or self._parent.characteristic() == 2: return [x] else: - sig_on() + pari_catch_sig_on() mx = self._new() mx.construct(FF_neg_i(x.val)) return [x, mx] else: - sig_off() + pari_catch_sig_off() if all: return [] else: @@ -790,27 +795,59 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): EXAMPLES:: - sage: F = FiniteField(2^10, 'a', impl='pari_ffelt') - sage: g = F.gen() + sage: F. = FiniteField(2^10, impl='pari_ffelt') sage: b = g; a = g^37 sage: a.log(b) 37 sage: b^37; a - a^8 + a^7 + a^4 + a + 1 - a^8 + a^7 + a^4 + a + 1 + g^8 + g^7 + g^4 + g + 1 + g^8 + g^7 + g^4 + g + 1 + + :: sage: F. = FiniteField(5^2, impl='pari_ffelt') sage: F(-1).log(F(2)) 2 + sage: F(1).log(a) + 0 + + Some cases where the logarithm is not defined or does not exist:: + + sage: F. = GF(3^10, impl='pari_ffelt') + sage: a.log(-1) + Traceback (most recent call last): + ... + ArithmeticError: element a does not lie in group generated by 2 + sage: a.log(0) + Traceback (most recent call last): + ... + ArithmeticError: discrete logarithm with base 0 is not defined + sage: F(0).log(1) + Traceback (most recent call last): + ... + ArithmeticError: discrete logarithm of 0 is not defined """ - # We have to specify the order of the base of the logarithm + base = self._parent(base) + if self.is_zero(): + raise ArithmeticError("discrete logarithm of 0 is not defined") + if base.is_zero(): + raise ArithmeticError("discrete logarithm with base 0 is not defined") + + # Compute the orders of self and base to check whether self + # actually lies in the cyclic group generated by base. PARI + # requires that this is the case. + # We also have to specify the order of the base anyway # because PARI assumes by default that this element generates # the multiplicative group. - cdef GEN x, order - base = self._parent(base) - sig_on() - order = FF_order((base).val, NULL) - x = FF_log(self.val, (base).val, order) + cdef GEN x, base_order, self_order + pari_catch_sig_on() + base_order = FF_order((base).val, NULL) + self_order = FF_order(self.val, NULL) + if not dvdii(base_order, self_order): + # self_order does not divide base_order + pari.clear_stack() + raise ArithmeticError("element %s does not lie in group generated by %s"%(self, base)) + x = FF_log(self.val, (base).val, base_order) return Integer(pari.new_gen(x)) def multiplicative_order(FiniteFieldElement_pari_ffelt self): @@ -828,7 +865,7 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): if self.is_zero(): raise ArithmeticError("Multiplicative order of 0 not defined.") cdef GEN order - sig_on() + pari_catch_sig_on() order = FF_order(self.val, NULL) return Integer(pari.new_gen(order)) @@ -924,13 +961,12 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): EXAMPLE:: - sage: k = FiniteField(3^3, 'a', impl='pari_ffelt') - sage: a = k.gen() + sage: k. = FiniteField(3^3, impl='pari_ffelt') sage: b = a**2 + 2*a + 1 sage: b._pari_() a^2 + 2*a + 1 """ - sig_on() + pari_catch_sig_on() return pari.new_gen(self.val) def _pari_init_(self): @@ -952,7 +988,7 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): where `p` is the characteristic, `f` is the defining polynomial and `a` is the name of the generator. """ - sig_on() + pari_catch_sig_on() return pari.new_gen_to_string(self.val) def _magma_init_(self, magma): From 6cd493bfe8dd6371403d89537dbe2eba288ee6c8 Mon Sep 17 00:00:00 2001 From: Peter Bruin Date: Sat, 31 Aug 2013 18:40:55 +0200 Subject: [PATCH 26/85] Trac #15125: reviewer patch --- src/sage/rings/finite_rings/element_pari_ffelt.pyx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/sage/rings/finite_rings/element_pari_ffelt.pyx b/src/sage/rings/finite_rings/element_pari_ffelt.pyx index 5193cf5b3cd..1b24ee6461e 100644 --- a/src/sage/rings/finite_rings/element_pari_ffelt.pyx +++ b/src/sage/rings/finite_rings/element_pari_ffelt.pyx @@ -19,7 +19,6 @@ AUTHORS: include "sage/ext/stdsage.pxi" -include "sage/ext/interrupt.pxi" include "sage/libs/pari/pari_err.pxi" from element_base cimport FinitePolyExtElement @@ -132,7 +131,8 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): def __init__(FiniteFieldElement_pari_ffelt self, object parent, object x): """ - Create an empty finite field element with the given parent. + Initialise ``self`` with the given ``parent`` and value + converted from ``x``. This is called when constructing elements from Python. @@ -163,8 +163,6 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): cdef FiniteFieldElement_pari_ffelt _new(FiniteFieldElement_pari_ffelt self): """ Create an empty element with the same parent as ``self``. - - This is the Cython replacement for __init__. """ cdef FiniteFieldElement_pari_ffelt x x = FiniteFieldElement_pari_ffelt.__new__(FiniteFieldElement_pari_ffelt) @@ -272,7 +270,7 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): f = cgetg(n + 2, t_VECSMALL) set_gel(f, 1, gmael(g, 2, 1)) for i in xrange(n): - f[i + 2] = long(x[i]) + f[i + 2] = x[i] if t == t_FF_F2xq: f = Flx_to_F2x(f) else: From 28c9241e5349a8f9f26aed1232ba69e4f6005709 Mon Sep 17 00:00:00 2001 From: Jeroen Demeyer Date: Mon, 2 Sep 2013 08:41:28 +0200 Subject: [PATCH 27/85] Trac #15125: Fix conversion FiniteField_pari_ffelt -> GP --- .../rings/finite_rings/element_pari_ffelt.pyx | 31 +++++++++++++------ 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/src/sage/rings/finite_rings/element_pari_ffelt.pyx b/src/sage/rings/finite_rings/element_pari_ffelt.pyx index 1b24ee6461e..3a09858501b 100644 --- a/src/sage/rings/finite_rings/element_pari_ffelt.pyx +++ b/src/sage/rings/finite_rings/element_pari_ffelt.pyx @@ -975,19 +975,30 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): sage: k. = GF(3^17, impl='pari_ffelt') sage: a._pari_init_() - 'a' + 'subst(a+3*a,a,ffgen(Mod(1, 3)*x^17 + Mod(2, 3)*x + Mod(1, 3),a))' + sage: k(1)._pari_init_() + 'subst(1+3*a,a,ffgen(Mod(1, 3)*x^17 + Mod(2, 3)*x + Mod(1, 3),a))' - .. NOTE:: + This is used for conversion to GP. The element is displayed + as "a" but has correct arithmetic:: - To use the output as a field element in the PARI/GP - interpreter, the finite field must have been defined - previously. This can be done using the GP command - ``a = ffgen(f*Mod(1, p))``, - where `p` is the characteristic, `f` is the defining - polynomial and `a` is the name of the generator. + sage: gp(a) + a + sage: gp(a).type() + t_FFELT + sage: gp(a)^100 + 2*a^16 + 2*a^15 + a^4 + a + 1 + sage: gp(a^100) + 2*a^16 + 2*a^15 + a^4 + a + 1 + sage: gp(k(0)) + 0 + sage: gp(k(0)).type() + t_FFELT """ - pari_catch_sig_on() - return pari.new_gen_to_string(self.val) + ffgen = "ffgen(%s,a)" % self._parent.modulus()._pari_init_() + # Add this "zero" to ensure that the polynomial is not constant + zero = "%s*a" % self._parent.characteristic() + return "subst(%s+%s,a,%s)" % (self, zero, ffgen) def _magma_init_(self, magma): """ From 4d84feb2ab4d9977c72ec4d2f7d06ab0fd257bf4 Mon Sep 17 00:00:00 2001 From: Nathann Cohen Date: Mon, 20 May 2013 15:27:02 +0200 Subject: [PATCH 28/85] Trac #14619: Test that a graph is distance-regular --- src/sage/graphs/distances_all_pairs.pyx | 87 +++++++++++++++++++++++++ src/sage/graphs/graph.py | 4 ++ 2 files changed, 91 insertions(+) diff --git a/src/sage/graphs/distances_all_pairs.pyx b/src/sage/graphs/distances_all_pairs.pyx index 570138dcfb8..5784c51a902 100644 --- a/src/sage/graphs/distances_all_pairs.pyx +++ b/src/sage/graphs/distances_all_pairs.pyx @@ -463,6 +463,93 @@ def distances_all_pairs(G): sage_free(distances) return d +def is_distance_regular(G, parameters = False): + r""" + Tests if the graph is distance-regular + + A graph `G` is distance-regular if there exist integers `d_1,...,d_n` such + that for every vertex `v\in G` we have `d_i=\#\{u:d_G(u,v) =i\}`. + + For more information on distance-regular graphs, see its associated + :wikipedia:`wikipedia page `. + + INPUT: + + - ``parameters`` (boolean) -- whether to replace ``True`` answers with a + dictionary associating `d_i` to an integer `i>0` if `d_i>0` (one can then + obtain `d_i` by doing ``dictionary.get(i,0)``). Set to ``False`` by + default. + + EXAMPLES:: + + sage: g = graphs.PetersenGraph() + sage: g.is_distance_regular() + True + sage: g.is_distance_regular(parameters = True) + {1: 3, 2: 6} + + Cube graphs, which are not strongly regular, are a bit more interesting;; + + sage: graphs.CubeGraph(4).is_distance_regular(parameters = True) + {1: 4, 2: 6, 3: 4, 4: 1} + + """ + cdef int i,l + cdef int n = G.order() + + if n <= 2: + return {} if parameters else True + + if not G.is_regular(): + return False + + cdef unsigned short * distance_matrix = c_distances_all_pairs(G) + + # - d_array is the vector of d_i corresponding to the first vertex + # + # - d_tmp is a vector that we use to check that d_array is the same for + # every vertex v + cdef unsigned short * d_array = sage_calloc(2*n, sizeof(unsigned short)) + cdef unsigned short * d_tmp = d_array + n + + if d_array==NULL: + sage_free(distance_matrix) + raise MemoryError() + + # Filling d_array + cdef unsigned short * pointer = distance_matrix + for i in range(n): + d_array[pointer[i]] += 1 + pointer += n + + # For each of the n-1 other vertices + for l in range(1,n): + + # We set d_tmp and fill it with the data from the l^th row + memset(d_tmp, 0, n*sizeof(unsigned short)) + for i in range(n): + d_tmp[pointer[i]] += 1 + + # If d_tmp != d_array, we are done + if memcmp(d_array, d_tmp, n*sizeof(unsigned short)) != 0: + sage_free(distance_matrix) + sage_free(d_array) + return False + + pointer += n + + cdef dict dict_parameters + if parameters: + dict_parameters = {i:d_array[i] for i in range(n) if i and d_array[i] > 0} + + sage_free(distance_matrix) + sage_free(d_array) + + if parameters: + return dict_parameters + else: + return True + ################################### # Both distances and predecessors # ################################### diff --git a/src/sage/graphs/graph.py b/src/sage/graphs/graph.py index 1af226879cf..c46fe6eba4e 100644 --- a/src/sage/graphs/graph.py +++ b/src/sage/graphs/graph.py @@ -53,6 +53,7 @@ :meth:`~Graph.is_long_antihole_free` | Tests whether ``self`` contains an induced anticycle of length at least 5. :meth:`~Graph.is_weakly_chordal` | Tests whether ``self`` is weakly chordal. :meth:`~Graph.is_strongly_regular` | Tests whether ``self`` is strongly regular. + :meth:`~Graph.is_distance_regular` | Tests whether ``self`` is distance-regular. :meth:`~Graph.is_tree` | Return True if the graph is a tree. :meth:`~Graph.is_forest` | Return True if the graph is a forest, i.e. a disjoint union of trees. :meth:`~Graph.is_overfull` | Tests whether the current graph is overfull. @@ -6250,6 +6251,9 @@ def two_factor_petersen(self): import sage.graphs.graph_decompositions.graph_products Graph.is_cartesian_product = types.MethodType(sage.graphs.graph_decompositions.graph_products.is_cartesian_product, None, Graph) +import sage.graphs.distances_all_pairs +Graph.is_distance_regular = types.MethodType(sage.graphs.distances_all_pairs.is_distance_regular, None, Graph) + # From Python modules import sage.graphs.line_graph Graph.is_line_graph = sage.graphs.line_graph.is_line_graph From f7fe96f9fadc728fb71f3685f5911247e2e087c7 Mon Sep 17 00:00:00 2001 From: Frederic Chapoton Date: Sun, 8 Sep 2013 14:01:46 +0200 Subject: [PATCH 29/85] Trac #15177: a typo in generic_graph.py --- src/sage/graphs/generic_graph.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/sage/graphs/generic_graph.py b/src/sage/graphs/generic_graph.py index 2b338a9606f..88b449a1ae2 100644 --- a/src/sage/graphs/generic_graph.py +++ b/src/sage/graphs/generic_graph.py @@ -2883,13 +2883,13 @@ def spanning_trees_count(self, root_vertex=None): if self.order() == 0: return 0 - if self.is_directed() == False: - M=self.kirchhoff_matrix() + if not self.is_directed(): + M = self.kirchhoff_matrix() M.subdivide(1,1) M2 = M.subdivision(1,1) return M2.determinant() else: - if root_vertex == None: + if root_vertex is None: root_vertex=self.vertex_iterator().next() if root_vertex not in self.vertices(): raise ValueError("Vertex (%s) not in the graph."%root_vertex) @@ -4541,7 +4541,7 @@ def edge_disjoint_spanning_trees(self,k, root=None, solver = None, verbose = 0): # edges[j][e] is equal to one if and only if edge e belongs to color j edges = p.new_variable(dim=2) - if root == None: + if root is None: root = self.vertex_iterator().next() # r_edges is a relaxed variable grater than edges. It is used to @@ -6569,14 +6569,14 @@ def flow(self, x, y, value_only=True, integer=False, use_edge_labels=True, verte True """ - if vertex_bound == True and method == "FF": + if vertex_bound and method == "FF": raise ValueError("This method does not support both vertex_bound=True and method=\"FF\".") if (method == "FF" or - (method == None and vertex_bound == False)): + (method is None and not vertex_bound)): return self._ford_fulkerson(x,y, value_only=value_only, integer=integer, use_edge_labels=use_edge_labels) - if method != "LP" and method != None: + if method != "LP" and not method is None: raise ValueError("The method argument has to be equal to either \"FF\", \"LP\" or None") @@ -13497,7 +13497,7 @@ def tensor_product(self, other): and `((u,v), (w,x))` is an edge iff - `(u, w)` is an edge of self, and - `(v, x)` is an edge of other. - The tensor product is also knwon as the categorical product and the + The tensor product is also known as the categorical product and the kronecker product (refering to the kronecker matrix product). See :wikipedia:`Wikipedia article on the Kronecker product `. @@ -13559,12 +13559,12 @@ def tensor_product(self, other): G = Graph() else: raise TypeError('the graphs should be both directed or both undirected') - G.add_vertices( [(u,v) for u in self for v in other] ) - for u,w in self.edge_iterator(labels=None): - for v,x in other.edge_iterator(labels=None): - G.add_edge((u,v), (w,x)) + G.add_vertices( [(u, v) for u in self for v in other] ) + for u, w in self.edge_iterator(labels=None): + for v, x in other.edge_iterator(labels=None): + G.add_edge((u, v), (w, x)) if not G._directed: - G.add_edge((u,x), (w,v)) + G.add_edge((u, x), (w, v)) return G categorical_product = tensor_product From 1e4ceddcae0c96b3fd02fb194aebde4140b3d668 Mon Sep 17 00:00:00 2001 From: Miguel Marco Date: Sat, 29 Jun 2013 22:35:58 +0200 Subject: [PATCH 30/85] Trac #14841: improve frobby interface --- src/sage/interfaces/frobby.py | 259 +++++++++++++++++++++++++++------- 1 file changed, 207 insertions(+), 52 deletions(-) diff --git a/src/sage/interfaces/frobby.py b/src/sage/interfaces/frobby.py index fc93fd13a3d..06991495315 100644 --- a/src/sage/interfaces/frobby.py +++ b/src/sage/interfaces/frobby.py @@ -20,6 +20,7 @@ """ from subprocess import * +from sage.misc.misc_c import prod class Frobby: def __call__(self, action, input=None, options=[], verbose=False): @@ -39,16 +40,17 @@ def __call__(self, action, input=None, options=[], verbose=False): EXAMPLES: We compute the lcm of an ideal provided in Monos format. - sage: frobby("analyze", input="vars x,y,z;[x^2,x*y];", #optional - ... options=["lcm", "iformat monos", "oformat 4ti2"]) #optional - 'x^2*y\n' + sage: frobby("analyze", input="vars x,y,z;[x^2,x*y];", # optional - frobby + ... options=["lcm", "iformat monos", "oformat 4ti2"]) # optional - frobby + ' 2 1 0\n\n2 generators\n3 variables\n' + We get an exception if frobby reports an error. - sage: frobby("do_dishes") #optional + sage: frobby("do_dishes") # optional - frobby Traceback (most recent call last): ... RuntimeError: Frobby reported an error: - ERROR: Unknown action "do_dishes". + ERROR: No action has the prefix "do_dishes". AUTHOR: - Bjarke Hammersholt Roune (2008-04-27) @@ -74,6 +76,142 @@ def __call__(self, action, input=None, options=[], verbose=False): return output + def alexander_dual(self, monomial_ideal): + r""" + This function computes the Alexander dual of the passed-in + monomial ideal. This ideal is the one corresponding to the + simplicial complex whose faces are the complements of the + nonfaces of the simplicial complex corresponding to the input + ideal. + + INPUT: + monomial_ideal -- The monomial ideal to decompose. + + OUTPUT: + The monomial corresponding to the Alexander dual. + + EXAMPLES: + This is a simple example of computing irreducible decomposition. + + sage: (a, b, c, d) = QQ['a,b,c,d'].gens() # optional - frobby + sage: id = ideal(a * b, b * c, c * d, d * a) # optional - frobby + sage: alexander_dual = frobby.alexander_dual(id) # optional - frobby + sage: true_alexander_dual = ideal(b * d, a * c) # optional - frobby + sage: alexander_dual == true_alexander_dual # use sets to ignore order # optional - frobby + True + + We see how it is much faster to compute this with frobby than the built-in + procedure for simplicial complexes. + + sage: t=simplicial_complexes.PoincareHomologyThreeSphere() # optional - frobby + sage: R=PolynomialRing(QQ,16,'x') # optional - frobby + sage: I=R.ideal([prod([R.gen(i-1) for i in a]) for a in t.facets()]) # optional - frobby + sage: len(frobby.alexander_dual(I).gens()) # optional - frobby + 643 + + + """ + frobby_input = self._ideal_to_string(monomial_ideal) + frobby_output = self('alexdual', input=frobby_input) + return self._parse_ideals(frobby_output, monomial_ideal.ring())[0] + + def hilbert(self, monomial_ideal): + r""" + Computes the multigraded Hilbert-Poincare series of the input + ideal. Use the -univariate option to get the univariate series. + + The Hilbert-Poincare series of a monomial ideal is the sum of all + monomials not in the ideal. This sum can be written as a (finite) + rational function with $(x_1-1)(x_2-1)...(x_n-1)$ in the denominator, + assuming the variables of the ring are $x_1,x2,...,x_n$. This action + computes the polynomial in the numerator of this fraction. + + INPUT: + + monomial_ideal -- A monomial ideal. + + OUTPUT: + + A polynomial in the same ring as the ideal. + + EXAMPLES:: + + sage: R.=QQ[] # optional - frobby + sage: I=[d*b*c,b^2*c,b^10,d^10]*R # optional - frobby + sage: frobby.hilbert(I) # optional - frobby + d^10*b^10*c + d^10*b^10 + d^10*b*c + b^10*c + d^10 + b^10 + d*b^2*c + d*b*c + b^2*c + 1 + + """ + frobby_input = self._ideal_to_string(monomial_ideal) + frobby_output = self('hilbert', input=frobby_input) + ring=monomial_ideal.ring() + lines=frobby_output.split('\n') + if lines[-1]=='': + lines.pop(-1) + if lines[-1]=='(coefficient)': + lines.pop(-1) + lines.pop(0) + resul=0 + for l in lines: + lis=map(int,l.split()) + resul+=lis[0]+prod([ring.gen(i)**lis[i+1] for i in range(len(lis)-1)]) + return resul + + def associated_primes(self, monomial_ideal): + r""" + This function computes the associated primes of the passed-in + monomial ideal. + + INPUT: + monomial_ideal -- The monomial ideal to decompose. + + OUTPUT: + A list of the associated primes of the monomial ideal. These ideals + are constructed in the same ring as monomial_ideal is. + + EXAMPLES:: + + sage: R.=QQ[] # optional - frobby + sage: I=[d*b*c,b^2*c,b^10,d^10]*R # optional - frobby + sage: frobby.associated_primes(I) # optional - frobby + [Ideal (d, b) of Multivariate Polynomial Ring in d, b, c over Rational Field, + Ideal (d, b, c) of Multivariate Polynomial Ring in d, b, c over Rational Field] + + """ + frobby_input = self._ideal_to_string(monomial_ideal) + frobby_output = self('assoprimes', input=frobby_input) + lines=frobby_output.split('\n') + lines.pop(0) + if lines[-1]=='': + lines.pop(-1) + lists=[map(int,a.split()) for a in lines] + def to_monomial(exps): + return [v ** e for v, e in zip(monomial_ideal.ring().gens(), exps) if e != 0] + return [monomial_ideal.ring().ideal(to_monomial(a)) for a in lists] + + def dimension(self, monomial_ideal): + r""" + This function computes the dimension of the passed-in + monomial ideal. + + INPUT: + monomial_ideal -- The monomial ideal to decompose. + + OUTPUT: + The dimension of the zero set of the ideal. + + EXAMPLES:: + + sage: R.=QQ[] # optional - frobby + sage: I=[d*b*c,b^2*c,b^10,d^10]*R # optional - frobby + sage: frobby.dimension(I) # optional - frobby + 1 + + """ + frobby_input = self._ideal_to_string(monomial_ideal) + frobby_output = self('dimension', input=frobby_input) + return int(frobby_output) + def irreducible_decomposition(self, monomial_ideal): r""" This function computes the irreducible decomposition of the passed-in @@ -88,37 +226,38 @@ def irreducible_decomposition(self, monomial_ideal): monomial_ideal. These ideals are constructed in the same ring as monomial_ideal is. - EXAMPLES: + EXAMPLES:: This is a simple example of computing irreducible decomposition. - sage: (x, y, z) = QQ['x,y,z'].gens() #optional - sage: id = ideal(x ** 2, y ** 2, x * z, y * z) #optional - sage: decom = frobby.irreducible_decomposition(id) #optional - sage: true_decom = [ideal(x, y), ideal(x ** 2, y ** 2, z)] #optional - sage: set(decom) == set(true_decom) # use sets to ignore order #optional + sage: (x, y, z) = QQ['x,y,z'].gens() # optional - frobby + sage: id = ideal(x ** 2, y ** 2, x * z, y * z) # optional - frobby + sage: decom = frobby.irreducible_decomposition(id) # optional - frobby + sage: true_decom = [ideal(x, y), ideal(x ** 2, y ** 2, z)] # optional - frobby + sage: set(decom) == set(true_decom) # use sets to ignore order # optional - frobby True We now try the special case of the zero ideal in different rings. We should also try PolynomialRing(QQ, names=[]), but it has a bug which makes that impossible (see trac ticket 3028). - sage: rings = [ZZ['x'], CC['x,y']] #optional - sage: allOK = True #optional - sage: for ring in rings: #optional - ... id0 = ring.ideal(0) #optional - ... decom0 = frobby.irreducible_decomposition(id0) #optional - ... allOK = allOK and decom0 == [id0] #optional - sage: allOK #optional + sage: rings = [ZZ['x'], CC['x,y']] # optional - frobby + sage: allOK = True # optional - frobby + sage: for ring in rings: # optional - frobby + ... id0 = ring.ideal(0) # optional - frobby + ... decom0 = frobby.irreducible_decomposition(id0) # optional - frobby + ... allOK = allOK and decom0 == [id0] # optional - frobby + sage: allOK # optional - frobby True Finally, we try the ideal that is all of the ring in different rings. - sage: allOK = True #optional - sage: for ring in rings: #optional - ... id1 = ring.ideal(1) #optional - ... decom1 = frobby.irreducible_decomposition(id1) #optional - ... allOK = allOK and decom1 == [id1] #optional - sage: allOK #optional + sage: rings = [ZZ['x'], CC['x,y']] # optional - frobby + sage: allOK = True # optional - frobby + sage: for ring in rings: # optional - frobby + ... id1 = ring.ideal(1) # optional - frobby + ... decom1 = frobby.irreducible_decomposition(id1) # optional - frobby + ... allOK = allOK and decom1 == [id1] # optional - frobby + sage: allOK # optional - frobby True """ frobby_input = self._ideal_to_string(monomial_ideal) @@ -139,20 +278,36 @@ def _parse_ideals(self, string, ring): A list of the monomial ideals in the order they are listed in the string. - EXAMPLES: - sage: ring = QQ['x,y,z'] #optional - sage: (x, y, z) = ring.gens() #optional - sage: string = '2 3\n1 2 3\n0 5 0' #optional - sage: parsed_ideals = frobby._parse_ideals(string, ring) #optional - sage: reference_ideals = [ring.ideal(x, y ** 2, z ** 3), #optional - ... ring.ideal(y ** 5)] #optional #optional - sage: parsed_ideals == reference_ideals #optional - True + EXAMPLES:: + sage: ring = QQ['x,y,z'] # optional - frobby + sage: (x, y, z) = ring.gens() # optional - frobby + sage: string = '2 3\n1 2 3\n0 5 0\n2 3\n1 2 3\n4 5 6' # optional - frobby + sage: frobby._parse_ideals(string, ring) # optional - frobby + [Ideal (x*y^2*z^3, y^5) of Multivariate Polynomial Ring in x, y, z over Rational Field, + Ideal (x*y^2*z^3, x^4*y^5*z^6) of Multivariate Polynomial Ring in x, y, z over Rational Field] + """ + lines=string.split('\n') + if lines[-1]=='': + lines.pop(-1) + matrices=[] + while len(lines)>0: + if lines[0].split()[1]=='ring': + lines.pop(0) + lines.pop(0) + matrices.append('1 '+str(ring.ngens())+'\n'+'0 '*ring.ngens()+'\n') + else: + nrows=int(lines[0].split()[0]) + nmatrix=lines.pop(0)+'\n' + for i in range(nrows): + nmatrix+=lines.pop(0)+'\n' + matrices.append(nmatrix) def to_ideal(exps): - gens = [v ** e for v, e in zip(ring.gens(), exps) if e != 0] + if len(exps)==0: + return ring.zero_ideal() + gens = [prod([v ** e for v, e in zip(ring.gens(), expo) if e != 0]) for expo in exps] return ring.ideal(gens or ring(1)) - return map(to_ideal, self._parse_4ti2_matrix(string)) or [ring.ideal()] + return [to_ideal(self._parse_4ti2_matrix(a)) for a in matrices] or [ring.ideal()] def _parse_4ti2_matrix(self, string): r""" @@ -166,17 +321,17 @@ def _parse_4ti2_matrix(self, string): A list of rows of the matrix, where each row is represented as a list of integers. - EXAMPLES: + EXAMPLES:: The format is straight-forward, as this example shows. - sage: string = '2 3\n1 2 3\n 0 5 0' #optional - sage: parsed_matrix = frobby._parse_4ti2_matrix(string) #optional - sage: reference_matrix = [[1, 2, 3], [0, 5, 0]] #optional - sage: parsed_matrix == reference_matrix #optional + sage: string = '2 3\n1 2 3\n 0 5 0' # optional - frobby + sage: parsed_matrix = frobby._parse_4ti2_matrix(string) # optional - frobby + sage: reference_matrix = [[1, 2, 3], [0, 5, 0]] # optional - frobby + sage: parsed_matrix == reference_matrix # optional - frobby True A number of syntax errors lead to exceptions. - sage: string = '1 1\n one' #optional - sage: frobby._parse_4ti2_matrix(string) #optional + sage: string = '1 1\n one' # optional - frobby + sage: frobby._parse_4ti2_matrix(string) # optional - frobby Traceback (most recent call last): ... RuntimeError: Format error: encountered non-number. @@ -212,11 +367,11 @@ def _ideal_to_string(self, monomial_ideal): OUTPUT: A string in 4ti2 format representing the ideal. - EXAMPLES: - sage: ring = QQ['x,y,z'] #optional - sage: (x, y, z) = ring.gens() #optional - sage: id = ring.ideal(x ** 2, x * y * z) #optional - sage: frobby._ideal_to_string(id) == "2 3\n2 0 0\n1 1 1\n" #optional + EXAMPLES:: + sage: ring = QQ['x,y,z'] # optional - frobby + sage: (x, y, z) = ring.gens() # optional - frobby + sage: id = ring.ideal(x ** 2, x * y * z) # optional - frobby + sage: frobby._ideal_to_string(id) == "2 3\n2 0 0\n1 1 1\n" # optional - frobby True """ # There is no exponent vector that represents zero as a generator, so @@ -242,11 +397,11 @@ def _monomial_to_string(self, monomial): OUTPUT: A string representing the exponent vector of monomial. - EXAMPLES: - sage: ring = QQ['x,y,z'] #optional - sage: (x, y, z) = ring.gens() #optional - sage: monomial = x * x * z #optional - sage: frobby._monomial_to_string(monomial) == '2 0 1\n' #optional + EXAMPLES:: + sage: ring = QQ['x,y,z'] # optional - frobby + sage: (x, y, z) = ring.gens() # optional - frobby + sage: monomial = x * x * z # optional - frobby + sage: frobby._monomial_to_string(monomial) == '2 0 1\n' # optional - frobby True """ exponents = monomial.exponents() From 94dc0db0ee78e830e45fe2030247d9792c80e543 Mon Sep 17 00:00:00 2001 From: Volker Braun Date: Tue, 24 Sep 2013 11:28:44 +0100 Subject: [PATCH 31/85] Trac #15220: Fix MAX_MODULUS for integer_modn_dense --- src/sage/modules/vector_modn_dense.pyx | 21 ++++++++++++++++++--- src/sage/rings/finite_rings/integer_mod.pyx | 5 +++++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/sage/modules/vector_modn_dense.pyx b/src/sage/modules/vector_modn_dense.pyx index e207658f1f2..cb79473f969 100644 --- a/src/sage/modules/vector_modn_dense.pyx +++ b/src/sage/modules/vector_modn_dense.pyx @@ -60,6 +60,18 @@ TESTS: sage: v = vector(Integers(next_prime(10^20)), [1,2,3,4,5]) sage: loads(dumps(v)) == v True + + sage: K = GF(previous_prime(2^31)) + sage: v = vector(K, [42]); type(v[0]) + + sage: ~v[0] + 2096353084 + + sage: K = GF(next_prime(2^31)) + sage: v = vector(K, [42]); type(v[0]) + + sage: ~v[0] + 1482786336 """ ############################################################################### @@ -72,10 +84,13 @@ TESTS: include 'sage/ext/interrupt.pxi' include 'sage/ext/stdsage.pxi' -MAX_MODULUS = MOD_INT_MAX +from sage.rings.finite_rings.stdint cimport INTEGER_MOD_INT64_LIMIT + +MAX_MODULUS = INTEGER_MOD_INT64_LIMIT -from sage.rings.finite_rings.integer_mod cimport (IntegerMod_int, IntegerMod_int64, - IntegerMod_abstract, use_32bit_type) +from sage.rings.finite_rings.integer_mod cimport ( + IntegerMod_int, IntegerMod_int64, + IntegerMod_abstract, use_32bit_type) cdef mod_int ivalue(IntegerMod_abstract x) except -1: if PY_TYPE_CHECK_EXACT(x, IntegerMod_int): diff --git a/src/sage/rings/finite_rings/integer_mod.pyx b/src/sage/rings/finite_rings/integer_mod.pyx index df253ba1f10..f999431b4ec 100644 --- a/src/sage/rings/finite_rings/integer_mod.pyx +++ b/src/sage/rings/finite_rings/integer_mod.pyx @@ -50,6 +50,11 @@ TESTS:: sage: a = R(824362); b = R(205942) sage: a * b 851127 + + sage: type(IntegerModRing(2^31-1).an_element()) + + sage: type(IntegerModRing(2^31).an_element()) + """ ################################################################################# From d12f91d8657bad3664630007cdb334ed9b17be37 Mon Sep 17 00:00:00 2001 From: Volker Braun Date: Mon, 9 Sep 2013 11:02:15 +0100 Subject: [PATCH 32/85] Trac #15168: Refactor various displayhooks into DisplayHookBase and derived classes. Also, fix plotting in the notebook if typeset is enabled (which used yet another displayhook hack) --- src/sage/groups/matrix_gps/matrix_group.py | 4 +- src/sage/misc/displayhook.py | 523 ++++++++++++++------- src/sage/misc/latex.py | 23 +- 3 files changed, 356 insertions(+), 194 deletions(-) diff --git a/src/sage/groups/matrix_gps/matrix_group.py b/src/sage/groups/matrix_gps/matrix_group.py index 6896e4c40d9..4070fe02fd4 100644 --- a/src/sage/groups/matrix_gps/matrix_group.py +++ b/src/sage/groups/matrix_gps/matrix_group.py @@ -228,9 +228,9 @@ def _repr_(self): return 'Matrix group over {0} with {1} generators'.format( self.base_ring(), self.ngens()) else: - from sage.misc.displayhook import format_obj + from sage.misc.displayhook import format_list return 'Matrix group over {0} with {1} generators {2}'.format( - self.base_ring(), self.ngens(), format_obj(self.gens())) + self.base_ring(), self.ngens(), format_list(self.gens())) def _repr_option(self, key): """ diff --git a/src/sage/misc/displayhook.py b/src/sage/misc/displayhook.py index 18cdb8dca22..dc306c21068 100644 --- a/src/sage/misc/displayhook.py +++ b/src/sage/misc/displayhook.py @@ -52,168 +52,358 @@ - Bill Cauchois (2009): initial version - Jean-Baptiste Priez (2013): ASCII art +- Volker Braun (2013): refactored into DisplayHookBase """ import sys, __builtin__ +class ListFormatter(object): -# This is used to wrap lines when printing "tall" lists. -MAX_COLUMN = 70 + # This is used to wrap lines when printing "tall" lists. + MAX_COLUMN = 70 -def _check_tall_list_and_format(the_list): - """ - First check whether a list is "tall" -- whether the reprs of the - elements of the list will span multiple lines and cause the list - to be printed awkwardly. If not, this function returns ``None`` and - does nothing; you should revert back to the normal method for - printing an object (its repr). If so, return the string in the - special format. Note that the special format isn't just for - matrices. Any object with a multiline repr will be formatted. + def _check_tall_list_and_format(self, the_list): + """ + First check whether a list is "tall" -- whether the reprs of the + elements of the list will span multiple lines and cause the list + to be printed awkwardly. If not, this function returns ``None`` and + does nothing; you should revert back to the normal method for + printing an object (its repr). If so, return the string in the + special format. Note that the special format isn't just for + matrices. Any object with a multiline repr will be formatted. - INPUT: + INPUT: - - ``the_list`` - The list (or a tuple). + - ``the_list`` - The list (or a tuple). - TESTS:: + TESTS:: - sage: from sage.misc.displayhook import format_obj + sage: from sage.misc.displayhook import DisplayHookBase + sage: dhb = DisplayHookBase() - We test _check_tall_list_and_format() indirectly by calling format_obj() on - a list of matrices:: + We test :meth:`_check_tall_list_and_format` indirectly by + calling :meth:`simple_format_obj` on a list of matrices:: - sage: print sage.misc.displayhook.format_obj( \ - [matrix([[1, 2, 3, 4], [5, 6, 7, 8]]) for i in xrange(7)]) - [ - [1 2 3 4] [1 2 3 4] [1 2 3 4] [1 2 3 4] [1 2 3 4] [1 2 3 4] - [5 6 7 8], [5 6 7 8], [5 6 7 8], [5 6 7 8], [5 6 7 8], [5 6 7 8], - - [1 2 3 4] - [5 6 7 8] - ] + sage: print dhb.simple_format_obj( + ....: [matrix([[1, 2, 3, 4], [5, 6, 7, 8]]) for i in xrange(7)]) + [ + [1 2 3 4] [1 2 3 4] [1 2 3 4] [1 2 3 4] [1 2 3 4] [1 2 3 4] + [5 6 7 8], [5 6 7 8], [5 6 7 8], [5 6 7 8], [5 6 7 8], [5 6 7 8], + + [1 2 3 4] + [5 6 7 8] + ] - We return ``None`` if we don't have anything special to do:: + We return ``None`` if we don't have anything special to do:: - sage: format_obj('one-line string') - sage: format_obj(matrix([[1,2,3]])) - """ - # For every object to be printed, split its repr on newlines and store the - # result in this list. - split_reprs = [] - tall = False - for elem in the_list: - split_reprs.append(`elem`.split('\n')) - if len(split_reprs[-1]) > 1: - # Meanwhile, check to make sure the list is actually "tall". - tall = True - if not tall: - return None - # Figure out which type of parenthesis to use, based on the type of the_list. - if isinstance(the_list, tuple): - parens = '()' - elif isinstance(the_list, list): - parens = '[]' - else: - raise TypeError, 'expected list or tuple' - - # running_lines is a list of lines, which are stored as lists of strings - # to be joined later. For each split repr, we add its lines to the - # running_lines array. When current_column exceeds MAX_COLUMN, process - # and output running_lines using _print_tall_list_row. - running_lines = [[]] - current_column = 0 - s = [parens[0]] - for split_repr in split_reprs: - width = max(len(x) for x in split_repr) - if current_column + width > MAX_COLUMN and not (width > MAX_COLUMN): - s.extend(_tall_list_row(running_lines)) - running_lines = [[]] - current_column = 0 - current_column += width + 2 - # Add the lines from split_repr to the running_lines array. It may - # be necessary to add or remove lines from either one so that the - # number of lines matches up. - for i in xrange(len(running_lines), len(split_repr)): - running_lines.insert(0, [' ' * len(x) for x in running_lines[-1]]) - line_diff = len(running_lines) - len(split_repr) - for i, x in enumerate(split_repr): - running_lines[i + line_diff].append(x.ljust(width)) - for i in xrange(line_diff): - running_lines[i].append(' ' * width) - # Output any remaining entries. - if len(running_lines[0]) > 0: - s.extend(_tall_list_row(running_lines, True)) - s.append(parens[1]) - return "\n".join(s) - -# This helper function for _print_tall_list processes and outputs the -# contents of the running_lines array. -def _tall_list_row(running_lines, last_row=False): - s=[] - for i, line in enumerate(running_lines): - if i + 1 != len(running_lines): - sep, tail = ' ', '' + sage: dhb.simple_format_obj('one-line string') + sage: dhb.simple_format_obj(matrix([[1,2,3]])) + """ + # For every object to be printed, split its repr on newlines and store the + # result in this list. + split_reprs = [] + tall = False + for elem in the_list: + split_reprs.append(repr(elem).split('\n')) + if len(split_reprs[-1]) > 1: + # Meanwhile, check to make sure the list is actually "tall". + tall = True + if not tall: + return None + # Figure out which type of parenthesis to use, based on the type of the_list. + if isinstance(the_list, tuple): + parens = '()' + elif isinstance(the_list, list): + parens = '[]' else: - # The commas go on the bottom line of this row. - sep, tail = ', ', '' if last_row else ',' - s.append(sep.join(line) + tail) - # Separate rows with a newline to make them stand out. - if not last_row: - s.append("") - return s - -def format_obj(obj): - """ - This function is used internally by the displayhook. + raise TypeError('expected list or tuple') + + # running_lines is a list of lines, which are stored as lists of strings + # to be joined later. For each split repr, we add its lines to the + # running_lines array. When current_column exceeds MAX_COLUMN, process + # and output running_lines using _print_tall_list_row. + running_lines = [[]] + current_column = 0 + s = [parens[0]] + for split_repr in split_reprs: + width = max(len(x) for x in split_repr) + if current_column + width > self.MAX_COLUMN and not (width > self.MAX_COLUMN): + s.extend(self._tall_list_row(running_lines)) + running_lines = [[]] + current_column = 0 + current_column += width + 2 + # Add the lines from split_repr to the running_lines array. It may + # be necessary to add or remove lines from either one so that the + # number of lines matches up. + for i in xrange(len(running_lines), len(split_repr)): + running_lines.insert(0, [' ' * len(x) for x in running_lines[-1]]) + line_diff = len(running_lines) - len(split_repr) + for i, x in enumerate(split_repr): + running_lines[i + line_diff].append(x.ljust(width)) + for i in xrange(line_diff): + running_lines[i].append(' ' * width) + # Output any remaining entries. + if len(running_lines[0]) > 0: + s.extend(self._tall_list_row(running_lines, True)) + s.append(parens[1]) + return "\n".join(s) + + def _tall_list_row(self, running_lines, last_row=False): + """ + Helper for :meth:`_check_tall_list_and_format` - We attempt to keep ascii art of list/tuple members intact as we - print them. See :meth:`sage.structure.parent._repr_option` for - details. + This helper function processes and outputs the contents of the + running_lines array. - OUTPUT: + TESTS:: - Return a string if we want to print it in a special way; - otherwise, return ``None``. + sage: from sage.misc.displayhook import format_list + sage: format_list._tall_list_row(['a b', 'b c', 'c']) + ['a b', 'b c', 'c,', ''] + """ + s=[] + for i, line in enumerate(running_lines): + if i + 1 != len(running_lines): + sep, tail = ' ', '' + else: + # The commas go on the bottom line of this row. + sep, tail = ', ', '' if last_row else ',' + s.append(sep.join(line) + tail) + # Separate rows with a newline to make them stand out. + if not last_row: + s.append("") + return s - EXAMPLES:: + def try_format_list(self, obj): + """ + Format list/tuple. + + OUTPUT: + + A string representation or ``None``. The latter means that no + Sage-specific formatting is defined and the default should be + used. - sage: import sage.misc.displayhook + EXAMPLES:: - For most objects, nothing is done (``None`` is returned): + sage: from sage.misc.displayhook import format_list + sage: format_list.try_format_list('Hello, world!') + sage: format_list('Hello, world!') + "'Hello, world!'" + """ + ascii_art_repr = False + for o in obj: + try: + ascii_art_repr = ascii_art_repr or o.parent()._repr_option('element_ascii_art') + except (AttributeError, TypeError): + pass + if ascii_art_repr: + return self._check_tall_list_and_format(obj) + else: + return None - sage: sage.misc.displayhook.format_obj('Hello, world!') - sage: sage.misc.displayhook.format_obj((1, 2, 3, 4)) + def __call__(self, obj): + """ + Return a string formatting. - We demonstrate the special format for lists of matrices:: + This method is like :meth:`try_format_list` except that it + will always return a string. - sage: sage.misc.displayhook.format_obj( \ - [matrix([[1], [2]]), matrix([[3], [4]])]) - '[\n[1] [3]\n[2], [4]\n]' + OUTPUT: - TESTS: + String. - In #14466 we override IPython's special printing of ``type`` objects - and revert it to Python's standard string representation:: + EXAMPLES:: - sage: shell=sage.misc.interpreter.get_test_shell() - sage: shell.displayhook(type) - + sage: from sage.misc.displayhook import format_list + sage: format_list.try_format_list('Hello, world!') + sage: format_list('Hello, world!') + "'Hello, world!'" + """ + s = self.try_format_list(obj) + if s is None: + return repr(obj) + else: + return s - """ - if isinstance(obj, type): - return repr(obj) - ascii_art = False - if isinstance(obj, (tuple, list)) and len(obj) > 0: - for o in obj: - try: - ascii_art = ascii_art or o.parent()._repr_option('element_ascii_art') - except (AttributeError, TypeError): - pass - if ascii_art: - return _check_tall_list_and_format(obj) - else: - return None +format_list = ListFormatter() + + +class DisplayHookBase(object): + + def simple_format_obj(self, obj): + """This function is used internally by the displayhook. + + We attempt to keep ascii art of list/tuple members intact as we + print them. See :meth:`sage.structure.parent._repr_option` for + details. + + OUTPUT: + + Return a string if we want to print it in a special way; + otherwise, return ``None``. + + EXAMPLES:: + + sage: from sage.misc.displayhook import DisplayHookBase + sage: dhb = DisplayHookBase() + + For most objects, nothing is done (``None`` is returned): + + sage: dhb.simple_format_obj('Hello, world!') + sage: dhb.simple_format_obj((1, 2, 3, 4)) + + We demonstrate the special format for lists of matrices:: + + sage: dhb.simple_format_obj( + ....: [matrix([[1], [2]]), matrix([[3], [4]])]) + '[\n[1] [3]\n[2], [4]\n]' + + TESTS: + + In :trac:`14466` we override IPython's special printing of + ``type`` objects and revert it to Python's standard string + representation:: + + sage: shell=sage.misc.interpreter.get_test_shell() + sage: shell.displayhook(type) + + """ + if isinstance(obj, type): + return repr(obj) + if isinstance(obj, (tuple, list)) and len(obj) > 0: + return format_list.try_format_list(obj) + else: + return None + + def set_display(self, mode): + r""" + Select the text formatting method. + + INPUT: + + - ``mode`` -- string. One of ``simple``, ``ascii_art``, or ``typeset``. + + See :func:`simple_format_obj` or :func:`sage.misc.ascii_art.ascii_art`. + + TESTS:: + + sage: [identity_matrix(i) for i in range(3,7)] + [ + [1 0 0 0 0 0] + [1 0 0 0 0] [0 1 0 0 0 0] + [1 0 0 0] [0 1 0 0 0] [0 0 1 0 0 0] + [1 0 0] [0 1 0 0] [0 0 1 0 0] [0 0 0 1 0 0] + [0 1 0] [0 0 1 0] [0 0 0 1 0] [0 0 0 0 1 0] + [0 0 1], [0 0 0 1], [0 0 0 0 1], [0 0 0 0 0 1] + ] + sage: from sage.misc.interpreter import get_test_shell + sage: shell = get_test_shell() + sage: shell.run_cell('%display ascii_art') # indirect doctest + sage: shell.run_cell("i = var('i')") + sage: shell.run_cell('sum(i*x^i, i, 0, 10)') + 10 9 8 7 6 5 4 3 2 + 10*x + 9*x + 8*x + 7*x + 6*x + 5*x + 4*x + 3*x + 2*x + x + sage: shell.run_cell('%display simple') + """ + if mode not in ['simple', 'ascii_art', 'typeset']: + raise ValueError('invalid mode set') + self.mode = mode + + mode = 'simple' + + @property + def simple(self): + """ + Whether the mode is the "simple" (default) display. + + EXAMPLES:: + + sage: sys.displayhook.simple + True + sage: sys.displayhook.ascii_art + False + """ + return self.mode == 'simple' + + @property + def ascii_art(self): + """ + Whether the mode is the ascii art display. + + EXAMPLES:: + + sage: sys.displayhook.simple + True + sage: sys.displayhook.ascii_art + False + """ + return self.mode == 'ascii_art' + + @property + def typeset(self): + """ + Whether the mode is the notebook "Typeset" display. + + EXAMPLES:: + + sage: sys.displayhook.simple + True + sage: sys.displayhook.typeset + False + """ + return self.mode == 'typeset' + + def try_format_obj(self, obj): + """ + Format non-graphics object. + + OUTPUT: + + A string representation or ``None``. The latter means that no + Sage-specific formatting is defined and the default should be + used. + + TESTS:: + + sage: from sage.misc.displayhook import DisplayHookBase + sage: dhb = DisplayHookBase() + sage: dhb.try_format_obj('Hello, world!') + """ + if self.simple: + return self.simple_format_obj(obj) + if self.ascii_art: + from sage.misc.ascii_art import ascii_art + return ascii_art(obj) + if self.typeset: + from sage.misc.latex import pretty_print + pretty_print(obj) + return '' + assert(False) + + def try_format_graphics(self, obj): + """ + Format graphics object. + + OUTPUT: + + Boolean. Whether the object is graphics and was successfully + displayed. -class DisplayHook(object): + TESTS:: + + sage: from sage.misc.displayhook import DisplayHookBase + sage: dhb = DisplayHookBase() + sage: dhb.try_format_graphics('Hello, world!') + False + """ + from sage.structure.sage_object import SageObject + if isinstance(obj, SageObject) and hasattr(obj, '_graphics_'): + return obj._graphics_() + return False + + +class DisplayHook(DisplayHookBase): """ Display hook for Sage. @@ -221,7 +411,7 @@ class DisplayHook(object): IPython system for display hooks). This class provides a way to use the Sage display formatting when not using interactive Sage. """ - def __init__(self, oldhook = sys.__displayhook__): + def __init__(self, oldhook=sys.__displayhook__): """ Set the old display hook (default to repr) @@ -251,20 +441,18 @@ def __call__(self, obj): [0 0 1], [0 0 1] ) """ - from sage.structure.sage_object import SageObject - if isinstance(obj, SageObject) and hasattr(obj, '_graphics_'): - if obj._graphics_(): - return - s = format_obj(obj) + if self.try_format_graphics(obj): + return + s = self.try_format_obj(obj) if s is not None: print s __builtin__._ = obj else: self.oldhook(obj) + from IPython.core.formatters import PlainTextFormatter -from ascii_art import ascii_art -class SagePlainTextFormatter(PlainTextFormatter): +class SagePlainTextFormatter(DisplayHookBase, PlainTextFormatter): r""" A replacement for the plain text formatter which can use two facilities: @@ -288,67 +476,40 @@ class SagePlainTextFormatter(PlainTextFormatter): def __call__(self, obj): r""" Computes the format data of ``result``. If the - :func:`sage.misc.displayhook.format_obj` writes a string, then + :func:`sage.misc.displayhook.simple_format_obj` writes a string, then we override IPython's :class:`DisplayHook` formatting. EXAMPLES:: sage: from sage.misc.interpreter import get_test_shell sage: shell = get_test_shell() - sage: shell.display_formatter.formatters['text/plain'] + sage: fmt = shell.display_formatter.formatters['text/plain'] + sage: fmt <...displayhook.SagePlainTextFormatter object at 0x...> sage: shell.displayhook.compute_format_data(2) {u'text/plain': '2'} + sage: a = identity_matrix(ZZ, 2) sage: shell.displayhook.compute_format_data([a,a]) {u'text/plain': '[\n[1 0] [1 0]\n[0 1], [0 1]\n]'} - sage: from sage.misc.displayhook import SPTextFormatter - sage: SPTextFormatter.set_display("ascii_art") + sage: fmt.set_display('ascii_art') + sage: shell.displayhook.compute_format_data([a,a]) + {u'text/plain': [ [1 0] [1 0] ] + [ [0 1], [0 1] ]} + sage: i = var('i') sage: shell.displayhook.compute_format_data(sum(i*x^i, i, 0, 10)) {u'text/plain': 10 9 8 7 6 5 4 3 2 10*x + 9*x + 8*x + 7*x + 6*x + 5*x + 4*x + 3*x + 2*x + x} + sage: fmt.set_display('simple') """ - from sage.structure.sage_object import SageObject - if isinstance(obj, SageObject) and hasattr(obj, '_graphics_'): - if obj._graphics_(): - return '' - s = self._format_obj(obj) + if self.try_format_graphics(obj): + return '' + s = self.try_format_obj(obj) if s is None: s = super(SagePlainTextFormatter, self).__call__(obj) return s - _format_obj = lambda _, obj: format_obj(obj) - - def set_display(self, mode="ascii_art"): - r""" - Method uses to config the formatting method - (:meth:`simple_format_obj` or :func:`sage.misc.ascii_art.ascii_art`). - - TESTS:: - - sage: [identity_matrix(i) for i in range(3,7)] - [ - [1 0 0 0 0 0] - [1 0 0 0 0] [0 1 0 0 0 0] - [1 0 0 0] [0 1 0 0 0] [0 0 1 0 0 0] - [1 0 0] [0 1 0 0] [0 0 1 0 0] [0 0 0 1 0 0] - [0 1 0] [0 0 1 0] [0 0 0 1 0] [0 0 0 0 1 0] - [0 0 1], [0 0 0 1], [0 0 0 0 1], [0 0 0 0 0 1] - ] - sage: from sage.misc.displayhook import SPTextFormatter - sage: SPTextFormatter.set_display("ascii_art") - sage: from sage.misc.interpreter import get_test_shell - sage: shell = get_test_shell() - sage: shell.run_cell("i = var('i')") - sage: shell.run_cell('sum(i*x^i, i, 0, 10)') - 10 9 8 7 6 5 4 3 2 - 10*x + 9*x + 8*x + 7*x + 6*x + 5*x + 4*x + 3*x + 2*x + x - """ - self._format_obj = { - "ascii_art": ascii_art, - "simple": format_obj - }[mode] SPTextFormatter = None diff --git a/src/sage/misc/latex.py b/src/sage/misc/latex.py index 51f0b571e2b..c52d20bf586 100644 --- a/src/sage/misc/latex.py +++ b/src/sage/misc/latex.py @@ -48,7 +48,7 @@ \textheight=2\textheight ''') - +import sys import shutil, re import os.path import random @@ -2383,8 +2383,8 @@ def print_or_typeset(object): def pretty_print (*args): r""" - Try to pretty print the arguments in an intelligent way. For graphics - objects, this returns their default representation. For other + Try to pretty print the arguments in an intelligent way. For graphics + objects, this returns their default representation. For other objects, in the notebook, this calls the :func:`view` command, while from the command line, this produces an html string suitable for processing by MathJax. @@ -2444,6 +2444,9 @@ def pretty_print_default(enable=True): rendering things so that MathJax or some other latex-aware front end can render real math. + This function is pretty useless without the notebook, it shoudn't + be in the global namespace. + INPUT: - ``enable`` -- bool (optional, default ``True``). If ``True``, turn on @@ -2452,17 +2455,15 @@ def pretty_print_default(enable=True): EXAMPLES:: sage: pretty_print_default(True) - sage: sys.displayhook - + sage: 'foo' + sage: pretty_print_default(False) - sage: sys.displayhook == sys.__displayhook__ - True + sage: 'foo' + 'foo' """ import sys - if enable: - sys.displayhook = pretty_print - else: - sys.displayhook = sys.__displayhook__ + sys.displayhook.set_display('typeset' if enable else 'simple') + common_varnames = ['alpha', 'beta', From 677b91b2b14102f88eb176459ff7dbde0b771fce Mon Sep 17 00:00:00 2001 From: Punarbasu Purkayastha Date: Sun, 1 Sep 2013 11:29:05 +0800 Subject: [PATCH 33/85] Trac #15132: remove matrix.copy() - deprecated for four years --- src/sage/matrix/matrix0.pyx | 56 ------------------------ src/sage/matrix/matrix_generic_dense.pyx | 20 +++++++++ 2 files changed, 20 insertions(+), 56 deletions(-) diff --git a/src/sage/matrix/matrix0.pyx b/src/sage/matrix/matrix0.pyx index 83c0cc7235c..2b47bc3b57e 100644 --- a/src/sage/matrix/matrix0.pyx +++ b/src/sage/matrix/matrix0.pyx @@ -121,62 +121,6 @@ cdef class Matrix(sage.structure.element.Matrix): self._nrows = parent.nrows() self._ncols = parent.ncols() - def copy(self): - """ - Make a copy of self. If self is immutable, the copy will be - mutable. - - .. warning:: - - This method is deprecated and will be removed from a future - version of Sage. Please use the ``copy()`` function - instead. In other words, instead of doing ``m.copy()``, do ``copy(m)``. - - .. warning:: - - The individual elements aren't themselves copied (though - the list is copied). This shouldn't matter, since ring - elements are (almost!) always immutable in Sage. - - EXAMPLES: - - - The :meth:`.copy` method is deprecated. Instead, use the - :func:`copy` function:: - - sage: a = matrix([[1,2],[3,4]]) - sage: b = a.copy() - doctest:...: DeprecationWarning: the .copy() method is deprecated; please use the copy() function instead, for example, copy(M) - See http://trac.sagemath.org/6521 for details. - sage: b = copy(a) - - :: - - sage: R. = QQ['x'] - sage: a = matrix(R,2,[x+1,2/3, x^2/2, 1+x^3]); a - [ x + 1 2/3] - [1/2*x^2 x^3 + 1] - sage: b = copy(a) - sage: b[0,0] = 5 - sage: b - [ 5 2/3] - [1/2*x^2 x^3 + 1] - sage: a - [ x + 1 2/3] - [1/2*x^2 x^3 + 1] - - :: - - sage: b = copy(a) - sage: f = b[0,0]; f[0] = 10 - Traceback (most recent call last): - ... - IndexError: polynomials are immutable - """ - from sage.misc.superseded import deprecation - deprecation(6521, "the .copy() method is deprecated; please use the copy() function instead, for example, copy(M)") - return self.__copy__() - def list(self): """ List of the elements of self ordered by elements in each diff --git a/src/sage/matrix/matrix_generic_dense.pyx b/src/sage/matrix/matrix_generic_dense.pyx index 6deb97b32c7..5c3c4342a29 100644 --- a/src/sage/matrix/matrix_generic_dense.pyx +++ b/src/sage/matrix/matrix_generic_dense.pyx @@ -223,6 +223,26 @@ cdef class Matrix_generic_dense(matrix_dense.Matrix_dense): [0|1 2] [-+---] [3|4 5] + sage: R. = QQ['x'] + sage: a = matrix(R,2,[x+1,2/3, x^2/2, 1+x^3]); a + [ x + 1 2/3] + [1/2*x^2 x^3 + 1] + sage: b = copy(a) + sage: b[0,0] = 5 + sage: b + [ 5 2/3] + [1/2*x^2 x^3 + 1] + sage: a + [ x + 1 2/3] + [1/2*x^2 x^3 + 1] + + :: + + sage: b = copy(a) + sage: f = b[0,0]; f[0] = 10 + Traceback (most recent call last): + ... + IndexError: polynomials are immutable """ A = self.__class__(self._parent, self._entries, copy = True, coerce=False) if self._subdivisions is not None: From 54011d191d4c42af5a996439e0ad192e43a10751 Mon Sep 17 00:00:00 2001 From: Eviatar Bach Date: Wed, 28 Aug 2013 08:44:52 -0700 Subject: [PATCH 34/85] Trac #15118: ZeroDivisionError in MPF_pow not propagated in Cython mpmath --- src/sage/libs/mpmath/ext_impl.pxd | 2 +- src/sage/libs/mpmath/ext_impl.pyx | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/sage/libs/mpmath/ext_impl.pxd b/src/sage/libs/mpmath/ext_impl.pxd index aa9124468a3..0658b9a49dc 100644 --- a/src/sage/libs/mpmath/ext_impl.pxd +++ b/src/sage/libs/mpmath/ext_impl.pxd @@ -60,7 +60,7 @@ cdef MPF_set_ln2(MPF *x, MPopts opts) cdef MPF_cos(MPF *c, MPF *x, MPopts opts) cdef MPF_sin(MPF *c, MPF *x, MPopts opts) cdef MPF_cos_sin(MPF *c, MPF *s, MPF *x, MPopts opts) -cdef int MPF_pow(MPF *z, MPF *x, MPF *y, MPopts opts) +cdef int MPF_pow(MPF *z, MPF *x, MPF *y, MPopts opts) except -1 cdef MPF_complex_pow(MPF *zre, MPF *zim, MPF *xre, MPF *xim, MPF *yre, MPF *yim, MPopts opts) cdef MPF_hypsum(MPF *a, MPF *b, int p, int q, param_types, str ztype, coeffs, \ z, long prec, long wp, long epsshift, dict magnitude_check, kwargs) diff --git a/src/sage/libs/mpmath/ext_impl.pyx b/src/sage/libs/mpmath/ext_impl.pyx index e372d52f20f..269c59e74af 100644 --- a/src/sage/libs/mpmath/ext_impl.pyx +++ b/src/sage/libs/mpmath/ext_impl.pyx @@ -1,6 +1,20 @@ """ This module provides the core implementation of multiprecision floating-point arithmetic. Operations are done in-place. + +TESTS: + +See if :trac:`15118` is fixed:: + + sage: import mpmath + sage: mpmath.mpf(0)^(-2) + Traceback (most recent call last): + ... + ZeroDivisionError + sage: mpmath.zeta(2r, -3r) + Traceback (most recent call last): + ... + ZeroDivisionError """ include 'sage/ext/interrupt.pxi' @@ -1646,7 +1660,7 @@ cdef MPF_complex_exp(MPF *re, MPF *im, MPF *a, MPF *b, MPopts opts): MPF_clear(&c) MPF_clear(&s) -cdef int MPF_pow(MPF *z, MPF *x, MPF *y, MPopts opts): +cdef int MPF_pow(MPF *z, MPF *x, MPF *y, MPopts opts) except -1: """ Set z = x^y for real x and y and returns 0 if the result is real-valued. If the result is complex, does nothing and returns 1. From 178646f3e90dd0541f81a378066b63f3dd88bed3 Mon Sep 17 00:00:00 2001 From: darij grinberg Date: Wed, 4 Sep 2013 18:42:48 -0700 Subject: [PATCH 35/85] Trac #15157: fixes to Sym, mainly for degree_negation --- src/sage/combinat/sf/sfa.py | 82 ++++++++++++++++++++++++++----------- 1 file changed, 57 insertions(+), 25 deletions(-) diff --git a/src/sage/combinat/sf/sfa.py b/src/sage/combinat/sf/sfa.py index 842c3bfb40d..49222975f4e 100644 --- a/src/sage/combinat/sf/sfa.py +++ b/src/sage/combinat/sf/sfa.py @@ -799,9 +799,18 @@ def degree_negation(self, element): sage: f = 2*m[2,1] + 4*m[1,1] - 5*m[1] - 3*m[[]] sage: m.degree_negation(f) -3*m[] + 5*m[1] + 4*m[1, 1] - 2*m[2, 1] + + TESTS:: + + Using ``degree_negation`` on an element of a different basis + does not confuse Sage:: + + sage: e = Sym.elementary() + sage: m.degree_negation(e[3]) + -m[1, 1, 1] """ return self.sum_of_terms([ (lam, (-1)**(sum(lam)%2) * a) - for lam, a in element._monomial_coefficients.items() ]) + for lam, a in self(element) ]) def corresponding_basis_over(self, R): r""" @@ -1016,8 +1025,9 @@ def __getitem__(self, c, *rest): def _change_by_proportionality(self, x, function): r""" - Return the symmetric function obtained by scaling each basis - element corresponding to the partition `part` by ``function``(`part`). + Return the symmetric function obtained from ``x`` by scaling + each basis element corresponding to the partition `\lambda` by + ``function``(`\lambda`). INPUT: @@ -1053,7 +1063,10 @@ def _change_by_plethysm(self, x, expr, deg_one): - ``x` -- a symmetric function - ``expr`` -- an expression used in the plethysm - - ``deg_one`` -- specifies the degree one terms + - ``deg_one`` -- a list (or iterable) specifying the degree one + variables (that is, the terms to be treated as degree-one + elements when encountered in ``x``; they will be taken to the + appropriate powers when computing the plethysm) OUTPUT: @@ -2009,8 +2022,9 @@ def plethysm(self, x, include=None, exclude=None): (To compute outer plethysms over general binomial rings, change bases to the fraction field.) - By default, the degree one elements are the generators for the - ``self``'s base ring. + By default, the degree one elements are taken to be the + generators for the ``self``'s base ring. This setting can be + modified by specifying the ``include`` and ``exclude`` keywords. INPUT: @@ -2349,9 +2363,11 @@ def omega(self): def theta(self,a): r""" - Return the image of ``self`` under the theta automorphism which sends - `p[k]` to `a \cdot p[k]`. In general, this is well-defined outside - of the powersum basis only if the base ring is a `\QQ`-algebra. + Return the image of ``self`` under the theta endomorphism which sends + `p_k` to `a \cdot p_k` for every positive integer `k`. + + In general, this is well-defined outside of the powersum basis only + if the base ring is a `\QQ`-algebra. INPUT: @@ -2378,9 +2394,12 @@ def theta(self,a): def theta_qt(self,q=None,t=None): r""" Return the image of ``self`` under the `q,t`-deformed theta - automorphism which sends `p[k]` to `(1-q^k) / (1-t^k) \cdot p[k]` + endomorphism which sends `p_k` to `\frac{1-q^k}{1-t^k} \cdot p_k` for all positive integers `k`. + In general, this is well-defined outside of the powersum basis only + if the base ring is a `\QQ`-algebra. + INPUT: - ``q``, ``t`` -- parameters (default: ``None``, in which case 'q' @@ -2425,14 +2444,17 @@ def theta_qt(self,q=None,t=None): def omega_qt(self,q = None,t = None): r""" Return the image of ``self`` under the `q,t`-deformed omega - automorphism which sends `p[k]` to - `(-1)^{k-1} \cdot (1-q^k) / (1-t^k) \cdot p[k]` for all positive + automorphism which sends `p_k` to + `(-1)^{k-1} \cdot \frac{1-q^k}{1-t^k} \cdot p_k` for all positive integers `k`. + In general, this is well-defined outside of the powersum basis only + if the base ring is a `\QQ`-algebra. + INPUT: - - ``q``, ``t`` -- parameters (default: ``None``, in which case ``q`` - and ``t`` are used) + - ``q``, ``t`` -- parameters (default: ``None``, in which case + ``'q'`` and ``'t'`` are used) EXAMPLES:: @@ -2488,16 +2510,25 @@ def omega_qt(self,q = None,t = None): def itensor(self, x): r""" - Return the inner (tensor) product of ``self`` and ``x`` in the + Return the internal (tensor) product of ``self`` and ``x`` in the basis of ``self``. - The inner tensor product (also known as the Kronecker product, or as + The internal tensor product (also known as the Kronecker product, or as the second multiplication on the ring of symmetric functions) can be defined as the linear extension of the definition on power sums `p_{\lambda} \otimes p_{\mu} = \delta_{\lambda,\mu} z_{\lambda} p_{\lambda}`, where `z_{\lambda} = (1^{r_1} r_1!) (2^{r_2} r_2!) \cdots` for `\lambda = (1^{r_1} 2^{r_2} \cdots )`. + Note that the internal product of any two homogeneous symmetric + functions of equal degrees is a homogeneous symmetric function of the + same degree. On the other hand, the internal product of two homogeneous + symmetric functions of distinct degrees is `0`. + + The internal product is sometimes referred to as "inner product" in + the literature, but unfortunately this name is shared by a different + operation, namely the Hall inner product (see :meth:`scalar`). + INPUT: - ``x`` -- element of the ring of symmetric functions over the @@ -2505,11 +2536,11 @@ def itensor(self, x): OUTPUT: - - symmetric function which is of the same degree as ``self`` and ``x`` - if ``self`` and ``x`` have the same degree, and equals `0` if - they don't. + - the internal product of ``self`` with ``x`` (an element of the + ring of symmetric functions in the same basis as ``self``). - The methods :meth:`itensor`, :meth:`kronecker_product`, :meth:`inner_tensor` are all + The methods :meth:`itensor`, :meth:`internal_product`, + :meth:`kronecker_product`, :meth:`inner_tensor` are all synonyms. EXAMPLES:: @@ -2726,11 +2757,12 @@ def internal_coproduct(self): r""" Return the inner coproduct of ``self`` in the basis of ``self``. - The inner coproduct (also known as the Kronecker coproduct, or as the - second comultiplication on the ring of symmetric functions) is a ring - homomorphism `\Delta^\times` from the right of symmetric functions to - the tensor product (over the base ring) of this ring with itself. It - is uniquely characterized by the formula + The inner coproduct (also known as the Kronecker coproduct, as the + internal coproduct, or as the second comultiplication on the ring of + symmetric functions) is a ring homomorphism `\Delta^\times` from the + ring of symmetric functions to the tensor product (over the base + ring) of this ring with itself. It is uniquely characterized by the + formula .. MATH:: From 5079d9af6b71d57148a1df0103562144afc710ea Mon Sep 17 00:00:00 2001 From: Travis Scrimshaw Date: Fri, 6 Sep 2013 13:45:04 -0700 Subject: [PATCH 36/85] Trac #15157: review patch. --- src/sage/combinat/sf/sfa.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/sage/combinat/sf/sfa.py b/src/sage/combinat/sf/sfa.py index 49222975f4e..4c9e9fbcb14 100644 --- a/src/sage/combinat/sf/sfa.py +++ b/src/sage/combinat/sf/sfa.py @@ -800,14 +800,16 @@ def degree_negation(self, element): sage: m.degree_negation(f) -3*m[] + 5*m[1] + 4*m[1, 1] - 2*m[2, 1] - TESTS:: + TESTS: - Using ``degree_negation`` on an element of a different basis - does not confuse Sage:: + Using :meth:`degree_negation` on an element of a different + basis works correctly:: sage: e = Sym.elementary() sage: m.degree_negation(e[3]) -m[1, 1, 1] + sage: m.degree_negation(m(e[3])) + -m[1, 1, 1] """ return self.sum_of_terms([ (lam, (-1)**(sum(lam)%2) * a) for lam, a in self(element) ]) @@ -2525,9 +2527,12 @@ def itensor(self, x): same degree. On the other hand, the internal product of two homogeneous symmetric functions of distinct degrees is `0`. - The internal product is sometimes referred to as "inner product" in - the literature, but unfortunately this name is shared by a different - operation, namely the Hall inner product (see :meth:`scalar`). + .. NOTE:: + + The internal product is sometimes referred to as "inner product" + in the literature, but unfortunately this name is shared by a + different operation, namely the Hall inner product + (see :meth:`scalar`). INPUT: @@ -2537,7 +2542,7 @@ def itensor(self, x): OUTPUT: - the internal product of ``self`` with ``x`` (an element of the - ring of symmetric functions in the same basis as ``self``). + ring of symmetric functions in the same basis as ``self``) The methods :meth:`itensor`, :meth:`internal_product`, :meth:`kronecker_product`, :meth:`inner_tensor` are all From 1c66eae9d103512a9df171dd6b17edd691fa6dbc Mon Sep 17 00:00:00 2001 From: Rob Beezer Date: Fri, 23 Aug 2013 20:59:24 -0700 Subject: [PATCH 37/85] Trac #15089: Make GSL probability distribution seed effective --- src/sage/gsl/probability_distribution.pyx | 75 ++++++++++++++++++++--- 1 file changed, 68 insertions(+), 7 deletions(-) diff --git a/src/sage/gsl/probability_distribution.pyx b/src/sage/gsl/probability_distribution.pyx index cb7c5ee566b..d36db029b77 100644 --- a/src/sage/gsl/probability_distribution.pyx +++ b/src/sage/gsl/probability_distribution.pyx @@ -198,19 +198,37 @@ cdef class SphericalDistribution(ProbabilityDistribution): cdef double* vec def __init__(self, dimension=3, rng='default', seed=None): - """ + r""" EXAMPLES:: sage: T = SphericalDistribution() sage: T.get_random_element() # random (-0.872578667429, -0.29632873418, -0.388324285164) - """ + TESTS: + + Until :trac:`15089` a value of the ``seed`` keyword + besides ``None`` was ignored. We check here that setting + a seed is effective. :: + + sage: T = SphericalDistribution(seed=876) + sage: one = [T.get_random_element() for _ in range(10)] + sage: T = SphericalDistribution(seed=876) + sage: two = [T.get_random_element() for _ in range(10)] + sage: T = SphericalDistribution(seed=123) + sage: three = [T.get_random_element() for _ in range(10)] + sage: one == two + True + sage: one == three + False + """ gsl_rng_env_setup() self.set_random_number_generator(rng) self.r = gsl_rng_alloc(self.T) if seed == None: self.seed = random.randint(1, sys.maxint) + else: + self.seed = seed self.set_seed(self.seed) self.dimension = dimension self.vec = sage_malloc(self.dimension*(sizeof(double))) @@ -488,13 +506,29 @@ cdef class RealDistribution(ProbabilityDistribution): #cdef _get_random_element_c(self) def __init__(self, type = 'uniform', parameters = [], rng = 'default', seed = None): - """ + r""" EXAMPLES:: sage: T = RealDistribution('gaussian', 1, seed = 0) sage: T.get_random_element() 0.133918608119 + TESTS: + + Until :trac:`15089` a value of the ``seed`` keyword + besides ``None`` was ignored. We check here that setting + a seed is effective. :: + + sage: T = RealDistribution("beta",[1.6,4.3], seed=876) + sage: one = [T.get_random_element() for _ in range(10)] + sage: T = RealDistribution("beta",[1.6,4.3], seed=876) + sage: two = [T.get_random_element() for _ in range(10)] + sage: T = RealDistribution("beta",[1.6,4.3], seed=123) + sage: three = [T.get_random_element() for _ in range(10)] + sage: one == two + True + sage: one == three + False """ gsl_rng_env_setup() @@ -503,6 +537,8 @@ cdef class RealDistribution(ProbabilityDistribution): self.r = gsl_rng_alloc(self.T) if seed == None: self.seed = random.randint(1, sys.maxint) + else: + self.seed = seed self.set_seed(self.seed) self.name = " " self.set_distribution(type, parameters) @@ -748,10 +784,16 @@ cdef class RealDistribution(ProbabilityDistribution): sage: T = RealDistribution('gaussian', 1, seed = 10) sage: [T.get_random_element() for _ in range(10)] - [0.133918608119, -0.0881009918314, 1.67440840625, 0.733641107293, 0.997524631602, -1.277502081, -2.39671528273, -0.679280164729, -0.0390913184336, 0.893555545521] + [-0.746099959575, -0.00464460662641, -0.872053831721, + 0.691625992167, 2.67668674666, 0.632500281366, + -0.797426352196, -0.528497689337, 1.13531198495, + 0.991250567323] sage: T.reset_distribution() sage: [T.get_random_element() for _ in range(10)] - [0.133918608119, -0.0881009918314, 1.67440840625, 0.733641107293, 0.997524631602, -1.277502081, -2.39671528273, -0.679280164729, -0.0390913184336, 0.893555545521] + [-0.746099959575, -0.00464460662641, -0.872053831721, + 0.691625992167, 2.67668674666, 0.632500281366, + -0.797426352196, -0.528497689337, 1.13531198495, + 0.991250567323] """ if self.r != NULL: @@ -964,7 +1006,7 @@ cdef class GeneralDiscreteDistribution(ProbabilityDistribution): cdef long seed def __init__(self, P, rng = 'default', seed = None): - """ + r""" Given a list of probabilities P construct an instance of a gsl discrete random variable generator. @@ -973,13 +1015,32 @@ cdef class GeneralDiscreteDistribution(ProbabilityDistribution): sage: P = [0.3, 0.4, 0.3] sage: X = GeneralDiscreteDistribution(P) sage: assert X.get_random_element() in range(len(P)) - """ + TESTS: + + Until :trac:`15089` a value of the ``seed`` keyword + besides ``None`` was ignored. We check here that setting + a seed is effective. :: + + sage: P = [0.2, 0.3, 0.1, 0.4] + sage: T = GeneralDiscreteDistribution(P, seed=876) + sage: one = [T.get_random_element() for _ in range(50)] + sage: T = GeneralDiscreteDistribution(P, seed=876) + sage: two = [T.get_random_element() for _ in range(50)] + sage: T = GeneralDiscreteDistribution(P, seed=123) + sage: three = [T.get_random_element() for _ in range(50)] + sage: one == two + True + sage: one == three + False + """ gsl_rng_env_setup() self.set_random_number_generator(rng) self.r = gsl_rng_alloc(self.T) if seed == None: self.seed = random.randint(1, sys.maxint) + else: + self.seed = seed self.set_seed(self.seed) cdef int n From ac709d4192c65d9e1eb0d00817a1e9473e5571ae Mon Sep 17 00:00:00 2001 From: Paul Zimmermann Date: Sun, 25 Aug 2013 10:12:53 +0200 Subject: [PATCH 38/85] Trac #15093: typo in kronecker_delta documentation --- src/sage/functions/generalized.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/functions/generalized.py b/src/sage/functions/generalized.py index 66deaca4ba4..af8dcb38f6f 100644 --- a/src/sage/functions/generalized.py +++ b/src/sage/functions/generalized.py @@ -571,7 +571,7 @@ def _eval_(self, m, n): 1 Kronecker delta is a symmetric function. We keep arguments sorted to - ensure that (k_d(m, n) - k_d(n, m) cancels automatically:: + ensure that k_d(m, n) - k_d(n, m) cancels automatically:: sage: x,y=var('x,y') sage: kronecker_delta(x, y) From 6764544709aedd3b3c38008da74d2b320a62cd4d Mon Sep 17 00:00:00 2001 From: darij grinberg Date: Wed, 11 Sep 2013 17:48:41 -0700 Subject: [PATCH 39/85] Trac #15186: empty set composition --- src/sage/combinat/set_partition_ordered.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/sage/combinat/set_partition_ordered.py b/src/sage/combinat/set_partition_ordered.py index 4b9e01bd0fc..cdb9ce477e6 100644 --- a/src/sage/combinat/set_partition_ordered.py +++ b/src/sage/combinat/set_partition_ordered.py @@ -124,8 +124,10 @@ def __classcall_private__(cls, parts): [{2, 4}, {1, 3}] sage: s != t True + sage: OrderedSetPartition([]) + [] """ - P = OrderedSetPartitions( reduce(lambda x,y: x.union(y), map(Set, parts)) ) + P = OrderedSetPartitions( reduce(lambda x,y: x.union(y), map(Set, parts), Set([])) ) return P.element_class(P, parts) def __init__(self, parent, s): From 1ee24884fa78e5676ba6348b475a3fe794f85d0a Mon Sep 17 00:00:00 2001 From: CETHop Date: Tue, 27 Aug 2013 22:15:05 +0200 Subject: [PATCH 40/85] Trac #6667: Newton polygons of p-adic polynomials --- src/sage/geometry/newton_polygon.py | 33 +++- .../polynomial_padic_capped_relative_dense.py | 143 +++++++++++------- 2 files changed, 119 insertions(+), 57 deletions(-) diff --git a/src/sage/geometry/newton_polygon.py b/src/sage/geometry/newton_polygon.py index 9534da7340e..1ba987fb4b6 100644 --- a/src/sage/geometry/newton_polygon.py +++ b/src/sage/geometry/newton_polygon.py @@ -16,10 +16,8 @@ from sage.structure.parent import Parent from sage.structure.element import Element from sage.misc.cachefunc import cached_method -from sage.structure.misc import getattr_from_other_class from sage.rings.infinity import Infinity -from sage.rings.integer_ring import ZZ from sage.geometry.polyhedron.constructor import Polyhedron from sage.geometry.polyhedron.base import is_Polyhedron @@ -579,6 +577,12 @@ class ParentNewtonPolygon(Parent, UniqueRepresentation): The corresponding Newton polygon. + .. note:: + + By convention, a Newton polygon always contains the point + at infinity `(0, \infty)`. These polygons are attached to + polynomials or series over discrete valuation rings (e.g. padics). + EXAMPLES: We specify here a Newton polygon by its vertices:: @@ -593,6 +597,12 @@ class ParentNewtonPolygon(Parent, UniqueRepresentation): sage: NewtonPolygon([ (0,0), (1,1), (2,8), (3,5) ]) Finite Newton polygon with 3 vertices: (0, 0), (1, 1), (3, 5) + Note that the value ``+Infinity`` is allowed as the second coordinate + of a vertex:: + + sage: NewtonPolygon([ (0,0), (1,Infinity), (2,8), (3,5) ]) + Finite Newton polygon with 2 vertices: (0, 0), (3, 5) + If last_slope is set, the returned Newton polygon is infinite and ends with an infinite line having the specified slope:: @@ -632,6 +642,21 @@ class ParentNewtonPolygon(Parent, UniqueRepresentation): Infinite Newton polygon with 3 vertices: (0, 0), (1, 0), (3, 1) ending by an infinite line of slope 2/3 sage: NP.slopes() [0, 1/2, 1/2] + + :: + + Be careful, do not confuse Newton polygons provided by this class + with Newton polytopes. Compare:: + + sage: NP = NewtonPolygon([ (0,0), (1,45), (3,6) ]); NP + Finite Newton polygon with 2 vertices: (0, 0), (3, 6) + + sage: x, y = polygen(QQ,'x, y') + sage: p = 1 + x*y**45 + x**3*y**6 + sage: p.newton_polytope() + A 2-dimensional polyhedron in ZZ^2 defined as the convex hull of 3 vertices + sage: p.newton_polytope().vertices() + (A vertex at (0, 0), A vertex at (1, 45), A vertex at (3, 6)) """ Element = NewtonPolygon_element @@ -743,7 +768,7 @@ def _element_constructor_(self, arg, sort_slopes=True, last_slope=Infinity): if len(arg) > 0 and arg[0] in self.base_ring(): if sort_slopes: arg.sort() x = y = 0 - vertices = [ (x,y) ] + vertices = [(x, y)] for slope in arg: if not slope in self.base_ring(): raise TypeError("argument must be a list of coordinates or a list of (rational) slopes") @@ -751,7 +776,7 @@ def _element_constructor_(self, arg, sort_slopes=True, last_slope=Infinity): y += slope vertices.append((x,y)) else: - vertices = arg + vertices = [(x, y) for (x, y) in arg if y is not Infinity] if len(vertices) == 0: polyhedron = Polyhedron(base_ring=self.base_ring(), ambient_dim=2) else: diff --git a/src/sage/rings/polynomial/padics/polynomial_padic_capped_relative_dense.py b/src/sage/rings/polynomial/padics/polynomial_padic_capped_relative_dense.py index 0aa14f258ad..d9dd294dc96 100644 --- a/src/sage/rings/polynomial/padics/polynomial_padic_capped_relative_dense.py +++ b/src/sage/rings/polynomial/padics/polynomial_padic_capped_relative_dense.py @@ -1003,73 +1003,110 @@ def disc(self): #def resultant(self): # raise NotImplementedError - def newton_slopes(self): - """ - Returns a list of the Newton slopes of this polynomial. These are the valuations of the roots of this polynomial. + def newton_polygon(self): + r""" + Returns the Newton polygon of this polynomial. + + .. NOTE:: + + If some coefficients have not enough precision an error is raised. + + OUTPUT: + + - a Newton polygon EXAMPLES:: - sage: K = Qp(13) + sage: K = Qp(2, prec=5) + sage: P. = K[] + sage: f = x^4 + 2^3*x^3 + 2^13*x^2 + 2^21*x + 2^37 + sage: f.newton_polygon() + Finite Newton polygon with 4 vertices: (0, 37), (1, 21), (3, 3), (4, 0) + + sage: K = Qp(5) sage: R. = K[] - sage: f = t^4 + 13^5*t^2 + 4*13^2*t - 13^7 + sage: f = 5 + 3*t + t^4 + 25*t^10 sage: f.newton_polygon() - [(0, 7), (1, 2), (4, 0)] - sage: f.newton_slopes() - [5, 2/3, 2/3, 2/3] + Finite Newton polygon with 4 vertices: (0, 1), (1, 0), (4, 0), (10, 2) + + Here is an example where the computation fails because precision is + not sufficient:: + + sage: g = f + K(0,0)*t^4; g + (5^2 + O(5^22))*t^10 + (O(5^0))*t^4 + (3 + O(5^20))*t + (5 + O(5^21)) + sage: g.newton_polygon() + Traceback (most recent call last): + ... + PrecisionError: The coefficient of t^4 has not enough precision + + TESTS: + + sage: (5*f).newton_polygon() + Finite Newton polygon with 4 vertices: (0, 2), (1, 1), (4, 1), (10, 3) + + AUTHOR: + + - Xavier Caruso (2013-03-20) """ - polygon = self.newton_polygon() - if polygon == []: - return [] - answer = [infinity] * polygon[0][0] - for m in range(1, len(polygon)): - dx = polygon[m][0] - polygon[m - 1][0] - dy = polygon[m][1] - polygon[m - 1][1] - answer.extend([-dy / dx] * dx) - return answer + if self._valaddeds is None: + self._comp_valaddeds() + from sage.geometry.newton_polygon import NewtonPolygon + valbase = self._valbase + polygon = NewtonPolygon([(x, val + valbase) + for x, val in enumerate(self._valaddeds)]) + polygon_prec = NewtonPolygon([(x, val + valbase) + for x, val in enumerate(self._relprecs)]) + vertices = polygon.vertices(copy=False) + vertices_prec = polygon_prec.vertices(copy=False) + + # The two following tests should always fail (i.e. the corresponding errors + # should never be raised). However, it's probably safer to keep them. + if vertices[0][0] > vertices_prec[0][0]: + raise PrecisionError("The constant coefficient has not enough precision") + if vertices[-1][0] < vertices_prec[-1][0]: + raise PrecisionError("The leading coefficient has not enough precision") + + for (x, y) in vertices: + if polygon_prec(x) <= y: + raise PrecisionError("The coefficient of %s^%s has not enough precision" % (self.parent().variable_name(), x)) + return polygon + + def newton_slopes(self, repetition=True): + """ + Returns a list of the Newton slopes of this polynomial. - def newton_polygon(self): - r""" - Returns a list of vertices of the Newton polygon of this polynomial. + These are the valuations of the roots of this polynomial. + + If ``repetition`` is ``True``, each slope is repeated a number of + times equal to its multiplicity. Otherwise it appears only one time. + + INPUT: + + - ``repetition`` -- boolean (default ``True``) + + OUTPUT: - NOTES: - The vertices are listed so that the first coordinates are strictly increasing, up to the polynomial's degree (not the limit of available precision information). Also note that if some coefficients have very low precision an error is raised. + - a list of rationals EXAMPLES:: - sage: K = Qp(13) + sage: K = Qp(5) sage: R. = K[] - sage: f = t^4 + 13^5*t^2 + 4*13^2*t - 13^7 + sage: f = 5 + 3*t + t^4 + 25*t^10 sage: f.newton_polygon() - [(0, 7), (1, 2), (4, 0)] + Finite Newton polygon with 4 vertices: (0, 1), (1, 0), (4, 0), (10, 2) + sage: f.newton_slopes() + [1, 0, 0, 0, -1/3, -1/3, -1/3, -1/3, -1/3, -1/3] + + sage: f.newton_slopes(repetition=False) + [1, 0, -1/3] + + AUTHOR: + + - Xavier Caruso (2013-03-20) """ - if self._poly == 0: - return [] - for x in range(len(self._relprecs)): - if not self._relprecs[x] is infinity: - break - if self._valaddeds is None: - self._comp_valaddeds() - if self._poly[x] == 0: - raise PrecisionError, "first term with non-infinite valuation must have determined valuation" - yrel = self._valaddeds[x] - answer = [(x, self._valbase + yrel)] - xf = self._poly.degree() - if xf == x: - return answer - yfrel = self._valaddeds[xf] - curslope = (yfrel - yrel) / (xf - x) - for i in range(x + 1, xf): - yrel += curslope - if self._valaddeds[i] < yrel: - if self._relprecs[i] == self._valaddeds[i]: - raise PrecisionError, "not enough precision known in coefficient %s to compute newton polygon"%i - yrel = self._valaddeds[i] - answer.append((i, self._valbase + yrel)) - curslope = (yfrel - yrel) / (xf - i) - from sage.misc.stopgap import stopgap - stopgap("Check that the Newton polygon below is actually convex.", 6667) - answer.append((xf, self._valbase + self._valaddeds[xf])) - return answer + polygon = self.newton_polygon() + return [-s for s in polygon.slopes(repetition=repetition)] def hensel_lift(self, a): raise NotImplementedError From fbe5b5efd2e2b943cda228d31994c0a912ccab50 Mon Sep 17 00:00:00 2001 From: Nathann Cohen Date: Fri, 5 Jul 2013 15:34:56 +0200 Subject: [PATCH 41/85] Trac #14856: Bug in GenericGraph.vertex_connectivity when the digraph is a tournament --- src/sage/graphs/base/c_graph.pyx | 14 +++++++++---- src/sage/graphs/generic_graph.py | 34 +++++++++++++++++++------------- 2 files changed, 30 insertions(+), 18 deletions(-) diff --git a/src/sage/graphs/base/c_graph.pyx b/src/sage/graphs/base/c_graph.pyx index 4e658820cb0..91557088cbe 100644 --- a/src/sage/graphs/base/c_graph.pyx +++ b/src/sage/graphs/base/c_graph.pyx @@ -2656,16 +2656,22 @@ class CGraphBackend(GenericGraphBackend): False A graph with non-integer vertex labels:: + sage: Graph(graphs.CubeGraph(3), implementation='c_graph').is_connected() True """ - cdef int v_int = 0 - v_int = bitset_first((self._cg).active_vertices) + cdef int v_int + cdef CGraph cg = self._cg + + if cg.num_edges() < cg.num_verts - 1: + return False + + v_int = bitset_first(cg.active_vertices) if v_int == -1: return True - v = vertex_label(v_int, self.vertex_ints, self.vertex_labels, self._cg) - return len(list(self.depth_first_search(v, ignore_direction=True))) == (self._cg).num_verts + v = vertex_label(v_int, self.vertex_ints, self.vertex_labels, cg) + return len(list(self.depth_first_search(v, ignore_direction=True))) == cg.num_verts def is_strongly_connected(self): r""" diff --git a/src/sage/graphs/generic_graph.py b/src/sage/graphs/generic_graph.py index 88b449a1ae2..65a5d22685b 100644 --- a/src/sage/graphs/generic_graph.py +++ b/src/sage/graphs/generic_graph.py @@ -7617,38 +7617,49 @@ def vertex_connectivity(self, value_only=True, sets=False, solver=None, verbose= When ``value_only = True``, this function is optimized for small connectivity values and does not need to build a linear program. - It is the case for connected graphs which are not - connected:: + It is the case for connected graphs which are not connected:: sage: g = 2 * graphs.PetersenGraph() sage: g.vertex_connectivity() - 0.0 + 0 Or if they are just 1-connected:: sage: g = graphs.PathGraph(10) sage: g.vertex_connectivity() - 1.0 + 1 For directed graphs, the strong connectivity is tested through the dedicated function:: sage: g = digraphs.ButterflyGraph(3) sage: g.vertex_connectivity() - 0.0 + 0 A complete graph on `10` vertices is `9`-connected:: sage: g = graphs.CompleteGraph(10) sage: g.vertex_connectivity() 9 + + A complete digraph on `10` vertices is `9`-connected:: + + sage: g = DiGraph(graphs.CompleteGraph(10)) + sage: g.vertex_connectivity() + 9 """ g=self if sets: value_only=False - if g.is_clique(): + # When the graph is complete, the MILP below is infeasible. + if ((not g.is_directed() and g.is_clique()) + or + (g.is_directed() and g.size() >= (g.order()-1)*g.order() and + ((not g.allows_loops() and not g.allows_multiple_edges()) + or + all(g.has_edge(u,v) for u in g for v in g if v != u)))): if value_only: return g.order()-1 elif not sets: @@ -7659,15 +7670,14 @@ def vertex_connectivity(self, value_only=True, sets=False, solver=None, verbose= if value_only: if self.is_directed(): if not self.is_strongly_connected(): - return 0.0 + return 0 else: if not self.is_connected(): - return 0.0 + return 0 if len(self.blocks_and_cut_vertices()[0]) > 1: - return 1.0 - + return 1 if g.is_directed(): reorder_edge = lambda x,y : (x,y) @@ -7704,7 +7714,6 @@ def vertex_connectivity(self, value_only=True, sets=False, solver=None, verbose= p.add_constraint(in_set[0][u]+in_set[2][v],max=1) p.add_constraint(in_set[2][u]+in_set[0][v],max=1) - p.set_binary(in_set) p.set_objective(p.sum([in_set[1][v] for v in g])) @@ -7716,7 +7725,6 @@ def vertex_connectivity(self, value_only=True, sets=False, solver=None, verbose= in_set = p.get_values(in_set) - cut = [] a = [] b = [] @@ -7729,7 +7737,6 @@ def vertex_connectivity(self, value_only=True, sets=False, solver=None, verbose= else: b.append(v) - val.append(cut) if sets: @@ -7737,7 +7744,6 @@ def vertex_connectivity(self, value_only=True, sets=False, solver=None, verbose= return val - ### Vertex handlers def add_vertex(self, name=None): From 0628ee3b65e6195df2195c98b1df4c3767fcaad9 Mon Sep 17 00:00:00 2001 From: Marc Mezzarobba Date: Sat, 22 Jun 2013 13:10:26 +0200 Subject: [PATCH 42/85] Fix two small issues with make micro_release - |& is a bash4-ism - the filtering of error messages does not work in non-English locales --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 6ac2e342745..7570edd86c0 100644 --- a/Makefile +++ b/Makefile @@ -94,7 +94,7 @@ distclean: clean doc-clean lib-clean bdist-clean micro_release: bdist-clean lib-clean @echo "Stripping binaries ..." - find local/lib local/bin -type f -exec strip '{}' ';' |& grep -v "File format not recognized" | grep -v "File truncated" || true + LC_ALL=C find local/lib local/bin -type f -exec strip '{}' ';' 2>&1 | grep -v "File format not recognized" | grep -v "File truncated" || true TESTPRELIMS = local/bin/sage-starts TESTALL = ./sage -t --all From e794b82d03dc11a221498805927e6d99aed0301b Mon Sep 17 00:00:00 2001 From: Nathann Cohen Date: Thu, 29 Aug 2013 15:02:28 +0200 Subject: [PATCH 43/85] Trac #14619: Test if a graph is distance-regular -- reviewer's remarks --- src/sage/graphs/distances_all_pairs.pyx | 54 ++++++++++++++++--------- 1 file changed, 34 insertions(+), 20 deletions(-) diff --git a/src/sage/graphs/distances_all_pairs.pyx b/src/sage/graphs/distances_all_pairs.pyx index 5784c51a902..5458085cbe8 100644 --- a/src/sage/graphs/distances_all_pairs.pyx +++ b/src/sage/graphs/distances_all_pairs.pyx @@ -164,13 +164,13 @@ cdef inline all_pairs_shortest_path_BFS(gg, # The list of waiting vertices, the beginning and the end of the list cdef unsigned short * waiting_list = sage_malloc(n*sizeof(unsigned short)) - if waiting_list==NULL: + if waiting_list == NULL: raise MemoryError() cdef unsigned short waiting_beginning = 0 cdef unsigned short waiting_end = 0 cdef int * degree = sage_malloc(n*sizeof(int)) - if degree==NULL: + if degree == NULL: sage_free(waiting_list) raise MemoryError() @@ -193,7 +193,7 @@ cdef inline all_pairs_shortest_path_BFS(gg, c_distances = distances else: c_distances = sage_malloc( n * sizeof(unsigned short)) - if c_distances==NULL: + if c_distances == NULL: sage_free(waiting_list) sage_free(degree) raise MemoryError() @@ -309,10 +309,10 @@ cdef unsigned short * c_shortest_path_all_pairs(G) except NULL: cdef unsigned int n = G.order() cdef unsigned short * distances = sage_malloc(n*n*sizeof(unsigned short)) - if distances==NULL: + if distances == NULL: raise MemoryError() cdef unsigned short * predecessors = sage_malloc(n*n*sizeof(unsigned short)) - if predecessors==NULL: + if predecessors == NULL: sage_free(distances) raise MemoryError() all_pairs_shortest_path_BFS(G, predecessors, distances, NULL) @@ -401,7 +401,7 @@ cdef unsigned short * c_distances_all_pairs(G): cdef unsigned int n = G.order() cdef unsigned short * distances = sage_malloc(n*n*sizeof(unsigned short)) - if distances==NULL: + if distances == NULL: raise MemoryError() all_pairs_shortest_path_BFS(G, NULL, distances, NULL) @@ -468,7 +468,9 @@ def is_distance_regular(G, parameters = False): Tests if the graph is distance-regular A graph `G` is distance-regular if there exist integers `d_1,...,d_n` such - that for every vertex `v\in G` we have `d_i=\#\{u:d_G(u,v) =i\}`. + that for every vertex `v\in G` we have `d_i=\#\{u:d_G(u,v) =i\}`. Thus a + strongly-regular graph is also distance-regular, and a distance-regular + graph is necessarily regular too. For more information on distance-regular graphs, see its associated :wikipedia:`wikipedia page `. @@ -480,6 +482,11 @@ def is_distance_regular(G, parameters = False): obtain `d_i` by doing ``dictionary.get(i,0)``). Set to ``False`` by default. + .. SEEALSO:: + + * :meth:`Graph.is_regular` + * :meth:`Graph.is_strongly_regular` + EXAMPLES:: sage: g = graphs.PetersenGraph() @@ -488,16 +495,21 @@ def is_distance_regular(G, parameters = False): sage: g.is_distance_regular(parameters = True) {1: 3, 2: 6} - Cube graphs, which are not strongly regular, are a bit more interesting;; + Cube graphs, which are not strongly regular, are a bit more interesting:: sage: graphs.CubeGraph(4).is_distance_regular(parameters = True) {1: 4, 2: 6, 3: 4, 4: 1} + TESTS:: + + sage: graphs.PathGraph(2).is_distance_regular(parameters = True) + {1: 1} + """ cdef int i,l cdef int n = G.order() - if n <= 2: + if n <= 1: return {} if parameters else True if not G.is_regular(): @@ -512,14 +524,15 @@ def is_distance_regular(G, parameters = False): cdef unsigned short * d_array = sage_calloc(2*n, sizeof(unsigned short)) cdef unsigned short * d_tmp = d_array + n - if d_array==NULL: + if d_array == NULL: sage_free(distance_matrix) raise MemoryError() # Filling d_array cdef unsigned short * pointer = distance_matrix for i in range(n): - d_array[pointer[i]] += 1 + if pointer[i] < n: + d_array[pointer[i]] += 1 pointer += n # For each of the n-1 other vertices @@ -528,7 +541,8 @@ def is_distance_regular(G, parameters = False): # We set d_tmp and fill it with the data from the l^th row memset(d_tmp, 0, n*sizeof(unsigned short)) for i in range(n): - d_tmp[pointer[i]] += 1 + if pointer[i] < n: + d_tmp[pointer[i]] += 1 # If d_tmp != d_array, we are done if memcmp(d_array, d_tmp, n*sizeof(unsigned short)) != 0: @@ -607,11 +621,11 @@ def distances_and_predecessors_all_pairs(G): return {}, {} cdef unsigned short * distances = sage_malloc(n*n*sizeof(unsigned short)) - if distances==NULL: + if distances == NULL: raise MemoryError() cdef unsigned short * c_distances = distances cdef unsigned short * predecessor = sage_malloc(n*n*sizeof(unsigned short)) - if predecessor==NULL: + if predecessor == NULL: sage_free(distances) raise MemoryError() cdef unsigned short * c_predecessor = predecessor @@ -667,10 +681,10 @@ cdef unsigned short * c_eccentricity(G) except NULL: cdef unsigned int n = G.order() cdef unsigned short * ecc = sage_malloc(n*sizeof(unsigned short)) - if ecc==NULL: + if ecc == NULL: raise MemoryError() cdef unsigned short * distances = sage_malloc(n*n*sizeof(unsigned short)) - if distances==NULL: + if distances == NULL: sage_free(ecc) raise MemoryError() all_pairs_shortest_path_BFS(G, NULL, distances, ecc) @@ -992,10 +1006,10 @@ def floyd_warshall(gg, paths = True, distances = False): # init dist t_dist = sage_malloc(n*n*sizeof(unsigned short)) - if t_dist==NULL: + if t_dist == NULL: raise MemoryError() dist = sage_malloc(n*sizeof(unsigned short *)) - if dist==NULL: + if dist == NULL: sage_free(t_dist) raise MemoryError() dist[0] = t_dist @@ -1011,12 +1025,12 @@ def floyd_warshall(gg, paths = True, distances = False): if paths: # init prec t_prec = sage_malloc(n*n*sizeof(unsigned short)) - if t_prec==NULL: + if t_prec == NULL: sage_free(t_dist) sage_free(dist) raise MemoryError() prec = sage_malloc(n*sizeof(unsigned short *)) - if prec==NULL: + if prec == NULL: sage_free(t_dist) sage_free(dist) sage_free(t_prec) From cb556eccd5a5ea41927129291d6d56a0524dd294 Mon Sep 17 00:00:00 2001 From: Paul Zimmermann Date: Fri, 23 Aug 2013 13:34:59 +0200 Subject: [PATCH 44/85] =?UTF-8?q?Trac=20#14321:=20More=20doctests=20from?= =?UTF-8?q?=20the=20book=20"Calcul=20math=C3=A9matique=20avec=20Sage"=20(C?= =?UTF-8?q?hapter=20"linsolve")?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tests/french_book/linsolve_doctest.py | 216 ++++++++++++++++++ 1 file changed, 216 insertions(+) create mode 100644 src/sage/tests/french_book/linsolve_doctest.py diff --git a/src/sage/tests/french_book/linsolve_doctest.py b/src/sage/tests/french_book/linsolve_doctest.py new file mode 100644 index 00000000000..ca209d4ae0a --- /dev/null +++ b/src/sage/tests/french_book/linsolve_doctest.py @@ -0,0 +1,216 @@ +## -*- encoding: utf-8 -*- +""" +This file (./linsolve_doctest.sage) was *autogenerated* from ./linsolve.tex, +with sagetex.sty version 2011/05/27 v2.3.1. +It contains the contents of all the sageexample environments from this file. +You should be able to doctest this file with: +sage -t ./linsolve_doctest.sage +It is always safe to delete this file; it is not used in typesetting your +document. + +Sage example in ./linsolve.tex, line 235:: + + sage: def cond_hilbert(n): + ....: A = matrix(QQ, [[1/(i+j-1) for j in [1..n]] for i in [1..n]]) + ....: return A.norm(Infinity) * (A^-1).norm(Infinity) + +Sage example in ./linsolve.tex, line 269:: + + sage: n = 8 + sage: x = vector(QQ,[1 for i in range(0,n)]) + sage: A = matrix(QQ, [[1/(i+j-1) for j in [1..n]] for i in [1..n]]) + sage: y = A*x + sage: A[n-1,n-1] = (1/(2*n-1))*(1+1/(10^5)) # perturbe la matrice + sage: sol = A\y + sage: diff = max(float(sol[i]-x[i]) for i in range(0,n)) + +Sage example in ./linsolve.tex, line 313:: + + sage: n = 8 + sage: A = matrix(RR, [[1/(i+j-1) for j in [1..n]] for i in [1..n]]) + sage: x = vector(RR, [1 for i in range(0,n)]) + sage: y = A*x + sage: s = A.solve_right(y) + sage: diff = [float(s[i]-x[i]) for i in range(0,n)] + +Sage example in ./linsolve.tex, line 422:: + + sage: n = 20; cout = (n+1)*factorial(n); cout + 51090942171709440000 + +Sage example in ./linsolve.tex, line 433:: + + sage: v = 3*10^9 + sage: print "%3.3f"%float(cout/v/3600/24/365) + 540.028 + +Sage example in ./linsolve.tex, line 502:: + + sage: A = matrix(RDF, [[-1,2],[3,4]]) + sage: b = vector(RDF, [2,3]) + sage: x = A\b; x + (-0.2, 0.9) + +Sage example in ./linsolve.tex, line 512:: + + sage: x = A.solve_right(b) + +Sage example in ./linsolve.tex, line 520:: + + sage: A = matrix(RDF, [[-1,2],[3,4]]) + sage: P, L, U = A.LU() + +Sage example in ./linsolve.tex, line 561:: + + sage: A = random_matrix(RDF, 1000) + sage: b = vector(RDF, range(1000)) + +Sage example in ./linsolve.tex, line 600:: + + sage: m = random_matrix(RDF, 10) + sage: A = transpose(m)*m + sage: C = A.cholesky() + +Sage example in ./linsolve.tex, line 655:: + + sage: A = random_matrix(RDF,6,5) + sage: Q, R = A.QR() + +Sage example in ./linsolve.tex, line 786:: + + sage: A = matrix(RDF, [[1,3,2],[1,4,2],[0,5,2],[1,3,2]]) + sage: b = vector(RDF, [1,2,3,4]) + sage: Z = transpose(A)*A + sage: C = Z.cholesky() + sage: R = transpose(A)*b + sage: Z.solve_right(R) + (-1.5, -0.5, 2.75) + +Sage example in ./linsolve.tex, line 822:: + + sage: A = matrix(RDF, [[1,3,2],[1,4,2],[0,5,2],[1,3,2]]) + sage: b = vector(RDF, [1,2,3,4]) + sage: Q, R = A.QR() + sage: R1 = R[0:3,0:3] + sage: b1 = transpose(Q)*b + sage: c = b1[0:3] + sage: R1.solve_right(c) + (-1.5, -0.5, 2.75) + +Sage example in ./linsolve.tex, line 834:: + + sage: Z = A.transpose()*A + sage: Z.norm(Infinity)*(Z^-1).norm(Infinity) + 1992.375 + +Sage example in ./linsolve.tex, line 876:: + + sage: A = matrix(RDF, [[1,3,2],[1,3,2],[0,5,2],[1,3,2]]) + sage: b = vector(RDF, [1,2,3,4]) + sage: U, Sig, V = A.SVD() + sage: m = A.ncols() + sage: x = vector(RDF, [0]*m) + sage: lamb = vector(RDF, [0]*m) + sage: for i in range(0,m): + ....: s = Sig[i,i] + ....: if s < 1e-12: + ....: break + ....: lamb[i] = U.column(i)*b / s + sage: x = V*lamb; x + (0.237037037037, 0.451851851852, 0.37037037037) + +Sage example in ./linsolve.tex, line 968:: + + sage: A = matrix(RDF, [[1,2],[3,4],[5,6],[7,8]]) + +Sage example in ./linsolve.tex, line 974:: + + sage: th = 0.7 + sage: R = matrix(RDF, [[cos(th),sin(th)],[-sin(th),cos(th)]]) + sage: B = (A + 0.1*random_matrix(RDF,4,2)) * transpose(R) + +Sage example in ./linsolve.tex, line 1189:: + + sage: A = matrix(RDF, [[1,3,2],[1,2,3],[0,5,2]]) + +Sage example in ./linsolve.tex, line 1382:: + + sage: def pol2companion(p): + ....: n = len(p) + ....: m = matrix(RDF,n) + ....: for i in range(1,n): + ....: m[i,i-1]=1 + ....: for i in range(0,n): + ....: m[i,n-1]=-p[i] + ....: return m + +Sage example in ./linsolve.tex, line 1392:: + + sage: q = [1,-1,2,3,5,-1,10,11] + sage: comp = pol2companion(q); comp + [ 0.0 0.0 0.0 0.0 0.0 0.0 0.0 -1.0] + [ 1.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0] + [ 0.0 1.0 0.0 0.0 0.0 0.0 0.0 -2.0] + [ 0.0 0.0 1.0 0.0 0.0 0.0 0.0 -3.0] + [ 0.0 0.0 0.0 1.0 0.0 0.0 0.0 -5.0] + [ 0.0 0.0 0.0 0.0 1.0 0.0 0.0 1.0] + [ 0.0 0.0 0.0 0.0 0.0 1.0 0.0 -10.0] + [ 0.0 0.0 0.0 0.0 0.0 0.0 1.0 -11.0] + sage: racines = comp.eigenvalues(); racines + [0.347521510119 + 0.566550553398*I, 0.347521510119 - 0.566550553398*I, + 0.345023776962 + 0.439908702386*I, 0.345023776962 - 0.439908702386*I, + -0.517257614325 + 0.512958206789*I, -0.517257614325 - + 0.512958206789*I, -1.36699716455, -9.98357818097] + +Sage example in ./linsolve.tex, line 1515:: + + sage: def eval(P,x): + ....: if len(P) == 0: + ....: return 0 + ....: else: + ....: return P[0]+x*eval(P[1:],x) + +Sage example in ./linsolve.tex, line 1523:: + + sage: def pscal(P,Q,lx): + ....: return float(sum(eval(P,s)*eval(Q,s) for s in lx)) + +Sage example in ./linsolve.tex, line 1528:: + + sage: def padd(P,a,Q): + ....: for i in range(0,len(Q)): + ....: P[i] += a*Q[i] + +Sage example in ./linsolve.tex, line 1536:: + + sage: class BadParamsforOrthop(Exception): + ....: def __init__(self, degreplusun, npoints): + ....: self.deg = degreplusun + ....: self.np = npoints + ....: def __str__(self): + ....: return "degre: " + str(self.deg) + \ + ....: " nb. points: " + repr(self.np) + +Sage example in ./linsolve.tex, line 1546:: + + sage: def orthopoly(n,x): + ....: if n > len(x): + ....: raise BadParamsforOrthop(n-1, len(x)) + ....: orth = [[1./sqrt(float(len(x)))]] + ....: for p in range(1,n): + ....: nextp = copy(orth[p-1]) + ....: nextp.insert(0,0) + ....: s = [] + ....: for i in range(p-1,max(p-3,-1),-1): + ....: s.append(pscal(nextp, orth[i], x)) + ....: j = 0 + ....: for i in range(p-1,max(p-3,-1),-1): + ....: padd(nextp, -s[j], orth[i]) + ....: j += 1 + ....: norm = sqrt(pscal(nextp, nextp, x)) + ....: nextpn = [nextp[i]/norm for i in range(len(nextp))] + ....: orth.append(nextpn) + ....: return orth + +""" +# This file was *autogenerated* from the file linsolve_doctest.sage. From 46a9e14a5857d70170a282d108355006a430d759 Mon Sep 17 00:00:00 2001 From: Davis Shurbert Date: Sat, 20 Jul 2013 12:05:08 -0700 Subject: [PATCH 45/85] Trac #14913: Add GroupMixinLibGAP as a base class for finitely presented groups. --- src/sage/groups/finitely_presented.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/sage/groups/finitely_presented.py b/src/sage/groups/finitely_presented.py index 0fcb6f185ea..914c175e444 100644 --- a/src/sage/groups/finitely_presented.py +++ b/src/sage/groups/finitely_presented.py @@ -132,6 +132,7 @@ from sage.groups.group import Group from sage.groups.libgap_wrapper import ParentLibGAP, ElementLibGAP +from sage.groups.libgap_mixin import GroupMixinLibGAP from sage.structure.unique_representation import UniqueRepresentation from sage.libs.gap.libgap import libgap from sage.libs.gap.element import GapElement @@ -173,7 +174,7 @@ class FinitelyPresentedGroupElement(FreeGroupElement): b*a*b^-1*a^-1 """ - def __init__(self, parent, x): + def __init__(self, parent, x, check=True): """ The Python constructor. @@ -381,7 +382,8 @@ def wrap_FpGroup(libgap_fpgroup): return FinitelyPresentedGroup(free_group, relations) -class FinitelyPresentedGroup(UniqueRepresentation, Group, ParentLibGAP): +class FinitelyPresentedGroup(GroupMixinLibGAP, UniqueRepresentation, + Group, ParentLibGAP): """ A class that wraps GAP's Finitely Presented Groups From b4c5286307d18d20d9de17968888a9ae4f8f0506 Mon Sep 17 00:00:00 2001 From: Volker Braun Date: Wed, 14 Aug 2013 20:34:56 +0100 Subject: [PATCH 46/85] Trac #15045: Workaround for shared library bug --- build/pkgs/atlas/SPKG.txt | 4 ++++ build/pkgs/atlas/spkg-install | 10 ++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/build/pkgs/atlas/SPKG.txt b/build/pkgs/atlas/SPKG.txt index f65d92af92e..79057cc931f 100644 --- a/build/pkgs/atlas/SPKG.txt +++ b/build/pkgs/atlas/SPKG.txt @@ -92,6 +92,10 @@ The package can be configured via three environment variables: == ChangeLog == +=== atlas-3.10.1.p4, lapack-3.4.2 (Volker Braun, 14 August 2013) === + * Trac #15045: Workaround for shared library bug, + non-deterministically affecting some old platforms + === atlas-3.10.1.p3, lapack-3.4.2 (Volker Braun, 6 July 2013) === * Trac #14781: move untracked files to src/ in preparation for git * Added spkg-src to populate the src/ directory diff --git a/build/pkgs/atlas/spkg-install b/build/pkgs/atlas/spkg-install index e7e42fc01f2..442b0ae0b77 100755 --- a/build/pkgs/atlas/spkg-install +++ b/build/pkgs/atlas/spkg-install @@ -529,13 +529,19 @@ build_and_save_archdef() ###################################################################### rc = make_atlas_library('shared') -assert_success(rc, bad='Failed to install ATLAS single-threaded shared library', - good='Installed ATLAS single-threaded shared library') +if rc!=0: + print 'Failed to install ATLAS single-threaded shared library' + print 'This is bad. Using static library as last resort.' + INSTALL_STATIC_LIBRARIES = True +else: + print 'Installed ATLAS single-threaded shared library' rc = make_atlas_library('ptshared') if rc!=0: print 'Failed to build threaded library, possibly because your' print 'system does not support it.' +else: + print 'Installed ATLAS multi-threaded shared library' ###################################################################### From a854c61c943e55f0a1baf198e2fb68e049a99e7c Mon Sep 17 00:00:00 2001 From: Travis Scrimshaw Date: Tue, 17 Sep 2013 12:21:16 -0700 Subject: [PATCH 47/85] Trac #15204: fix gap cyclotomics to sage --- src/sage/libs/gap/element.pyx | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/sage/libs/gap/element.pyx b/src/sage/libs/gap/element.pyx index f768619417e..41c4c9a27c9 100644 --- a/src/sage/libs/gap/element.pyx +++ b/src/sage/libs/gap/element.pyx @@ -1464,13 +1464,28 @@ cdef class GapElement_Cyclotomic(GapElement): zeta3 sage: libgap.E(3).sage(ring=CyclotomicField(6)) zeta6 - 1 + + TESTS: + + Check that :trac:`15204` is fixed:: + + sage: libgap.E(3).sage(ring=UniversalCyclotomicField()) + E(3) + sage: libgap.E(3).sage(ring=CC) + -0.500000000000000 + 0.866025403784439*I """ if ring is None: conductor = self.Conductor() from sage.rings.number_field.number_field import CyclotomicField ring = CyclotomicField(conductor.sage()) else: - conductor = ring._n() + try: + conductor = ring._n() + except AttributeError: + from sage.rings.number_field.number_field import CyclotomicField + conductor = self.Conductor() + cf = CyclotomicField(conductor.sage()) + return ring(cf(self.CoeffsCyc(conductor).sage())) coeff = self.CoeffsCyc(conductor).sage() return ring(coeff) From 49dc95300bb19606dc10fbd6a5eb53d63e62a48e Mon Sep 17 00:00:00 2001 From: Nomail Name Date: Fri, 16 Aug 2013 16:03:43 -0400 Subject: [PATCH 48/85] Trac #14776: implements StrongTableau and StrongTableaux classes --- src/sage/combinat/all.py | 2 +- src/sage/combinat/core.py | 49 +- src/sage/combinat/k_tableau.py | 2431 +++++++++++++++++++++++++++++++- 3 files changed, 2443 insertions(+), 39 deletions(-) diff --git a/src/sage/combinat/all.py b/src/sage/combinat/all.py index 6d5852c29ec..6edb799a084 100644 --- a/src/sage/combinat/all.py +++ b/src/sage/combinat/all.py @@ -83,7 +83,7 @@ from sage.combinat.tableau_tuple import TableauTuple, StandardTableauTuple, TableauTuples, StandardTableauTuples -from k_tableau import WeakTableau, WeakTableaux +from k_tableau import WeakTableau, WeakTableaux, StrongTableau, StrongTableaux #Words from words.all import * diff --git a/src/sage/combinat/core.py b/src/sage/combinat/core.py index cb847dd4b92..4f1c6064f06 100644 --- a/src/sage/combinat/core.py +++ b/src/sage/combinat/core.py @@ -78,7 +78,7 @@ def __classcall_private__(cls, part, k): return part part = Partition(part) if not part.is_core(k): - raise ValueError, "%s is not a %s-core"%(part, k) + raise ValueError("%s is not a %s-core"%(part, k)) l = sum(part.k_boundary(k).row_lengths()) return Cores(k, l)(part) @@ -104,7 +104,7 @@ def __init__(self, parent, core): k = parent.k part = Partition(core) if not part.is_core(k): - raise ValueError, "%s is not a %s-core"%(part, k) + raise ValueError("%s is not a %s-core"%(part, k)) CombinatorialObject.__init__(self, core) Element.__init__(self, parent) @@ -331,7 +331,7 @@ def _transposition_to_reduced_word(self, t): sage: c._transposition_to_reduced_word([2, 2]) Traceback (most recent call last): ... - AssertionError: t_0 and t_1 cannot be equal mod k + ValueError: t_0 and t_1 cannot be equal mod k sage: c = Core([],30) sage: c._transposition_to_reduced_word([4, 12]) @@ -342,7 +342,8 @@ def _transposition_to_reduced_word(self, t): [1, 2, 0, 1, 2, 0, 2, 1, 0, 2, 1] """ k = self.k() - assert (t[0]-t[1])%k != 0, "t_0 and t_1 cannot be equal mod k" + if (t[0]-t[1])%k == 0: + raise ValueError("t_0 and t_1 cannot be equal mod k") if t[0] > t[1]: return self._transposition_to_reduced_word([t[1],t[0]]) else: @@ -378,10 +379,11 @@ def weak_le(self, other): sage: c.weak_le(x) Traceback (most recent call last): ... - AssertionError: The two cores do not have the same k + ValueError: The two cores do not have the same k """ if type(self) == type(other): - assert self.k() == other.k(), "The two cores do not have the same k" + if self.k() != other.k(): + raise ValueError("The two cores do not have the same k") else: other = Core(other, self.k()) w = self.to_grassmannian() @@ -432,15 +434,14 @@ def strong_le(self, other): sage: c.strong_le(x) Traceback (most recent call last): ... - AssertionError: The two cores do not have the same k + ValueError: The two cores do not have the same k """ if type(self) == type(other): - assert self.k() == other.k(), "The two cores do not have the same k" + if self.k()!=other.k(): + raise ValueError("The two cores do not have the same k") else: other = Core(other, self.k()) - w = self.to_grassmannian() - v = other.to_grassmannian() - return w.bruhat_le(v) + return other.contains(self) def contains(self, other): r""" @@ -448,7 +449,7 @@ def contains(self, other): INPUT: - - ``other`` -- another `k`-core + - ``other`` -- another `k`-core or a list OUTPUT: a boolean @@ -465,7 +466,7 @@ def contains(self, other): False """ la = self.to_partition() - mu = other.to_partition() + mu = Core(other, self.k()).to_partition() return la.contains(mu) def strong_covers(self): @@ -481,11 +482,25 @@ def strong_covers(self): sage: c.strong_covers() [[5, 3, 1], [4, 2, 1, 1]] """ - w = self.to_grassmannian() - S = w.bruhat_upper_covers() - S = [x for x in S if x.is_affine_grassmannian()] - return [ x.affine_grassmannian_to_core() for x in set(S) ] + S = Cores(self.k(), length=self.length()+1) + return [ ga for ga in S if ga.contains(self) ] + def strong_down_list(self): + r""" + Returns a list of all elements that are covered by ``self`` in strong order. + + EXAMPLES:: + + sage: c = Core([1],3) + sage: c.strong_down_list() + [[]] + sage: c = Core([5,3,1],3) + sage: c.strong_down_list() + [[4, 2], [3, 1, 1]] + """ + if self==[]: + return [] + return [ga for ga in Cores(self.k(), length=self.length()-1) if self.contains(ga)] def Cores(k, length = None, **kwargs): r""" diff --git a/src/sage/combinat/k_tableau.py b/src/sage/combinat/k_tableau.py index bb971ea2c23..9448286fbb9 100644 --- a/src/sage/combinat/k_tableau.py +++ b/src/sage/combinat/k_tableau.py @@ -7,6 +7,8 @@ For semistandard tableaux, the notion of weak and strong horizontal strip is necessary. More information can be found in [LLMS2006]_ . + .. SEEALSO:: :meth:`sage.combinat.k_tableau.StrongTableau`, :meth:`sage.combinat.k_tableau.WeakTableau` + REFERENCES: .. [LLMS2006] T. Lam, L. Lapointe, J. Morse, M. Shimozono, @@ -48,6 +50,13 @@ from sage.combinat.core import Core from sage.rings.all import ZZ from sage.misc.misc import uniq +from sage.functions.generalized import sgn +from sage.misc.flatten import flatten +from sage.combinat.skew_partition import SkewPartition +from sage.combinat.tableau import TableauOptions +from sage.combinat.composition import Composition +import cartesian_product +import copy def WeakTableau(t, k, inner_shape = [], representation = "core"): r""" @@ -337,7 +346,7 @@ def weight(self): """ return self.parent()._weight - def size_of_shape(self): + def size(self): r""" Return the size of the shape of ``self``. @@ -353,15 +362,15 @@ def size_of_shape(self): sage: t = WeakTableau([[None, 1, 1, 2, 2], [None, 2], [1]], 3) sage: t.shape() ([5, 2, 1], [1, 1]) - sage: t.size_of_shape() + sage: t.size() 4 sage: t = WeakTableau([[1,1,2],[2,3],[3]], 3, representation="bounded") sage: t.shape() [3, 2, 1] - sage: t.size_of_shape() + sage: t.size() 6 """ - return self.parent().size_of_shape() + return self.parent().size() def intermediate_shapes(self): r""" @@ -550,7 +559,7 @@ def shape(self): return (self._outer_shape, self._inner_shape) return self._outer_shape - def size_of_shape(self): + def size(self): r""" Return the size of the shape. @@ -562,13 +571,13 @@ def size_of_shape(self): EXAMPLES:: sage: T = WeakTableaux(3, [5,2,1], [1,1,1,1,1,1]) - sage: T.size_of_shape() + sage: T.size() 6 sage: T = WeakTableaux(3, [3,2,1], [1,1,1,1,1,1], representation = 'bounded') - sage: T.size_of_shape() + sage: T.size() 6 sage: T = WeakTableaux(4, [[6,2,1], [2]], [2,1,1,1], 'factorized_permutation') - sage: T.size_of_shape() + sage: T.size() 5 """ if self._representation == 'bounded': @@ -2172,25 +2181,2405 @@ def __iter__(self): Element = WeakTableau_factorized_permutation -def intermediate_shapes(t): + +######## END weak tableaux BEGIN strong tableaux + +class StrongTableau(ClonableList): r""" - Return the intermediate shapes of tableau ``t``. + A (standard) strong `k`-tableau is a (saturated) chain in Bruhat order. + + Combinatorially, it is a sequence of embedded `k+1`-cores (subject to some conditions) + together with a set of markings. + + A strong cover in terms of cores corresponds to certain translated ribbons. A marking + corresponds to the choice of one of the translated ribbons, which is indicated by + marking the head (southeast most cell in French notation) of the chosen ribbon. For + more information, see [LLMS2006]_ and [LLMSSZ2013]_. + + In Sage, a strong `k`-tableau is created by specifying `k`, a standard strong + tableau together with its markings, and a weight `\mu`. Here the standard tableau is + represented by a sequence of `k+1`-cores - A (skew) tableau with letters `1,2,\ldots,\ell` can be viewed as a sequence of shapes, - where the `i`-th shape is given by the shape of the subtableau on letters `1,2,\ldots,i`. - The output is the list of these shapes. + .. MATH:: + + \lambda^{(0)} \subseteq \lambda^{(1)} \subseteq \cdots \subseteq \lambda^{(m)} + + where each of the `\lambda^{(i)}` is a `k+1`-core. The standard tableau is a filling + of the diagram for the core `\lambda^{(m)}/\lambda^{(0)}` where a strong cover + is represented by letters `\pm i` in the skew shape `\lambda^{(i)}/\lambda^{(i-1)}`. + Each skew `(k+1)`-core `\lambda^{(i)}/\lambda^{(i-1)}` is a ribbon or multiple + copies of the same ribbon which are separated by `k+1` diagonals. Precisely one of + the copies of the ribbons will be marked in the largest diagonal of the connected + component (the 'head' of the ribbon). The marked cells are indicated by negative + signs. + + The strong tableau is stored as a standard strong marked tableau (referred to as the + standard part of the strong tableau) and a vector representing the weight. EXAMPLES:: - sage: from sage.combinat.k_tableau import intermediate_shapes - sage: t = WeakTableau([[1, 1, 2, 2, 3], [2, 3], [3]],3) - sage: intermediate_shapes(t) - [[], [2], [4, 1], [5, 2, 1]] + sage: StrongTableau( [[-1, -2, -3], [3]], 2, [3] ) + [[-1, -1, -1], [1]] + sage: StrongTableau([[-1,-2,-4,-7],[-3,6,-6,8],[4,7],[-5,-8]], 3, [2,2,3,1]) + [[-1, -1, -2, -3], [-2, 3, -3, 4], [2, 3], [-3, -4]] + + Alternatively, the strong `k`-tableau can also be entered directly in semistandard + format and then the standard tableau and the weight are computed and stored:: + + sage: T = StrongTableau([[-1,-1,-1],[1]], 2); T + [[-1, -1, -1], [1]] + sage: T.to_standard_list() + [[-1, -2, -3], [3]] + sage: T.weight() + (3,) + sage: T = StrongTableau([[-1, -1, -2, -3], [-2, 3, -3, 4], [2, 3], [-3, -4]], 3); T + [[-1, -1, -2, -3], [-2, 3, -3, 4], [2, 3], [-3, -4]] + sage: T.to_standard_list() + [[-1, -2, -4, -7], [-3, 6, -6, 8], [4, 7], [-5, -8]] + sage: T.weight() + (2, 2, 3, 1) + """ - sage: t = WeakTableau([[None, None, 2, 3, 4], [1, 4], [2]], 3) - sage: intermediate_shapes(t) - [[2], [2, 1], [3, 1, 1], [4, 1, 1], [5, 2, 1]] - """ + def __init__(self, parent, T): + """ + INPUT: + + - ``parent`` - an instance of ``StrongTableaux`` + - ``T`` -- standard marked strong (possibly skew) `k`-tableau or a semistandard + marked strong (possibly skew) `k`-tableau with inner cells represented by + ``None`` + + EXAMPLES:: + + sage: T = StrongTableau( [[-1, -2, -3]], 3 ); T + [[-1, -2, -3]] + sage: T + [[-1, -2, -3]] + sage: T.weight() + (1, 1, 1) + sage: T.size() + 3 + sage: T.parent() + Set of strong 3-tableaux of shape [3] and of weight (1, 1, 1) + sage: StrongTableau( [[-1, -2, -3], [3]], 2 ) + [[-1, -2, -3], [3]] + sage: StrongTableau( [[-1, -1, 2], [-2]], 2 ) + [[-1, -1, 2], [-2]] + sage: T = StrongTableau( [[-1, -2, 3], [-3]], 2, weight=[2,1] ); T + [[-1, -1, 2], [-2]] + sage: T = StrongTableau( [[-1, -2, 3], [-3]], 2, weight=[0,2,1] ); T + [[-2, -2, 3], [-3]] + sage: T.weight() + (0, 2, 1) + sage: T.size() + 3 + sage: T.parent() + Set of strong 2-tableaux of shape [3, 1] and of weight (0, 2, 1) + sage: StrongTableau( [[-1, -2, 3], [-3]], 2, weight=[1,2] ) + Traceback (most recent call last): + ... + ValueError: The weight=(1, 2) and the markings on the standard tableau=[[-1, -2, 3], [-3]] do not agree. + sage: StrongTableau( [[None, None, -2, -4], [None, None], [-1, -3], [2, 4], [-5], [5], [5], [5]], 4 ) + [[None, None, -2, -4], [None, None], [-1, -3], [2, 4], [-5], [5], [5], [5]] + sage: StrongTableau( [[None, None, -2, -4], [None, None], [-1, -3], [2, 4], [-5], [5], [5], [5]], 4, weight=[2,2,1] ) + [[None, None, -1, -2], [None, None], [-1, -2], [1, 2], [-3], [3], [3], [3]] + sage: StrongTableau( [[None, None, -1, -2], [None, None], [-1, -2], [1, 2], [-3], [3], [3], [3]], 4) + [[None, None, -1, -2], [None, None], [-1, -2], [1, 2], [-3], [3], [3], [3]] + + TESTS:: + + sage: T = StrongTableau([], 3); T + [] + sage: T.weight() + () + sage: T.parent() + Set of strong 3-tableaux of shape [] and of weight () + sage: T = StrongTableau( [[None, None], [None, None]], 4, weight=() ); T + [[None, None], [None, None]] + sage: T.size() + 0 + """ + self.k = parent.k + self._tableau = T + ClonableList.__init__(self, parent, T) + + __metaclass__ = ClasscallMetaclass + + @staticmethod + def __classcall_private__(cls, T, k, weight=None): + r""" + Straighten input and implement the shortcut ``StrongTableau(T, k, weight=None)`` + to ``StrongTableaux(k, shape, weight)(T)``. + + TESTS:: + + sage: t = StrongTableau( [[-1, -2, -3]], 3 ) + sage: t.parent() + Set of strong 3-tableaux of shape [3] and of weight (1, 1, 1) + sage: TestSuite(t).run() + sage: t = StrongTableau( [[-1, -2, 3], [-3]], 2, weight=[2,1] ) + sage: TestSuite(t).run() + sage: StrongTableau([[-1,-1,-1]], 3) + [[-1, -1, -1]] + sage: StrongTableau([[None, None, None], [None]], 2) + [[None, None, None], [None]] + + sage: StrongTableau([[-1, -2, -2], [1]], 2) + Traceback (most recent call last): + ... + ValueError: Unable to parse strong marked tableau : [[-1, -2, -2], [1]] + + sage: StrongTableau([[-1,-1,-1,-1]], 3) + Traceback (most recent call last): + ... + ValueError: [4] is not a 4-core + + sage: StrongTableau([[-1, -2], [2]], 3) + Traceback (most recent call last): + ... + ValueError: The marks in [[-1, -2], [2]] are not correctly placed. + + sage: StrongTableau([[None, None, None], [None]], 3) + Traceback (most recent call last): + ... + ValueError: [3, 1] is not a 4-core + + sage: StrongTableau([[None, -1, 2], [-2]], 2, [2]) + Traceback (most recent call last): + ... + ValueError: The weight=(2,) and the markings on the standard tableau=[[None, -1, 2], [-2]] do not agree. + """ + if isinstance(T, cls): + return T + outer_shape = Core(map(len, T),k+1) + inner_shape = Core(filter(lambda x: x>0, [row.count(None) for row in T]), k+1) + Te = [v for row in T for v in row if v is not None]+[0] + count_marks = tuple([Te.count(-(i+1)) for i in range(-min(Te))]) + if not all( v==1 for v in count_marks ): + # if T is not standard -> turn into standard + if weight is not None and tuple(weight)!=count_marks: + raise ValueError("Weight = %s and tableau = %s do not agree"%(weight, T)) + tijseq = StrongTableaux.marked_CST_to_transposition_sequence(T, k) + if len(tijseq)0, map(lambda row: filter(lambda x: x==None, row ), T))),self.k+1).length() + if len(uniq([v for v in flatten(list(T)) if v in ZZ and v<0]))!=size-inner_size: + return False # TT does not have exactly self.size() marked cells + for i in range(len(T)): + for j in range(len(T[i])): + v = T[i][j] + if v!=None and v<0 and ((i!=0 and T[i-1][j]==abs(v)) or (j= self.content_of_marked_head( ss+j+2 ): + return False + ss += mu[i] + return True + + def _repr_diagram(self): + r""" + Return a string representing the pretty print of the tableau. + + EXAMPLES:: + + sage: StrongTableau([[-1,-2,-4,-7],[-3,6,-6,8],[4,7],[-5,-8]], 3, [2,2,3,1])._repr_diagram() + ' -1 -1 -2 -3\n -2 3 -3 4\n 2 3\n -3 -4' + sage: StrongTableau([[None, None, -1, -2], [None, None], [-1, -2], [1, 2], [-3], [3], [3], [3]], 4)._repr_diagram() + ' . . -1 -2\n . .\n -1 -2\n 1 2\n -3\n 3\n 3\n 3' + sage: StrongTableau([], 4)._repr_diagram() + '' + """ + return SkewTableau(self.to_list())._repr_diagram() + + def _repr_list(self): + r""" + Return a string representing the list of lists of the tableau. + + EXAMPLES:: + + sage: StrongTableau([[-1,-2,-4,-7],[-3,6,-6,8],[4,7],[-5,-8]], 3, [2,2,3,1])._repr_list() + '[[-1, -1, -2, -3], [-2, 3, -3, 4], [2, 3], [-3, -4]]' + sage: StrongTableau([[None, None, -1, -2], [None, None], [-1, -2], [1, 2], [-3], [3], [3], [3]], 4)._repr_list() + '[[None, None, -1, -2], [None, None], [-1, -2], [1, 2], [-3], [3], [3], [3]]' + sage: StrongTableau([], 4)._repr_list() + '[]' + """ + return repr(self.to_list()) + + def _repr_compact(self): + """ + Return a compact string representation of ``self``. + + EXAMPLES:: + + sage: StrongTableau([[-1,-2,-4,-7],[-3,6,-6,8],[4,7],[-5,-8]], 3, [2,2,3,1])._repr_compact() + '-1,-1,-2,-3/-2,3,-3,4/2,3/-3,-4' + sage: StrongTableau([[None, None, -1, -2], [None, None], [-1, -2], [1, 2], [-3], [3], [3], [3]], 4)._repr_compact() + '.,.,-1,-2/.,./-1,-2/1,2/-3/3/3/3' + sage: StrongTableau([],4)._repr_compact() + '-' + """ + return SkewTableau(self.to_list())._repr_compact() + + def _repr_(self): + r""" + Return a representation of ``self``. + + To display a strong marked tableau we display the semistandard version. + + EXAMPLES:: + + sage: StrongTableau( [[-1, -2, -3]], 3 ) + [[-1, -2, -3]] + sage: StrongTableau( [[-1, -2, -3]], 3 , weight=[3]) + [[-1, -1, -1]] + sage: StrongTableau( [], 3 ) + [] + sage: T = StrongTableau([[-1,-2,3],[-3]],2) + sage: T + [[-1, -2, 3], [-3]] + sage: Tableaux.global_options(display="diagram") + sage: T + -1 -2 3 + -3 + sage: Tableaux.global_options(convention="French") + sage: T + -3 + -1 -2 3 + sage: Tableaux.global_options(display="compact") + sage: T + -1,-2,3/-3 + sage: Tableaux.global_options(display="list",convention="English") + """ + return self.parent().global_options.dispatch(self, '_repr_', 'display') + + def cell_of_marked_head(self, v): + r""" + Return location of marked head labeled by ``v`` in the standard part of ``self``. + + Return the coordinates of the ``v``-th marked cell in the strong standard tableau + ``self``. If there is no mark, then the value returned is `(0, r)` where `r` is + the length of the first row. + + INPUT: + + - ``v`` -- an integer representing the label in the standard tableau + + OUTPUT: + + - a pair of the coordinates of the marked cell with entry ``v`` + + EXAMPLES:: + + sage: T = StrongTableau([[-1, -3, 4, -5], [-2], [-4]], 3) + sage: [ T.cell_of_marked_head(i) for i in range(1,7)] + [(0, 0), (1, 0), (0, 1), (2, 0), (0, 3), (0, 4)] + sage: T = StrongTableau([[None, None, -1, -2], [None, None], [-1, -2], [1, 2], [-3], [3], [3], [3]], 4) + sage: [ T.cell_of_marked_head(i) for i in range(1,7)] + [(2, 0), (0, 2), (2, 1), (0, 3), (4, 0), (0, 4)] + + TESTS:: + + sage: StrongTableau([],4).cell_of_marked_head(4) + (0, 0) + """ + T = self.to_standard_list() + if T==[]: + return (0,0) + for i in range(len(T)): + for j in range(len(T[i])): + if T[i][j]==-v: + return (i,j) + return (0,len(T[0])) + + def content_of_marked_head(self, v): + r""" + Return the diagonal of the marked label ``v`` in the standard part of ``self``. + + Return the content (the `j-i` coordinate of the cell) of the ``v``-th marked cell + in the strong standard tableau ``self``. If there is no mark, then the value + returned is the size of first row. + + INPUT: + + - ``v`` -- an integer representing the label in the standard tableau + + OUTPUT: + + - an integer representing the residue of the location of the mark + + EXAMPLES:: + + sage: [ StrongTableau([[-1, -3, 4, -5], [-2], [-4]], 3).content_of_marked_head(i) for i in range(1,7)] + [0, -1, 1, -2, 3, 4] + sage: T = StrongTableau([[None, None, -1, -2], [None, None], [-1, -2], [1, 2], [-3], [3], [3], [3]], 4) + sage: [ T.content_of_marked_head(i) for i in range(1,7)] + [-2, 2, -1, 3, -4, 4] + + TESTS:: + + sage: StrongTableau([],4).content_of_marked_head(4) + 0 + """ + c = self.cell_of_marked_head(v) + return c[1]-c[0] + + def cells_of_marked_ribbon(self, v): + r""" + Return a list of all cells the marked ribbon labeled by ``v`` in the standard part of ``self``. + + Return the list of coordinates of the cells which are in the marked + ribbon with label ``v`` in the standard part of the tableau. Note that + the result is independent of the weight of the tableau. + + The cells are listed from largest content (where the mark is located) + to the smallest. Hence, the first entry in this list will be the marked cell. + + INPUT: + + - ``v`` -- the entry of the standard tableau + + OUTPUT: + + - a list of pairs representing the coordinates of the cells of + the marked ribbon + + EXAMPLES:: + + sage: T = StrongTableau([[-1, -1, -2, -2, 3], [2, -3], [-3]],3) + sage: T.to_standard_list() + [[-1, -2, -3, -4, 6], [4, -6], [-5]] + sage: T.cells_of_marked_ribbon(1) + [(0, 0)] + sage: T.cells_of_marked_ribbon(4) + [(0, 3)] + sage: T = StrongTableau([[-1,-2,-4,-7],[-3,6,-6,8],[4,7],[-5,-8]], 3) + sage: T.cells_of_marked_ribbon(6) + [(1, 2), (1, 1)] + sage: T.cells_of_marked_ribbon(9) + [] + sage: T = StrongTableau([[None, None, -1, -1, 3], [1, -3], [-3]],3) + sage: T.to_standard_list() + [[None, None, -1, -2, 4], [2, -4], [-3]] + sage: T.cells_of_marked_ribbon(1) + [(0, 2)] + + TESTS:: + + sage: StrongTableau([],3).cells_of_marked_ribbon(1) + [] + """ + d = self.content_of_marked_head(v) + T = SkewTableau(self.to_unmarked_standard_list()) + cells = [] + while d is not None: + adt=[c for c in T.cells_by_content(d) if T[c[0]][c[1]]==v] + if adt==[]: + d = None + else: + d -= 1 + cells += adt + return cells + + def cell_of_highest_head( self, v ): + """ + Return the cell of the highest head of label ``v`` in the standard part of ``self``. + + Return the cell where the head of the ribbon in the highest row is located + in the underlying standard tableau. If there is no cell with entry ``v`` then + the cell returned is `(0, r)` where `r` is the length of the first row. + + This cell is calculated by iterating through the diagonals of the tableau. + + INPUT: + + - ``v`` -- an integer indicating the label in the standard tableau + + OUTPUT: + + - a pair of integers indicating the coordinates of the head of the highest + ribbon with label ``v`` + + EXAMPLES:: + + sage: T = StrongTableau([[-1,2,-3],[-2,3],[3]], 1) + sage: [T.cell_of_highest_head(v) for v in range(1,5)] + [(0, 0), (1, 0), (2, 0), (0, 3)] + sage: T = StrongTableau([[None,None,-3,4],[3,-4]],2) + sage: [T.cell_of_highest_head(v) for v in range(1,5)] + [(1, 0), (1, 1), (0, 4), (0, 4)] + + TESTS:: + + sage: StrongTableau([],2).cell_of_highest_head(1) + (0, 0) + """ + Tlist = SkewTableau(self.to_standard_list()) + if Tlist==[]: + return (0, 0) + r = len(Tlist[0]) + dout = (0, r) + for d in range(-len(Tlist),r+1): + for c in Tlist.cells_by_content(d): + if nabs(Tlist[c[0]][c[1]])==v: + dout = c + if dout!=(0, r) and dout[1]-dout[0]!=d: + return dout + return dout + + def content_of_highest_head( self, v ): + r""" + Return the diagonal of the highest head of the cells labeled ``v`` in the standard part of ``self``. + + Return the content of the cell of the head in the highest row of all ribbons labeled by ``v`` of + the underlying standard tableau. If there is no cell with entry ``v`` then + the value returned is the length of the first row. + + INPUT: + + - ``v`` -- an integer representing the label in the standard tableau + + OUTPUT: + + - an integer representing the content of the head of the highest + ribbon with label ``v`` + + EXAMPLES:: + + sage: [StrongTableau([[-1,2,-3],[-2,3],[3]], 1).content_of_highest_head(v) for v in range(1,5)] + [0, -1, -2, 3] + + TESTS:: + + sage: StrongTableau([], 4).content_of_highest_head(1) + 0 + sage: StrongTableau([[-1,-1]], 4).content_of_highest_head(3) + 2 + """ + c = self.cell_of_highest_head(v) + return c[1]-c[0] + + def cells_head_dictionary(self): + r""" + Return a dictionary with the locations of the heads of all markings. + + Return a dictionary of values and lists of cells where the heads with the values + are located. + + OUPUT: + + - a dictionary with keys the entries in the tableau and values are the coordinates + of the heads with those entries + + EXAMPLES:: + + sage: T = StrongTableau([[-1,-2,-4,7],[-3,6,-6,8],[4,-7],[-5,-8]], 3) + sage: T.cells_head_dictionary() + {1: [(0, 0)], + 2: [(0, 1)], + 3: [(1, 0)], + 4: [(2, 0), (0, 2)], + 5: [(3, 0)], + 6: [(1, 2)], + 7: [(2, 1), (0, 3)], + 8: [(3, 1), (1, 3)]} + sage: T = StrongTableau([[None, 4, -4, -6, -7, 8, 8, -8], [None, -5, 8, 8, 8], [-3, 6]],3) + sage: T.cells_head_dictionary() + {1: [(2, 0)], + 2: [(0, 2)], + 3: [(1, 1)], + 4: [(2, 1), (0, 3)], + 5: [(0, 4)], + 6: [(1, 4), (0, 7)]} + sage: StrongTableau([[None, None], [None, -1]], 4).cells_head_dictionary() + {1: [(1, 1)]} + + TESTS:: + + sage: StrongTableau([[None, None], [None]], 4).cells_head_dictionary() + {} + sage: StrongTableau([],4).cells_head_dictionary() + {} + """ + return StrongTableaux.cells_head_dictionary(self.to_unmarked_standard_list()) + + def cells_of_heads(self, v): + r""" + Return a list of cells of the heads with label ``v`` in the standard part of ``self``. + + A list of cells which are heads of the ribbons with label ``v`` in the + standard part of the tableau ``self``. If there is no cell labelled by ``v`` then return the empty + list. + + INPUT: + + - ``v`` -- an integer label + + OUPUT: + + - a list of pairs of integers of the coordinates of the heads of the ribbons + with label ``v`` + + EXAMPLES:: + + sage: T = StrongTableau([[None, None, -1, -2], [None, None], [-1, -2], [1, 2], [-3], [3], [3], [3]], 4) + sage: T.cells_of_heads(1) + [(2, 0)] + sage: T.cells_of_heads(2) + [(3, 0), (0, 2)] + sage: T.cells_of_heads(3) + [(2, 1)] + sage: T.cells_of_heads(4) + [(3, 1), (0, 3)] + sage: T.cells_of_heads(5) + [(4, 0)] + sage: T.cells_of_heads(6) + [] + + TESTS:: + + sage: StrongTableau([[None, None], [None]], 4).cells_of_heads(1) + [] + sage: StrongTableau([],4).cells_of_heads(1) + [] + """ + dout = self.cells_head_dictionary() + if v in dout.keys(): + return dout[v] + else: + return [] + + def contents_of_heads(self, v): + r""" + A list of contents of the cells which are heads of the ribbons with label ``v``. + + If there is no cell labelled by ``v`` then return the empty list. + + INPUT: + + - ``v`` -- an integer label + + OUPUT: + + - a list of integers of the content of the heads of the ribbons with label ``v`` + + EXAMPLES:: + + sage: T = StrongTableau([[None, None, -1, -2], [None, None], [-1, -2], [1, 2], [-3], [3], [3], [3]], 4) + sage: T.contents_of_heads(1) + [-2] + sage: T.contents_of_heads(2) + [-3, 2] + sage: T.contents_of_heads(3) + [-1] + sage: T.contents_of_heads(4) + [-2, 3] + sage: T.contents_of_heads(5) + [-4] + sage: T.contents_of_heads(6) + [] + + TESTS:: + + sage: StrongTableau([[None, None], [None]], 4).contents_of_heads(1) + [] + sage: StrongTableau([],4).contents_of_heads(1) + [] + """ + return [c[1]-c[0] for c in self.cells_of_heads(v)] + + def entries_by_content(self, diag): + r""" + Return the entries on the diagonal of ``self``. + + Return the entries in the tableau that are in the cells `(i,j)` with + `j-i` equal to ``diag`` (that is, with content equal to ``diag``). + + INPUT: + + - ``diag`` -- an integer indicating the diagonal + + OUTPUT: + + - a list (perhaps empty) of labels on the diagonal ``diag`` + + EXAMPLES:: + + sage: T = StrongTableau([[None, None, -1, -2], [None, None], [-1, -2], [1, 2], [-3], [3], [3], [3]], 4) + sage: T.entries_by_content(0) + [] + sage: T.entries_by_content(1) + [] + sage: T.entries_by_content(2) + [-1] + sage: T.entries_by_content(-2) + [-1, 2] + + TESTS:: + + sage: StrongTableau([[None, None], [None]], 4).entries_by_content(1) + [] + sage: StrongTableau([],4).entries_by_content(1) + [] + """ + return SkewTableau(self.to_list()).entries_by_content(diag) + + def entries_by_content_standard(self, diag): + r""" + Return the entries on the diagonal of the standard part of ``self``. + + Return the entries in the tableau that are in the cells `(i,j)` with + `j-i` equal to ``diag`` (that is, with content equal to ``diag``) in the + standard tableau. + + INPUT: + + - ``diag`` -- an integer indicating the diagonal + + OUTPUT: + + - a list (perhaps empty) of labels on the diagonal ``diag`` + + EXAMPLES:: + + sage: T = StrongTableau([[None, None, -1, -2], [None, None], [-1, -2], [1, 2], [-3], [3], [3], [3]], 4) + sage: T.entries_by_content_standard(0) + [] + sage: T.entries_by_content_standard(1) + [] + sage: T.entries_by_content_standard(2) + [-2] + sage: T.entries_by_content_standard(-2) + [-1, 4] + + TESTS:: + + sage: StrongTableau([[None, None], [None]], 4).entries_by_content_standard(1) + [] + sage: StrongTableau([],4).entries_by_content_standard(1) + [] + """ + return SkewTableau(self.to_standard_list()).entries_by_content(diag) + + def ribbons_above_marked(self, v): + r""" + Number of ribbons of label ``v`` higher than the marked ribbon in the standard part. + + Return the number of copies of the ribbon with label ``v`` in the standard part + of ``self`` which are in a higher row than the marked ribbon. Note that the result + is independent of the weight of the tableau. + + INPUT: + + - ``v`` -- the entry of the standard tableau + + OUTPUT: + + - an integer representing the number of copies of the ribbon above the marked + ribbon + + EXAMPLES:: + + sage: T = StrongTableau([[-1,-2,-4,-7],[-3,6,-6,8],[4,7],[-5,-8]], 3) + sage: T.ribbons_above_marked(4) + 1 + sage: T.ribbons_above_marked(6) + 0 + sage: T.ribbons_above_marked(9) + 0 + sage: StrongTableau([[-1,-2,-3,-4],[2,3,4],[3,4],[4]], 1).ribbons_above_marked(4) + 3 + + TESTS:: + + sage: StrongTableau([[None, None], [None]], 4).ribbons_above_marked(1) + 0 + sage: StrongTableau([],4).ribbons_above_marked(1) + 0 + """ + d = self.content_of_marked_head(v) + count = 0 + for i in range(self.k+1, len(self.to_standard_list())+d, self.k+1): + count += int(v in self.entries_by_content_standard(d-i)) + return count + + def height_of_ribbon(self, v): + r""" + The number of rows occupied by one of the ribbons with label ``v``. + + The number of rows occupied by the marked ribbon with label ``v`` + (and by consequence the number of rows occupied by any ribbon with the same label) + in the standard part of ``self``. + + INPUT: + + - ``v`` -- the label of the standard marked tableau + + OUTPUT: + + - a non-negative integer representing the number of rows + occupied by the ribbon which is marked + + EXAMPLES:: + + sage: T = StrongTableau([[-1, -1, -2, -2, 3], [2, -3], [-3]],3) + sage: T.to_standard_list() + [[-1, -2, -3, -4, 6], [4, -6], [-5]] + sage: T.height_of_ribbon(1) + 1 + sage: T.height_of_ribbon(4) + 1 + sage: T = StrongTableau([[None,None,1,-2],[None,-3,4,-5],[-1,3],[-4,5]], 3) + sage: T.height_of_ribbon(3) + 2 + sage: T.height_of_ribbon(6) + 0 + + TESTS:: + + sage: StrongTableau([[None, None], [None]], 4).height_of_ribbon(1) + 0 + sage: StrongTableau([],4).height_of_ribbon(1) + 0 + """ + return len(uniq([c[0] for c in self.cells_of_marked_ribbon(v)])) + + def number_of_connected_components(self, v): + r""" + Number of connected components of ribbons with label ``v`` in the standard part. + + The number of connected components is calculated by finding the number of cells + with label ``v`` in the standard part of the tableau and dividing by the number + of cells in the ribbon. + + INPUT: + + - ``v`` -- the label of the standard marked tableau + + OUTPUT: + + - a non-negative integer representing the number of connected + components + + EXAMPLES:: + + sage: T = StrongTableau([[-1, -1, -2, -2, 3], [2, -3], [-3]],3) + sage: T.to_standard_list() + [[-1, -2, -3, -4, 6], [4, -6], [-5]] + sage: T.number_of_connected_components(1) + 1 + sage: T.number_of_connected_components(4) + 2 + sage: T = StrongTableau([[-1,-2,-4,-7],[-3,6,-6,8],[4,7],[-5,-8]], 3) + sage: T.number_of_connected_components(6) + 1 + sage: T.number_of_connected_components(9) + 0 + + TESTS:: + + sage: StrongTableau([[None, None], [None]], 4).number_of_connected_components(1) + 0 + sage: StrongTableau([],4).number_of_connected_components(1) + 0 + """ + sz = len(self.cells_of_marked_ribbon(v)) + if sz==0: + return 0 + T = self.to_standard_list() + nocells = len([i for i in range(len(T)) for j in range(len(T[i])) if T[i][j]==v])+1 + return ZZ(nocells/sz) + + def intermediate_shapes(self): + r""" + Return the intermediate shapes of ``self``. + + A (skew) tableau with letters `1, 2, \ldots, \ell` can be viewed as a sequence of + shapes, where the `i`-th shape is given by the shape of the subtableau on letters + `1, 2, \ldots, i`. + + The output is the list of these shapes. The marked cells are ignored so to + recover the strong tableau one would need the intermediate shapes and the + :meth:`content_of_marked_head` for each pair of adjacent shapes in the list. + + OUTPUT: + + - a list of lists of integers representing `k+1`-cores + + EXAMPLES:: + + sage: T = StrongTableau([[-1,-2,-4,-7],[-3,6,-6,8],[4,7],[-5,-8]], 3, [2,2,3,1]) + sage: T.intermediate_shapes() + [[], [2], [3, 1, 1], [4, 3, 2, 1], [4, 4, 2, 2]] + sage: T = StrongTableau([[None, None, -1, -2], [None, None], [-1, -2], [1, 2], [-3], [3], [3], [3]], 4) + sage: T.intermediate_shapes() + [[2, 2], [3, 2, 1, 1], [4, 2, 2, 2], [4, 2, 2, 2, 1, 1, 1, 1]] + + TESTS:: + + sage: StrongTableau([[None, None], [None]], 4).intermediate_shapes() + [[2, 1]] + sage: StrongTableau([],4).intermediate_shapes() + [[]] + """ + return intermediate_shapes(self.to_unmarked_list()) + + def pp( self ): + r""" + Print the strong tableau ``self`` in pretty print format. + + EXAMPLES:: + + sage: T = StrongTableau([[-1,-2,-4,-7],[-3,6,-6,8],[4,7],[-5,-8]], 3, [2,2,3,1]) + sage: T.pp() + -1 -1 -2 -3 + -2 3 -3 4 + 2 3 + -3 -4 + sage: T = StrongTableau([[None, None, -1, -2], [None, None], [-1, -2], [1, 2], [-3], [3], [3], [3]], 4) + sage: T.pp() + . . -1 -2 + . . + -1 -2 + 1 2 + -3 + 3 + 3 + 3 + sage: Tableaux.global_options(convention="French") + sage: T.pp() + 3 + 3 + 3 + -3 + 1 2 + -1 -2 + . . + . . -1 -2 + sage: Tableaux.global_options(convention="English") + """ + print self._repr_diagram() + + def outer_shape( self ): + r""" + Return the outer shape of ``self``. + + This method returns the outer shape of ``self`` as viewed as a ``Core``. + The outer shape of a strong tableau is always a `(k+1)`-core. + + OUTPUT: + + - a `(k+1)`-core + + EXAMPLES:: + + sage: StrongTableau([[None, None, -1, -2], [None, None], [-1, -2], [1, 2], [-3], [3], [3], [3]], 4).outer_shape() + [4, 2, 2, 2, 1, 1, 1, 1] + sage: StrongTableau([[-1,-2,-4,-7],[-3,6,-6,8],[4,7],[-5,-8]], 3, [2,2,3,1]).outer_shape() + [4, 4, 2, 2] + + TESTS:: + + sage: StrongTableau([[None, None], [None]], 4).outer_shape() + [2, 1] + sage: StrongTableau([],4).outer_shape() + [] + """ + return self.parent().outer_shape() + + def inner_shape( self ): + r""" + Return the inner shape of ``self``. + + If ``self`` is a strong skew tableau, then this method returns the inner shape + (the shape of the cells labelled with ``None``). + If ``self`` is not skew, then the inner shape is empty. + + OUTPUT: + + - a `(k+1)`-core + + EXAMPLES:: + + sage: StrongTableau([[None, None, -1, -2], [None, None], [-1, -2], [1, 2], [-3], [3], [3], [3]], 4).inner_shape() + [2, 2] + sage: StrongTableau([[-1,-2,-4,-7],[-3,6,-6,8],[4,7],[-5,-8]], 3, [2,2,3,1]).inner_shape() + [] + + TESTS:: + + sage: StrongTableau([[None, None], [None]], 4).inner_shape() + [2, 1] + sage: StrongTableau([],4).inner_shape() + [] + """ + return self.parent().inner_shape() + + def shape( self ): + r""" + Return the shape of ``self``. + + If ``self`` is a skew tableau then return a pair of `k+1`-cores consisting of the + outer and the inner shape. If ``self`` is strong tableau with no inner shape then + return a `k+1`-core. + + INPUT: + + - ``form`` - optional argument to indicate 'inner', 'outer' or 'skew' (default : 'outer') + + OUTPUT: + + - a `k+1`-core or a pair of `k+1`-cores if form is not 'inner' or 'outer' + + EXAMPLES:: + + sage: T = StrongTableau([[None, None, -1, -2], [None, None], [-1, -2], [1, 2], [-3], [3], [3], [3]], 4) + sage: T.shape() + ([4, 2, 2, 2, 1, 1, 1, 1], [2, 2]) + sage: StrongTableau([[-1, -2, 3], [-3]], 2).shape() + [3, 1] + sage: type(StrongTableau([[-1, -2, 3], [-3]], 2).shape()) + + + TESTS:: + + sage: StrongTableau([[None, None, None], [None]], 2).shape() + ([3, 1], [3, 1]) + sage: StrongTableau([],4).shape() + [] + """ + return self.parent().shape() + + def weight( self ): + r""" + Return the weight of the tableau. + + The weight is a list of non-negative integers indicating the number of 1s, + number of 2s, number of 3s, etc. + + OUTPUT: + + - a list of non-negative integers + + EXAMPLES:: + + sage: T = StrongTableau([[-1, -2, -3, 4], [-4], [-5]], 3); T.weight() + (1, 1, 1, 1, 1) + sage: T.set_weight([3,1,1]).weight() + (3, 1, 1) + sage: StrongTableau([[-1,-1,-2,-3],[-2,3,-3,4],[2,3],[-3,-4]], 3).weight() + (2, 2, 3, 1) + + TESTS:: + + sage: StrongTableau([[None, None], [None]], 4).weight() + () + sage: StrongTableau([],4).weight() + () + """ + return self.parent()._weight + + def size( self ): + """ + Return the size of the strong tableau. + + The size of the strong tableau is the sum of the entries in the + :meth:`weight`. It will also be equal to the length of the + outer shape (as a `k+1`-core) minus the length of the inner shape. + + .. SEEALSO:: :meth:`sage.combinat.core.Core.length` + + OUTPUT: + + - a non-negative integer + + EXAMPLES:: + + sage: StrongTableau([[-1, -2, -3, 4], [-4], [-5]], 3).size() + 5 + sage: StrongTableau([[None, None, -1, 2], [-2], [-3]], 3).size() + 3 + + TESTS:: + + sage: StrongTableau([[None, None], [None]], 4).size() + 0 + sage: StrongTableau([],4).size() + 0 + """ + return sum(self.weight()) + + def to_list( self ): + """ + Return the marked column strict (possibly skew) tableau as a list of lists. + + OUTPUT: + + - a list of lists of integers or ``None`` + + EXAMPLES:: + + sage: StrongTableau([[-1, -2, -3, 4], [-4], [-5]], 3).set_weight([2,1,1,1]).to_list() + [[-1, -1, -2, 3], [-3], [-4]] + sage: StrongTableau([[None, None, -1, -2], [None, None], [-1, -2], [1, 2], [-3], [3], [3], [3]], 4).to_list() + [[None, None, -1, -2], [None, None], [-1, -2], [1, 2], [-3], [3], [3], [3]] + sage: StrongTableau([[-1, -2, -3, 4], [-4], [-5]], 3, [3,1,1]).to_list() + [[-1, -1, -1, 2], [-2], [-3]] + + TESTS:: + + sage: StrongTableau([[None, None], [None]], 4).to_list() + [[None, None], [None]] + sage: StrongTableau([],4).to_list() + [] + """ + def f(v): + # f is a function which maps v or -v to the weight value corresponding to the partition mu + if v is None: + return None + else: + return sgn(v)*min([i for i in range(len(self.weight())+1) if sum(self.weight()[:i])>=abs(v)]) + return [[f(v) for v in row] for row in self.to_standard_list()] + + def to_unmarked_list( self ): + """ + Return the tableau as a list of lists with markings removed. + + Return the list of lists of the rows of the tableau where the markings have been + removed. + + OUTPUT: + + - a list of lists of integers or ``None`` + + EXAMPLES:: + + sage: T = StrongTableau( [[-1, -2, -3, 4], [-4], [-5]], 3, [3,1,1]) + sage: T.to_unmarked_list() + [[1, 1, 1, 2], [2], [3]] + sage: TT = T.set_weight([2,1,1,1]) + sage: TT.to_unmarked_list() + [[1, 1, 2, 3], [3], [4]] + sage: StrongTableau( [[None, None, -1, -2], [None, None], [-1, -2], [1, 2], [-3], [3], [3], [3]], 4).to_unmarked_list() + [[None, None, 1, 2], [None, None], [1, 2], [1, 2], [3], [3], [3], [3]] + + TESTS:: + + sage: StrongTableau([[None, None], [None]], 4).to_unmarked_list() + [[None, None], [None]] + sage: StrongTableau([],4).to_unmarked_list() + [] + """ + return [[nabs(v) for v in row] for row in self.to_list()] + + def to_standard_list(self): + """ + Return the underlying standard strong tableau as a list of lists. + + Internally, for a strong tableau the standard strong tableau and its weight + is stored separately. This method returns the underlying standard part. + + OUTPUT: + + - a list of lists of integers or ``None`` + + EXAMPLES:: + + sage: StrongTableau([[-1, -2, -3, 4], [-4], [-5]], 3, [3,1,1]).to_standard_list() + [[-1, -2, -3, 4], [-4], [-5]] + sage: StrongTableau([[None, None, -1, -2], [None, None], [-1, -2], [1, 2], [-3], [3], [3], [3]], 4).to_standard_list() + [[None, None, -2, -4], [None, None], [-1, -3], [2, 4], [-5], [5], [5], [5]] + + TESTS:: + + sage: StrongTableau([[None, None], [None]], 4).to_standard_list() + [[None, None], [None]] + sage: StrongTableau([],4).to_standard_list() + [] + """ + return self._tableau + + def to_standard_tableau(self): + """ + Return the underlying standard strong tableau as a ``StrongTableau`` object. + + Internally, for a strong tableau the standard strong tableau and its weight + is stored separately. This method returns the underlying standard part as a + ``StrongTableau``. + + OUTPUT: + + - a strong tableau with standard weight + + EXAMPLES:: + + sage: T = StrongTableau([[-1, -2, -3, 4], [-4], [-5]], 3, [3,1,1]) + sage: T.to_standard_tableau() + [[-1, -2, -3, 4], [-4], [-5]] + sage: T.to_standard_tableau() == T.to_standard_list() + False + sage: StrongTableau([[None, None, -1, -2], [None, None], [-1, -2], [1, 2], [-3], [3], [3], [3]], 4).to_standard_tableau() + [[None, None, -2, -4], [None, None], [-1, -3], [2, 4], [-5], [5], [5], [5]] + + TESTS:: + + sage: StrongTableau([[None, None], [None]], 4).to_standard_tableau() + [[None, None], [None]] + sage: StrongTableau([],4).to_standard_tableau() + [] + """ + return StrongTableau(self._tableau, self.k) + + def to_unmarked_standard_list( self ): + """ + Return the standard part of the tableau as a list of lists with markings removed. + + Return the list of lists of the rows of the tableau where the markings have been + removed. + + OUTPUT: + + - a list of lists of integers or ``None`` + + EXAMPLES:: + + sage: StrongTableau( [[-1, -2, -3, 4], [-4], [-5]], 3, [3,1,1]).to_unmarked_standard_list() + [[1, 2, 3, 4], [4], [5]] + sage: StrongTableau( [[None, None, -1, -2], [None, None], [-1, -2], [1, 2], [-3], [3], [3], [3]], 4).to_unmarked_standard_list() + [[None, None, 2, 4], [None, None], [1, 3], [2, 4], [5], [5], [5], [5]] + + TESTS:: + + sage: StrongTableau([[None, None], [None]], 4).to_unmarked_standard_list() + [[None, None], [None]] + sage: StrongTableau([],4).to_unmarked_standard_list() + [] + """ + return map(lambda x: map(nabs,x), self.to_standard_list()) + + def _latex_(self): + r""" + Return a latex method for the tableau. + + EXAMPLES:: + + sage: T = StrongTableau( [[None, -1, -2, 3], [2, -3]], 2, weight=[2,1] ) + sage: Tableaux.global_options(convention = "English") + sage: latex(T) + {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}} + \raisebox{-.6ex}{$\begin{array}[b]{*{4}c}\cline{1-4} + \lr{}&\lr{1^\ast}&\lr{1^\ast}&\lr{2}\\\cline{1-4} + \lr{1}&\lr{2^\ast}\\\cline{1-2} + \end{array}$} + } + sage: Tableaux.global_options(convention = "French") + sage: latex(T) + {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}} + \raisebox{-.6ex}{$\begin{array}[t]{*{4}c}\cline{1-2} + \lr{1}&\lr{2^\ast}\\\cline{1-4} + \lr{}&\lr{1^\ast}&\lr{1^\ast}&\lr{2}\\\cline{1-4} + \end{array}$} + } + """ + def chi(x): + if x==None: + return "" + if x in ZZ: + s = "%s"%abs(x) + if x<0: + s += "^\\ast" + return s + return "%s"%x + T = [[chi(x) for x in row] for row in self.to_list()] + from output import tex_from_array + return tex_from_array(T) + + def restrict( self, r ): + r""" + Restrict the standard part of the tableau to the labels `1, 2, \ldots, r`. + + Return the tableau consisting of the labels of the standard part of ``self`` + restricted to the labels of `1` through ``r``. The result is another + ``StrongTableau`` object. + + INPUT: + + - ``r`` -- an integer + + OUTPUT: + + - A strong tableau + + EXAMPLES:: + + sage: T = StrongTableau([[None, None, -4, 5, -5], [None, None], [-1, -3], [-2], [2], [2], [3]], 4, weight=[1,1,1,1,1]) + sage: T.restrict(3) + [[None, None], [None, None], [-1, -3], [-2], [2], [2], [3]] + sage: TT = T.restrict(0) + sage: TT + [[None, None], [None, None]] + sage: TT == StrongTableau( [[None, None], [None, None]], 4 ) + True + sage: T.restrict(5) == T + True + + TESTS:: + + sage: StrongTableau([[None, None], [None]], 4).restrict(1) + [[None, None], [None]] + sage: StrongTableau([],4).restrict(1) + [] + """ + rr = sum(self.weight()[:r]) + rest_tab = filter(lambda y: len(y)>0, map(lambda row: filter(lambda x: x==None or abs(x)<=rr, row ), self.to_standard_list())) + new_parent = StrongTableaux( self.k, (Core(map(len, rest_tab), self.k+1), self.inner_shape()), self.weight()[:r] ) + return new_parent(rest_tab) + + def set_weight( self, mu ): + """ + Sets a new weight ``mu`` for ``self``. + + This method first tests if the underlying standard tableau is column-strict with + respect to the weight ``mu``. If it is, then it changes the weight and returns + the tableau; otherwise it raises an error. + + INPUT: + + - ``mu`` -- a list of non-negative integers representing the new weight + + EXAMPLES:: + + sage: StrongTableau( [[-1, -2, -3], [3]], 2 ).set_weight( [3] ) + [[-1, -1, -1], [1]] + sage: StrongTableau( [[-1, -2, -3], [3]], 2 ).set_weight( [0,3] ) + [[-2, -2, -2], [2]] + sage: StrongTableau( [[-1, -2, 3], [-3]], 2 ).set_weight( [2, 0, 1] ) + [[-1, -1, 3], [-3]] + sage: StrongTableau( [[-1, -2, 3], [-3]], 2 ).set_weight( [3] ) + Traceback (most recent call last): + ... + ValueError: [[-1, -2, 3], [-3]] is not a semistandard strong tableau with respect to the partition [3] + + TESTS:: + + sage: StrongTableau([[None, None], [None]], 4).set_weight([]) + [[None, None], [None]] + sage: StrongTableau([],4).set_weight([]) + [] + """ + if sum(mu)!=self.size() or self.is_column_strict_with_weight( mu ): + return StrongTableaux.__classcall__(StrongTableaux, self.k, (self.outer_shape(), self.inner_shape()), tuple(mu))(self.to_standard_list()) + else: + raise ValueError("%s is not a semistandard strong tableau with respect to the partition %s"%(self,mu)) + + def left_action( self, tij ): + r""" + Action of transposition ``tij`` on ``self`` by adding marked ribbons. + + Computes the left action of the transposition ``tij`` on the tableau. + If ``tij`` acting on the element of the affine grassmannian raises the length by 1, + then this function will add a cell to the standard tableau. + + INPUT: + + - ``tij`` -- a transposition represented as a pair `(i, j)`. + + OUPUT: + + - ``self`` after it has been modified by the action of the transposition ``tij`` + + EXAMPLES:: + + sage: StrongTableau( [[None, -1, -2, -3], [3], [-4]], 3, weight=[1,1,1,1] ).left_action([0,1]) + [[None, -1, -2, -3, 5], [3, -5], [-4]] + sage: StrongTableau( [[None, -1, -2, -3], [3], [-4]], 3, weight=[1,1,1,1] ).left_action([4,5]) + [[None, -1, -2, -3, -5], [3, 5], [-4]] + sage: T = StrongTableau( [[None, -1, -2, -3], [3], [-4]], 3, weight=[1,1,1,1] ) + sage: T.left_action([-3,-2]) + [[None, -1, -2, -3], [3], [-4], [-5]] + sage: T = StrongTableau( [[None, -1, -2, -3], [3], [-4]], 3, weight=[3,1] ) + sage: T.left_action([-3,-2]) + [[None, -1, -1, -1], [1], [-2], [-3]] + sage: T + [[None, -1, -1, -1], [1], [-2]] + sage: T.check() + sage: T.weight() + (3, 1) + + TESTS:: + + sage: StrongTableau([[None, None], [None]], 4).left_action([-2,-1]) + [[None, None], [None], [-1]] + sage: StrongTableau([],4).left_action([0,1]) + [[-1]] + """ + T = StrongTableaux._left_action_list(copy.deepcopy( self.to_standard_list() ), tij, self.size()+1, self.k) + return StrongTableau( T, self.k, self.weight()+(1,) ) + + def follows_tableau( self ): + r""" + Return a list of strong marked tableaux with length one longer than ``self``. + + Return list of all strong tableaux obtained from ``self`` by extending to a core + which follows the shape of ``self`` in the strong order. + + OUTPUT: + + - a list of strong tableaux which follow ``self`` in strong order + + EXAMPLES:: + + sage: T = StrongTableau([[-1,-2,-4,-7],[-3,6,-6,8],[4,7],[-5,-8]], 3, [2,2,3,1]) + sage: T.follows_tableau() + [[[-1, -1, -2, -3, 5, 5, -5], [-2, 3, -3, 4], [2, 3], [-3, -4]], + [[-1, -1, -2, -3, 5], [-2, 3, -3, 4], [2, 3, 5], [-3, -4], [-5]], + [[-1, -1, -2, -3, 5], [-2, 3, -3, 4], [2, 3, -5], [-3, -4], [5]], + [[-1, -1, -2, -3, -5], [-2, 3, -3, 4], [2, 3, 5], [-3, -4], [5]], + [[-1, -1, -2, -3], [-2, 3, -3, 4], [2, 3], [-3, -4], [-5], [5], [5]]] + sage: StrongTableau([[-1,-2],[-3,-4]],3).follows_tableau() + [[[-1, -2, 5, 5, -5], [-3, -4]], [[-1, -2, 5], [-3, -4], [-5]], + [[-1, -2, -5], [-3, -4], [5]], [[-1, -2], [-3, -4], [-5], [5], [5]]] + + TESTS:: + + sage: StrongTableau([[None, None], [None]], 4).follows_tableau() + [[[None, None, -1], [None]], [[None, None], [None, -1]], [[None, None], [None], [-1]]] + sage: StrongTableau([],4).follows_tableau() + [[[-1]]] + """ + v = self.size()+1 + out = [] + for T in StrongTableaux.follows_tableau_unsigned_standard( self.to_standard_list(), self.k ): + for m in StrongTableaux.cells_head_dictionary(T)[v]: + TT = copy.deepcopy(T) + TT[m[0]][m[1]] = -v + out.append(StrongTableau(TT, self.k, self.weight()+(1,))) + return out + + def spin_of_ribbon( self, v ): + r""" + Return the spin of the ribbon with label ``v`` in the standard part of ``self``. + + The spin of a ribbon is an integer statistic. It is the sum of `(h-1) r` plus + the number of connected components above the marked one where `h` is the height + of the marked ribbon and `r` is the number of connected components. + + .. SEEALSO:: :meth:`height_of_ribbon`, :meth:`number_of_connected_components`, + :meth:`ribbons_above_marked` + + INPUT: + + - ``v`` -- a label of the standard part of the tableau + + OUTPUT: + + - an integer value representing the spin of the ribbon with label ``v``. + + EXAMPLES:: + + sage: T = StrongTableau([[-1,-2,5,6],[-3,-4,-7,8],[-5,-6],[7,-8]], 3) + sage: [T.spin_of_ribbon(v) for v in range(1,9)] + [0, 0, 0, 0, 0, 0, 1, 0] + sage: T = StrongTableau([[None,None,-1,-3],[-2,3,-3,4],[2,3],[-3,-4]], 3) + sage: [T.spin_of_ribbon(v) for v in range(1,7)] + [0, 1, 0, 0, 1, 0] + + TESTS:: + + sage: StrongTableau([[None, None], [None]], 4).spin_of_ribbon(1) + 0 + sage: StrongTableau([],4).spin_of_ribbon(1) + 0 + """ + return (self.height_of_ribbon(v)-1)*self.number_of_connected_components(v)+self.ribbons_above_marked(v) + + def spin( self ): + r""" + Return the spin statistic of the tableau ``self``. + + The spin is an integer statistic on a strong marked tableau. It is + the sum of `(h-1) r` plus the number of connected components above the + marked one where `h` is the height of the marked ribbon and `r` is + the number of connected components. + + .. SEEALSO:: :meth:`height_of_ribbon`, :meth:`number_of_connected_components`, + :meth:`ribbons_above_marked` + + The `k`-Schur functions with a parameter `t` can be defined as + + .. MATH:: + + s^{(k)}_\lambda[X; t] = \sum_T t^{spin(T)} m_{weight(T)}[X] + + where the sum is over all column strict marked strong `k`-tableaux + of shape `\lambda` and partition content. + + OUTPUT: + + - an integer value representing the spin. + + EXAMPLES:: + + sage: StrongTableau([[-1,-2,5,6],[-3,-4,-7,8],[-5,-6],[7,-8]], 3, [2,2,3,1]).spin() + 1 + sage: StrongTableau([[-1,-2,-4,-7],[-3,6,-6,8],[4,7],[-5,-8]], 3, [2,2,3,1]).spin() + 2 + sage: StrongTableau([[None,None,-1,-3],[-2,3,-3,4],[2,3],[-3,-4]], 3).spin() + 2 + sage: ks3 = SymmetricFunctions(QQ['t'].fraction_field()).kschur(3) + sage: t = ks3.realization_of().t + sage: m = ks3.ambient().realization_of().m() + sage: myks221 = sum(sum(t**T.spin() for T in StrongTableaux(3,[3,2,1],weight=mu))*m(mu) for mu in Partitions(5, max_part=3)) + sage: myks221 == m(ks3[2,2,1]) + True + sage: h = ks3.ambient().realization_of().h() + sage: Core([4,4,2,2],4).to_bounded_partition() + [2, 2, 2, 2] + sage: ks3[2,2,2,2].lift().scalar(h[3,3,2]) == sum( t**T.spin() for T in StrongTableaux(3, [4,4,2,2], weight=[3,3,2]) ) + True + + TESTS:: + + sage: StrongTableau([[None, None], [None]], 4).spin() + 0 + sage: StrongTableau([],4).spin() + 0 + """ + return sum(self.spin_of_ribbon(v) for v in range(1,self.size()+1)) + + def to_transposition_sequence( self ): + """ + Return a list of transpositions corresponding to ``self``. + + Given a strong column strict tableau ``self`` returns the the list of transpositions + which when applied to the left of an empty tableau gives the corresponding strong + standard tableau. + + OUTPUT: + + - a list of pairs of values ``[i,j]`` representing the transpositions `t_{ij}` + + EXAMPLES:: + + sage: T = StrongTableau([[-1, -1, -1], [1]],2) + sage: T.to_transposition_sequence() + [[2, 3], [1, 2], [0, 1]] + sage: T = StrongTableau([[-1, -1, 2], [-2]],2) + sage: T.to_transposition_sequence() + [[-1, 0], [1, 2], [0, 1]] + sage: T = StrongTableau([[None, -1, 2, -3], [-2, 3]],2) + sage: T.to_transposition_sequence() + [[3, 4], [-1, 0], [1, 2]] + + TESTS:: + + sage: StrongTableau([[None, None], [None]], 4).to_transposition_sequence() + [] + sage: StrongTableau([],4).to_transposition_sequence() + [] + """ + return StrongTableaux.marked_CST_to_transposition_sequence( self.to_list(), self.k ) + +class StrongTableaux(UniqueRepresentation, Parent): + + def __init__( self, k, shape, weight ): + r""" + TESTS:: + + sage: strongT = StrongTableaux(2, [3,1], weight=[2,1]) + sage: TestSuite(strongT).run() + + sage: strongT = StrongTableaux(0, [2,2], weight=[2,2]) + Traceback (most recent call last): + ... + ValueError: The input k has to be a positive integer + """ + self._outer_shape = shape[0] + self._inner_shape = shape[1] + self.k = k + if weight is None: + self._weight = (1,)*(self._outer_shape.length()-self._inner_shape.length()) + else: + self._weight = weight + Parent.__init__(self, category = FiniteEnumeratedSets()) + + @staticmethod + def __classcall_private__(cls, k, shape, weight=None): + r""" + Straighten arguments before unique representation. + + TESTS:: + + sage: ST3 = StrongTableaux(3, [2,2], weight=[1,1,1,1]) + sage: TestSuite(ST3).run() + """ + if k<=0: + raise ValueError("The input k has to be a positive integer") + if shape==[] or shape[0] in ZZ: + outer_shape = Core(shape,k+1) + inner_shape = Core([],k+1) + else: + outer_shape = Core(shape[0],k+1) + inner_shape = Core(shape[1],k+1) + if weight is not None: + weight = tuple(weight) + return super(StrongTableaux, cls).__classcall__(cls, k, (outer_shape, inner_shape), weight) + + def _repr_( self ): + r""" + Return the representation of ``self``. + + EXAMPLES:: + + sage: StrongTableaux(3, [2,2], weight=[1,1,1,1]) + Set of strong 3-tableaux of shape [2, 2] and of weight (1, 1, 1, 1) + sage: StrongTableaux(3, [2,2]) + Set of strong 3-tableaux of shape [2, 2] and of weight (1, 1, 1, 1) + sage: StrongTableaux(3, [[2,2],[1]], weight=[0,0,2,1]) + Set of strong 3-tableaux of shape [[2, 2], [1]] and of weight (0, 0, 2, 1) + sage: StrongTableaux(3, [[],[]], weight=[]) + Set of strong 3-tableaux of shape [] and of weight () + """ + if self._inner_shape==[]: + s = "Set of strong %s-tableaux"%self.k + s +=" of shape %s"%self._outer_shape + else: + s = "Set of strong %s-tableaux"%self.k + s +=" of shape [%s, %s]"%(self._outer_shape, self._inner_shape) + s +="%sand of weight %s"%(" ",self._weight) + return s + + global_options = TableauOptions + + def an_element(self): + r""" + Return the first generated element of the class of ``StrongTableaux``. + + EXAMPLES:: + + sage: ST = StrongTableaux(3, [3], weight=[3]) + sage: ST.an_element() + [[-1, -1, -1]] + """ + return self.__iter__().next() + + def outer_shape(self): + r""" + Return the outer shape of the class of strong tableaux. + + OUTPUT: + + - a `k+1`-core + + EXAMPLES:: + + sage: StrongTableaux( 2, [3,1] ).outer_shape() + [3, 1] + sage: type(StrongTableaux( 2, [3,1] ).outer_shape()) + + sage: StrongTableaux( 4, [[2,1], [1]] ).outer_shape() + [2, 1] + """ + return self._outer_shape + + def inner_shape(self): + r""" + Return the inner shape of the class of strong tableaux. + + OUTPUT: + + - a `k+1`-core + + EXAMPLES:: + + sage: StrongTableaux( 2, [3,1] ).inner_shape() + [] + sage: type(StrongTableaux( 2, [3,1] ).inner_shape()) + + sage: StrongTableaux( 4, [[2,1], [1]] ).inner_shape() + [1] + """ + return self._inner_shape + + def shape(self): + r""" + Return the shape of ``self``. + + If the ``self`` has an inner shape return a pair consisting of an inner and + an outer shape. If the inner shape is empty then return only the outer shape. + + OUTPUT: + + - a `k+1`-core or a pair of `k+1`-cores + + EXAMPLES:: + + sage: StrongTableaux( 2, [3,1] ).shape() + [3, 1] + sage: type(StrongTableaux( 2, [3,1] ).shape()) + + sage: StrongTableaux( 4, [[2,1], [1]] ).shape() + ([2, 1], [1]) + """ + if self._inner_shape != []: + return (self._outer_shape, self._inner_shape) + return self._outer_shape + + def __iter__(self): + r""" + TESTS:: + + sage: ST = StrongTableaux(3, [4,1], weight=[2,2]) + sage: ST.list() + [[[-1, -1, -2, -2], [2]], [[-1, -1, 2, -2], [-2]]] + sage: ST = StrongTableaux(3, [5,2,2], weight=[2,2,2,1]) + sage: ST.cardinality() + 14 + sage: StrongTableaux(3, [5,2,2], weight=[3,3,1]).list() + [[[-1, -1, -1, -2, -2], [-2, 2], [2, -3]], [[-1, -1, -1, 2, -2], [-2, -2], [2, -3]], [[-1, -1, -1, -2, -3], [-2, -2], [2, 2]]] + sage: StrongTableaux(3, [4,1,1]).cardinality() + 10 + sage: StrongTableaux(3, [5,2,2], weight=[6,1]).list() # there are no strong column strict tableaux of shape [5,2,2] and weight (6,1) + [] + sage: StrongTableaux(3, [[5,2,2], [3,1,1]], weight=[2,1]).list() + [[[None, None, None, -1, -1], [None, 1], [None, -2]], + [[None, None, None, 1, -1], [None, -1], [None, -2]], + [[None, None, None, -1, -2], [None, -1], [None, 1]]] + sage: StrongTableaux(2, [[4,3,3,2,2,1,1], [2,1,1]], weight=[1,1,1,1]).cardinality() + 150 + sage: StrongTableaux(2, [[7,5,3,1], [2,1,1]], weight=[2,2]).cardinality() + 18 + sage: StrongTableaux(2, [[3,1],[3,1]]).list() + [[[None, None, None], [None]]] + sage: StrongTableaux(4, []).list() + [[]] + """ + size = sum(self._weight) + if size==0: + yield self([[None]*(row) for row in self._inner_shape]) + else: + for unT in StrongTableaux.standard_unmarked_iterator( self.k, size, self._outer_shape, self._inner_shape ): + for T in StrongTableaux.marked_given_unmarked_and_weight_iterator( unT, self.k, self._weight ): + yield T + + @classmethod + def standard_unmarked_iterator( cls, k, size, outer_shape=None, inner_shape=[] ): + r""" + An iterator for standard unmarked strong tableaux. + + An iterator which generates all unmarked tableaux of a given ``size`` which are + contained in ``outer_shape`` and which contain the ``inner_shape``. + + These are built recursively by building all standard marked strong tableaux of + size ``size`` `-1` and adding all possible covers. + + If ``outer_shape`` is ``None`` then there is no restriction on the shape of the + tableaux which are created. + + INPUT: + + - ``k``, ``size`` - a positive integers + - ``outer_shape`` - a list representing a `k+1`-core (default: ``None``) + - ``inner_shape`` - a list representing a `k+1`-core (default: []) + + OUTPUT: + + - an iterator which lists all standard strong unmarked tableaux with ``size`` + cells and which are contained in ``outer_shape`` and contain ``inner_shape`` + + EXAMPLES:: + + sage: list(StrongTableaux.standard_unmarked_iterator(2, 3)) + [[[1, 2, 3], [3]], [[1, 2], [3], [3]], [[1, 3, 3], [2]], [[1, 3], [2], [3]]] + sage: list(StrongTableaux.standard_unmarked_iterator(2, 1, inner_shape=[1,1])) + [[[None, 1, 1], [None]], [[None, 1], [None], [1]]] + sage: len(list(StrongTableaux.standard_unmarked_iterator(4,4))) + 10 + sage: len(list(StrongTableaux.standard_unmarked_iterator(4,6))) + 98 + sage: len(list(StrongTableaux.standard_unmarked_iterator(4,4, inner_shape=[2,2]))) + 92 + sage: len(list(StrongTableaux.standard_unmarked_iterator(4,4, outer_shape=[5,2,2,1], inner_shape=[2,2]))) + 10 + + TESTS:: + + sage: list(StrongTableaux.standard_unmarked_iterator(2,0, outer_shape=[3,1], inner_shape=[3,1])) + [[[None, None, None], [None]]] + sage: list(StrongTableaux.standard_unmarked_iterator(4,0, outer_shape=[])) + [[]] + """ + if size==0: + if outer_shape is None or Core(outer_shape,k+1).contains(inner_shape): + yield [[None]*(inner_shape[i]) for i in range(len(inner_shape))] + else: + for T in cls.standard_unmarked_iterator(k, size-1, outer_shape, inner_shape): + for TT in cls.follows_tableau_unsigned_standard(T, k): + if outer_shape is None or Core(outer_shape, k+1).contains(map(len,TT)): + yield TT + + @classmethod + def marked_given_unmarked_and_weight_iterator( cls, unmarkedT, k, weight ): + r""" + An iterator generating strong marked tableaux from an unmarked strong tableau. + + Iterator which lists all marked tableaux of weight ``weight`` such that the + standard unmarked part of the tableau is equal to ``unmarkedT``. + + INPUT: + + - ``unmarkedT`` - a list of lists representing a strong unmarked tableau + - ``k`` - a positive integer + - ``weight`` - a list of non-negative integers indicating the weight + + OUTPUT: + + - an iterator that returns ``StrongTableau`` objects + + EXAMPLES:: + + sage: ST = StrongTableaux.marked_given_unmarked_and_weight_iterator([[1,2,3],[3]], 2, [3]) + sage: list(ST) + [[[-1, -1, -1], [1]]] + sage: ST = StrongTableaux.marked_given_unmarked_and_weight_iterator([[1,2,3],[3]], 2, [0,3]) + sage: list(ST) + [[[-2, -2, -2], [2]]] + sage: ST = StrongTableaux.marked_given_unmarked_and_weight_iterator([[1,2,3],[3]], 2, [1,2]) + sage: list(ST) + [[[-1, -2, -2], [2]]] + sage: ST = StrongTableaux.marked_given_unmarked_and_weight_iterator([[1,2,3],[3]], 2, [2,1]) + sage: list(ST) + [[[-1, -1, 2], [-2]], [[-1, -1, -2], [2]]] + sage: ST = StrongTableaux.marked_given_unmarked_and_weight_iterator([[None, None, 1, 2, 4], [2, 4], [3]], 3, [3,1]) + sage: list(ST) + [] + sage: ST = StrongTableaux.marked_given_unmarked_and_weight_iterator([[None, None, 1, 2, 4], [2, 4], [3]], 3, [2,2]) + sage: list(ST) + [[[None, None, -1, -1, 2], [1, -2], [-2]], + [[None, None, -1, -1, -2], [1, 2], [-2]]] + + TESTS:: + + sage: list(StrongTableaux.marked_given_unmarked_and_weight_iterator([[None, None, None],[None]], 2, [])) + [[[None, None, None], [None]]] + sage: list(StrongTableaux.marked_given_unmarked_and_weight_iterator([], 4, weight=[])) + [[]] + """ + td = StrongTableaux.cells_head_dictionary( unmarkedT ) + if td == {}: # the tableau is empty + yield StrongTableau( unmarkedT, k, [] ) + else: + allmarkings = cartesian_product.CartesianProduct(*[td[v] for v in td.keys()]) + dsc = Composition(weight).descents() + for m in allmarkings: + if all(((m[i][1]-m[i][0]=len(Tlist): + Tlist.append([]) + Tlist[c[0]].append( v ) + if len(Tlist[c[0]])-c[0]==tij[1]: + Tlist[c[0]][-1] = -Tlist[c[0]][-1] #mark the cell that is on the j-1 diagonal + return Tlist + else: + raise ValueError("%s is not a single step up in the strong lattice"%tij) + + @classmethod + def follows_tableau_unsigned_standard( cls, Tlist, k ): + r""" + Return a list of strong tableaux one longer in length than ``Tlist``. + + Return list of all standard strong tableaux obtained from ``Tlist`` by extending to + a core which follows the shape of ``Tlist`` in the strong order. It does not put + the markings on the last entry that it adds but it does keep the markings on all + entries smaller. The objects returned are not ``StrongTableau`` objects (and + cannot be) because the last entry will not properly marked. + + INPUT: + + - ``Tlist`` -- a filling of a `k+1`-core as a list of lists + - ``k`` - an integer + + OUTPUT: + + - a list of strong tableaux which follow ``Tlist`` in strong order + + EXAMPLES:: + + sage: StrongTableaux.follows_tableau_unsigned_standard([[-1, -1, -2, -3], [-2, 3, -3, 4], [2, 3], [-3, -4]], 3) + [[[-1, -1, -2, -3, 5, 5, 5], [-2, 3, -3, 4], [2, 3], [-3, -4]], + [[-1, -1, -2, -3, 5], [-2, 3, -3, 4], [2, 3, 5], [-3, -4], [5]], + [[-1, -1, -2, -3], [-2, 3, -3, 4], [2, 3], [-3, -4], [5], [5], [5]]] + sage: StrongTableaux.follows_tableau_unsigned_standard([[None,-1],[-2,-3]],3) + [[[None, -1, 4, 4, 4], [-2, -3]], [[None, -1, 4], [-2, -3], [4]], + [[None, -1], [-2, -3], [4], [4], [4]]] + + TESTS:: + + sage: StrongTableaux.follows_tableau_unsigned_standard([[None, None, None], [None]], 2) + [[[None, None, None, 1], [None, 1]], [[None, None, None], [None], [1]]] + sage: StrongTableaux.follows_tableau_unsigned_standard([], 4) + [[[1]]] + """ + v = max([0]+[abs(v) for rows in Tlist for v in rows if v is not None])+1 + out = [] + sh = Core(map(len, Tlist), k+1) + for ga in sh.strong_covers(): + T = copy.deepcopy(Tlist) + T += [[] for i in range(len(ga)-len(T))] + for c in SkewPartition([ga.to_partition(), sh.to_partition()]).cells(): + T[c[0]] += [v] + out.append(T) + return out + + @classmethod + def standard_marked_iterator( cls, k, size, outer_shape=None, inner_shape=[] ): + r""" + An iterator for generating standard strong marked tableaux. + + An iterator which generates all standard marked `k`-tableaux of a given ``size`` + which are contained in ``outer_shape`` and contain the ``inner_shape``. + If ``outer_shape`` is ``None`` then there is no restriction on the shape of the + tableaux which are created. + + INPUT: + + - ``k`` - a positive integer + - ``size`` - a positive integer + - ``outer_shape`` - a list which is a `k+1`-core (default: ``None``) + - ``inner_shape`` - a list which is a `k+1`-core (default: []) + + OUPUT: + + - an iterator which returns the standard marked tableaux with ``size`` cells + and that are contained in ``outer_shape`` and contain ``inner_shape`` + + EXAMPLES:: + + sage: list(StrongTableaux.standard_marked_iterator(2, 3)) + [[[-1, -2, 3], [-3]], [[-1, -2, -3], [3]], [[-1, -2], [-3], [3]], [[-1, 3, -3], [-2]], [[-1, 3], [-2], [-3]], [[-1, -3], [-2], [3]]] + sage: list(StrongTableaux.standard_marked_iterator(2, 1, inner_shape=[1,1])) + [[[None, 1, -1], [None]], [[None, 1], [None], [-1]], [[None, -1], [None], [1]]] + sage: len(list(StrongTableaux.standard_marked_iterator(4,4))) + 10 + sage: len(list(StrongTableaux.standard_marked_iterator(4,6))) + 140 + sage: len(list(StrongTableaux.standard_marked_iterator(4,4, inner_shape=[2,2]))) + 200 + sage: len(list(StrongTableaux.standard_marked_iterator(4,4, outer_shape=[5,2,2,1], inner_shape=[2,2]))) + 24 + + TESTS:: + + sage: list(StrongTableaux.standard_marked_iterator(2,0,inner_shape=[3,1])) + [[[None, None, None], [None]]] + sage: list(StrongTableaux.standard_marked_iterator(4,0)) + [[]] + """ + for T in cls.standard_unmarked_iterator( k, size, outer_shape, inner_shape ): + for TT in cls.marked_given_unmarked_and_weight_iterator( T, k, [1]*(size) ): + yield TT + + @classmethod + def cells_head_dictionary( cls, T ): + r""" + Return a dictionary with the locations of the heads of all markings. + + Return a dictionary of values and lists of cells where the heads with the values + are located in a strong standard unmarked tableau ``T``. + + INPUT: + + - ``T`` -- a strong standard unmarked tableau as a list of lists + + OUPUT: + + - a dictionary with keys the entries in the tableau and values are the coordinates + of the heads with those entries + + EXAMPLES:: + + sage: StrongTableaux.cells_head_dictionary([[1,2,4,7],[3,6,6,8],[4,7],[5,8]]) + {1: [(0, 0)], + 2: [(0, 1)], + 3: [(1, 0)], + 4: [(2, 0), (0, 2)], + 5: [(3, 0)], + 6: [(1, 2)], + 7: [(2, 1), (0, 3)], + 8: [(3, 1), (1, 3)]} + sage: StrongTableaux.cells_head_dictionary([[None, 2, 2, 4, 5, 6, 6, 6], [None, 3, 6, 6, 6], [1, 4]]) + {1: [(2, 0)], + 2: [(0, 2)], + 3: [(1, 1)], + 4: [(2, 1), (0, 3)], + 5: [(0, 4)], + 6: [(1, 4), (0, 7)]} + + TESTS:: + + sage: StrongTableaux.cells_head_dictionary([[None, None, None],[None]]) + {} + sage: StrongTableaux.cells_head_dictionary([]) + {} + """ + if T==[]: + return {} + ST = SkewTableau(T) + dout = {} + for i in range(-len(T),len(T[0])): + nextv = ST.entries_by_content(i+1) + for c in ST.cells_by_content(i): + v = T[c[0]][c[1]] + if not v in nextv: + if v in dout.keys(): + dout[v] += [c] + else: + dout[v] = [c] + return dout + + @classmethod + def marked_CST_to_transposition_sequence( self, T, k ): + """ + Return a list of transpositions corresponding to ``T``. + + Given a strong column strict tableau ``T`` returns the the list of transpositions + which when applied to the left of an empty tableau gives the corresponding strong + standard tableau. + + INPUT: + + - ``T`` - a non-empty column strict tableau as a list of lists + - ``k`` - a positive integer + + OUTPUT: + + - a list of pairs of values ``[i,j]`` representing the transpositions `t_{ij}` + + EXAMPLES:: + + sage: StrongTableaux.marked_CST_to_transposition_sequence([[-1, -1, -1], [1]], 2) + [[2, 3], [1, 2], [0, 1]] + sage: StrongTableaux.marked_CST_to_transposition_sequence([], 2) + [] + sage: StrongTableaux.marked_CST_to_transposition_sequence([[-2, -2, -2], [2]], 2) + [[2, 3], [1, 2], [0, 1]] + + TESTS:: + + sage: StrongTableaux.marked_CST_to_transposition_sequence([[None, None, None], [None]], 2) + [] + sage: StrongTableaux.marked_CST_to_transposition_sequence([], 4) + [] + """ + LL = list(T) + marks = [v for row in T for v in row if v!=None and v<0]+[0] + m = -min(marks) # the largest marked cell + transeq = [] # start with the empty list and append on the right + sh = Core(map(len,T), k+1) + for v in range(m,0,-1): + for j in range(len(LL[0]),-len(LL)-1,-1): + if -v in [LL[i][i+j] for i in range(len(LL)) if len(LL[i])>j+i and i+j>=0]: + for l in range(k): + msh = sh.affine_symmetric_group_action([j-l,j+1],transposition=True) + # my worry here is that the affine symmetric group action might apply an invalid + # transposition but get something of the right length anyway. How do I test if it is applying + # a valid or invalid transposition? + if msh.length()==sh.length()-1: + # if applying t_{j-l,j+1} reduces the size of the shape by 1 + valcells = [LL[c[0]][c[1]] for c in SkewPartition([sh.to_partition(),msh.to_partition()]).cells()] + if all(x!=None for x in valcells) and all(abs(x)==v for x in valcells) and filter( lambda x: x==-v, valcells )==[-v]: + # if all values are \pm v and exactly one of them is -v + transeq.append([j-l, j+1]) + LL = [[LL[a][b] for b in range(len(LL[a])) if (a,b) in msh.to_partition().cells()] for a in range(len(msh.to_partition()))] + sh = msh + if LL==[]: + return transeq + return transeq + + @classmethod + def transpositions_to_standard_strong( self, transeq, k, emptyTableau=[] ): + """ + Return a strong tableau correponding to a sequence of transpositions. + + This method returns the action by left multiplication on the empty strong tableau + by transpositions specified by ``transeq``. + + INPUT: + + - ``transeq`` -- a sequence of transpositions `t_{ij}` (a list of pairs). + - ``emptyTableau`` -- (default: ``[]``) an empty list or a skew strong tableau + possibly consisting of ``None`` entries + + OUTPUT: + + - a ``StrongTableau`` object + + EXAMPLES:: + + sage: StrongTableaux.transpositions_to_standard_strong([[0,1]], 2) + [[-1]] + sage: StrongTableaux.transpositions_to_standard_strong([[-2,-1], [2,3]], 2, [[None, None]]) + [[None, None, -1], [1], [-2]] + sage: StrongTableaux.transpositions_to_standard_strong([[2, 3], [1, 2], [0, 1]], 2) + [[-1, -2, -3], [3]] + sage: StrongTableaux.transpositions_to_standard_strong([[-1, 0], [1, 2], [0, 1]], 2) + [[-1, -2, 3], [-3]] + sage: StrongTableaux.transpositions_to_standard_strong([[3, 4], [-1, 0], [1, 2]], 2, [[None]]) + [[None, -1, 2, -3], [-2, 3]] + + TESTS:: + + sage: StrongTableaux.transpositions_to_standard_strong([], 2, [[None, None, None], [None]]) + [[None, None, None], [None]] + sage: StrongTableaux.transpositions_to_standard_strong([], 4, []) + [] + """ + out = copy.deepcopy(emptyTableau) + for i in range(1,len(transeq)+1): + out = StrongTableaux._left_action_list(out, transeq[-i], i, k) + return StrongTableau(out, k, weight = (1,)*len(transeq)) + + Element = StrongTableau + +#### common or global functions related to weak/strong tableaux + +def nabs(v): + r""" + Return the absolute value of ``v`` or ``None``. + + INPUT: + + - ``v`` -- either an integer or ``None`` + + OUTPUT: + + - either a non-negative integer or ``None`` + + EXAMPLES:: + + sage: from sage.combinat.k_tableau import nabs + sage: nabs(None) + sage: nabs(-3) + 3 + sage: nabs(None) + """ + if v is None: + return v + else: + return abs(v) + +def intermediate_shapes(t): + r""" + Return the intermediate shapes of tableau ``t``. + + A (skew) tableau with letters `1, 2,\ldots, \ell` can be viewed as a sequence of + shapes, where the `i`-th shape is given by the shape of the subtableau on letters + `1, 2, \ldots, i`. The output is the list of these shapes. + + OUTPUT: + + - a list of lists representing partitions + + EXAMPLES:: + + sage: from sage.combinat.k_tableau import intermediate_shapes + sage: t = WeakTableau([[1, 1, 2, 2, 3], [2, 3], [3]],3) + sage: intermediate_shapes(t) + [[], [2], [4, 1], [5, 2, 1]] + + sage: t = WeakTableau([[None, None, 2, 3, 4], [1, 4], [2]], 3) + sage: intermediate_shapes(t) + [[2], [2, 1], [3, 1, 1], [4, 1, 1], [5, 2, 1]] + """ shapes = [] t = SkewTableau(list(t)) for i in range(len(t.weight())+1): From bc71b7301e755ba7e8c6e91d1579f0bbf1c1177e Mon Sep 17 00:00:00 2001 From: Frederic Chapoton Date: Wed, 21 Aug 2013 21:28:43 +0200 Subject: [PATCH 49/85] Trac #10674: make coverage working for .sage files --- src/bin/sage-coverage | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/bin/sage-coverage b/src/bin/sage-coverage index 5283dd55d91..c258faee260 100755 --- a/src/bin/sage-coverage +++ b/src/bin/sage-coverage @@ -203,7 +203,9 @@ def go(filename): print("File %s does not exist."%filename, file=sys.stderr) sys.exit(1) - if not (filename.endswith('.py') or filename.endswith('.pyx')): + if not (filename.endswith('.py') + or filename.endswith('.pyx') + or filename.endswith('.sage')): return global first From 94a5c1af93268ed7d08794faef9c1ad10d69374d Mon Sep 17 00:00:00 2001 From: "R. Andrew Ohana" Date: Wed, 21 Aug 2013 17:15:58 -0700 Subject: [PATCH 50/85] [FIXUP] 5.12.beta3: update git specific files These currently include * VERSION.txt * package-version.txt * checksums.ini --- VERSION.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION.txt b/VERSION.txt index a595ea6b4f8..86ca765821f 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -Sage version 5.12.beta2, released 2013-08-20 +Sage version 5.12.beta3, released 2013-08-21 From 98d08406c5e290f3d8ebc3b319504d2008744acb Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Thu, 22 Aug 2013 12:11:53 -0700 Subject: [PATCH 51/85] Fix doctest doctest due to directory restructure. --- src/sage/doctest/control.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/doctest/control.py b/src/sage/doctest/control.py index d8a9ac4971e..d0a93f2c36b 100644 --- a/src/sage/doctest/control.py +++ b/src/sage/doctest/control.py @@ -142,7 +142,7 @@ def skipdir(dirname): sage: from sage.doctest.control import skipdir sage: skipdir(sage.env.SAGE_SRC) False - sage: skipdir(os.path.join(SAGE_ROOT, "devel", "sagenb", "sagenb", "data")) + sage: skipdir(os.path.join(sage.env.SAGE_SRC, "sage", "doctest", "tests")) True """ if os.path.exists(os.path.join(dirname, "nodoctest.py")): From 59c84473d939542d5c7abbef350341c92f1a9bd4 Mon Sep 17 00:00:00 2001 From: Dmitrii Pasechnik Date: Sat, 14 Sep 2013 01:01:47 +0800 Subject: [PATCH 52/85] Trac #15194: added imports and doctests for MIPSolver exceptions --- src/sage/coding/delsarte_bounds.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/sage/coding/delsarte_bounds.py b/src/sage/coding/delsarte_bounds.py index 3c8bd47d4e2..7fa1f9377a4 100644 --- a/src/sage/coding/delsarte_bounds.py +++ b/src/sage/coding/delsarte_bounds.py @@ -155,6 +155,12 @@ def delsarte_bound_hamming_space(n, d, q, sage: delsarte_bound_hamming_space(11,3,4) 327680/3 + Such an input is invalid:: + + sage: delsarte_bound_hamming_space(11,3,-4) + Solver exception: 'PPL : There is no feasible solution' () + False + REFERENCES: .. [1] P. Delsarte, An algebraic approach to the association schemes of coding theory, @@ -163,10 +169,11 @@ def delsarte_bound_hamming_space(n, d, q, """ + from sage.numerical.mip import MIPSolverException A, p = _delsarte_LP_building(n, d, 0, q, isinteger, solver) try: bd=p.solve() - except sage.numerical.mip.MIPSolverException, exc: + except MIPSolverException, exc: print "Solver exception: ", exc, exc.args if return_data: return A,p,False @@ -235,7 +242,14 @@ def delsarte_bound_additive_hamming_space(n, d, q, d_star=1, q_base=0, sage: delsarte_bound_additive_hamming_space(11,3,4,q_base=2) 16 + Such a d_star is not possible:: + + sage: delsarte_bound_additive_hamming_space(11,3,4,d_star=9) + Solver exception: 'PPL : There is no feasible solution' () + False + """ + from sage.numerical.mip import MIPSolverException if q_base == 0: q_base = q @@ -260,7 +274,7 @@ def delsarte_bound_additive_hamming_space(n, d, q, d_star=1, q_base=0, A, p = _delsarte_LP_building(n, d, d_star, q, isinteger, solver, q_base**m) try: bd=p.solve() - except sage.numerical.mip.MIPSolverException, exc: + except MIPSolverException, exc: print "Solver exception: ", exc, exc.args if return_data: return A,p,False From 18be736d849f757025675abe1765f84f2cc3770f Mon Sep 17 00:00:00 2001 From: Paul Zimmermann Date: Sat, 24 Aug 2013 09:14:00 +0200 Subject: [PATCH 53/85] Trac #13770: bug in multivariate factorization over prime fields --- .../rings/polynomial/multi_polynomial_libsingular.pyx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx b/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx index 66d3fcbac2d..311bf235a77 100644 --- a/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx +++ b/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx @@ -4004,6 +4004,14 @@ cdef class MPolynomial_libsingular(sage.rings.polynomial.multi_polynomial.MPolyn sage: factor(p*q) (x^2 + y^2 + x + 1) * (x^4 + x^2*y^2 + y^4 + x*y^2 + x^2 + y^2 + 1) + Check that :trac:`13770` is fixed:: + + sage: U. = GF(2)[] + sage: f = y*t^8 + y^5*t^2 + y*t^6 + t^7 + y^6 + y^5*t + y^2*t^4 + y^2*t^2 + y^2*t + t^3 + y^2 + t^2 + sage: l = f.factor() + sage: l[0][0]==t^2 + y + t + 1 or l[1][0]==t^2 + y + t + 1 + True + The following used to sometimes take a very long time or get stuck, see :trac:`12846`. These 100 iterations should take less than 1 second:: From a77c210547018db1d8bd8915e85937adc6485f15 Mon Sep 17 00:00:00 2001 From: Jeroen Demeyer Date: Mon, 26 Aug 2013 15:54:15 +0200 Subject: [PATCH 54/85] Trac #13770: Add upstream pull request 215 for multivariate factorisation --- build/pkgs/singular/.hgignore | 4 +- build/pkgs/singular/SPKG.txt | 8 + build/pkgs/singular/install-sh | 246 ------------------ .../singular/patches/pullrequest215.patch | 230 ++++++++++++++++ build/pkgs/singular/spkg-install | 29 +-- 5 files changed, 252 insertions(+), 265 deletions(-) delete mode 100755 build/pkgs/singular/install-sh create mode 100644 build/pkgs/singular/patches/pullrequest215.patch diff --git a/build/pkgs/singular/.hgignore b/build/pkgs/singular/.hgignore index 2c2707e8d72..970ce7af9db 100644 --- a/build/pkgs/singular/.hgignore +++ b/build/pkgs/singular/.hgignore @@ -1,2 +1,2 @@ -^src/ - +^src/latest +^src/shared diff --git a/build/pkgs/singular/SPKG.txt b/build/pkgs/singular/SPKG.txt index c0a8a4c8f9b..e1194aa82b7 100644 --- a/build/pkgs/singular/SPKG.txt +++ b/build/pkgs/singular/SPKG.txt @@ -64,6 +64,8 @@ See spkg-src. * osx_link.patch: #14415: Fixes linker problems on OS X PPC. * sanitize_gmp_header_hack.patch: Fix and simplify generation of `factory/cf_gmp.h` (cf. #14737). + * pullrequest215.patch: Backport of first 3 patches from + https://github.com/Singular/Sources/pull/215 Other notes * The option '--without-dynamic-kernel' is used on *all* @@ -91,6 +93,12 @@ Other notes == ChangeLog == +=== singular-3-1-5.p9 (Paul Zimmermann, Jeroen Demeyer, 26 August 2013) === + * #13770: Add upstream pull request 215 for multivariate factorisation. + * spkg-install: split apply_patches step in 2 steps: choose_patches and + apply_patches; add a few small fixes. + * Remove install-sh which is no longer needed. + === singular-3-1-5.p8 (Leif Leonhardy, Volker Braun, 10 July 2013) === * #14737: Fix and simplify generation of `factory/cf_gmp.h` (by adding `patches/sanitize_gmp_header_hack.patch`). diff --git a/build/pkgs/singular/install-sh b/build/pkgs/singular/install-sh deleted file mode 100755 index 406f5672bb7..00000000000 --- a/build/pkgs/singular/install-sh +++ /dev/null @@ -1,246 +0,0 @@ -#!/bin/sh -# -# install - install a program, script, or datafile -# This comes from X11R5. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. -# - - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -tranformbasename="" -transform_arg="" -instcmd="$mvprog" -chmodcmd="$chmodprog 0755" -chowncmd="" -chgrpcmd="" -stripcmd="" -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src="" -dst="" -dir_arg="" - -while [ x"$1" != x ]; do - case $1 in - -c) instcmd="$cpprog" - shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - -s) stripcmd="$stripprog" - shift - continue;; - - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; - - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; - - *) if [ x"$src" = x ] - then - src=$1 - else - # this colon is to work around a 386BSD /bin/sh bug - : - dst=$1 - fi - shift - continue;; - esac -done - -if [ x"$src" = x ] -then - echo "install: no input file specified" - exit 1 -else - true -fi - -if [ x"$dir_arg" != x ]; then - dst=$src - src="" - - if [ -d $dst ]; then - instcmd=: - else - instcmd=mkdir - fi -else - -# Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad -# if $src (and thus $dsttmp) contains '*'. - -# obachman 6/15/98 -# Here is an ugly fix for a bug in cygwin -# '[ test -f $src ]' evaluates to true, even if only $src.exe exists -# However 'cp $src $dst' can not find $src, if only $src.exe exists - if test -f "$src.exe" && test -x "$src.exe"; then - src="$src.exe" - true - elif [ -f $src -o -d $src ] - then - true - else - echo "install: $src does not exist" - exit 1 - fi - - if [ x"$dst" = x ] - then - echo "install: no destination specified" - exit 1 - else - true - fi - -# If destination is a directory, append the input filename; if your system -# does not like double slashes in filenames, you may need to add some logic - - if [ -d $dst ] - then - dst="$dst"/`basename $src` - else - true - fi -fi - -## this sed command emulates the dirname command -dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` - -# Make sure that the destination directory exists. -# this part is taken from Noah Friedman's mkinstalldirs script - -# Skip lots of stat calls in the usual case. -if [ ! -d "$dstdir" ]; then -defaultIFS=' -' -IFS="${IFS-${defaultIFS}}" - -oIFS="${IFS}" -# Some sh's can't handle IFS=/ for some reason. -IFS='%' -set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` -IFS="${oIFS}" - -pathcomp='' - -while [ $# -ne 0 ] ; do - pathcomp="${pathcomp}${1}" - shift - - if [ ! -d "${pathcomp}" ] ; - then - $mkdirprog "${pathcomp}" - else - true - fi - - pathcomp="${pathcomp}/" -done -fi - -if [ x"$dir_arg" != x ] -then - $doit $instcmd $dst && - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi -else - -# If we're going to rename the final executable, determine the name now. - - if [ x"$transformarg" = x ] - then - dstfile=`basename $dst` - else - echo "basename $dst $transformbasename | sed $transformarg$transformbasename" - dstfile=`basename $dst $transformbasename | - sed $transformarg`$transformbasename - fi - -# don't allow the sed command to completely eliminate the filename - - if [ x"$dstfile" = x ] - then - dstfile=`basename $dst` - else - true - fi - -# Make a temp file name in the proper directory. - - dsttmp=$dstdir/#inst.$$# - -# Move or copy the file name to the temp name - - $doit $instcmd $src $dsttmp && - - trap "rm -f ${dsttmp}" 0 && - -# and set any options; do chmod last to preserve setuid bits - -# If any of these fail, we abort the whole thing. If we want to -# ignore errors from any of these, just make sure not to ignore -# errors from the above "$doit $instcmd $src $dsttmp" command. - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && - -# Now rename the file to the real destination. - - $doit $rmcmd -f $dstdir/$dstfile && - $doit $mvcmd $dsttmp $dstdir/$dstfile - -fi && - - -exit 0 diff --git a/build/pkgs/singular/patches/pullrequest215.patch b/build/pkgs/singular/patches/pullrequest215.patch new file mode 100644 index 00000000000..c26c8795111 --- /dev/null +++ b/build/pkgs/singular/patches/pullrequest215.patch @@ -0,0 +1,230 @@ +diff -ru latest/factory/facFqBivar.cc b/factory/facFqBivar.cc +--- latest/factory/facFqBivar.cc 2012-07-12 16:24:57.000000000 +0200 ++++ b/factory/facFqBivar.cc 2013-08-26 14:09:25.479601121 +0200 +@@ -403,7 +403,9 @@ + delete [] v; + if (recombination) + { +- appendTestMapDown (result, buf (y - eval, y), info, source, ++ buf= buf (y-eval,y); ++ buf /= Lc (buf); ++ appendTestMapDown (result, buf, info, source, + dest); + F= 1; + return result; +@@ -430,7 +432,9 @@ + delete [] v; + if (recombination) + { +- appendTestMapDown (result, buf (y - eval, y), info, source, dest); ++ buf= buf (y-eval,y); ++ buf /= Lc (buf); ++ appendTestMapDown (result, buf, info, source, dest); + F= 1; + return result; + } +@@ -1616,6 +1620,8 @@ + buf= mod (buf, yToL); + buf /= content (buf, x); + buf2= buf (y-evaluation, y); ++ buf2 /= Lc (buf2); ++ buf2 /= Lc (buf2); + if (!k && beta == x) + { + if (degree (buf2, alpha) < 1) +@@ -1738,6 +1744,8 @@ + { + tmp1= tmp1 (y - evaluation, y); + tmp2= tmp2 (y - evaluation, y); ++ tmp1 /= Lc (tmp1); ++ tmp2 /= Lc (tmp2); + if (!k && beta == x && degree (tmp2, alpha) < 1 && + degree (tmp1, alpha) < 1) + { +@@ -1792,6 +1800,8 @@ + buf= mod (buf, yToL); + buf /= content (buf, x); + buf2= buf (y - evaluation, y); ++ buf2 /= Lc (buf2); ++ buf2 /= Lc (buf2); + if (!k && beta == x) + { + if (degree (buf2, alpha) < 1) +@@ -2650,9 +2660,12 @@ + if (isIrreducible) + { + delete [] bounds; +- CanonicalForm G= F; ++ Variable y= Variable (2); ++ CanonicalForm tmp= F (y - evaluation, y); ++ CFList source, dest; ++ tmp= mapDown (tmp, info, source, dest); + F= 1; +- return CFList (G); ++ return CFList (tmp); + } + + CFArray * A= new CFArray [factors.length()]; +@@ -4327,11 +4340,11 @@ + else + { + i= 1; +- while ((degree (F,y)/4)*i + 4 <= smallFactorDeg) ++ while ((degree (F,y)/4+1)*i + 4 <= smallFactorDeg) + i++; + while (i < 5) + { +- dummy= tmin (degree (F,y)+1, (degree (F,y)/4)*i+4); ++ dummy= tmin (degree (F,y)+1, (degree (F,y)/4+1)*i+4); + if (l < dummy) + { + factors.insert (LCF); +@@ -4471,11 +4484,11 @@ + else + { + i= 1; +- while ((degree (F,y)/4)*i + 4 <= smallFactorDeg) ++ while ((degree (F,y)/4+1)*i + 4 <= smallFactorDeg) + i++; + while (i < 5) + { +- dummy= tmin (degree (F,y)+1, (degree (F,y)/4)*i+4); ++ dummy= tmin (degree (F,y)+1, (degree (F,y)/4+1)*i+4); + if (l < dummy) + { + factors.insert (LCF); +@@ -4619,11 +4632,11 @@ + else + { + i= 1; +- while ((degree (F,y)/4)*i + 4 <= smallFactorDeg) ++ while (((degree (F,y)/4)*i+1) + 4 <= smallFactorDeg) + i++; + while (i < 5) + { +- dummy= tmin (degree (F,y)+1, (degree (F,y)/4)*i+4); ++ dummy= tmin (degree (F,y)+1, ((degree (F,y)/4)+1)*i+4); + if (l < dummy) + { + factors.insert (LCF); +@@ -5020,12 +5033,12 @@ + CanonicalForm bufF= F; + int factorsFound= 0; + if (alpha.level() == 1 || (alpha.level() != 1 && reduceFq2Fp)) +- reconstructionTry (result, bufF, bufUniFactors, degree (F) + 1 + degree +- (LCF), factorsFound, factorsFoundIndex, NTLN, false ++ reconstructionTry (result, bufF, bufUniFactors, degree (F) + 1, ++ factorsFound, factorsFoundIndex, NTLN, false + ); + else +- reconstructionTry (result, bufF, bufUniFactors, degree (F) + 1 + degree +- (LCF), factorsFound, factorsFoundIndex, NTLNe, false ++ reconstructionTry (result, bufF, bufUniFactors, degree (F) + 1, ++ factorsFound, factorsFoundIndex, NTLNe, false + ); + if (alpha.level() == 1 || (alpha.level() != 1 && reduceFq2Fp)) + { +@@ -5336,7 +5349,7 @@ + if (minBound > 16 || result.length() == 0) + { + result= Union (result, smallFactors); +- CanonicalForm MODl= power (y, degree (F) + 1 + degree (LC (F, 1))); ++ CanonicalForm MODl= power (y, degree (F) + 1); + delete [] bounds; + return Union (result, factorRecombination (bufUniFactors, F, MODl, degs, 1, + bufUniFactors.length()/2 +@@ -5585,7 +5598,7 @@ + delete [] bounds; + return Union (smallFactors, extFactorRecombination + (bufUniFactors, F, +- power (y, degree (F) + 1 + degree (LCF)),info, ++ power (y, degree (F) + 1),info, + degs, evaluation, 1, bufUniFactors.length()/2 + ) + ); +@@ -5638,8 +5651,8 @@ + CanonicalForm bufF= F; + int factorsFound= 0; + +- extReconstructionTry (result, bufF, bufUniFactors, degree (F) + 1 + degree +- (LCF), factorsFound, factorsFoundIndex, NTLN, false, ++ extReconstructionTry (result, bufF, bufUniFactors, degree (F) + 1, ++ factorsFound, factorsFoundIndex, NTLN, false, + info, evaluation + ); + +@@ -5767,7 +5780,10 @@ + result= Union (result, smallFactors); + if (degs.getLength() == 1 || bufUniFactors.length() == 1) + { +- result.append (bufF); ++ CFList source, dest; ++ CanonicalForm tmp= bufF (y - evaluation, y); ++ tmp= mapDown (tmp, info, source, dest); ++ result.append (tmp); + return result; + } + return Union (result, extHenselLiftAndLatticeRecombi (bufF, bufUniFactors, +@@ -5834,7 +5850,7 @@ + if (minBound > 16 || result.length() == 0) + { + result= Union (result, smallFactors); +- CanonicalForm MODl= power (y, degree (F) + 1 + degree (LC (F, 1))); ++ CanonicalForm MODl= power (y, degree (F) + 1); + delete [] bounds; + return Union (result, extFactorRecombination (bufUniFactors, F, MODl, info, + degs, evaluation, 1, +@@ -6116,7 +6132,7 @@ + return factors; + } + +- if (i == 0) ++ if (i == 0 && !extension) + { + if (subCheck1 > 0) + { +diff -ru latest/factory/facFqBivarUtil.cc b/factory/facFqBivarUtil.cc +--- latest/factory/facFqBivarUtil.cc 2012-07-12 16:24:57.000000000 +0200 ++++ b/factory/facFqBivarUtil.cc 2013-08-26 14:09:38.979597772 +0200 +@@ -494,16 +494,21 @@ + //middle product style computation of [G*oldQ]^{l}_{oldL} + CanonicalForm G3= div (G, xToOldL); + CanonicalForm Up= mulMod2 (G3, oldQ, xToLOldL); +- CanonicalForm xToOldL2= power (x, oldL/2); ++ CanonicalForm xToOldL2= power (x, (oldL+1)/2); + CanonicalForm G2= mod (G, xToOldL); + CanonicalForm G1= div (G2, xToOldL2); + CanonicalForm G0= mod (G2, xToOldL2); + CanonicalForm oldQ1= div (oldQ, xToOldL2); + CanonicalForm oldQ0= mod (oldQ, xToOldL2); +- CanonicalForm Mid= mulMod2 (G1, oldQ1, xToLOldL); ++ CanonicalForm Mid; ++ if (oldL % 2 == 1) ++ Mid= mulMod2 (G1, oldQ1*x, xToLOldL); ++ else ++ Mid= mulMod2 (G1, oldQ1, xToLOldL); + //computation of Low might be faster using a real middle product? + CanonicalForm Low= mulMod2 (G0, oldQ1, xToOldL)+mulMod2 (G1, oldQ0, xToOldL); +- Low= div (Low, xToOldL2); ++ Low= div (Low, power (x, oldL/2)); ++ Low= mod (Low, xToLOldL); + Up += Mid + Low; + bufF= div (F, xToOldL); + bufF -= Up; +diff -ru latest/factory/facMul.cc b/factory/facMul.cc +--- latest/factory/facMul.cc 2012-07-12 16:24:57.000000000 +0200 ++++ b/factory/facMul.cc 2013-08-26 14:09:38.979597772 +0200 +@@ -2720,13 +2720,6 @@ + divrem (A, B, Q, R); + return; + } +- if (!(B.level() == 1 && B.isUnivariate()) && +- (A.level() == 1 && A.isUnivariate())) +- { +- Q= 0; +- R= A; +- return; +- } + + Variable x= Variable (1); + int degB= degree (B, x); diff --git a/build/pkgs/singular/spkg-install b/build/pkgs/singular/spkg-install index c11aaf0ee5b..02382ad08a2 100755 --- a/build/pkgs/singular/spkg-install +++ b/build/pkgs/singular/spkg-install @@ -68,17 +68,12 @@ if [ "x$SAGE64" = xyes ]; then fi fi -CPPFLAGS="-I$SAGE_LOCAL/include $CPPFLAGS" +export CPPFLAGS="-I$SAGE_LOCAL/include $CPPFLAGS" # we are building everything fPIC, this might impose a slight # performance hit, need to evaluate: - -CXXFLAGS="$CXXFLAGS -fPIC" -CFLAGS="$CFLAGS -fPIC" - -export CXXFLAGS -export CFLAGS -export CPPFLAGS +export CXXFLAGS="$CXXFLAGS -fPIC" +export CFLAGS="$CFLAGS -fPIC" # The Sun assembler has problems with -pipe, so disable it. @@ -88,7 +83,7 @@ if [ "$UNAME" = "SunOS" ]; then fi -apply_patches() +choose_patches() { cd "$PATCHES" || return $? @@ -105,12 +100,14 @@ apply_patches() mv configure_omalloc "$SRC/omalloc/configure" mv conditional/singular_xalloc.patch . || return $? fi +} +apply_patches() +{ # Apply all patches - cd "$SRC" || return $? - for patch in `ls "$PATCHES"/*.patch`; do + for patch in "$PATCHES"/*.patch; do [ -r "$patch" ] || continue # Skip non-existing or non-readable patches - echo "Applying $patch" + echo "Applying $patch" patch -p1 <"$patch" if [ $? -ne 0 ]; then echo >&2 "Error applying '$patch'" @@ -129,8 +126,6 @@ remove_old_version() config() { - cd "$SRC" || return $? - # configure notes: # 1) We really need to add --exec-prefix and --bindir as Singular # uses some wierd defaults. @@ -229,7 +224,7 @@ build_libsingular() build_factory() { - cd "$SRC/factory" || return $? + cd factory || return $? $MAKE distclean @@ -272,7 +267,7 @@ build_factory() build_libfac() { - cd "$SRC/libfac" || return $? + cd libfac || return $? $MAKE distclean @@ -308,7 +303,7 @@ install_docs() # Actually run all the functions defined above -for i in apply_patches remove_old_version config \ +for i in choose_patches apply_patches remove_old_version config \ build_singular build_libsingular build_factory build_libfac \ create_singular_script install_docs ; do echo "### Singular spkg-install: $i ###" From 1f954cde1cc5a920c6fc956ace1f5a314e3000f0 Mon Sep 17 00:00:00 2001 From: Eviatar Bach Date: Wed, 28 Aug 2013 09:58:07 -0700 Subject: [PATCH 55/85] Trac #14694: fixing doctest for SymPy 0.7.3 --- src/sage/calculus/test_sympy.py | 4 ++-- src/sage/misc/ascii_art.py | 4 ++-- src/sage/misc/displayhook.py | 2 +- src/sage/symbolic/constants.py | 6 ++++-- src/sage/symbolic/integration/integral.py | 17 +++++++++++------ 5 files changed, 20 insertions(+), 13 deletions(-) diff --git a/src/sage/calculus/test_sympy.py b/src/sage/calculus/test_sympy.py index 9bb41f44eff..660ab24b724 100644 --- a/src/sage/calculus/test_sympy.py +++ b/src/sage/calculus/test_sympy.py @@ -125,8 +125,8 @@ sage: pprint(f) 2 4 6 8 - 3*x 11*x 241*x 8651*x - 1 + ---- + ----- + ------ + ------- + O(x**10) + 3*x 11*x 241*x 8651*x / 10\ + 1 + ---- + ----- + ------ + ------- + O\x / 2 8 240 13440 sage: pprint_use_unicode(prev_use) False diff --git a/src/sage/misc/ascii_art.py b/src/sage/misc/ascii_art.py index 681581a43c8..685c309dc85 100644 --- a/src/sage/misc/ascii_art.py +++ b/src/sage/misc/ascii_art.py @@ -804,10 +804,10 @@ def ascii_art(obj): TESTS:: sage: n = var('n') - sage: ascii_art(sum(binomial(2*n,n+1)*x^n, n, 0, oo)) + sage: ascii_art(sum(binomial(2 * n, n + 1) * x^n, n, 0, oo)) / __________ \ -\2*x + \/ -4*x + 1 - 1/ - ------------------------- + -------------------------- __________ 2*x*\/ -4*x + 1 sage: ascii_art(list(DyckWords(3))) diff --git a/src/sage/misc/displayhook.py b/src/sage/misc/displayhook.py index 04418eaccd0..18cdb8dca22 100644 --- a/src/sage/misc/displayhook.py +++ b/src/sage/misc/displayhook.py @@ -25,7 +25,7 @@ sage: shell.run_cell('integral(x^2/pi^x, x)') / 2 2 \ -x*log(pi) -\x *log (pi) + 2*x*log(pi) + 2/*e - -------------------------------------------- + --------------------------------------------- 3 log (pi) sage: shell.run_cell("i = var('i')") diff --git a/src/sage/symbolic/constants.py b/src/sage/symbolic/constants.py index 646b3d32f42..f2d8cdc7667 100644 --- a/src/sage/symbolic/constants.py +++ b/src/sage/symbolic/constants.py @@ -711,9 +711,11 @@ def _sympy_(self): EXAMPLES:: - sage: import sympy - sage: sympy.nan == NaN # indirect doctest + sage: bool(NaN._sympy_()._sage_() == NaN) True + sage: import sympy + sage: sympy.nan == NaN # this should be fixed + False """ import sympy return sympy.nan diff --git a/src/sage/symbolic/integration/integral.py b/src/sage/symbolic/integration/integral.py index 38755f773a5..e692ae67a7c 100644 --- a/src/sage/symbolic/integration/integral.py +++ b/src/sage/symbolic/integration/integral.py @@ -468,14 +468,19 @@ def integrate(expression, v=None, a=None, b=None, algorithm=None): We can also use Sympy:: - sage: _ = var('x, y, z') - sage: (x^y-z).integrate(y) - -y*z + x^y/log(x) - sage: (x^y-z).integrate(y,algorithm="sympy") + sage: integrate(x*sin(log(x)), x) + -1/5*x^2*(cos(log(x)) - 2*sin(log(x))) + sage: integrate(x*sin(log(x)), x, algorithm='sympy') + -1/5*x^2*cos(log(x)) + 2/5*x^2*sin(log(x)) + sage: _ = var('y, z') + sage: (x^y - z).integrate(y) -y*z + x^y/log(x) + sage: (x^y - z).integrate(y, algorithm="sympy") # see Trac #14694 + Traceback (most recent call last): + ... + AttributeError: 'Piecewise' object has no attribute '_sage_' - - We integrate the above function in maple now:: + We integrate the above function in Maple now:: sage: g = maple(f); g # optional - maple sin(x^2)+y^z From f788a530a75aedd3f6bad6758645de06ca237bb0 Mon Sep 17 00:00:00 2001 From: Volker Braun Date: Fri, 30 Aug 2013 21:04:36 +0100 Subject: [PATCH 56/85] Trac #15045: Other workaround for shared library bug without static libraries --- build/pkgs/atlas/SPKG.txt | 7 +++++++ .../atlas/patches/do_not_force_mutex.patch | 18 ++++++++++++++++++ build/pkgs/atlas/spkg-install | 8 ++------ 3 files changed, 27 insertions(+), 6 deletions(-) create mode 100644 build/pkgs/atlas/patches/do_not_force_mutex.patch diff --git a/build/pkgs/atlas/SPKG.txt b/build/pkgs/atlas/SPKG.txt index 79057cc931f..4c4d918898d 100644 --- a/build/pkgs/atlas/SPKG.txt +++ b/build/pkgs/atlas/SPKG.txt @@ -36,6 +36,9 @@ Solaris, but should also work on OSX and Cygwin. * patches/threads.patch: Avoid thread-related symbols ATL_(Set|Reset|Free|Dec)AtomicCount symbols in single-threaded library. + * patches/do_not_force_mutex.patch: always use assembly over mutex + since the mutex version fails to build a shared library. See #15045 + for details. * lapack-x.y.z.tgz: The netlib lapack tarball. If you update this, make sure you also update the LAPACK_TARBALL variable in spkg-install. @@ -92,6 +95,10 @@ The package can be configured via three environment variables: == ChangeLog == +=== atlas-3.10.1.p5, lapack-3.4.2 (Volker Braun, 30 August 2013) === + * Trac #15045: Another workaround for shared library bug that does + not involve static libraries + === atlas-3.10.1.p4, lapack-3.4.2 (Volker Braun, 14 August 2013) === * Trac #15045: Workaround for shared library bug, non-deterministically affecting some old platforms diff --git a/build/pkgs/atlas/patches/do_not_force_mutex.patch b/build/pkgs/atlas/patches/do_not_force_mutex.patch new file mode 100644 index 00000000000..5db61bd7889 --- /dev/null +++ b/build/pkgs/atlas/patches/do_not_force_mutex.patch @@ -0,0 +1,18 @@ +Always use assembly over mutex since the mutex version fails to build +a shared library. See #15045 for details. + +diff --git a/tune/threads/tune_count.c b/tune/threads/tune_count.c +index f09717f..4dc3fde 100644 +--- a/tune/threads/tune_count.c ++++ b/tune/threads/tune_count.c +@@ -241,8 +241,8 @@ int main(int nargs, char **args) + */ + if (tmut < tldec*1.02) + { +- printf("\nNO REAL ADVANTAGE TO ASSEMBLY, FORCING USE OF MUTEX\n"); +- ATL_assert(!system("make iForceUseMutex")); ++ printf("\nNO REAL ADVANTAGE TO ASSEMBLY OVER MUTEX\n"); ++ printf("\nASSEMBLY/MUTEX ratio is %.2f, but we'll stick with assembly anyway\n", tldec/tmut); + } + } + free(timearr); diff --git a/build/pkgs/atlas/spkg-install b/build/pkgs/atlas/spkg-install index 442b0ae0b77..c1845085bf5 100755 --- a/build/pkgs/atlas/spkg-install +++ b/build/pkgs/atlas/spkg-install @@ -529,12 +529,8 @@ build_and_save_archdef() ###################################################################### rc = make_atlas_library('shared') -if rc!=0: - print 'Failed to install ATLAS single-threaded shared library' - print 'This is bad. Using static library as last resort.' - INSTALL_STATIC_LIBRARIES = True -else: - print 'Installed ATLAS single-threaded shared library' +assert_success(rc, bad='Failed to install ATLAS single-threaded shared library', + good='Installed ATLAS single-threaded shared library') rc = make_atlas_library('ptshared') if rc!=0: From b446364c0081886e9883ebf6a9ad6d6d1fa7e50b Mon Sep 17 00:00:00 2001 From: "R. Andrew Ohana" Date: Fri, 30 Aug 2013 16:05:52 -0700 Subject: [PATCH 57/85] [FIXUP] 5.12.beta4: update git specific files These currently include * VERSION.txt * package-version.txt * checksums.ini --- VERSION.txt | 2 +- build/pkgs/ipython/checksums.ini | 6 +++--- build/pkgs/ipython/package-version.txt | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/VERSION.txt b/VERSION.txt index 86ca765821f..287f0a854ec 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -Sage version 5.12.beta3, released 2013-08-21 +Sage version 5.12.beta4, released 2013-08-30 diff --git a/build/pkgs/ipython/checksums.ini b/build/pkgs/ipython/checksums.ini index 2dcd45bc5db..3170fc4b6e7 100644 --- a/build/pkgs/ipython/checksums.ini +++ b/build/pkgs/ipython/checksums.ini @@ -1,3 +1,3 @@ -sha1=1076f8ddcaa3f51e5febac9d8fdb39e789c22a1d -md5=3108fd91d47e2a87e17b92834f5e79d8 -cksum=2751286105 +sha1=b533236e5c5d4f85bbc654c2bfe890dbb9e68b8e +md5=29585ef7a2e4396527fa64de11c36e59 +cksum=4222531866 diff --git a/build/pkgs/ipython/package-version.txt b/build/pkgs/ipython/package-version.txt index c317a91891f..9beb74d490b 100644 --- a/build/pkgs/ipython/package-version.txt +++ b/build/pkgs/ipython/package-version.txt @@ -1 +1 @@ -0.13.1 +0.13.2 From 7e07dc481885c363963f05a781e64dc06e030eb8 Mon Sep 17 00:00:00 2001 From: Julian Rueth Date: Fri, 19 Jul 2013 22:40:47 +0200 Subject: [PATCH 58/85] split SAGE_REPO variable into SAGE_REPO_ANONYMOUS and SAGE_REPO_AUTHENTICATED Conflicts: src/sage/dev/git_interface.py src/sage/env.py --- src/bin/sage-env | 10 +++++++--- src/bin/sage-upgrade | 4 ++-- src/sage/env.py | 11 ++++++++--- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/bin/sage-env b/src/bin/sage-env index c9f8802a97a..afb372021d4 100644 --- a/src/bin/sage-env +++ b/src/bin/sage-env @@ -314,9 +314,13 @@ if [ "$SAGE_UPSTREAM" = "" ]; then SAGE_UPSTREAM="http://www.sagemath.org/packages/upstream/" export SAGE_UPSTREAM fi -if [ -z "$SAGE_REPO" ]; then - SAGE_REPO="git://github.com/sagemath/sage.git" - export SAGE_REPO +if [ -z "$SAGE_REPO_ANONYMOUS" ]; then + SAGE_REPO_ANONYMOUS="git://github.com/sagemath/sage.git" + export SAGE_REPO_ANONYMOUS +fi +if [ -z "$SAGE_REPO_AUTHENTICATED" ]; then + SAGE_REPO_AUTHENTICATED="ssh://git@trac.sagemath.org:2222/sage.git" + export SAGE_REPO_AUTHENTICATED fi if [ -z "$SAGE_DISTFILES" ]; then SAGE_DISTFILES="$SAGE_ROOT/upstream" diff --git a/src/bin/sage-upgrade b/src/bin/sage-upgrade index 55432d1dda4..f875eaccc42 100755 --- a/src/bin/sage-upgrade +++ b/src/bin/sage-upgrade @@ -18,7 +18,7 @@ usage () { [ "$#" -le 2 ] || die `usage` if [ "$#" -gt 0 ]; then - SAGE_REPO="$1" + SAGE_REPO_ANONYMOUS="$1" shift fi @@ -53,7 +53,7 @@ if [ -z "$BRANCH" ]; then exit 1 fi -git pull "$SAGE_REPO" "$BRANCH" +git pull "$SAGE_REPO_ANONYMOUS" "$BRANCH" hash -r sage-real-upgrade diff --git a/src/sage/env.py b/src/sage/env.py index 082ea574d19..132bb05c92f 100644 --- a/src/sage/env.py +++ b/src/sage/env.py @@ -99,11 +99,16 @@ def _add_variable_or_fallback(key, fallback, force=False): _add_variable_or_fallback('SAGE_SPKG_INST', opj('$SAGE_LOCAL', 'var', 'lib', 'sage', 'installed')) _add_variable_or_fallback('SAGE_DOC', opj('$SAGE_SRC', 'doc')) _add_variable_or_fallback('DOT_SAGE', opj(os.environ.get('HOME','$SAGE_ROOT'), '.sage')) +_add_variable_or_fallback('SAGE_DOT_GIT', opj('$SAGE_ROOT', '.git')) # misc -_add_variable_or_fallback('SAGE_URL', 'http://sage.math.washington.edu/sage/') -_add_variable_or_fallback('SAGE_VERSION', version.version) -_add_variable_or_fallback('SAGE_DATE', version.date) +_add_variable_or_fallback('SAGE_URL', 'http://sage.math.washington.edu/sage/') +_add_variable_or_fallback('REALM', 'sage.math.washington.edu') +_add_variable_or_fallback('TRAC_SERVER_URI', 'https://trac.sagemath.org') +_add_variable_or_fallback('SAGE_REPO_AUTHENTICATED', 'ssh://git@trac.sagemath.org:2222/sage.git') +_add_variable_or_fallback('SAGE_REPO_ANONYMOUS', 'git://github.com/sagemath/sage.git') +_add_variable_or_fallback('SAGE_VERSION', version.version) +_add_variable_or_fallback('SAGE_DATE', version.date) # post process if ' ' in DOT_SAGE: From 270e30db131785c7073d5c81a2cced62b6a8ade5 Mon Sep 17 00:00:00 2001 From: "R. Andrew Ohana" Date: Fri, 30 Aug 2013 22:08:56 -0700 Subject: [PATCH 59/85] fix up some small issues with bdist/sdist --- src/bin/sage | 5 +---- src/bin/sage-bdist | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/bin/sage b/src/bin/sage index 19d403249c9..eda06a1e221 100755 --- a/src/bin/sage +++ b/src/bin/sage @@ -834,6 +834,7 @@ if [ "$1" = '-pkg_nc' -o "$1" = "--pkg_nc" ]; then fi if [ "$1" = '-sdist' -o "$1" = "--sdist" ]; then + maybe_sage_location shift exec sage-sdist "$@" fi @@ -848,10 +849,6 @@ if [ "$1" = '-rsyncdist' -o "$1" = "--rsyncdist" ]; then fi if [ "$1" = '-bdist' -o "$1" = "--bdist" ]; then - if [ $# -ne 2 ]; then - echo >&2 "** MISSING VERSION NUMBER! **" - exit 2 - fi maybe_sage_location shift exec sage-bdist "$@" diff --git a/src/bin/sage-bdist b/src/bin/sage-bdist index c7650175a33..cfdd9c14e99 100755 --- a/src/bin/sage-bdist +++ b/src/bin/sage-bdist @@ -42,7 +42,7 @@ mkdir -p "$TMP_DIR/$TARGET" # Clone Sage repository echo "Cloning Sage repository..." git clone "$SAGE_ROOT" "$TMP_DIR/$TARGET" -( cd "$TMP_DIR/$TARGET" && git remote set-url origin git://github.com/sagemath/sage.git ) +( cd "$TMP_DIR/$TARGET" && git remote set-url origin "$SAGE_REPO_ANONYMOUS" ) # Copy VERSION.txt (which is untracked) cp -p VERSION.txt "$TMP_DIR/$TARGET" From b1c867dd6379470e30c03538f0fefb701ac053e5 Mon Sep 17 00:00:00 2001 From: "R. Andrew Ohana" Date: Fri, 30 Aug 2013 22:09:48 -0700 Subject: [PATCH 60/85] bit of cleanup with the upgrade process --- src/bin/sage-real-upgrade | 5 +++++ src/bin/sage-upgrade | 26 +++++++++++++------------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/bin/sage-real-upgrade b/src/bin/sage-real-upgrade index 38a79c24c0e..a813888f9f4 100755 --- a/src/bin/sage-real-upgrade +++ b/src/bin/sage-real-upgrade @@ -1,5 +1,7 @@ #!/usr/bin/env bash +set -e + # People often move the Sage install right before doing the upgrade, so it's # important to fix any path hardcoding issues first, or certain library # links will fail. @@ -8,3 +10,6 @@ sage-location # Run make with SAGE_UPGRADING set export SAGE_UPGRADING=yes make + +# check to make sure sage still starts +sage-starts diff --git a/src/bin/sage-upgrade b/src/bin/sage-upgrade index f875eaccc42..249459204e3 100755 --- a/src/bin/sage-upgrade +++ b/src/bin/sage-upgrade @@ -7,7 +7,7 @@ cd "$SAGE_ROOT" CMD="${0##*/}" die () { - echo >&2 "$@" + echo >&2 -e "$@" exit 1 } @@ -40,20 +40,20 @@ else fi if [ -z "$BRANCH" ]; then - echo >&2 "You are not using a one of the following" - echo >&2 "supported branchs/tags for upgrading:" - echo >&2 - echo >&2 " release" - echo >&2 " beta" - echo >&2 " master" - echo >&2 " 5.9" - echo >&2 " 5.10" - echo >&2 " 6.0" - echo >&2 " ..." - exit 1 + die "You are not using a one of the following supported branchs/tags for upgrading:\n\n" \ + " release\n beta\n master\n 5.9\n 5.11\n 6.0\n ..." fi -git pull "$SAGE_REPO_ANONYMOUS" "$BRANCH" +# portable way to create a random 40 character string, that even works with Solaris' gimped head command. +while [ ${#RAND} -lt 40 ]; do + RAND=${RAND}$(< /dev/urandom tr -cd '_A-Z-a-z-0-9\n' | head -1 | tr -d '\n') +done +RAND=${RAND:0:40} + +git fetch "$SAGE_REPO_ANONYMOUS" "$BRANCH":$RAND || die "There was a failure downloading Sage's sources. Please make sure you are connected to the internet. Aborting..." + +git merge $RAND || { git merge --abort || true; git branch -D $RAND; die "There was a failure updating Sage's sources, aborting..."; } +git branch -d $RAND hash -r sage-real-upgrade From 85d11f673ccfbc93ea0d19110dcf250033f4fe57 Mon Sep 17 00:00:00 2001 From: "R. Andrew Ohana" Date: Fri, 30 Aug 2013 22:11:24 -0700 Subject: [PATCH 61/85] deps: fix/remove some old references --- build/deps | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/build/deps b/build/deps index 013232ccd7d..0c6985ea201 100644 --- a/build/deps +++ b/build/deps @@ -1,16 +1,11 @@ ############################################################################### -# This file ($SAGE_ROOT/spkg/standard/deps) will be copied into -# $SAGE_ROOT/spkg/Makefile by $SAGE_ROOT/spkg/install +# This file ($SAGE_ROOT/build/deps) will be copied into +# $SAGE_ROOT/build/Makefile by $SAGE_ROOT/build/install ############################################################################### -# Let e.g. SAGE_ROOT/spkg/install pass options to sage-spkg, i.e. currently +# Let e.g. SAGE_ROOT/build/install pass options to sage-spkg, i.e. currently # "-f", to force rebuilding dependent packages during an upgrade (#9896). -# -# When upgrading from a 4.x version of Sage, the script "sage-spkg" will be -# found in SAGE_ROOT/local/bin until the new sage_root repo is installed. -# After that, it will be found in SAGE_ROOT/spkg/bin -# (SAGE_ROOT/spkg/bin is added to the PATH in spkg/install). -# Therefore, do not put an explicit path for sage-spkg here. + SAGE_SPKG = sage-spkg $${SAGE_SPKG_OPTS} PIPE = $(SAGE_ROOT)/build/pipestatus @@ -118,7 +113,7 @@ all-sage: \ csage \ extcode -# TOOLCHAIN consists of dependencies determined by spkg/install, +# TOOLCHAIN consists of dependencies determined by build/install, # including for example the GCC package. toolchain: $(TOOLCHAIN) From 79fd21f5cc21ce72eb4770c78324651f5e90bd3e Mon Sep 17 00:00:00 2001 From: "R. Andrew Ohana" Date: Fri, 30 Aug 2013 22:11:58 -0700 Subject: [PATCH 62/85] sage-spkg: fix misleading message for `sage --info` --- src/bin/sage-spkg | 2 +- src/sage/tests/cmdline.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bin/sage-spkg b/src/bin/sage-spkg index 78a67de0b15..b1486078692 100755 --- a/src/bin/sage-spkg +++ b/src/bin/sage-spkg @@ -284,7 +284,7 @@ elif [ -z "$PKG_HAS_PATH" ]; then fi USE_LOCAL_SCRIPTS=yes PKG_NAME_UPSTREAM="${PKG_BASE}-`echo $PKG_VER | sed 's/\.p[0-9][0-9]*$//'`" - echo "Using local scripts to install $PKG_NAME" + echo "Found local metadata for $PKG_NAME" if [ $INFO -eq 0 ]; then # see if we can the source tarball locally diff --git a/src/sage/tests/cmdline.py b/src/sage/tests/cmdline.py index 7e45f0f0107..1c3961454e3 100644 --- a/src/sage/tests/cmdline.py +++ b/src/sage/tests/cmdline.py @@ -200,7 +200,7 @@ def test_executable(args, input="", timeout=100.0, **kwds): sage: out, err, ret = test_executable(["sage", "--info", "sqlalchemy"]) sage: print out - Using local scripts to install sqlalchemy-... + Found local metadata for sqlalchemy-... = SQLAlchemy = ... SQLAlchemy is the Python SQL toolkit... From 6d4882c1d7a435d246bac6c519a33c58f1f2efc9 Mon Sep 17 00:00:00 2001 From: "R. Andrew Ohana" Date: Fri, 30 Aug 2013 22:32:40 -0700 Subject: [PATCH 63/85] sage-spkg: update header comment to reflect current status of script --- src/bin/sage-spkg | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/bin/sage-spkg b/src/bin/sage-spkg index b1486078692..cad789b28ef 100755 --- a/src/bin/sage-spkg +++ b/src/bin/sage-spkg @@ -10,6 +10,7 @@ # -s: do not delete temporary build directory # -c: after installing, run the test suite for the spkg. This should # override the settings of SAGE_CHECK and SAGE_CHECK_PACKAGES. +# -d: only download the package # # A package may assume that the following environment # variables are defined: @@ -26,12 +27,15 @@ # This script does the following: # # 1. Set environment variables (by calling sage-env) -# 2. Decompress package into a build directory +# 2. Extract the metadata and upstream sources into a build directory # 3. Run the script in the package called spkg-install # 4. Return error 1 if anything goes wrong. # # AUTHORS: # +# - Robert Bradshaw, R. Andrew Ohana (2013): #14480: extend functionality to +# support the unified git repository. +# # - Jeroen Demeyer (2012-02-27): #12602: refactor code to find packages, # download them and extract them. # From 64b4c713528d369cbf15a9ed846561cbea68d884 Mon Sep 17 00:00:00 2001 From: "R. Andrew Ohana" Date: Fri, 30 Aug 2013 22:43:17 -0700 Subject: [PATCH 64/85] src/MANIFEST.in: update (probably needs a bit more still) --- src/MANIFEST.in | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/MANIFEST.in b/src/MANIFEST.in index a24a4df142d..2431792287b 100644 --- a/src/MANIFEST.in +++ b/src/MANIFEST.in @@ -1,15 +1,11 @@ global-include *.c *.cc *.cpp *.h *.hh *.hpp *.inc *.py *.pyx *.pxd *.pxi *.rst *.txt *.tex -graft .hg -include .hgignore .hgtags include MANIFEST.in -include bundle export install pull sage-push -include spkg-delauto spkg-dist spkg-install include c_lib/SConstruct graft sage/server/notebook/templates graft sage/libs/gap/test -recursive-include sage README +recursive-include sage recursive-exclude sage/ext/interpreters *.c *.h *.pyx *.pxd exclude sage/libs/pari/gen.h exclude sage/modular/arithgroup/farey_symbol.h From 0085e864c468af840f4dd2f1d7a9aa0115b6f3d1 Mon Sep 17 00:00:00 2001 From: "R. Andrew Ohana" Date: Fri, 30 Aug 2013 23:15:24 -0700 Subject: [PATCH 65/85] [FIXUP] git spkg: update git specific files These currently include * VERSION.txt * package-version.txt * checksums.ini --- build/pkgs/git/checksums.ini | 3 +++ build/pkgs/git/package-version.txt | 1 + 2 files changed, 4 insertions(+) create mode 100644 build/pkgs/git/checksums.ini create mode 100644 build/pkgs/git/package-version.txt diff --git a/build/pkgs/git/checksums.ini b/build/pkgs/git/checksums.ini new file mode 100644 index 00000000000..d9f0f44d191 --- /dev/null +++ b/build/pkgs/git/checksums.ini @@ -0,0 +1,3 @@ +sha1=8cce24a390595d6e62c3aa66bef332ab95900173 +md5=9b178a549f64e6f896b634e76ce4c1a6 +cksum=3835145085 diff --git a/build/pkgs/git/package-version.txt b/build/pkgs/git/package-version.txt new file mode 100644 index 00000000000..dc374d5e1c4 --- /dev/null +++ b/build/pkgs/git/package-version.txt @@ -0,0 +1 @@ +1.7.12.2.p0 From 728e542453259b59b7e012f382e141652671d425 Mon Sep 17 00:00:00 2001 From: "R. Andrew Ohana" Date: Fri, 30 Aug 2013 23:21:52 -0700 Subject: [PATCH 66/85] sage-bdist: VERSION.txt is now tracked --- src/bin/sage-bdist | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/bin/sage-bdist b/src/bin/sage-bdist index cfdd9c14e99..1e1ecb89452 100755 --- a/src/bin/sage-bdist +++ b/src/bin/sage-bdist @@ -44,9 +44,6 @@ echo "Cloning Sage repository..." git clone "$SAGE_ROOT" "$TMP_DIR/$TARGET" ( cd "$TMP_DIR/$TARGET" && git remote set-url origin "$SAGE_REPO_ANONYMOUS" ) -# Copy VERSION.txt (which is untracked) -cp -p VERSION.txt "$TMP_DIR/$TARGET" - echo "Done cloning Sage repository." echo "Copying files over to tmp directory" From 6912669a7da6c5754663fb9a0ef6d29cdb73f38b Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Wed, 28 Aug 2013 22:04:57 -0700 Subject: [PATCH 67/85] Fix --new option for doctests. --- .gitignore | 8 ++------ src/sage/doctest/control.py | 41 ++++++++++++++++--------------------- 2 files changed, 20 insertions(+), 29 deletions(-) diff --git a/.gitignore b/.gitignore index b59740af6c5..50bfc48db38 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,2 @@ -*.pyc -/.BUILDSTART -/dist -/local -/logs -/upstream +ignored +ignored_dir \ No newline at end of file diff --git a/src/sage/doctest/control.py b/src/sage/doctest/control.py index d0a93f2c36b..d4c38c81167 100644 --- a/src/sage/doctest/control.py +++ b/src/sage/doctest/control.py @@ -441,7 +441,7 @@ def add_files(self): 'sagenb' """ opj = os.path.join - from sage.env import SAGE_SRC + from sage.env import SAGE_SRC, SAGE_ROOT if self.options.all: self.log("Doctesting entire Sage library.") from glob import glob @@ -450,28 +450,23 @@ def add_files(self): self.files.extend(glob(opj(SAGE_SRC, 'doc', '[a-z][a-z]'))) self.options.sagenb = True elif self.options.new: - # Get all files changed in the working repo, as well as all - # files in the top Mercurial queue patch. - from sage.misc.hg import hg_sage - out, err = hg_sage('status --rev qtip^', interactive=False, debug=False) - if not err: - qtop = hg_sage('qtop', interactive=False, debug=False)[0].strip() - self.log("Doctesting files in mq patch " + repr(qtop)) - else: # Probably mq isn't used - out, err = hg_sage('status', interactive=False, debug=False) - if not err: - self.log("Doctesting files changed since last hg commit") - else: - raise RuntimeError("failed to run hg status:\n" + err) - - for X in out.split('\n'): - tup = X.split() - if len(tup) != 2: continue - c, filename = tup - if c in ['M','A']: - filename = opj(SAGE_SRC, filename) - if not skipfile(filename): - self.files.append(filename) + # Get all files changed in the working repo. + import subprocess + change = subprocess.check_output(["git", + "--git-dir=" + SAGE_ROOT + "/.git", + "--work-tree=" + SAGE_ROOT, + "status", + "--porcelain"]) + self.log("Doctesting files changed since last git commit") + for line in change.split("\n"): + if not line: + continue + data = line.strip().split(' ') + status, filename = data[0], data[-1] + if (set(status).issubset("MARCU") + and filename.startswith("src/sage") + and (filename.endswith(".py") or filename.endswith(".pyx"))): + self.files.append(filename) if self.options.sagenb: if not self.options.all: self.log("Doctesting the Sage notebook.") From c7903c067f0fa949bcd09e6e60c6c306dee26ab4 Mon Sep 17 00:00:00 2001 From: "R. Andrew Ohana" Date: Sun, 1 Sep 2013 01:36:09 -0700 Subject: [PATCH 68/85] remove redundant copy of the mac-app that got included by accident --- src/ext/sage/ext/mac-app/AppController.h | 75 - src/ext/sage/ext/mac-app/AppController.m | 574 -- src/ext/sage/ext/mac-app/AppDelegate.h | 35 - src/ext/sage/ext/mac-app/AppDelegate.m | 227 - src/ext/sage/ext/mac-app/Defaults.plist | 128 - .../ext/mac-app/English.lproj/Credits.html | 11 - .../mac-app/English.lproj/InfoPlist.strings | 2 - .../English.lproj/MainMenu.nib/designable.nib | 7476 ----------------- .../MainMenu.nib/keyedobjects.nib | Bin 63323 -> 0 bytes .../MyDocument.nib/designable.nib | 1418 ---- .../MyDocument.nib/keyedobjects.nib | Bin 8031 -> 0 bytes .../sage/ext/mac-app/InputPanelController.h | 22 - .../sage/ext/mac-app/InputPanelController.m | 39 - src/ext/sage/ext/mac-app/MyDocument.h | 28 - src/ext/sage/ext/mac-app/MyDocument.m | 187 - .../ext/mac-app/PreferencePanelController.h | 29 - .../ext/mac-app/PreferencePanelController.m | 173 - src/ext/sage/ext/mac-app/Sage-Info.plist | 300 - .../mac-app/Sage.xcodeproj/project.pbxproj | 431 - src/ext/sage/ext/mac-app/Sage_Prefix.pch | 7 - src/ext/sage/ext/mac-app/appl.icns | Bin 37640 -> 0 bytes src/ext/sage/ext/mac-app/loading-page.html | 274 - src/ext/sage/ext/mac-app/main.m | 14 - src/ext/sage/ext/mac-app/open-location.sh | 22 - .../ext/mac-app/sage-document-cython.icns | Bin 47738 -> 0 bytes .../sage/ext/mac-app/sage-document-py.icns | Bin 41318 -> 0 bytes .../sage/ext/mac-app/sage-document-sage.icns | Bin 43061 -> 0 bytes .../sage/ext/mac-app/sage-document-spkg.icns | Bin 43811 -> 0 bytes .../sage/ext/mac-app/sage-document-sws.icns | Bin 42074 -> 0 bytes .../ext/mac-app/sage-is-running-on-port.sh | 40 - src/ext/sage/ext/mac-app/sage-small-blue.png | Bin 1594 -> 0 bytes src/ext/sage/ext/mac-app/sage-small-green.png | Bin 3580 -> 0 bytes src/ext/sage/ext/mac-app/sage-small-grey.png | Bin 683 -> 0 bytes src/ext/sage/ext/mac-app/sage-small-red.png | Bin 1587 -> 0 bytes src/ext/sage/ext/mac-app/start-sage.sh | 71 - 35 files changed, 11583 deletions(-) delete mode 100644 src/ext/sage/ext/mac-app/AppController.h delete mode 100644 src/ext/sage/ext/mac-app/AppController.m delete mode 100644 src/ext/sage/ext/mac-app/AppDelegate.h delete mode 100644 src/ext/sage/ext/mac-app/AppDelegate.m delete mode 100644 src/ext/sage/ext/mac-app/Defaults.plist delete mode 100644 src/ext/sage/ext/mac-app/English.lproj/Credits.html delete mode 100644 src/ext/sage/ext/mac-app/English.lproj/InfoPlist.strings delete mode 100644 src/ext/sage/ext/mac-app/English.lproj/MainMenu.nib/designable.nib delete mode 100644 src/ext/sage/ext/mac-app/English.lproj/MainMenu.nib/keyedobjects.nib delete mode 100644 src/ext/sage/ext/mac-app/English.lproj/MyDocument.nib/designable.nib delete mode 100644 src/ext/sage/ext/mac-app/English.lproj/MyDocument.nib/keyedobjects.nib delete mode 100644 src/ext/sage/ext/mac-app/InputPanelController.h delete mode 100644 src/ext/sage/ext/mac-app/InputPanelController.m delete mode 100644 src/ext/sage/ext/mac-app/MyDocument.h delete mode 100644 src/ext/sage/ext/mac-app/MyDocument.m delete mode 100644 src/ext/sage/ext/mac-app/PreferencePanelController.h delete mode 100644 src/ext/sage/ext/mac-app/PreferencePanelController.m delete mode 100644 src/ext/sage/ext/mac-app/Sage-Info.plist delete mode 100644 src/ext/sage/ext/mac-app/Sage.xcodeproj/project.pbxproj delete mode 100644 src/ext/sage/ext/mac-app/Sage_Prefix.pch delete mode 100644 src/ext/sage/ext/mac-app/appl.icns delete mode 100644 src/ext/sage/ext/mac-app/loading-page.html delete mode 100644 src/ext/sage/ext/mac-app/main.m delete mode 100755 src/ext/sage/ext/mac-app/open-location.sh delete mode 100644 src/ext/sage/ext/mac-app/sage-document-cython.icns delete mode 100644 src/ext/sage/ext/mac-app/sage-document-py.icns delete mode 100644 src/ext/sage/ext/mac-app/sage-document-sage.icns delete mode 100644 src/ext/sage/ext/mac-app/sage-document-spkg.icns delete mode 100644 src/ext/sage/ext/mac-app/sage-document-sws.icns delete mode 100755 src/ext/sage/ext/mac-app/sage-is-running-on-port.sh delete mode 100644 src/ext/sage/ext/mac-app/sage-small-blue.png delete mode 100644 src/ext/sage/ext/mac-app/sage-small-green.png delete mode 100644 src/ext/sage/ext/mac-app/sage-small-grey.png delete mode 100644 src/ext/sage/ext/mac-app/sage-small-red.png delete mode 100755 src/ext/sage/ext/mac-app/start-sage.sh diff --git a/src/ext/sage/ext/mac-app/AppController.h b/src/ext/sage/ext/mac-app/AppController.h deleted file mode 100644 index 1b3b6f47579..00000000000 --- a/src/ext/sage/ext/mac-app/AppController.h +++ /dev/null @@ -1,75 +0,0 @@ -// -// AppController.h -// SageMenu -// -// Created by Ivan Andrus on 19/6/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import - - -@interface AppController : NSObject { - - /* Our outlets which allow us to access the interface */ - IBOutlet NSMenu *statusMenu; - IBOutlet id appDelegate; - IBOutlet id prefWindow; - IBOutlet id inputPanelController; - - NSStatusItem *statusItem; - NSImage *statusImageBlue; - NSImage *statusImageGrey; - NSImage *statusImageGreen; - NSImage *statusImageRed; - - NSString *sageBinary; - NSString *logPath; - NSMutableArray *URLQueue; - - NSUserDefaults *defaults; - - NSTask *theTask; - NSPipe *taskPipe; - - int port; - BOOL myIsInDock, haveStatusItem, useSystemBrowser, neverOpenedFileBrowser; - -} - -// Server control --(IBAction)startServer:(id)sender; --(IBAction)stopServer:(id)sender; --(BOOL)serverIsRunning:(BOOL)wait; --(void)serverStartedWithPort:(int)port; --(void)taskTerminated:(NSNotification *)aNotification; - -// Notebook functions --(IBAction)openNotebook:(id)sender; --(IBAction)newWorksheet:(id)sender; --(IBAction)browseLocalSageURL:(id)sender; --(IBAction)browseRemoteURL:(id)sender; - -// Terminal and advanced --(IBAction)terminalSession:(id)sender; --(IBAction)viewSageLog:(id)sender; --(IBAction)revealInFinder:(id)sender; --(IBAction)terminalSessionPromptForFile:(id)sender; --(IBAction)terminalSessionPromptForInput:(id)sender; --(NSString*)convertMenuTitleToSageCommand:(NSString*)title; - --(IBAction)showPreferences:(id)sender; - --(void)setupPaths; - -// Quit --(IBAction)stopServerAndQuit:(id)sender; - -// Ancillary functions --(void)sageBrowse:(NSString*)location; --(void)sageTerminalRun:(NSString*)sessionType withArguments:(NSArray*)arguments; --(void)terminalRun:(NSString*)command; --(NSString*)createPrompt:(NSString*)sessionType forCommand:(NSString*)command; --(BOOL)isTigerOrLess; - -@end diff --git a/src/ext/sage/ext/mac-app/AppController.m b/src/ext/sage/ext/mac-app/AppController.m deleted file mode 100644 index 5705bbdad16..00000000000 --- a/src/ext/sage/ext/mac-app/AppController.m +++ /dev/null @@ -1,574 +0,0 @@ -// -// AppController.m -// SageMenu -// -// Created by Ivan Andrus on 19/6/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import "AppController.h" -#import "MyDocument.h" -#import "InputPanelController.h" -#import - - -@implementation AppController - -// With help from -// http://www.sonsothunder.com/devres/revolution/tutorials/StatusMenu.html - -- (void) awakeFromNib{ - - // Used to detect where our files are - NSBundle *bundle = [NSBundle mainBundle]; - - // Allocate and load the images into the application which will be used for our NSStatusItem - statusImageBlue = [[NSImage alloc] initWithContentsOfFile:[bundle pathForResource:@"sage-small-blue" ofType:@"png"]]; - statusImageRed = [[NSImage alloc] initWithContentsOfFile:[bundle pathForResource:@"sage-small-red" ofType:@"png"]]; - statusImageGrey = [[NSImage alloc] initWithContentsOfFile:[bundle pathForResource:@"sage-small-grey" ofType:@"png"]]; - statusImageGreen = [[NSImage alloc] initWithContentsOfFile:[bundle pathForResource:@"sage-small-green" ofType:@"png"]]; - - // Access to the user's defaults - defaults = [NSUserDefaults standardUserDefaults]; - - // Find sageBinary etc. - [self setupPaths]; - - // Initialize the StatusItem if desired. - // If we are on Tiger, then showing in the dock doesn't work - // properly, hence pretend they didn't want it. - myIsInDock = [defaults boolForKey:@"myShowInDock"] && ![self isTigerOrLess]; - haveStatusItem = !myIsInDock || [defaults boolForKey:@"alsoShowMenuExtra"]; - useSystemBrowser = !myIsInDock || [defaults boolForKey:@"useSystemBrowser"]; - if ( haveStatusItem ) { - // Create the NSStatusBar and set its length - statusItem = [[[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength] retain]; - - // Set the image in NSStatusItem - [statusItem setImage:statusImageGrey]; - - // Tell NSStatusItem what menu to load - [statusItem setMenu:statusMenu]; - // Set the tooptip for our item - [statusItem setToolTip:@"Control Sage Notebook Server"]; - // Enable highlighting when menu is opened - [statusItem setHighlightMode:YES]; - } else { - [statusItem setEnabled:NO]; - } - - // indicate that we haven't started the server yet - port = 0; - neverOpenedFileBrowser = YES; - URLQueue = [[NSMutableArray arrayWithCapacity:3] retain]; - - // Start the sage server, or check if it's running - if ( [defaults boolForKey:@"startServerOnLaunch"] ) { - [self startServer:self]; - } else { - [self serverIsRunning:NO]; - } - - // Set up notifications when an NSTask finishes. - // For us this will be for checking if the server is running - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(taskTerminated:) - name:NSTaskDidTerminateNotification - object:nil]; -} - -- (void) dealloc { - // Release the images we loaded into memory - [statusImageBlue release]; - [statusImageRed release]; - [statusImageGrey release]; - [statusImageGreen release]; - [sageBinary release]; - [logPath release]; - [theTask release]; - [taskPipe release]; - [URLQueue release]; - [super dealloc]; -} - - --(IBAction)startServer:(id)sender{ - // TODO: Check to see if it's running before attempting to start - NSLog(@"Starting server"); - if (haveStatusItem) [statusItem setImage:statusImageGreen]; - NSString *scriptPath = [[NSBundle mainBundle] pathForResource:@"start-sage" ofType:@"sh"]; - - // Add SAGE_BROWSER to environment to point back to this application - if ( !useSystemBrowser ) { - NSString *browserPath = [[NSBundle mainBundle] pathForResource:@"open-location" ofType:@"sh"]; - setenv("SAGE_BROWSER", [browserPath UTF8String], 1); // this overwrites, should it? - } - - // Create a task to start the server - [NSTask launchedTaskWithLaunchPath:scriptPath - arguments:[NSArray arrayWithObjects:sageBinary, logPath, nil]]; - // We now forget about the task. I hope that's okay... - - // Open loading page since it can take a while to start - [self browseRemoteURL:[[NSBundle mainBundle] pathForResource:@"loading-page" ofType:@"html"]]; - - // Get info about the server if we're not going to get it via opening a page - if ( useSystemBrowser ) { - [self serverIsRunning:YES]; - } -} - --(BOOL)serverIsRunning:(BOOL)wait{ - - // Start busy polling until the server starts - if ( theTask == nil && taskPipe == nil ) { - theTask = [[NSTask alloc] init]; - taskPipe = [[NSPipe alloc] init]; - [theTask setStandardOutput:taskPipe]; - [theTask setLaunchPath:[[NSBundle mainBundle] pathForResource:@"sage-is-running-on-port" ofType:@"sh"]]; - if (wait) [theTask setArguments:[NSArray arrayWithObject:@"--wait"]]; - [theTask launch]; - } - return NO; -} - --(void)serverStartedWithPort:(int)p{ - if (haveStatusItem) [statusItem setImage:statusImageBlue]; - port = p; - if ( [URLQueue count] > 0 ) { - NSEnumerator *e = [URLQueue objectEnumerator]; - id url; - while (url = [e nextObject]) { - [self browseLocalSageURL:url]; - } - [URLQueue removeAllObjects]; - } -} - -- (void)taskTerminated:(NSNotification *)aNotification { - - NSTask *theObject = [aNotification object]; - if (theObject == theTask) { - const int status = [theObject terminationStatus]; - if (status == 0) { - // Parse the output - NSData *data = [[taskPipe fileHandleForReading] readDataToEndOfFile]; - NSString* s = [[NSString alloc] initWithBytes:[data bytes] - length:[data length] - encoding:NSUTF8StringEncoding]; - const int p = [s intValue]; - [s release]; - [self serverStartedWithPort:p]; - } else { - // We failed, so tell the user - if (haveStatusItem) [statusItem setImage:statusImageGrey]; - port = 0; - } - // Reset for next time. - [theTask release]; - theTask = nil; - [taskPipe release]; - taskPipe = nil; - } else { - // NSLog(@"Got called for a different task."); - } -} - --(IBAction)stopServer:(id)sender{ - if (haveStatusItem) [statusItem setImage:statusImageRed]; - - // Get the pid of the Sage server - NSString *pidFile = [@"~/.sage/sage_notebook.sagenb/twistd.pid" stringByStandardizingPath]; - NSString *pid = [NSString stringWithContentsOfFile:pidFile - encoding:NSUTF8StringEncoding - error:NULL]; - - if (pid == nil) { - // Get the pid of the Sage server - pidFile = [@"~/.sage/sage_notebook.sagenb/sagenb.pid" stringByStandardizingPath]; - pid = [NSString stringWithContentsOfFile:pidFile - encoding:NSUTF8StringEncoding - error:NULL]; - } - - NSLog(@"Stopping server with pid: %@", pid ); - if (pid != nil) { - kill([pid intValue], SIGTERM); - } - - if (haveStatusItem) [statusItem setImage:statusImageGrey]; - port = 0; -} - -// To create an alternate menu, in IB create another menu item, give it a key equivalent of opt/alt and check the alternate box (left most tab of inspector) --(IBAction)stopServerAndQuit:(id)sender{ - - [self stopServer:self]; - - // Tell the application to quit - [NSApp performSelector:@selector(terminate:) withObject:nil afterDelay:0.0]; -} - --(IBAction)viewSageLog:(id)sender{ - if (logPath != nil) { - // open files with the default viewer (I think the default is Console.app) - // http://lethain.com/entry/2008/apr/05/opening-files-with-associated-app-in-cocoa/ - NSWorkspace *workspace = [NSWorkspace sharedWorkspace]; - [workspace openFile:logPath]; - } -} - --(void)setupPaths{ - - // Find the log path - NSFileManager *fileMgr = [NSFileManager defaultManager]; - NSArray *directories = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES); - NSString *tmpLogPath; - if ([directories count] > 0) { - tmpLogPath = [directories objectAtIndex:0]; - tmpLogPath = [tmpLogPath stringByAppendingPathComponent:@"Logs"]; - - if ( [fileMgr fileExistsAtPath:tmpLogPath] || [fileMgr createDirectoryAtPath:tmpLogPath attributes:nil] ) { - logPath = [tmpLogPath stringByAppendingPathComponent:@"sage.log"]; -/* If we want to send our log there... - int fd = open([logPath fileSystemRepresentation], (O_RDWR|O_CREAT|O_TRUNC), (S_IRWXU|S_IRWXG|S_IRWXO)); - if (fd != -1) { - result = asl_add_log_file(NULL, fd); - } - */ - } else { - logPath = [[NSBundle mainBundle] pathForResource:@"sage" ofType:@"log"]; - NSLog(@"Couldn't create the directory (%@) for log file. Going to log to %@.",tmpLogPath,logPath); - } - } else { - logPath = [[NSBundle mainBundle] pathForResource:@"sage" ofType:@"log"]; - NSLog(@"Something is fishy: couldn't find a path for log files. Going to log to %@.", logPath); - } - [logPath retain]; - - // ### Find the sage binary ### - - // If they have a plist entry telling where it is try that. - sageBinary = [defaults objectForKey:@"SageBinary"]; - // If that isn't wanted or isn't executable, try a sage built in to the application - BOOL isDir = YES; - // If the file is a directory, see if it's SAGE_ROOT - if ( [fileMgr fileExistsAtPath:sageBinary isDirectory:&isDir] && isDir ) { - [defaults setObject:[sageBinary stringByAppendingPathComponent:@"sage"] - forKey:@"SageBinary"]; - sageBinary = [defaults objectForKey:@"SageBinary"]; - } - // Put isDir last since technically it's value is undefined if the file doesn't exist - if ( ![defaults boolForKey:@"useAltSageBinary"] || ![fileMgr isExecutableFileAtPath:sageBinary] ) { - NSString * path = [[NSBundle mainBundle] pathForResource:@"sage" ofType:nil inDirectory:@"sage"]; - sageBinary = path ? [[NSString alloc] initWithString:path] : nil; - [defaults setBool:NO forKey:@"useAltSageBinary"]; - } - - // If that doesn't work then have them locate a binary for us - if ( !sageBinary || ![fileMgr isExecutableFileAtPath:sageBinary] ) { - - // Create a File Open Dialog class - NSOpenPanel *openDlg = [NSOpenPanel openPanel]; - - // Enable the selection of files and directories - [openDlg setTitle:@"Please choose a Sage executable"]; - [openDlg setMessage:@"This application did not come with a Sage distribution, and there is no valid alternative specified.\n\ -Please choose a Sage executable to use from now on. If you do not, sage is assumed to be in PATH.\n\ -You can change it later in Preferences."]; - [openDlg setCanChooseFiles:YES]; - [openDlg setCanChooseDirectories:YES]; - - // Display the dialog. If the OK button was pressed, - // process the files. - while ( [openDlg runModalForDirectory:nil file:nil] == NSOKButton ) { - sageBinary = [[openDlg filenames] objectAtIndex:0]; - // if they give a folder, look for sage inside - if ( [fileMgr fileExistsAtPath:sageBinary isDirectory:&isDir] && isDir ) { - sageBinary = [sageBinary stringByAppendingPathComponent:@"sage"]; - } - // Sanity check for the validity of the Sage Binary - if ( [fileMgr isExecutableFileAtPath:sageBinary] ) { - // Save for future sessions - [defaults setBool:YES forKey:@"useAltSageBinary"]; - [defaults setObject:sageBinary forKey:@"SageBinary"]; - [sageBinary retain]; - return; - } - [openDlg setMessage:@"That does not appear to be a valid sage executable.\nPlease choose another, or cancel to assume sage is in PATH."]; - } - - // Quit since there's no point going on. - // [NSApp performSelector:@selector(terminate:) withObject:nil afterDelay:0.0]; - - NSLog(@"WARNING: Could not find a good sage executable, falling back to sage and hoping it's in PATH."); - sageBinary = @"sage"; - } -} - --(IBAction)revealInFinder:(id)sender{ - if ( [[sender title] isEqualToString:@"Reveal in Shell"] ) { - [self terminalRun:[NSString stringWithFormat:@"cd '%@' && $SHELL", - [sageBinary stringByDeletingLastPathComponent]]]; - } else { - [[NSWorkspace sharedWorkspace] selectFile:[sageBinary stringByDeletingLastPathComponent] - inFileViewerRootedAtPath:nil]; - } -} - --(IBAction)openNotebook:(id)sender{ - [self browseLocalSageURL:@""]; -} - --(IBAction)newWorksheet:(id)sender{ - [self browseLocalSageURL:@"new_worksheet"]; -} - --(IBAction)showPreferences:(id)sender{ - [NSApp activateIgnoringOtherApps:YES]; - [prefWindow makeKeyAndOrderFront:self]; -} - --(IBAction)browseLocalSageURL:(id)sender{ - NSString *sageURL; - if ([sender isKindOfClass:[NSString class]]) { - sageURL = sender; - } else { - sageURL = [[defaults arrayForKey:@"sageURLs"] objectAtIndex:[sender tag]]; - } - // The server is not running - if ( port == 0 && [defaults boolForKey:@"autoStartServer"] ) { - // Queue the URL up for opening and start the server - // Do I need to retain it?? - [URLQueue addObject:sageURL]; - [self startServer:self]; - } else { - // Browse to the url right away - [self sageBrowse:[NSString stringWithFormat:@"http://localhost:%d/%@", port, sageURL]]; - } -} - --(IBAction)browseRemoteURL:(id)sender{ - NSString *sageURL; - if ([sender isKindOfClass:[NSString class]]) { - sageURL = sender; - } else { - sageURL = [[defaults arrayForKey:@"sageURLs"] objectAtIndex:[sender tag]]; - } - [self sageBrowse:sageURL]; -} - --(void)sageBrowse:(NSString*)location{ - - if ( !useSystemBrowser ) { - [[NSApplication sharedApplication] activateIgnoringOtherApps:TRUE]; - - NSError *outError = nil; - id myDocument = [[NSDocumentController sharedDocumentController] - openUntitledDocumentAndDisplay:YES error:&outError]; - if ( myDocument == nil ) { - [NSApp presentError:outError]; - NSLog(@"sageBrowser: Error creating document: %@", [outError localizedDescription]); - } else { - [[[myDocument webView] mainFrame] - loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:location]]]; - } - - } else if ( [defaults boolForKey:@"respectSAGE_BROWSER"] ) { - - // TODO: escape quotes in location - NSString *command = [NSString - stringWithFormat:@"%@ -min -c 'import sage.misc.viewer as b; os.system(b.browser() + \" %@\")' &", - sageBinary, - location]; - - // TODO: Should probably make this use NSTask - system([command UTF8String]); - } else { - - if ( [location characterAtIndex:0] == '/' ) { - [[NSWorkspace sharedWorkspace] openFile:location]; - } else { - [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:location]]; - } - } -} - - --(NSString*)convertMenuTitleToSageCommand:(NSString*)title{ - - if ( [title isEqualToString:@"Sage"] || [title isEqualToString:@"Sage (advanced)"] || [title isEqualToString:@"Terminal Session"] ) { - // A few special cases to open sage itself - return nil; - } else if ( ([title length] > 2) && [[NSCharacterSet uppercaseLetterCharacterSet] characterIsMember:[title characterAtIndex:0]] ) { - // If it's capitalized, and more than one character then use the lowercased first letter. - // This is so things like Build and Test can work, but R and M2 will still work. - // This is really a hack, because I'm too lazy to create a bunch of different methods (and I think it's ugly) - unichar first = [[title lowercaseString] characterAtIndex:0]; - return [NSString stringWithCharacters:&first length:1]; - } else { - // If it's lowercased, assume it's the command, but remove ... from the end - return [title stringByTrimmingCharactersInSet: - [NSCharacterSet characterSetWithCharactersInString: - [NSString stringWithFormat:@"%C", ((unsigned short)0x2026)]]]; // @"…" - } -} - --(IBAction)terminalSession:(id)sender{ - [self sageTerminalRun: [self convertMenuTitleToSageCommand:[sender title]] withArguments: nil]; -} - --(IBAction)terminalSessionPromptForInput:(id)sender{ - - NSString *sessionType = [self convertMenuTitleToSageCommand:[sender title]]; - NSString *command; - if ( [sessionType length] > 1 ) { - command = [sageBinary stringByAppendingFormat:@" --%@", sessionType]; - } else if ( [sessionType length] > 0 ) { - command = [sageBinary stringByAppendingFormat:@" -%@", sessionType]; - } else { - command = sageBinary; - } - - [defaults synchronize]; - NSString *defArgs = [[defaults dictionaryForKey:@"DefaultArguments"] - objectForKey:command]; - - [inputPanelController runCommand:command - withPrompt:[self createPrompt:sessionType forCommand:command] - withArguments:defArgs - editingCommand:[defaults boolForKey:@"editFullCommands"]]; -} - --(NSString*)createPrompt:(NSString*)sessionType forCommand:(NSString*)command{ - return [NSString stringWithFormat:@"Going to run sage %@\nPlease enter any arguments, escaped as you would for a shell.\n\nThe command will be run as\n%@ %C", - sessionType ? sessionType : @"", command, ((unsigned short)0x2026)]; -} - --(IBAction)terminalSessionPromptForFile:(id)sender{ - - // Create a File Open Dialog class - NSOpenPanel *openDlg = [NSOpenPanel openPanel]; - - // Enable the selection of files and directories - [openDlg setCanChooseFiles:YES]; - [openDlg setCanChooseDirectories:YES]; - [openDlg setAllowsMultipleSelection:YES]; - [openDlg setTitle:[NSString stringWithFormat:@"Choose file(s) for %@",[sender title]]]; - - // Display the dialog. If the OK button was pressed, - // process the files. - NSString * base_dir = nil; - if (neverOpenedFileBrowser) { - base_dir = [NSString stringWithFormat:@"%@/../devel/sage/sage",sageBinary]; - neverOpenedFileBrowser=NO; - } - // If they supply files, then run the command - if ( [openDlg runModalForDirectory:base_dir file:nil] == NSOKButton ) { - [self sageTerminalRun:[self convertMenuTitleToSageCommand:[sender title]] - withArguments:[openDlg filenames]]; - } -} - --(void)sageTerminalRun:(NSString*)sessionType withArguments:(NSArray*)arguments{ - NSString *command; - if ( sessionType == nil ) { - NSLog(@"starting sage" ); - command = sageBinary; - } else if ( [sessionType length] > 1 ) { - command = [sageBinary stringByAppendingFormat:@" --%@", sessionType]; - } else { - command = [sageBinary stringByAppendingFormat:@" -%@", sessionType]; - } - - // Get any default options they might have for this session - [defaults synchronize]; - NSString *defArgs = [[defaults dictionaryForKey:@"DefaultArguments"] - objectForKey:(sessionType != nil) ? sessionType : @"sage" ]; - if ( defArgs != nil ) { - command = [command stringByAppendingFormat:@" %@", defArgs]; - } - if ( arguments != nil ) { - for( int i = 0; i < [arguments count]; i++ ) { - command = [command stringByAppendingFormat:@" %@", [arguments objectAtIndex:i]]; - } - } - - // Hold command key to edit before running - if ( [defaults boolForKey:@"alwaysPromptForArguments"] || [[NSApp currentEvent] modifierFlags] & NSCommandKeyMask ) { - [inputPanelController runCommand:command - withPrompt:[self createPrompt:sessionType forCommand:command] - withArguments:defArgs - editingCommand:YES]; - } else { - [self terminalRun:command]; - } -} - --(void)terminalRun:(NSString*)command{ - NSLog(@"Running command: %@", command); - - // Escape quotes and backslashes in the command - // I think that's all we need to handle for applescript itself - NSMutableString * escapedCommand = [NSMutableString stringWithString:command]; - [escapedCommand replaceOccurrencesOfString:@"\\" - withString:@"\\\\" - options:0 - range:NSMakeRange(0, [escapedCommand length])]; - [escapedCommand replaceOccurrencesOfString:@"\"" - withString:@"\\\"" - options:0 - range:NSMakeRange(0, [escapedCommand length])]; - // We can't use the (arguably easier) stringByReplacingOccurrencesOfString:withString since that's 10.5+ - // NSString *escapedCommand = [[command stringByReplacingOccurrencesOfString:@"\\" withString:@"\\\\"] - // stringByReplacingOccurrencesOfString:@"\"" withString:@"\\\""]; - - // Which applescript to run - NSString *ApplescriptKey = [defaults objectForKey:@"TerminalEmulator"]; - // Print the command into the applescript - NSString *bringAppToFrontScript = - [NSString stringWithFormat:[[defaults dictionaryForKey:@"TerminalEmulatorList"] - objectForKey:ApplescriptKey], - escapedCommand]; - - // NSLog(@"Executing applescript: %@", bringAppToFrontScript); - - NSDictionary* errorDict; - NSAppleEventDescriptor *returnDescriptor = NULL; - NSAppleScript* scriptObject = [[NSAppleScript alloc] - initWithSource:bringAppToFrontScript]; - returnDescriptor = [scriptObject executeAndReturnError: &errorDict]; - if ( returnDescriptor == nil ) { - NSLog(@"terminalRun: Error running Applescript: %@", errorDict); - } - [scriptObject release]; -} - -// http://www.cocoadev.com/index.pl?DeterminingOSVersion --(BOOL)isTigerOrLess{ - OSErr err; - SInt32 version; - if ((err = Gestalt(gestaltSystemVersionMajor, &version)) != noErr) { - NSLog(@"Unable to determine gestaltSystemVersionMajor: %hd",err); - return YES; - } - if ( version < 10 ) return YES; // Of course this should never happen... - if ((err = Gestalt(gestaltSystemVersionMinor, &version)) != noErr) { - NSLog(@"Unable to determine gestaltSystemVersionMinor: %hd",err); - return YES; - } - if ( version < 5 ) return YES; - return NO; -} - -// TODO: make installing packages easy -- stringByLaunchingPath:withArguments:error: -// TODO: maybe this should be written in py-objc so that we can call into sage directly (but then we would have to worry about environment etc.) -// TODO: make some services (search for NSSendTypes) -- pack/unpack spkg, extract sws from pdf, crap/fixdoctests/preparse/Test/coverage/pkg/pkg_nc/etc. - -// TODO: open files such as .sws, .sage, .py, .spkg, -- .pdf (and extract sws from them), .htm, whatever else I can handle -// TODO: quicklook generator, spotlight importer -- use UTI -// NOTE: http://developer.apple.com/mac/library/documentation/Miscellaneous/Reference/UTIRef/Articles/System-DeclaredUniformTypeIdentifiers.html -// TODO: icons for files -- they need some help with the alpha channel. I clearly don't know what I'm doing. I should really make them all from by script... - - -@end diff --git a/src/ext/sage/ext/mac-app/AppDelegate.h b/src/ext/sage/ext/mac-app/AppDelegate.h deleted file mode 100644 index ce20841e247..00000000000 --- a/src/ext/sage/ext/mac-app/AppDelegate.h +++ /dev/null @@ -1,35 +0,0 @@ -// -// AppDelegate.h -// -// Created by Ivan Andrus on 26/6/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import -#import "AppController.h" - -// http://stackoverflow.com/questions/1496788/building-for-10-5-in-xcode-3-2-on-snow-leopard-error - -// this is a 10.6 only protocol, but we build on 10.4 and 10.5 which -// makes the #if more complicated than the webpage, so we don't worrry -// about it. -//@interface AppDelegate : NSObject -@interface AppDelegate : NSObject -{ - IBOutlet AppController* appController; - -} - -+ (void)initialize; -- (void)applicationDidFinishLaunching:(NSNotification *)aNotification; -- (void)applicationWillFinishLaunching:(NSNotification *)aNotification; -- (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender; - -// Opening files -- (BOOL)application:(NSApplication * )theApplication openFile: (NSString * )filename; -- (void)getUrl:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent; - - --(IBAction)openDocumentWithDialogBox:(id)sender; - -@end diff --git a/src/ext/sage/ext/mac-app/AppDelegate.m b/src/ext/sage/ext/mac-app/AppDelegate.m deleted file mode 100644 index e0e7c7e9958..00000000000 --- a/src/ext/sage/ext/mac-app/AppDelegate.m +++ /dev/null @@ -1,227 +0,0 @@ -// -// AppDelegate.m -// -// Created by Ivan Andrus on 26/6/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import "AppDelegate.h" -#import "AppController.h" -#import -#import -#import - -@implementation AppDelegate - -+ (void)initialize{ - // Make sure default are up to date - NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - NSDictionary *factoryDefaults = [NSDictionary dictionaryWithContentsOfFile: [[NSBundle mainBundle] pathForResource:@"Defaults" ofType:@"plist"]]; - [defaults registerDefaults: factoryDefaults]; -} - -- (void)applicationWillFinishLaunching:(NSNotification *)aNotification{ - // This is early enough to show in the dock if we want to - // http://www.cocoadev.com/index.pl?LSUIElement - // http://codesorcery.net/2008/02/06/feature-requests-versus-the-right-way-to-do-it - - NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - BOOL isInDock = [defaults boolForKey:@"myShowInDock"]; - - if ( isInDock ) { - ProcessSerialNumber psn = { 0, kCurrentProcess }; - // display dock icon - OSStatus returnCode = TransformProcessType(&psn, kProcessTransformToForegroundApplication); - if( returnCode != 0 ) { - // According to http://www.cocoadev.com/index.pl?TransformProcessType - // TransformProcessType is available since 10.3, but doen't work for our case until 10.5 - NSLog(@"Could not show Sage.app in the dock. Error %ld", returnCode); - // It's forbidden to showInDock since it doesn't work - [defaults setBool:NO forKey:@"myShowInDock"]; - [defaults synchronize]; - - } else { - - // enable menu bar - SetSystemUIMode(kUIModeNormal, 0); - // switch to Dock.app - [[NSWorkspace sharedWorkspace] launchAppWithBundleIdentifier:@"com.apple.dock" - options:NSWorkspaceLaunchDefault - additionalEventParamDescriptor:nil - launchIdentifier:nil]; - // switch back - [[NSApplication sharedApplication] activateIgnoringOtherApps:TRUE]; - } - } else { - // NSLog(@"Not showing in Dock"); - } - - // If we are using the system browser we don't need all of the menus - // TODO: make this use menu titles not indexes - if ( [defaults boolForKey:@"useSystemBrowser"] ) { - [[NSApp mainMenu] removeItemAtIndex:6]; // Window menu - [[NSApp mainMenu] removeItemAtIndex:2]; // Edit menu - } -} - -- (void)applicationDidFinishLaunching:(NSNotification *)aNotification { - // Register that we can open URLs - NSAppleEventManager *em = [NSAppleEventManager sharedAppleEventManager]; - [em setEventHandler:self - andSelector:@selector(getUrl:withReplyEvent:) - forEventClass:kInternetEventClass - andEventID:kAEGetURL]; -} - -- (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender{ - return NO; -} - -// From here down are methods from NSApplicationDelegate, which probably do belong in another file. -// If/when this is done, I think you have to change the "File's Owner"'s delegate in IB -- (BOOL)application: (NSApplication * )theApplication openFile: (NSString * )filename{ - - NSString *extension = [filename pathExtension]; - NSLog(@"Told to open %@ of type %@", filename, extension); - - // Handle the file based on extension - if ( [extension isEqual:@"sage"] || [extension isEqual:@"py"] ) { - // Run sage and python files in your terminal - [appController sageTerminalRun:nil withArguments:[NSArray arrayWithObject:filename]]; - - } else if ( [extension isEqual:@"sws"] - || [extension isEqual:@"txt"] - || [extension isEqual:@"zip"] ) - { - - // Browse to a url which will upload the file. - // Perhaps we should have an option to delete the file when done... - NSString* theURL = [NSString stringWithFormat:@"upload_worksheet?url=%@", - [[NSURL fileURLWithPath: filename] relativeString]]; - [appController browseLocalSageURL:theURL]; - - } else if ( [extension isEqual:@"spkg"] ) { - // Install the spkg - [appController sageTerminalRun:@"i" withArguments:[NSArray arrayWithObject:filename]]; - - } else if ( [extension isEqual:@"html"] || [extension isEqual:@"htm"] ) { // maybe others? - - NSError *outError = nil; - id myDocument = [[NSDocumentController sharedDocumentController] - openUntitledDocumentAndDisplay:YES error:&outError]; - if ( myDocument == nil ) { - [NSApp presentError:outError]; - NSLog(@"sageBrowser: Error creating document: %@", [outError localizedDescription]); - } else { - [[[myDocument webView] mainFrame] - loadRequest:[NSURLRequest requestWithURL: - [NSURL URLWithString: - [NSString stringWithFormat:@"file://%@", - [filename stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]]]]]; - } - - } else if ( [[NSFileManager defaultManager] isExecutableFileAtPath:[NSString stringWithFormat:@"%@/sage", filename]] ) { - // Use this as the sage folder - // NSFileManager *fileManager = [NSFileManager defaultManager]; - [[NSUserDefaults standardUserDefaults] setObject:[NSString stringWithFormat:@"%@/sage", filename] - forKey:@"SageBinary"]; - [appController setupPaths]; - - } else { - NSLog(@"I have no idea how I got a file of type %@.", extension); - return NO; - } - return YES; -} - -// http://stackoverflow.com/questions/49510/how-do-you-set-your-cocoa-application-as-the-default-web-browser -- (void)getUrl:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent{ - // Get the URL - NSString *urlStr = [[event paramDescriptorForKeyword:keyDirectObject] stringValue]; - // Activate us - [[NSApplication sharedApplication] activateIgnoringOtherApps:TRUE]; - - if ( [[urlStr pathExtension] isEqual:@"spkg"] ) { - // We can install spkg's from URLs - [appController sageTerminalRun:@"i" withArguments:[NSArray arrayWithObject:urlStr]]; - - } else if ( ( [[urlStr pathExtension] isEqual:@"sws"] - || [[urlStr pathExtension] isEqual:@"txt"] - || [[urlStr pathExtension] isEqual:@"zip"] ) - && - ! ( [[urlStr substringToIndex:16] isEqual:@"http://localhost"] - || [[urlStr substringToIndex:17] isEqual:@"https://localhost"] ) ) - { - - // Browse to a url which will upload the file. - // Perhaps we should have an option to delete the file when done... - NSString* theURL = [NSString stringWithFormat:@"upload_worksheet?url=%@", - [[NSURL URLWithString: urlStr] relativeString]]; - [appController browseLocalSageURL:theURL]; - - } else { - - // Open the url in a new window - NSError *outError = nil; - id myDocument = [[NSDocumentController sharedDocumentController] - openUntitledDocumentAndDisplay:YES error:&outError]; - if ( myDocument == nil ) { - [NSApp presentError:outError]; - NSLog(@"sageBrowser: Error creating document: %@", [outError localizedDescription]); - } else { - [[[myDocument webView] mainFrame] - loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:urlStr]]]; - } - - // Check if the server has started - // TODO: This detection will only work if we are SAGE_BROWSER (i.e. we are in the dock) - NSArray *components = [urlStr componentsSeparatedByString:@"/?startup_token="]; - if ( [components count] > 1 ) { - urlStr = [components objectAtIndex:0]; - components = [urlStr componentsSeparatedByString:@"localhost:"]; - if ( [components count] > 1 ) { - const int port = (int)[[components objectAtIndex:1] floatValue]; - // We need to give it some time to load before we start loading queued things - // which happens from serverStartedWithPort - if ([[myDocument webView] respondsToSelector: @selector(isLoading)]) { - // block while the webview loads - while ([[myDocument webView] isLoading]) { - [[NSRunLoop currentRunLoop] - runMode:NSDefaultRunLoopMode - beforeDate:[NSDate distantFuture]]; - } - } else { - // Eyeball it... This should only happen before 10.4.11 - sleep(1); - } - [appController serverStartedWithPort:port]; - } - } - } -} - --(IBAction)openDocumentWithDialogBox:(id)sender{ - NSLog(@"openDocument:%@",sender); - - // Create the File Open Dialog class. - NSOpenPanel* openDlg = [NSOpenPanel openPanel]; - [openDlg setCanChooseFiles:YES]; - [openDlg setCanChooseDirectories:NO]; - - // Display the dialog. If the OK button was pressed, - // process the files. - if ( [openDlg runModalForDirectory:nil file:nil] == NSOKButton ) - { - // Get an array containing the full filenames of all - // files and directories selected. - NSArray* files = [openDlg filenames]; - for( int i = 0; i < [files count]; i++ ) - { - NSString* fileName = [files objectAtIndex:i]; - [self application:nil openFile:fileName]; - } - } -} - - -@end diff --git a/src/ext/sage/ext/mac-app/Defaults.plist b/src/ext/sage/ext/mac-app/Defaults.plist deleted file mode 100644 index 15381d6e0f7..00000000000 --- a/src/ext/sage/ext/mac-app/Defaults.plist +++ /dev/null @@ -1,128 +0,0 @@ - - - - - DefaultArguments - - SageBinary - /Applications/ - TerminalEmulator - Terminal - TerminalEmulatorList - - Terminal - set the_script to "%@; exit" - -tell application "System Events" - if "Terminal" is in name of every application process then - tell application "Terminal" - activate - do script the_script - end tell - else - -- It's not running, so it will create a window - -- when it starts. We reuse this window. - tell application "Terminal" - activate - do script the_script in window 1 - end tell - end if -end tell - Terminal - don't exit - set the_script to "%@" - -tell application "System Events" - if "Terminal" is in name of every application process then - tell application "Terminal" - activate - do script the_script - end tell - else - -- It's not running, so it will create a window - -- when it starts. We reuse this window. - tell application "Terminal" - activate - do script the_script in window 1 - end tell - end if -end tell - iTerm - set the_script to "%@; exit" - -tell application "System Events" - set is_running to ("iTerm" is in name of every application process) -end tell - -tell application "iTerm" - if is_running then - set myterm to make new terminal - tell myterm to launch session "Default" - set mysession to last session of myterm - else - set mysession to (session 1 of terminal 1) - end if - tell the mysession - write text the_script - end tell - activate -end tell - iTerm - don't exit - set the_script to "%@" - -tell application "System Events" - set is_running to ("iTerm" is in name of every application process) -end tell - -tell application "iTerm" - if is_running then - set myterm to make new terminal - tell myterm to launch session "Default" - set mysession to last session of myterm - else - set mysession to (session 1 of terminal 1) - end if - tell the mysession - write text the_script - end tell - activate -end tell - xterm - do shell script "xterm -e '%@' &" - xterm - don't exit - do shell script "xterm -hold -e '%@' &" - - alsoShowMenuExtra - - alwaysPromptForArguments - - editFullCommands - - myShowInDock - - respectSAGE_BROWSER - - sageURLs - - help/ - doc/static/tutorial/index.html - doc/static/a_tour_of_sage/index.html - doc/static/reference/index.html - doc/static/developer/index.html - http://sagemath.org/ - http://wiki.sagemath.org/support/ReportingBugs - http://trac.sagemath.org/sage_trac/ - http://sagemath.org/help-groups.html - http://wiki.sagemath.org/ - irc://irc.freenode.net/#sage-devel - http://ask.sagemath.org/ - - startServerOnLaunch - - useAltSageBinary - - useSystemBrowser - - autoStartServer - - - diff --git a/src/ext/sage/ext/mac-app/English.lproj/Credits.html b/src/ext/sage/ext/mac-app/English.lproj/Credits.html deleted file mode 100644 index 6bebc0b3974..00000000000 --- a/src/ext/sage/ext/mac-app/English.lproj/Credits.html +++ /dev/null @@ -1,11 +0,0 @@ - - -The Sage project was begun by William Stein and is possible thanks to -the work of many -people -and many open -source projects. Please see -the acknowledgement -page for a list of those who have contributed monetarily. - - \ No newline at end of file diff --git a/src/ext/sage/ext/mac-app/English.lproj/InfoPlist.strings b/src/ext/sage/ext/mac-app/English.lproj/InfoPlist.strings deleted file mode 100644 index 477b28ff8f8..00000000000 --- a/src/ext/sage/ext/mac-app/English.lproj/InfoPlist.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* Localized versions of Info.plist keys */ - diff --git a/src/ext/sage/ext/mac-app/English.lproj/MainMenu.nib/designable.nib b/src/ext/sage/ext/mac-app/English.lproj/MainMenu.nib/designable.nib deleted file mode 100644 index 55f169c1d5c..00000000000 --- a/src/ext/sage/ext/mac-app/English.lproj/MainMenu.nib/designable.nib +++ /dev/null @@ -1,7476 +0,0 @@ - - - - 1060 - 10K549 - 1938 - 1038.36 - 461.00 - - com.apple.InterfaceBuilder.CocoaPlugin - 1938 - - - YES - NSComboBoxCell - NSMenuItem - NSMenu - NSTextFieldCell - NSButtonCell - NSButton - NSBox - NSComboBox - NSTabView - NSCustomObject - NSTabViewItem - NSView - NSWindowTemplate - NSTextField - NSUserDefaultsController - - - YES - com.apple.InterfaceBuilder.CocoaPlugin - - - PluginDependencyRecalculationVersion - - - - YES - - NSApplication - - - FirstResponder - - - NSApplication - - - AppDelegate - - - AMainMenu - - YES - - - Sage - - 1048576 - 2147483647 - - NSImage - NSMenuCheckmark - - - NSImage - NSMenuMixedState - - submenuAction: - - Sage - - YES - - - About Sage - - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Preferences… - , - 1048576 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Services - - 1048576 - 2147483647 - - - submenuAction: - - Services - - YES - - _NSServicesMenu - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Hide Sage - h - 1048576 - 2147483647 - - - - - - Hide Others - h - 1572864 - 2147483647 - - - - - - Show All - - 1048576 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Quit Sage - q - 1048576 - 2147483647 - - - - - - YES - Quit w/o Stopping Server - q - 1572864 - 2147483647 - - - - - _NSAppleMenu - - - - - File - - 1048576 - 2147483647 - - - submenuAction: - - File - - YES - - - New Worksheet - n - 1572864 - 2147483647 - - - - - - Open Notebook - n - 1048576 - 2147483647 - - - - - - Open File… - o - 1048576 - 2147483647 - - - - - - Open Recent - - 1048576 - 2147483647 - - - submenuAction: - - Open Recent - - YES - - - Clear Menu - - 1048576 - 2147483647 - - - - - _NSRecentDocumentsMenu - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Close - w - 1048576 - 2147483647 - - - - - - YES - Save - s - 1048576 - 2147483647 - - - - - - YES - Save As… - S - 1179648 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Page Setup... - P - 1179648 - 2147483647 - - - - - - - Print… - p - 1048576 - 2147483647 - - - - - - - - - Edit - - 1048576 - 2147483647 - - - submenuAction: - - Edit - - YES - - - Undo - z - 1048576 - 2147483647 - - - - - - Redo - Z - 1179648 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Cut - x - 1048576 - 2147483647 - - - - - - Copy - c - 1048576 - 2147483647 - - - - - - Paste - v - 1048576 - 2147483647 - - - - - - Paste and Match Style - V - 1572864 - 2147483647 - - - - - - Delete - - 1048576 - 2147483647 - - - - - - Select All - a - 1048576 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Find - - 1048576 - 2147483647 - - - submenuAction: - - Find - - YES - - - Find… - f - 1048576 - 2147483647 - - - 1 - - - - Find Next - g - 1048576 - 2147483647 - - - 2 - - - - Find Previous - G - 1179648 - 2147483647 - - - 3 - - - - Use Selection for Find - e - 1048576 - 2147483647 - - - 7 - - - - Jump to Selection - j - 1048576 - 2147483647 - - - - - - - - - Substitutions - - 1048576 - 2147483647 - - - submenuAction: - - Substitutions - - YES - - - Show Substitutions - - 2147483647 - - - - - - YES - YES - - - 2147483647 - - - - - - Smart Copy/Paste - - 2147483647 - - - 1 - - - - Smart Quotes - - 2147483647 - - - 2 - - - - Smart Dashes - - 2147483647 - - - - - - Smart Links - - 2147483647 - - - 3 - - - - Text Replacement - - 2147483647 - - - - - - - - - Transformations - - 2147483647 - - - submenuAction: - - Transformations - - YES - - - Make Upper Case - - 2147483647 - - - - - - Make Lower Case - - 2147483647 - - - - - - Capitalize - - 2147483647 - - - - - - - - - Speech - - 1048576 - 2147483647 - - - submenuAction: - - Speech - - YES - - - Start Speaking - - 1048576 - 2147483647 - - - - - - Stop Speaking - - 1048576 - 2147483647 - - - - - - - - - - - - Server - - 2147483647 - - - submenuAction: - - Server - - YES - - - Open Notebook - - 2147483647 - - - - - - New Worksheet - - 2147483647 - - - - - - YES - YES - - - 2147483647 - - - - - - Start Server - - 2147483647 - - - - - - Stop Server - - 2147483647 - - - - - - View Log - - 2147483647 - - - - - - - - - Terminal Session - - 2147483647 - - - submenuAction: - - Terminal Session - - YES - - - Sage - - 2147483647 - - - - - - Sage (advanced) - - 2147483647 - - - - - - Math - - 2147483647 - - - submenuAction: - - Math - - YES - - - gap - - 2147483647 - - - - - - gp - - 2147483647 - - - - - - maxima - - 2147483647 - - - - - - mwrank - - 2147483647 - - - - - - R - - 2147483647 - - - - - - singular - - 2147483647 - - - - - - - - - Misc. - - 2147483647 - - - submenuAction: - - Misc. - - YES - - - ecl - - 2147483647 - - - - - - ipython - - 2147483647 - - - - - - python - - 2147483647 - - - - - - scons - - 2147483647 - - - - - - twistd - - 2147483647 - - - - - - sh - - 2147483647 - - - - - - - - - - - - Development - - 2147483647 - - - submenuAction: - - Development - - YES - - - Reveal in Finder - - 2147483647 - - - - - - Reveal in Shell - - 2147483647 - - - - - - Build - - 2147483647 - - - - - - YES - docbuild - - 524288 - 2147483647 - - - - - - YES - YES - - - 2147483647 - - - - - - Testing - - 2147483647 - - - submenuAction: - - Testing - - YES - - - Test… - - 2147483647 - - - - - - YES - tp… - - 524288 - 2147483647 - - - - - - testall - - 2147483647 - - - - - - coverage… - - 2147483647 - - - - - - YES - coverageall - - 524288 - 2147483647 - - - - - - - - - Debugging - - 2147483647 - - - submenuAction: - - Debugging - - YES - - - preparse… - - 2147483647 - - - - - - gdb - - 2147483647 - - - - - - YES - gdb-ipython - - 524288 - 2147483647 - - - - - - - - - Packaging - - 2147483647 - - - submenuAction: - - Packaging - - YES - - - bdist - - 2147483647 - - - - - - sdist - - 2147483647 - - - - - - pkg… - - 2147483647 - - - - - - YES - pkg_nc… - - 524288 - 2147483647 - - - - - - - - - - - - Window - - 1048576 - 2147483647 - - - submenuAction: - - Window - - YES - - - Minimize - m - 1048576 - 2147483647 - - - - - - Zoom - - 1048576 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Bring All to Front - - 1048576 - 2147483647 - - - - - _NSWindowsMenu - - - - - Help - - 2147483647 - - - submenuAction: - - Help - - YES - - - Sage Help - ? - 1048576 - 2147483647 - - - - - - Sage Tutorial - - 2147483647 - - - 1 - - - - Tour of Sage - - 2147483647 - - - 2 - - - - Reference Manual - - 2147483647 - - - 3 - - - - Developer Guide - - 2147483647 - - - 4 - - - - YES - YES - - - 2147483647 - - - - - - Ask a question - - 2147483647 - - - 11 - - - - YES - YES - - - 2147483647 - - - - - - www.sagemath.org - - 2147483647 - - - 5 - - - - Report a Bug - - 2147483647 - - - 6 - - - - Trac (bug tracker) - - 2147483647 - - - 7 - - - - Mailing Lists - - 2147483647 - - - 8 - - - - Wiki - - 2147483647 - - - 9 - - - - IRC - - 2147483647 - - - 10 - - - _NSHelpMenu - - - - _NSMainMenu - - - NSFontManager - - - 7 - 2 - {{385, 363}, {448, 387}} - 1685585920 - Preferences - NSWindow - - - - 256 - - YES - - - 12 - {{13, 10}, {422, 371}} - - - YES - - 1 - - - 256 - - YES - - - 268 - {{32, 266}, {289, 18}} - - YES - - -2080244224 - 0 - Also show menubar item* - - LucidaGrande - 13 - 1044 - - - 1211912703 - 2 - - NSImage - NSSwitch - - - NSSwitch - - - - 200 - 25 - - - - - 268 - {{15, 286}, {217, 18}} - - YES - - -2080244224 - 0 - Show in Dock (requires 10.5)* - - - 1211912703 - 2 - - - - - 200 - 25 - - - - - 268 - {{15, 306}, {167, 18}} - - YES - - -2080244224 - 0 - Start server on launch* - - - 1211912703 - 2 - - - - - 200 - 25 - - - - - 268 - {{15, 204}, {222, 18}} - - YES - - 67239424 - 0 - Use alternate Sage executable*: - - - 1211912703 - 2 - - - - - 200 - 25 - - - - - 268 - {{32, 246}, {155, 18}} - - YES - - -2080244224 - 0 - Use system browser* - - - 1211912703 - 2 - - - - - 200 - 25 - - - - - 268 - {{15, 132}, {359, 18}} - - YES - - 67239424 - 0 - Always prompt for arguments (hold ⌘ to do so once) - - - 1211912703 - 2 - - - - - 200 - 25 - - - - - 268 - {{15, 152}, {359, 18}} - - YES - - -2080244224 - 0 - Start server when opening sws files - - - 1211912703 - 2 - - - - - 200 - 25 - - - - - 268 - {{15, 112}, {285, 18}} - - YES - - 67239424 - 0 - Edit full commands (not just arguments) - - - 1211912703 - 2 - - - - - 200 - 25 - - - - - 268 - {{14, 1}, {373, 96}} - - YES - - 67239424 - 272891904 - SW4gdGhpcyB0YWIgcHJlZmVyZW5jZXMgYXJlIHNhdmVkIGltbWVkaWF0ZWx5LCBidXQgaXRlbXMgbWFy -a2VkIHdpdGggKiByZXF1aXJlIHJlc3RhcnQgdG8gdGFrZSBlZmZlY3QuCgpUaXA6IERyYWdnaW5nIGEg -ZmlsZSB0byB0aGUgU2FnZSBFeGVjdXRhYmxlIHRleHQgYm94IHdpbGwgcGFzdGUgdGhlIHBhdGguA - - LucidaGrande - 12 - 16 - - - - 6 - System - controlColor - - 3 - MC42NjY2NjY2NjY3AA - - - - 1 - MC4xNjMwNDM0NzgzIDAuMTYzMDQzNDc4MyAwLjE2MzA0MzQ3ODMAA - - - - - - 268 - {{34, 176}, {350, 22}} - - YES - - -1804468671 - 272630784 - - - - YES - - 6 - System - textBackgroundColor - - 3 - MQA - - - - 6 - System - textColor - - 3 - MAA - - - - - - - 268 - {{15, 226}, {227, 18}} - - YES - - 67239424 - 0 - Respect SAGE_BROWSER (slower) - - - 1211912703 - 2 - - - - - 200 - 25 - - - - - 268 - {{237, 195}, {153, 32}} - - YES - - 67239424 - 134217728 - Add to PATH - - - -2038284033 - 129 - - - 200 - 25 - - - - {{10, 33}, {402, 325}} - - - General - - - - - 2 - - - 256 - - YES - - - 268 - {{147, 237}, {240, 26}} - - YES - - 343014976 - 272630784 - - - - YES - - - 6 - System - controlTextColor - - - 5 - YES - - - - 274 - {15, 0} - - - YES - - YES - - - 12 - 10 - 1000 - - 75628032 - 0 - - - - 3 - MC4zMzMzMzI5ODU2AA - - - - - 338820672 - 268436480 - - - YES - - 6 - System - controlBackgroundColor - - - - - 3 - YES - - - - 3 - 2 - - - 6 - System - gridColor - - 3 - MC41AA - - - 19 - tableViewAction: - -767524864 - - - - 1 - 15 - 0 - YES - 0 - - - - - - 268 - {{14, 243}, {125, 17}} - - YES - - 68288064 - 272630784 - Terminal Emulator: - - - - - - - - - 268 - {{17, 42}, {367, 193}} - - YES - - -1805517311 - 272629760 - - - - YES - - - - - - - 268 - {{294, 6}, {96, 32}} - - YES - - 67239424 - 134217728 - Apply - - - -2038284033 - 129 - - - 200 - 25 - - - - - 268 - {{75, 298}, {312, 26}} - - YES - - 343014976 - 272630784 - - - - YES - - - 5 - YES - - - - 274 - {15, 0} - - - YES - - YES - - - 12 - 10 - 1000 - - 75628032 - 0 - - - - 3 - MC4zMzMzMzI5ODU2AA - - - - - 338820672 - 268436480 - - - YES - - - - 3 - YES - - - - 3 - 2 - - - 19 - tableViewAction: - -767524864 - - - - 1 - 15 - 0 - YES - 0 - - - - - - 268 - {{14, 278}, {128, 17}} - - YES - - 68288064 - 272630784 - Default Arguments: - - - - - - - - - 268 - {{14, 303}, {56, 17}} - - YES - - 68288064 - 272630784 - Session: - - - - - - - - - 268 - {{147, 275}, {237, 22}} - - YES - - -1804468671 - 272630784 - - - - YES - - - - - - - 12 - {{-3, 267}, {407, 5}} - - {0, 0} - - 67239424 - 0 - Box - - - - 3 - MCAwLjgwMDAwMDAxMTkAA - - - 3 - 2 - 0 - NO - - - - 268 - {{11, 6}, {126, 32}} - - YES - - 67239424 - 134217728 - Default Script - - - -2038284033 - 129 - - - 200 - 25 - - - - {{10, 33}, {402, 325}} - - Terminal Sessions - - - - - - - 0 - YES - YES - - YES - - - - - {448, 387} - - {{0, 0}, {1280, 778}} - {1e+13, 1e+13} - - - PreferencePanelController - - - AppController - - - - - YES - - - New Worksheet - - 2147483647 - - - - - - Open Notebook - - 2147483647 - - - - - - Terminal Session - - 2147483647 - - - submenuAction: - - Terminal Session - - YES - - - Sage - - 2147483647 - - - - - - Sage (advanced) - - 2147483647 - - - - - - gap - - 2147483647 - - - - - - gp - - 2147483647 - - - - - - maxima - - 2147483647 - - - - - - mwrank - - 2147483647 - - - - - - R - - 2147483647 - - - - - - singular - - 2147483647 - - - - - - Misc. - - 2147483647 - - - submenuAction: - - Misc. - - YES - - - ecl - - 2147483647 - - - - - - ipython - - 2147483647 - - - - - - python - - 2147483647 - - - - - - scons - - 2147483647 - - - - - - twistd - - 2147483647 - - - - - - sh - - 2147483647 - - - - - - - - - - - - YES - YES - - - 2147483647 - - - - - - Start Sage Server - - 2147483647 - - - - - - Stop Sage Server - - 2147483647 - - - - - - View Log - - 2147483647 - - - - - - Preferences… - - 2147483647 - - - - - - YES - YES - - - 2147483647 - - - - - - Development - - 2147483647 - - - submenuAction: - - Development - - YES - - - Reveal in Finder - - 2147483647 - - - - - - Reveal in Shell - - 2147483647 - - - - - - Build - - 2147483647 - - - - - - YES - docbuild - - 524288 - 2147483647 - - - - - - - - - Testing - - 2147483647 - - - submenuAction: - - Testing - - YES - - - Test… - - 2147483647 - - - - - - YES - tp… - - 524288 - 2147483647 - - - - - - testall - - 2147483647 - - - - - - coverage… - - 2147483647 - - - - - - YES - coverageall - - 524288 - 2147483647 - - - - - - - - - Debugging - - 2147483647 - - - submenuAction: - - Debugging - - YES - - - preparse… - - 2147483647 - - - - - - gdb - - 2147483647 - - - - - - YES - gdb-ipython - - 524288 - 2147483647 - - - - - - - - - Packaging - - 2147483647 - - - submenuAction: - - Packaging - - YES - - - bdist - - 2147483647 - - - - - - sdist - - 2147483647 - - - - - - pkg… - - 2147483647 - - - - - - YES - pkg_nc… - - 524288 - 2147483647 - - - - - - - - - Help - - 2147483647 - - - submenuAction: - - Help - - YES - - - Sage Help - ? - 1048576 - 2147483647 - - - - - - Sage Tutorial - - 2147483647 - - - 1 - - - - Tour of Sage - - 2147483647 - - - 2 - - - - Reference Manual - - 2147483647 - - - 3 - - - - Developer Guide - - 2147483647 - - - 4 - - - - YES - YES - - - 2147483647 - - - - - - Ask a question - - 2147483647 - - - 11 - - - - YES - YES - - - 2147483647 - - - - - - www.sagemath.org - - 2147483647 - - - 5 - - - - Report a Bug - - 2147483647 - - - 6 - - - - Trac (bug tracker) - - 2147483647 - - - 7 - - - - Mailing Lists - - 2147483647 - - - 8 - - - - Wiki - - 2147483647 - - - 9 - - - - IRC - - 2147483647 - - - 10 - - - _NSHelpMenu - - - - - YES - YES - - - 2147483647 - - - - - - Quit - - 2147483647 - - - - - - YES - Quit w/o stopping server - - 524288 - 2147483647 - - - - - - - YES - - - 27 - 2 - {{339, 463}, {494, 193}} - -1535638528 - Sage Input - NSPanel - - - - 256 - - YES - - - 289 - {{384, 12}, {96, 32}} - - YES - - 67239424 - 134217728 - OK - - - -2038284033 - 129 - - DQ - 200 - 25 - - - - - 289 - {{288, 12}, {96, 32}} - - YES - - 67239424 - 134217728 - Cancel - - - -2038284033 - 129 - - Gw - 200 - 25 - - - - - 290 - {{20, 48}, {454, 22}} - - YES - - -1804468671 - 272630784 - - - - YES - - - - - - - 274 - {{17, 88}, {460, 85}} - - YES - - 67239424 - 272629760 - R29pbmcgdG8gcnVuIHNhZ2UgJUAKUGxlYXNlIGVudGVyIGFueSBhcmd1bWVudHMsIGVzY2FwZWQgYXMg -eW91IHdvdWxkIGZvciBhIHNoZWxsLgoKVGhlIGNvbW1hbmQgd2lsbCBiZSBydW4gYXMKJUAg4oCmA - - LucidaGrande - 13 - 16 - - - - - - - - {494, 193} - - {{0, 0}, {1280, 778}} - {1e+13, 1e+13} - - - InputPanelController - - - - - YES - - - delegate - - - - 759 - - - - orderFrontStandardAboutPanel: - - - - 142 - - - - dockMenu - - - - 663 - - - - terminate: - - - - 689 - - - - terminate: - - - - 748 - - - - delegate - - - - 758 - - - - performMiniaturize: - - - - 37 - - - - arrangeInFront: - - - - 39 - - - - runPageLayout: - - - - 87 - - - - clearRecentDocuments: - - - - 127 - - - - performClose: - - - - 193 - - - - undo: - - - - 223 - - - - copy: - - - - 224 - - - - paste: - - - - 226 - - - - stopSpeaking: - - - - 227 - - - - cut: - - - - 228 - - - - redo: - - - - 231 - - - - selectAll: - - - - 232 - - - - startSpeaking: - - - - 233 - - - - delete: - - - - 235 - - - - performZoom: - - - - 240 - - - - performFindPanelAction: - - - - 241 - - - - centerSelectionInVisibleArea: - - - - 245 - - - - toggleSmartInsertDelete: - - - - 355 - - - - toggleAutomaticQuoteSubstitution: - - - - 356 - - - - toggleAutomaticLinkDetection: - - - - 357 - - - - saveDocument: - - - - 362 - - - - saveDocumentAs: - - - - 363 - - - - hide: - - - - 367 - - - - hideOtherApplications: - - - - 368 - - - - unhideAllApplications: - - - - 370 - - - - printDocument: - - - - 373 - - - - capitalizeWord: - - - - 454 - - - - lowercaseWord: - - - - 455 - - - - uppercaseWord: - - - - 456 - - - - toggleAutomaticDashSubstitution: - - - - 460 - - - - orderFrontSubstitutionsPanel: - - - - 461 - - - - toggleAutomaticTextReplacement: - - - - 463 - - - - performFindPanelAction: - - - - 467 - - - - performFindPanelAction: - - - - 468 - - - - performFindPanelAction: - - - - 469 - - - - pasteAsPlainText: - - - - 471 - - - - makeKeyAndOrderFront: - - - - 571 - - - - delegate - - - - 751 - - - - delegate - - - - 770 - - - - value: values.alsoShowMenuExtra - - - - - - value: values.alsoShowMenuExtra - value - values.alsoShowMenuExtra - 2 - - - 787 - - - - enabled: values.myShowInDock - - - - - - enabled: values.myShowInDock - enabled - values.myShowInDock - 2 - - - 788 - - - - value: values.myShowInDock - - - - - - value: values.myShowInDock - value - values.myShowInDock - 2 - - - 790 - - - - value: values.startServerOnLaunch - - - - - - value: values.startServerOnLaunch - value - values.startServerOnLaunch - 2 - - - 791 - - - - value: values.startServerOnLaunch - - - - - - value: values.startServerOnLaunch - value - values.startServerOnLaunch - 2 - - - 763 - - - - TerminalApplescript - - - - 574 - - - - TerminalEmulator - - - - 575 - - - - apply: - - - - 773 - - - - SessionType - - - - 782 - - - - DefaultArgs - - - - 783 - - - - appController - - - - 1284 - - - - resetTerminalApplescript: - - - - 1660 - - - - showInDock - - - - 1713 - - - - addToPATH: - - - - 1722 - - - - prefWindow - - - - 1723 - - - - startServer: - - - - 664 - - - - stopServer: - - - - 665 - - - - openNotebook: - - - - 666 - - - - newWorksheet: - - - - 667 - - - - newWorksheet: - - - - 671 - - - - openNotebook: - - - - 672 - - - - stopServerAndQuit: - - - - 688 - - - - browseLocalSageURL: - - - - 690 - - - - browseLocalSageURL: - - - - 691 - - - - browseLocalSageURL: - - - - 692 - - - - browseLocalSageURL: - - - - 693 - - - - browseLocalSageURL: - - - - 694 - - - - browseRemoteURL: - - - - 695 - - - - browseRemoteURL: - - - - 696 - - - - browseRemoteURL: - - - - 697 - - - - browseRemoteURL: - - - - 698 - - - - browseRemoteURL: - - - - 699 - - - - browseRemoteURL: - - - - 700 - - - - terminalSession: - - - - 724 - - - - stopServerAndQuit: - - - - 749 - - - - statusMenu - - - - 750 - - - - appDelegate - - - - 793 - - - - browseLocalSageURL: - - - - 794 - - - - browseLocalSageURL: - - - - 795 - - - - browseLocalSageURL: - - - - 796 - - - - browseLocalSageURL: - - - - 797 - - - - browseLocalSageURL: - - - - 798 - - - - browseRemoteURL: - - - - 799 - - - - browseRemoteURL: - - - - 800 - - - - browseRemoteURL: - - - - 801 - - - - browseRemoteURL: - - - - 802 - - - - browseRemoteURL: - - - - 803 - - - - browseRemoteURL: - - - - 804 - - - - terminalSession: - - - - 1032 - - - - terminalSession: - - - - 1047 - - - - revealInFinder: - - - - 1084 - - - - stopServer: - - - - 1205 - - - - startServer: - - - - 1235 - - - - openNotebook: - - - - 1236 - - - - newWorksheet: - - - - 1245 - - - - showPreferences: - - - - 1265 - - - - prefWindow - - - - 1266 - - - - inputPanelController - - - - 1310 - - - - terminalSession: - - - - 1360 - - - - terminalSession: - - - - 1363 - - - - terminalSession: - - - - 1376 - - - - terminalSession: - - - - 1377 - - - - terminalSession: - - - - 1378 - - - - terminalSession: - - - - 1379 - - - - terminalSession: - - - - 1380 - - - - terminalSession: - - - - 1381 - - - - terminalSession: - - - - 1387 - - - - terminalSession: - - - - 1388 - - - - terminalSession: - - - - 1389 - - - - terminalSession: - - - - 1390 - - - - terminalSession: - - - - 1391 - - - - terminalSession: - - - - 1408 - - - - terminalSession: - - - - 1410 - - - - terminalSessionPromptForFile: - - - - 1439 - - - - terminalSessionPromptForFile: - - - - 1443 - - - - terminalSession: - - - - 1444 - - - - terminalSession: - - - - 1457 - - - - terminalSession: - - - - 1459 - - - - terminalSessionPromptForFile: - - - - 1461 - - - - terminalSessionPromptForFile: - - - - 1475 - - - - terminalSessionPromptForFile: - - - - 1487 - - - - terminalSessionPromptForInput: - - - - 1488 - - - - terminalSessionPromptForInput: - - - - 1490 - - - - terminalSessionPromptForFile: - - - - 1491 - - - - terminalSessionPromptForInput: - - - - 1493 - - - - terminalSessionPromptForFile: - - - - 1548 - - - - terminalSessionPromptForInput: - - - - 1549 - - - - terminalSessionPromptForFile: - - - - 1550 - - - - terminalSessionPromptForFile: - - - - 1551 - - - - terminalSessionPromptForInput: - - - - 1557 - - - - terminalSessionPromptForFile: - - - - 1558 - - - - terminalSession: - - - - 1560 - - - - terminalSessionPromptForFile: - - - - 1562 - - - - terminalSession: - - - - 1565 - - - - terminalSession: - - - - 1566 - - - - terminalSessionPromptForFile: - - - - 1567 - - - - terminalSession: - - - - 1569 - - - - terminalSession: - - - - 1577 - - - - terminalSession: - - - - 1578 - - - - revealInFinder: - - - - 1580 - - - - terminalSession: - - - - 1616 - - - - terminalSessionPromptForInput: - - - - 1617 - - - - terminalSession: - - - - 1622 - - - - terminalSession: - - - - 1628 - - - - terminalSession: - - - - 1629 - - - - terminalSession: - - - - 1631 - - - - terminalSession: - - - - 1632 - - - - terminalSession: - - - - 1638 - - - - terminalSession: - - - - 1646 - - - - terminalSession: - - - - 1647 - - - - terminalSession: - - - - 1648 - - - - terminalSession: - - - - 1649 - - - - terminalSession: - - - - 1650 - - - - terminalSession: - - - - 1651 - - - - browseRemoteURL: - - - - 1662 - - - - browseRemoteURL: - - - - 1664 - - - - viewSageLog: - - - - 1680 - - - - viewSageLog: - - - - 1686 - - - - revealInFinder: - - - - 1692 - - - - revealInFinder: - - - - 1693 - - - - appController - - - - 1267 - - - - openDocumentWithDialogBox: - - - - 1724 - - - - delegate - - - - 784 - - - - value: values.useAltSageBinary - - - - - - value: values.useAltSageBinary - value - values.useAltSageBinary - 2 - - - 1259 - - - - value: values.useAltSageBinary - - - - - - value: values.useAltSageBinary - value - values.useAltSageBinary - 2 - - - 1261 - - - - value: values.useSystemBrowser - - - - - - value: values.useSystemBrowser - value - values.useSystemBrowser - 2 - - - 1271 - - - - enabled: values.myShowInDock - - - - - - enabled: values.myShowInDock - enabled - values.myShowInDock - 2 - - - 1275 - - - - delegate - - - - 1304 - - - - performClose: - - - - 1314 - - - - textField - - - - 1307 - - - - label - - - - 1308 - - - - window - - - - 1309 - - - - appController - - - - 1311 - - - - accept: - - - - 1312 - - - - value: values.alwaysPromptForArguments - - - - - - value: values.alwaysPromptForArguments - value - values.alwaysPromptForArguments - 2 - - - 1319 - - - - value: values.editFullCommands - - - - - - value: values.editFullCommands - value - values.editFullCommands - 2 - - - 1323 - - - - enabled: values.useAltSageBinary - - - - - - enabled: values.useAltSageBinary - enabled - values.useAltSageBinary - 2 - - - 1668 - - - - value: values.SageBinary - - - - - - value: values.SageBinary - value - values.SageBinary - 2 - - - 1670 - - - - delegate - - - - 1678 - - - - value: values.respectSAGE_BROWSER - - - - - - value: values.respectSAGE_BROWSER - value - values.respectSAGE_BROWSER - 2 - - - 1700 - - - - value: values.autoStartServer - - - - - - value: values.autoStartServer - value - values.autoStartServer - 2 - - - 1717 - - - - - YES - - 0 - - YES - - - - - - -2 - - - File's Owner - - - -1 - - - First Responder - - - -3 - - - Application - - - 29 - - - YES - - - - - - - - - - - - - 19 - - - YES - - - - - - 56 - - - YES - - - - - - 217 - - - YES - - - - - - 83 - - - YES - - - - - - 81 - - - YES - - - - - - - - - - - - - - - - 75 - - - - - 80 - - - - - 78 - - - - - 72 - - - - - 82 - - - - - 124 - - - YES - - - - - - 77 - - - - - 73 - - - - - 79 - - - - - 74 - - - - - 125 - - - YES - - - - - - 126 - - - - - 205 - - - YES - - - - - - - - - - - - - - - - - - - 202 - - - - - 198 - - - - - 207 - - - - - 214 - - - - - 199 - - - - - 203 - - - - - 197 - - - - - 206 - - - - - 215 - - - - - 218 - - - YES - - - - - - 220 - - - YES - - - - - - - - - - 213 - - - - - 210 - - - - - 221 - - - - - 208 - - - - - 209 - - - - - 57 - - - YES - - - - - - - - - - - - - - - - - 58 - - - - - 134 - - - - - 150 - - - - - 136 - - - - - 144 - - - - - 129 - - - - - 143 - - - - - 236 - - - - - 131 - - - YES - - - - - - 149 - - - - - 145 - - - - - 130 - - - - - 211 - - - YES - - - - - - 212 - - - YES - - - - - - - 195 - - - - - 196 - - - - - 348 - - - YES - - - - - - 349 - - - YES - - - - - - - - - - - - 350 - - - - - 351 - - - - - 354 - - - - - 419 - - - - - 449 - - - YES - - - - - - 450 - - - YES - - - - - - - - 451 - - - - - 452 - - - - - 453 - - - - - 457 - - - - - 458 - - - - - 459 - - - - - 462 - - - - - 470 - - - - - 530 - - - YES - - - - prefWindow - - - 531 - - - YES - - - - - - 572 - - - - - 578 - - - - - 580 - - - YES - - - - - - - - - - - - - - - - - - - - StatusItem - - - 581 - - - - - 582 - - - YES - - - - - - 583 - - - - - 584 - - - YES - - - - - - 585 - - - - - 586 - - - - - 587 - - - - - 588 - - - - - 589 - - - - - 590 - - - YES - - - - - - 591 - - - - - 592 - - - - - 593 - - - YES - - - - - - - - - - - - - - 619 - - - YES - - - - - - - - - 650 - - - YES - - - - - - - - - - - - - - - - - - - 651 - - - - - 652 - - - - - 653 - - - - - 654 - - - - - 655 - - - - - 656 - - - - - 657 - - - - - 658 - - - - - 659 - - - - - 660 - - - - - 661 - - - - - 662 - - - - - 669 - - - - - 673 - - - YES - - - - - - 674 - - - YES - - - - - - - - - - - - - - - - - - - 675 - - - - - 676 - - - - - 677 - - - - - 678 - - - - - 679 - - - - - 680 - - - - - 681 - - - - - 682 - - - - - 683 - - - - - 684 - - - - - 685 - - - - - 686 - - - - - 746 - - - - - 756 - - - - - 762 - - - - - 24 - - - YES - - - - - - - - - 23 - - - - - 239 - - - - - 5 - - - - - 92 - - - - - 998 - - - YES - - - - - - 1048 - - - YES - - - - - - 1103 - - - YES - - - - - - 1106 - - - YES - - - - - - - - - StatusItem - - - 1107 - - - - - 1108 - - - - - 1110 - - - - - 1113 - - - - - 1114 - - - - - 1264 - - - - - 1293 - - - YES - - - - inputPanel - - - 1294 - - - YES - - - - - - - - - 1295 - - - YES - - - - - - 1296 - - - - - 1297 - - - YES - - - - - - 1298 - - - - - 1299 - - - YES - - - - - - 1300 - - - - - 1301 - - - YES - - - - - - 1302 - - - - - 1303 - - - - - 1049 - - - YES - - - - - - - - - - - - - 1432 - - - YES - - - - - - 1433 - - - YES - - - - - - - - - - 1441 - - - - - 1437 - - - - - 1435 - - - - - 1409 - - - - - 1407 - - - - - 1347 - - - YES - - - - - - 1348 - - - YES - - - - - - - - 1351 - - - - - 1350 - - - - - 1053 - - - - - 1052 - - - - - 1458 - - - - - 1460 - - - - - 1474 - - - - - 1479 - - - YES - - - - - - 1480 - - - YES - - - - - - - - - 1482 - - - - - 1483 - - - - - 1484 - - - - - 1485 - - - - - 1498 - - - - - 1504 - - - YES - - - - - - 1505 - - - YES - - - - - - 1507 - - - YES - - - - - - 1508 - - - YES - - - - - - - - - 1510 - - - - - 1511 - - - - - 1512 - - - - - 1513 - - - - - 1522 - - - YES - - - - - - - - 1524 - - - - - 1525 - - - - - 1526 - - - - - 1532 - - - YES - - - - - - - - - - 1536 - - - - - 1537 - - - - - 1538 - - - - - 1539 - - - - - 1540 - - - - - 1571 - - - - - 1572 - - - - - 1574 - - - - - 1583 - - - - - 1586 - - - - - 1587 - - - - - 1589 - - - YES - - - - - - 1602 - - - YES - - - - - - - - - - - 1603 - - - - - 1604 - - - - - 1605 - - - - - 1606 - - - - - 1607 - - - - - 1608 - - - - - 1640 - - - - - 1641 - - - - - 1642 - - - - - 1643 - - - - - 1644 - - - - - 1645 - - - - - 1661 - - - - - 1663 - - - - - 1673 - - - YES - - - - - - - 1674 - - - YES - - - - - - 1675 - - - YES - - - - - - 1676 - - - YES - - - - - - - - - - - - - - - 1677 - - - YES - - - - - - - - - - - - - - - - - 547 - - - YES - - - - - - 548 - - - - - 549 - - - YES - - - - - - 550 - - - - - 551 - - - YES - - - - - - 552 - - - - - 1268 - - - YES - - - - - - 1269 - - - - - 545 - - - YES - - - - - - 546 - - - - - 553 - - - YES - - - - - - 554 - - - - - 555 - - - YES - - - - - - 556 - - - - - 576 - - - YES - - - - - - 577 - - - - - 774 - - - YES - - - - - - 775 - - - - - 776 - - - YES - - - - - - 777 - - - - - 778 - - - YES - - - - - - 779 - - - - - 780 - - - YES - - - - - - 781 - - - - - 785 - - - - - 1658 - - - YES - - - - - - 1659 - - - - - 1679 - - - - - 999 - - - YES - - - - - - - - - 1492 - - - - - 1367 - - - YES - - - - - - 1368 - - - YES - - - - - - - - - - - 1456 - - - - - 1386 - - - - - 1385 - - - - - 1384 - - - - - 1383 - - - - - 1382 - - - - - 1364 - - - YES - - - - - - 1365 - - - YES - - - - - - - - - - - 1375 - - - - - 1374 - - - - - 1373 - - - - - 1372 - - - - - 1371 - - - - - 1370 - - - - - 1000 - - - - - 1685 - - - - - 1687 - - - - - 1690 - - - - - 1694 - - - YES - - - - - - 1695 - - - - - 1655 - - - YES - - - - - - 1656 - - - - - 1320 - - - YES - - - - - - 1321 - - - - - 1315 - - - YES - - - - - - 1316 - - - - - 1665 - - - YES - - - - - - 1666 - - - - - 1252 - - - YES - - - - - - 1253 - - - - - 1714 - - - YES - - - - - - 1715 - - - - - 1720 - - - YES - - - - - - 1721 - - - - - - - YES - - YES - -1.IBPluginDependency - -2.IBPluginDependency - -3.IBPluginDependency - 1000.IBPluginDependency - 1048.IBPluginDependency - 1049.IBPluginDependency - 1052.IBPluginDependency - 1053.IBPluginDependency - 1103.IBPluginDependency - 1106.IBPluginDependency - 1107.IBPluginDependency - 1108.IBPluginDependency - 1110.IBPluginDependency - 1113.IBPluginDependency - 1114.IBPluginDependency - 124.IBPluginDependency - 125.IBPluginDependency - 1252.IBPluginDependency - 1253.IBPluginDependency - 126.IBPluginDependency - 1264.IBPluginDependency - 1268.IBPluginDependency - 1269.IBPluginDependency - 129.IBPluginDependency - 1293.IBPluginDependency - 1293.IBWindowTemplateEditedContentRect - 1293.NSWindowTemplate.visibleAtLaunch - 1294.IBPluginDependency - 1295.IBPluginDependency - 1296.IBPluginDependency - 1297.IBPluginDependency - 1298.IBPluginDependency - 1299.IBPluginDependency - 130.IBPluginDependency - 1300.IBPluginDependency - 1301.IBPluginDependency - 1302.IBPluginDependency - 1303.IBPluginDependency - 131.IBPluginDependency - 1315.IBPluginDependency - 1316.IBPluginDependency - 1320.IBPluginDependency - 1321.IBPluginDependency - 134.IBPluginDependency - 1347.IBPluginDependency - 1348.IBPluginDependency - 1350.IBPluginDependency - 1351.IBPluginDependency - 136.IBPluginDependency - 1364.IBPluginDependency - 1365.IBPluginDependency - 1367.IBPluginDependency - 1368.IBPluginDependency - 1370.IBPluginDependency - 1371.IBPluginDependency - 1372.IBPluginDependency - 1373.IBPluginDependency - 1374.IBPluginDependency - 1375.IBPluginDependency - 1382.IBPluginDependency - 1383.IBPluginDependency - 1384.IBPluginDependency - 1385.IBPluginDependency - 1386.IBPluginDependency - 1407.IBPluginDependency - 1409.IBPluginDependency - 143.IBPluginDependency - 1432.IBPluginDependency - 1433.IBPluginDependency - 1435.IBPluginDependency - 1437.IBPluginDependency - 144.IBPluginDependency - 1441.IBPluginDependency - 145.IBPluginDependency - 1456.IBPluginDependency - 1458.IBPluginDependency - 1460.IBPluginDependency - 1474.IBPluginDependency - 1479.IBPluginDependency - 1480.IBPluginDependency - 1482.IBPluginDependency - 1483.IBPluginDependency - 1484.IBPluginDependency - 1485.IBPluginDependency - 149.IBPluginDependency - 1492.IBPluginDependency - 1498.IBPluginDependency - 150.IBPluginDependency - 1504.IBPluginDependency - 1505.IBPluginDependency - 1507.IBPluginDependency - 1508.IBPluginDependency - 1510.IBPluginDependency - 1511.IBPluginDependency - 1512.IBPluginDependency - 1513.IBPluginDependency - 1522.IBPluginDependency - 1524.IBPluginDependency - 1525.IBPluginDependency - 1526.IBPluginDependency - 1532.IBPluginDependency - 1536.IBPluginDependency - 1537.IBPluginDependency - 1538.IBPluginDependency - 1539.IBPluginDependency - 1540.IBPluginDependency - 1571.IBPluginDependency - 1572.IBPluginDependency - 1574.IBPluginDependency - 1583.IBPluginDependency - 1586.IBPluginDependency - 1587.IBPluginDependency - 1589.IBPluginDependency - 1602.IBPluginDependency - 1603.IBPluginDependency - 1604.IBPluginDependency - 1605.IBPluginDependency - 1606.IBPluginDependency - 1607.IBPluginDependency - 1608.IBPluginDependency - 1640.IBPluginDependency - 1641.IBPluginDependency - 1642.IBPluginDependency - 1643.IBPluginDependency - 1644.IBPluginDependency - 1645.IBPluginDependency - 1655.IBPluginDependency - 1656.IBPluginDependency - 1658.IBPluginDependency - 1659.IBPluginDependency - 1661.IBPluginDependency - 1663.IBPluginDependency - 1665.IBPluginDependency - 1666.IBPluginDependency - 1673.IBPluginDependency - 1674.IBPluginDependency - 1675.IBPluginDependency - 1676.IBPluginDependency - 1677.IBPluginDependency - 1679.IBPluginDependency - 1685.IBPluginDependency - 1687.IBPluginDependency - 1690.IBPluginDependency - 1694.IBPluginDependency - 1695.IBPluginDependency - 1714.IBPluginDependency - 1715.IBPluginDependency - 1720.IBPluginDependency - 1721.IBPluginDependency - 19.IBPluginDependency - 195.IBPluginDependency - 196.IBPluginDependency - 197.IBPluginDependency - 198.IBPluginDependency - 199.IBPluginDependency - 202.IBPluginDependency - 203.IBPluginDependency - 205.IBPluginDependency - 206.IBPluginDependency - 207.IBPluginDependency - 208.IBPluginDependency - 209.IBPluginDependency - 210.IBPluginDependency - 211.IBPluginDependency - 212.IBPluginDependency - 213.IBPluginDependency - 214.IBPluginDependency - 215.IBPluginDependency - 217.IBPluginDependency - 218.IBPluginDependency - 220.IBPluginDependency - 221.IBPluginDependency - 23.IBPluginDependency - 236.IBPluginDependency - 239.IBPluginDependency - 24.IBPluginDependency - 29.IBPluginDependency - 348.IBPluginDependency - 349.IBPluginDependency - 350.IBPluginDependency - 351.IBPluginDependency - 354.IBPluginDependency - 419.IBPluginDependency - 449.IBPluginDependency - 450.IBPluginDependency - 451.IBPluginDependency - 452.IBPluginDependency - 453.IBPluginDependency - 457.IBPluginDependency - 458.IBPluginDependency - 459.IBPluginDependency - 462.IBPluginDependency - 470.IBPluginDependency - 5.IBPluginDependency - 530.IBPluginDependency - 530.IBWindowTemplateEditedContentRect - 530.NSWindowTemplate.visibleAtLaunch - 531.IBPluginDependency - 545.IBPluginDependency - 546.IBPluginDependency - 547.IBPluginDependency - 548.IBPluginDependency - 549.IBPluginDependency - 550.IBPluginDependency - 551.IBPluginDependency - 552.IBPluginDependency - 553.IBPluginDependency - 554.IBPluginDependency - 555.IBPluginDependency - 556.IBPluginDependency - 56.IBPluginDependency - 57.IBPluginDependency - 572.IBPluginDependency - 576.IBPluginDependency - 577.IBPluginDependency - 578.IBPluginDependency - 58.IBPluginDependency - 580.IBPluginDependency - 581.IBPluginDependency - 582.IBPluginDependency - 583.IBPluginDependency - 584.IBPluginDependency - 585.IBPluginDependency - 586.IBPluginDependency - 587.IBPluginDependency - 588.IBPluginDependency - 589.IBPluginDependency - 590.IBPluginDependency - 591.IBPluginDependency - 592.IBPluginDependency - 593.IBPluginDependency - 619.IBPluginDependency - 650.IBPluginDependency - 651.IBAttributePlaceholdersKey - 651.IBPluginDependency - 652.IBPluginDependency - 653.IBPluginDependency - 654.IBPluginDependency - 655.IBAttributePlaceholdersKey - 655.IBPluginDependency - 656.IBAttributePlaceholdersKey - 656.IBPluginDependency - 657.IBAttributePlaceholdersKey - 657.IBPluginDependency - 658.IBAttributePlaceholdersKey - 658.IBPluginDependency - 659.IBPluginDependency - 660.IBPluginDependency - 661.IBPluginDependency - 662.IBPluginDependency - 669.IBPluginDependency - 673.IBPluginDependency - 674.IBPluginDependency - 675.IBPluginDependency - 676.IBPluginDependency - 677.IBPluginDependency - 678.IBPluginDependency - 679.IBAttributePlaceholdersKey - 679.IBPluginDependency - 680.IBAttributePlaceholdersKey - 680.IBPluginDependency - 681.IBAttributePlaceholdersKey - 681.IBPluginDependency - 682.IBAttributePlaceholdersKey - 682.IBPluginDependency - 683.IBPluginDependency - 684.IBPluginDependency - 685.IBPluginDependency - 686.IBAttributePlaceholdersKey - 686.IBPluginDependency - 72.IBPluginDependency - 73.IBPluginDependency - 74.IBPluginDependency - 746.IBPluginDependency - 75.IBPluginDependency - 756.IBPluginDependency - 762.IBPluginDependency - 77.IBPluginDependency - 774.IBPluginDependency - 775.IBPluginDependency - 776.IBPluginDependency - 777.IBPluginDependency - 778.IBPluginDependency - 779.IBPluginDependency - 78.IBPluginDependency - 780.IBPluginDependency - 781.IBPluginDependency - 785.IBPluginDependency - 79.IBPluginDependency - 80.IBPluginDependency - 81.IBPluginDependency - 82.IBPluginDependency - 83.IBPluginDependency - 92.IBPluginDependency - 998.IBPluginDependency - 999.IBPluginDependency - - - YES - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - {{314, 361}, {494, 193}} - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - {{675, 108}, {448, 387}} - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - YES - - - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - YES - - - - com.apple.InterfaceBuilder.CocoaPlugin - - YES - - - - com.apple.InterfaceBuilder.CocoaPlugin - - YES - - - - com.apple.InterfaceBuilder.CocoaPlugin - - YES - - - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - YES - - - - com.apple.InterfaceBuilder.CocoaPlugin - - YES - - - - com.apple.InterfaceBuilder.CocoaPlugin - - YES - - - - com.apple.InterfaceBuilder.CocoaPlugin - - YES - - - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - YES - - - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - - - YES - - - - - - YES - - - - - 1724 - - - - YES - - AppController - NSObject - - YES - - YES - browseLocalSageURL: - browseRemoteURL: - newWorksheet: - openNotebook: - revealInFinder: - showPreferences: - startServer: - stopServer: - stopServerAndQuit: - terminalSession: - terminalSessionPromptForFile: - terminalSessionPromptForInput: - viewSageLog: - - - YES - id - id - id - id - id - id - id - id - id - id - id - id - id - - - - YES - - YES - browseLocalSageURL: - browseRemoteURL: - newWorksheet: - openNotebook: - revealInFinder: - showPreferences: - startServer: - stopServer: - stopServerAndQuit: - terminalSession: - terminalSessionPromptForFile: - terminalSessionPromptForInput: - viewSageLog: - - - YES - - browseLocalSageURL: - id - - - browseRemoteURL: - id - - - newWorksheet: - id - - - openNotebook: - id - - - revealInFinder: - id - - - showPreferences: - id - - - startServer: - id - - - stopServer: - id - - - stopServerAndQuit: - id - - - terminalSession: - id - - - terminalSessionPromptForFile: - id - - - terminalSessionPromptForInput: - id - - - viewSageLog: - id - - - - - YES - - YES - appDelegate - inputPanelController - prefWindow - statusMenu - - - YES - id - id - id - NSMenu - - - - YES - - YES - appDelegate - inputPanelController - prefWindow - statusMenu - - - YES - - appDelegate - id - - - inputPanelController - id - - - prefWindow - id - - - statusMenu - NSMenu - - - - - IBProjectSource - ./Classes/AppController.h - - - - AppDelegate - NSObject - - openDocumentWithDialogBox: - id - - - openDocumentWithDialogBox: - - openDocumentWithDialogBox: - id - - - - appController - AppController - - - appController - - appController - AppController - - - - IBProjectSource - ./Classes/AppDelegate.h - - - - InputPanelController - NSWindowController - - accept: - id - - - accept: - - accept: - id - - - - YES - - YES - appController - label - textField - window - - - YES - id - id - id - id - - - - YES - - YES - appController - label - textField - window - - - YES - - appController - id - - - label - id - - - textField - id - - - window - id - - - - - IBProjectSource - ./Classes/InputPanelController.h - - - - MyDocument - NSDocument - - YES - - YES - browseURL: - connectURL: - printDocument: - webViewShow: - - - YES - NSString - id - id - WebView - - - - YES - - YES - browseURL: - connectURL: - printDocument: - webViewShow: - - - YES - - browseURL: - NSString - - - connectURL: - id - - - printDocument: - id - - - webViewShow: - WebView - - - - - YES - - YES - progressIndicator - urlString - webView - - - YES - id - id - WebView - - - - YES - - YES - progressIndicator - urlString - webView - - - YES - - progressIndicator - id - - - urlString - id - - - webView - WebView - - - - - IBProjectSource - ./Classes/MyDocument.h - - - - NSDocument - - YES - - YES - printDocument: - revertDocumentToSaved: - runPageLayout: - saveDocument: - saveDocumentAs: - saveDocumentTo: - - - YES - id - id - id - id - id - id - - - - YES - - YES - printDocument: - revertDocumentToSaved: - runPageLayout: - saveDocument: - saveDocumentAs: - saveDocumentTo: - - - YES - - printDocument: - id - - - revertDocumentToSaved: - id - - - runPageLayout: - id - - - saveDocument: - id - - - saveDocumentAs: - id - - - saveDocumentTo: - id - - - - - IBProjectSource - ./Classes/NSDocument.h - - - - PreferencePanelController - NSObject - - YES - - YES - addToPATH: - apply: - resetTerminalApplescript: - - - YES - id - id - id - - - - YES - - YES - addToPATH: - apply: - resetTerminalApplescript: - - - YES - - addToPATH: - id - - - apply: - id - - - resetTerminalApplescript: - id - - - - - YES - - YES - DefaultArgs - SessionType - TerminalApplescript - TerminalEmulator - appController - prefWindow - showInDock - - - YES - id - id - id - id - id - id - id - - - - YES - - YES - DefaultArgs - SessionType - TerminalApplescript - TerminalEmulator - appController - prefWindow - showInDock - - - YES - - DefaultArgs - id - - - SessionType - id - - - TerminalApplescript - id - - - TerminalEmulator - id - - - appController - id - - - prefWindow - id - - - showInDock - id - - - - - IBProjectSource - ./Classes/PreferencePanelController.h - - - - WebView - - reloadFromOrigin: - id - - - reloadFromOrigin: - - reloadFromOrigin: - id - - - - IBProjectSource - ./Classes/WebView.h - - - - - 0 - IBCocoaFramework - - com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 - - - YES - 3 - - YES - - YES - NSMenuCheckmark - NSMenuMixedState - NSSwitch - - - YES - {9, 8} - {7, 2} - {15, 15} - - - - diff --git a/src/ext/sage/ext/mac-app/English.lproj/MainMenu.nib/keyedobjects.nib b/src/ext/sage/ext/mac-app/English.lproj/MainMenu.nib/keyedobjects.nib deleted file mode 100644 index 3af83e3c3aa0984ec2703ead5b5e43d5bb2844cb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 63323 zcmdSC2YeL8`#-+3ySKM{Js0i{*o_<=6p&TYM7|6L%+Ka4_*%Y>U&ibFW&BG18va^-Gk*)eg};^G$?xGGp*MEpVgQT$!}!zS76Hm}WR%dwqe>tO3>>u&2|JKJ`S zZMbcOt;jacHq%yYn`5i_BJja=ivm9qT&T$NI40nuhjC720jCD+L%y3-bh&X0CW;tSxO2<4$jbo`}nL~F_ z$0d#{9BUox99KJTa%^(k?AYws=D6Fj({Ybux8qUAV~)o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English.lproj/MyDocument.nib/designable.nib deleted file mode 100644 index 8b2666561a1..00000000000 --- a/src/ext/sage/ext/mac-app/English.lproj/MyDocument.nib/designable.nib +++ /dev/null @@ -1,1418 +0,0 @@ - - - - 1060 - 10F569 - 788 - 1038.29 - 461.00 - - YES - - YES - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.WebKitIBPlugin - - - YES - 788 - 788 - - - - YES - - - YES - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.WebKitIBPlugin - - - YES - - YES - - - YES - - - - YES - - MyDocument - - - FirstResponder - - - 15 - 2 - {{133, 33}, {753, 615}} - 1886912512 - Window - NSWindow - View - {1.79769e+308, 1.79769e+308} - {94, 86} - - - 256 - - YES - - - 274 - - YES - - YES - Apple HTML pasteboard type - Apple PDF pasteboard type - Apple PICT pasteboard type - Apple URL pasteboard type - Apple Web Archive pasteboard type - NSColor pasteboard type - NSFilenamesPboardType - NSStringPboardType - NeXT RTFD pasteboard type - NeXT Rich Text Format v1.0 pasteboard type - NeXT TIFF v4.0 pasteboard type - WebURLsWithTitlesPboardType - public.png - public.url - public.url-name - - - {{0, 20}, {753, 555}} - - - - - - - SgMt - - YES - - - YES - - - - YES - YES - - - - 266 - {{150, 583}, {563, 22}} - - - YES - - -1804468671 - 272630784 - - - LucidaGrande - 13 - 1044 - - - YES - - 6 - System - textBackgroundColor - - 3 - MQA - - - - 6 - System - textColor - - 3 - MAA - - - - - - - 1289 - - {{721, 586}, {16, 16}} - - - 20746 - 100 - - - - 268 - {{10, 584}, {27, 19}} - - - YES - - 67239424 - 0 - - - LucidaGrande - 12 - 16 - - - -2034482945 - 36 - - NSImage - NSLeftFacingTriangleTemplate - - - - 200 - 25 - - - - - 268 - {{39, 584}, {27, 19}} - - - YES - - 67239424 - 134217728 - - - - -2033958657 - 164 - - NSImage - NSRightFacingTriangleTemplate - - - - 200 - 25 - - - - - 268 - {{74, 584}, {30, 19}} - - - YES - - 67239424 - 134217728 - - - - -2033958657 - 164 - - NSImage - NSRefreshTemplate - - - - 200 - 25 - - - - - 268 - {{112, 584}, {30, 19}} - - - YES - - 67239424 - 134217728 - - - - -2033958657 - 164 - - NSImage - NSStopProgressTemplate - - - - 200 - 25 - - - - {753, 615} - - - - {{0, 0}, {1440, 878}} - {94, 108} - {1.79769e+308, 1.79769e+308} - - - NSApplication - - - MyDocument - - - - - YES - - - delegate - - - - 17 - - - - window - - - - 18 - - - - stopLoading: - - - - 100034 - - - - reload: - - - - 100035 - - - - goForward: - - - - 100036 - - - - goBack: - - - - 100037 - - - - urlString - - - - 100039 - - - - webView - - - - 100040 - - - - connectURL: - - - - 100041 - - - - progressIndicator - - - - 100050 - - - - - YES - - 0 - - - - - - -2 - - - File's Owner - - - -1 - - - First Responder - - - 5 - - - YES - - - - Window - - - 6 - - - YES - - - - - - - - - - - - -3 - - - Application - - - 100021 - - - - - 100022 - - - YES - - - - - - 100023 - - - - - 100024 - - - - - 100025 - - - YES - - - - - - 100026 - - - - - 100027 - - - YES - - - - - - 100028 - - - - - 100029 - - - YES - - - - - - 100030 - - - - - 100031 - - - YES - - - - - - 100032 - - - - - 100049 - - - - - - - YES - - YES - -3.IBPluginDependency - 100021.IBPluginDependency - 100022.IBPluginDependency - 100023.IBPluginDependency - 100024.IBPluginDependency - 100025.IBPluginDependency - 100026.IBPluginDependency - 100027.IBPluginDependency - 100028.IBPluginDependency - 100029.IBPluginDependency - 100030.IBPluginDependency - 100031.IBPluginDependency - 100032.IBPluginDependency - 5.IBEditorWindowLastContentRect - 5.IBPluginDependency - 5.IBWindowTemplateEditedContentRect - 5.ImportedFromIB2 - 5.editorWindowContentRectSynchronizationRect - 5.windowTemplate.hasMinSize - 5.windowTemplate.minSize - 6.IBPluginDependency - 6.ImportedFromIB2 - - - YES - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.WebKitIBPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - {{317, 203}, {753, 615}} - com.apple.InterfaceBuilder.CocoaPlugin - {{317, 203}, {753, 615}} - - {{201, 387}, {507, 413}} - - {94, 86} - com.apple.InterfaceBuilder.CocoaPlugin - - - - - YES - - - YES - - - - - YES - - - YES - - - - 100050 - - - - YES - - MyDocument - NSDocument - - YES - - YES - browseURL: - connectURL: - printDocument: - webViewShow: - - - YES - NSString - id - id - WebView - - - - YES - - YES - browseURL: - connectURL: - printDocument: - webViewShow: - - - YES - - browseURL: - NSString - - - connectURL: - id - - - printDocument: - id - - - webViewShow: - WebView - - - - - YES - - YES - progressIndicator - urlString - webView - - - YES - id - id - WebView - - - - YES - - YES - progressIndicator - urlString - webView - - - YES - - progressIndicator - id - - - urlString - id - - - webView - WebView - - - - - IBProjectSource - MyDocument.h - - - - MyDocument - NSDocument - - IBUserSource - - - - - - YES - - NSActionCell - NSCell - - IBFrameworkSource - AppKit.framework/Headers/NSActionCell.h - - - - NSApplication - NSResponder - - IBFrameworkSource - AppKit.framework/Headers/NSApplication.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSApplicationScripting.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSColorPanel.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSHelpManager.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSPageLayout.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSUserInterfaceItemSearching.h - - - - NSButton - NSControl - - IBFrameworkSource - AppKit.framework/Headers/NSButton.h - - - - NSButtonCell - NSActionCell - - IBFrameworkSource - AppKit.framework/Headers/NSButtonCell.h - - - - NSCell - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSCell.h - - - - NSControl - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSControl.h - - - - NSDocument - NSObject - - YES - - YES - printDocument: - revertDocumentToSaved: - runPageLayout: - saveDocument: - saveDocumentAs: - saveDocumentTo: - - - YES - id - id - id - id - id - id - - - - YES - - YES - printDocument: - revertDocumentToSaved: - runPageLayout: - saveDocument: - saveDocumentAs: - saveDocumentTo: - - - YES - - printDocument: - id - - - revertDocumentToSaved: - id - - - runPageLayout: - id - - - saveDocument: - id - - - saveDocumentAs: - id - - - saveDocumentTo: - id - - - - - IBFrameworkSource - AppKit.framework/Headers/NSDocument.h - - - - NSDocument - - IBFrameworkSource - AppKit.framework/Headers/NSDocumentScripting.h - - - - NSFormatter - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFormatter.h - - - - NSMenu - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSMenu.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSAccessibility.h - - - - NSObject - - - - NSObject - - - - NSObject - - - - NSObject - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSDictionaryController.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSDragging.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSFontManager.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSFontPanel.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSKeyValueBinding.h - - - - NSObject - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSNibLoading.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSOutlineView.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSPasteboard.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSSavePanel.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSTableView.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSToolbarItem.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSView.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSClassDescription.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObjectScripting.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSPortCoder.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSScriptClassDescription.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSScriptKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSScriptObjectSpecifiers.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSScriptWhoseTests.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLDownload.h - - - - NSObject - - IBFrameworkSource - Print.framework/Headers/PDEPluginInterface.h - - - - NSObject - - IBFrameworkSource - WebKit.framework/Headers/WebDownload.h - - - - NSObject - - IBFrameworkSource - WebKit.framework/Headers/WebEditingDelegate.h - - - - NSObject - - IBFrameworkSource - WebKit.framework/Headers/WebFrameLoadDelegate.h - - - - NSObject - - IBFrameworkSource - WebKit.framework/Headers/WebJavaPlugIn.h - - - - NSObject - - IBFrameworkSource - WebKit.framework/Headers/WebPlugin.h - - - - NSObject - - IBFrameworkSource - WebKit.framework/Headers/WebPluginContainer.h - - - - NSObject - - IBFrameworkSource - WebKit.framework/Headers/WebPolicyDelegate.h - - - - NSObject - - IBFrameworkSource - WebKit.framework/Headers/WebResourceLoadDelegate.h - - - - NSObject - - IBFrameworkSource - WebKit.framework/Headers/WebScriptObject.h - - - - NSObject - - IBFrameworkSource - WebKit.framework/Headers/WebUIDelegate.h - - - - NSProgressIndicator - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSProgressIndicator.h - - - - NSResponder - - IBFrameworkSource - AppKit.framework/Headers/NSInterfaceStyle.h - - - - NSResponder - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSResponder.h - - - - NSString - - - - NSString - - IBFrameworkSource - AppKit.framework/Headers/NSStringDrawing.h - - - - NSString - - IBFrameworkSource - Foundation.framework/Headers/NSPathUtilities.h - - - - NSString - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSString.h - - - - NSString - - - - NSTextField - NSControl - - IBFrameworkSource - AppKit.framework/Headers/NSTextField.h - - - - NSTextFieldCell - NSActionCell - - IBFrameworkSource - AppKit.framework/Headers/NSTextFieldCell.h - - - - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSClipView.h - - - - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSMenuItem.h - - - - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSRulerView.h - - - - NSView - NSResponder - - - - NSWindow - - IBFrameworkSource - AppKit.framework/Headers/NSDrawer.h - - - - NSWindow - NSResponder - - IBFrameworkSource - AppKit.framework/Headers/NSWindow.h - - - - NSWindow - - IBFrameworkSource - AppKit.framework/Headers/NSWindowScripting.h - - - - WebView - NSView - - YES - - YES - goBack: - goForward: - makeTextLarger: - makeTextSmaller: - makeTextStandardSize: - reload: - reloadFromOrigin: - stopLoading: - takeStringURLFrom: - toggleContinuousSpellChecking: - toggleSmartInsertDelete: - - - YES - id - id - id - id - id - id - id - id - id - id - id - - - - YES - - YES - goBack: - goForward: - makeTextLarger: - makeTextSmaller: - makeTextStandardSize: - reload: - reloadFromOrigin: - stopLoading: - takeStringURLFrom: - toggleContinuousSpellChecking: - toggleSmartInsertDelete: - - - YES - - goBack: - id - - - goForward: - id - - - makeTextLarger: - id - - - makeTextSmaller: - id - - - makeTextStandardSize: - id - - - reload: - id - - - reloadFromOrigin: - id - - - stopLoading: - id - - - takeStringURLFrom: - id - - - toggleContinuousSpellChecking: - id - - - toggleSmartInsertDelete: - id - - - - - IBFrameworkSource - WebKit.framework/Headers/WebView.h - - - - - 0 - IBCocoaFramework - - com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 - - - YES - ../Sage.xcodeproj - 3 - - YES - - YES - NSLeftFacingTriangleTemplate - NSRefreshTemplate - NSRightFacingTriangleTemplate - NSStopProgressTemplate - - - YES - {9, 9} - {10, 12} - {9, 9} - {11, 11} - - - - diff --git a/src/ext/sage/ext/mac-app/English.lproj/MyDocument.nib/keyedobjects.nib b/src/ext/sage/ext/mac-app/English.lproj/MyDocument.nib/keyedobjects.nib deleted file mode 100644 index 922ad82221be9d81074333515a0a85275d4a5497..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8031 zcmb7J349aP)<5@VZ?;J?X{LY>r0iQuOUn*jsBA5@E0ofZwnH08lai#AQVJJQ77-K` zc!)mv3b;L3LqtH)2RvmHki`YXUBMMM_|D9v$WndZ*Zy)dGxywc&+64Qw)WD!N7$0VEHt$A`+e$?+sN{`|xo=d?Z+F2eNS8 zW^Oy^Ko7kk5&FRZ7zjfl4RW9esv!gsn1!8?h4y;fa&Pf{wU|K-!ZIB%X95 zy+{H{Bq=11qI)^sVxpW?7bUwX{E}(bQd+0*Ch%Tl}=)H6)y^r2cAEaC8f9RX^Eqa(9 zp-1U4dYryZPtcR}6n%%Drf29`dXBzJ-=pu-59oRNA?&0d(F^or`U(AJ%E?cws1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L@TTFg;i%!b;e_Fo;k4m`;Yv)0m?1H~ zm_;#bVz$SeiuuYIV{{r5jbn|~SfJ(`mm60a*BP6Q8;nmF|7P4_+-=-r+-uxtJY+m? z{LJ{H2~1WKZ|Y>~WlA;;HH|c7o61a6Oy#CZ(^S*rrcI_7P5VrTO{Y!YnTffLxtBS` zoN3NASDL4qtIgBQesjQFYYv$s=9%VM<|gwz^L+CH^JC@>=D(Y_nGc)aF`qYoWd6?l zgZZ-gXY;S-D;BU&OD9XbrHiGTrH7@rrLQH?l4KccVV0Ga^_CYb2P~&7pId&m{AwlE z7^}%@v2s?smAA%P1#25?J8OGuUu&W@$vVV3%sSRuVlB0nS*KX5t&6M=Sl3&hvTn8R zvhKGYv!1qoX#LW9nTzAvaP7GEoSW;!b>_Nq-MKVwCO3;~;udmCxn{^3VjpH7VNbV@x8G^cw-?$2_Imq5`!f4V`#Ss6_AU0;?MLjF>_0oq4!a}H z(ZkWp(Z`YC=;s*h80W}weChbwamn$m<9o+%yoKj@JJ0j6d?&sa--o}G&*uyIVtyh&iJ#1ScrRbUi+mOD zFY({<-}6_T;Oy+|>g?|9>Fn+7>r8YeIr}?PodcbNokN|&ooUVt=Sb%r&Rl1n zv)6E^;n$E_E(*-tS!De8{=dx!SqL`Gj+`^Gqxk+cvgaY+-D9 zY$W!{*f(Q;bH%%|TzRfCSCz}>n&t|->RdBj^IY>?FS>TRcDZ)D_PF-BUUR+f`nT(# z>p!lyTt{5TTyMKhy54b}ah-F$=la0)q3eR{6W3?1FI-=_F1mhl{URg_DZ&6@kT66T zCX5i$g-jt!7$uAm#tAt>u8=1b2t~pKp+qPZ%7iIGxlk!g6{>}4LQseZ4Z>Vufv{Lu zA*>SC3hRW8!ZX5V;W^<2VVAI5cvaXh925= - -@interface InputPanelController : NSWindowController { - IBOutlet id label; - IBOutlet id textField; - IBOutlet id window; - IBOutlet id appController; - - NSString *commandPrefix; -} - -- (void)runCommand:(NSString*)command withPrompt:(NSString*)prompt withArguments:(NSString*)defArgs editingCommand:(BOOL)editable; -- (IBAction)accept:(id)sender; - -@end diff --git a/src/ext/sage/ext/mac-app/InputPanelController.m b/src/ext/sage/ext/mac-app/InputPanelController.m deleted file mode 100644 index fd8f2641874..00000000000 --- a/src/ext/sage/ext/mac-app/InputPanelController.m +++ /dev/null @@ -1,39 +0,0 @@ -// -// InputPanelController.m -// -// Created by Ivan Andrus on 7/9/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import "InputPanelController.h" -#import "AppController.h" - -@implementation InputPanelController - -- (void)runCommand:(NSString*)command withPrompt:(NSString*)prompt withArguments:(NSString*)defArgs editingCommand:(BOOL)editable{ - - // If it wasn't closed, give the user a bit of a flicker so they know it's a different prompt - [self close]; - - [label setStringValue:prompt]; - if (editable) { - [textField setStringValue: (defArgs == nil) ? command : [command stringByAppendingFormat:@" %@", defArgs]]; - commandPrefix = @""; - } else { - [textField setStringValue: (defArgs == nil ) ? @"" : defArgs]; - commandPrefix = [command retain]; - } - [NSApp activateIgnoringOtherApps:YES]; - [window makeKeyAndOrderFront:self]; - [self showWindow:self]; -} - -- (IBAction)accept:(id)sender{ - [self close]; - NSString * command = [NSString stringWithFormat:@"%@ %@", commandPrefix, [textField stringValue]]; - [appController terminalRun:command]; - [commandPrefix release]; -} - - -@end diff --git a/src/ext/sage/ext/mac-app/MyDocument.h b/src/ext/sage/ext/mac-app/MyDocument.h deleted file mode 100644 index 428ec42745e..00000000000 --- a/src/ext/sage/ext/mac-app/MyDocument.h +++ /dev/null @@ -1,28 +0,0 @@ -// -// MyDocument.h -// Sage -// -// Created by Ivan Andrus on 26/6/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - - -#import -#import - -@interface MyDocument : NSDocument -{ - IBOutlet id urlString; - IBOutlet WebView *webView; - IBOutlet id progressIndicator; -} - -- (IBAction)connectURL:(id)sender; -- (id)webView; -- (void)webViewShow:(WebView *)sender; -- (WebView *)webView:(WebView *)sender createWebViewWithRequest:(NSURLRequest *)request; -- (IBAction)browseURL:(NSString*)theURL; -- (IBAction)printDocument:(id)sender; - - -@end diff --git a/src/ext/sage/ext/mac-app/MyDocument.m b/src/ext/sage/ext/mac-app/MyDocument.m deleted file mode 100644 index ca38b29ab3f..00000000000 --- a/src/ext/sage/ext/mac-app/MyDocument.m +++ /dev/null @@ -1,187 +0,0 @@ -// -// MyDocument.m -// Sage -// -// Created by Ivan Andrus on 26/6/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import "MyDocument.h" -#import -#import -#import - -@implementation MyDocument - -- (id)init{ - self = [super init]; - if (self) { - - // Add your subclass-specific initialization here. - // If an error occurs here, send a [self release] message and return nil. - NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; - [nc addObserver:self selector:@selector(webViewProgressStarted:) name:WebViewProgressStartedNotification object:webView]; - [nc addObserver:self selector:@selector(webViewProgressFinished:) name:WebViewProgressFinishedNotification object:webView]; - - // We don't want undo - [self setHasUndoManager:NO]; - } - return self; -} - -- (NSString *)windowNibName{ - // Override returning the nib file name of the document - // If you need to use a subclass of NSWindowController or if your document supports multiple NSWindowControllers, you should remove this method and override -makeWindowControllers instead. - return @"MyDocument"; -} - -- (void)windowControllerDidLoadNib:(NSWindowController *) aController -{ - // TODO: this is slightly underhanded but easier than building our own from scratch. - [webView setApplicationNameForUserAgent:@"Safari/528.16 SageBrowser"]; - - [super windowControllerDidLoadNib:aController]; - - // Set up some delegates. Perhaps this could/should be done in the nib file - [webView setGroupName:@"MyDocument"]; - [webView setUIDelegate:self]; - [webView setFrameLoadDelegate:self]; -} - -// TODO: this will allow saving -- (NSData *)dataOfType:(NSString *)typeName error:(NSError **)outError -{ - // Insert code here to write your document to data of the specified type. If the given outError != NULL, ensure that you set *outError when returning nil. - - // You can also choose to override -fileWrapperOfType:error:, -writeToURL:ofType:error:, or -writeToURL:ofType:forSaveOperation:originalContentsURL:error: instead. - - // For applications targeted for Panther or earlier systems, you should use the deprecated API -dataRepresentationOfType:. In this case you can also choose to override -fileWrapperRepresentationOfType: or -writeToFile:ofType: instead. - NSLog(@"well at least I made it there"); - - if ( outError != NULL ) { - *outError = [NSError errorWithDomain:NSOSStatusErrorDomain code:unimpErr userInfo:NULL]; - } - - return nil; -} - - -- (BOOL)readFromURL:(NSURL *)absoluteURL ofType:(NSString *)typeName error:(NSError **)outError { - - NSLog(@"well at least I made it to open a url"); - if ( outError != NULL ) { - *outError = [NSError errorWithDomain:NSOSStatusErrorDomain code:unimpErr userInfo:NULL]; - } - return YES; -} - -- (BOOL)readFromData:(NSData *)data ofType:(NSString *)typeName error:(NSError **)outError -{ - // Insert code here to read your document from the given data of the specified type. If the given outError != NULL, ensure that you set *outError when returning NO. - - // You can also choose to override -readFromFileWrapper:ofType:error: or -readFromURL:ofType:error: instead. - - // For applications targeted for Panther or earlier systems, you should use the deprecated API -loadDataRepresentation:ofType. In this case you can also choose to override -readFromFile:ofType: or -loadFileWrapperRepresentation:ofType: instead. - NSLog(@"well at least I made it here"); - if ( outError != NULL ) { - *outError = [NSError errorWithDomain:NSOSStatusErrorDomain code:unimpErr userInfo:NULL]; - } - return YES; -} - -// From Fluidium -- (BOOL)writeToURL:(NSURL *)absoluteURL ofType:(NSString *)typeName error:(NSError **)outError { - NSData *archiveData = [[[[webView mainFrame] dataSource] webArchive] data]; - return [archiveData writeToURL:absoluteURL options:0 error:outError]; -} - -- (id)webView{ - return webView; -} - -- (IBAction)connectURL:(id)sender{ - [urlString setStringValue:[sender stringValue]]; - [[webView mainFrame] loadRequest: - [NSURLRequest requestWithURL: - [NSURL URLWithString: - [sender stringValue]]]]; -} - -- (WebView *)webView:(WebView *)sender createWebViewWithRequest:(NSURLRequest *)request{ - - NSError *outError = nil; - id myDocument = [[NSDocumentController sharedDocumentController] - openUntitledDocumentAndDisplay:YES error:&outError]; - if ( myDocument == nil ) { - [NSApp presentError:outError]; - NSLog(@"sageBrowser: Error creating document: %@", [outError localizedDescription]); - } else { - [[[myDocument webView] mainFrame] - loadRequest:request]; - - } - - return [myDocument webView]; -} - -- (void)webViewShow:(WebView *)sender{ - id myDocument = [[NSDocumentController sharedDocumentController] documentForWindow:[sender window]]; - [myDocument showWindows]; -} - -- (IBAction)browseURL:(NSString*)theURL{ - - id myDocument = [[NSDocumentController sharedDocumentController] - openUntitledDocumentOfType:@"DocumentType" - display:YES]; - - [[[myDocument webView] mainFrame] - loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:theURL]]]; -} - -- (void)webView:(WebView *)sender didStartProvisionalLoadForFrame:(WebFrame *)frame{ - // Only report feedback for the main frame. - if (frame == [sender mainFrame]){ - NSString *url = [[[[frame provisionalDataSource] request] URL] absoluteString]; - [urlString setStringValue:url]; - } -} - -// Taken from Fluidium - -- (void)webView:(WebView *)wv runOpenPanelForFileButtonWithResultListener:(id )listener { - NSOpenPanel *openPanel = [NSOpenPanel openPanel]; - [openPanel beginSheetForDirectory:nil - file:nil - modalForWindow:[[self webView] window] - modalDelegate:self - didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo:) - contextInfo:[listener retain]]; // retained -} - -- (void)openPanelDidEnd:(NSSavePanel *)openPanel returnCode:(int)code contextInfo:(id )listener { - [listener autorelease]; // released - - if (NSOKButton == code) { - [listener chooseFilename:[openPanel filename]]; - } -} - -- (IBAction)printDocument:(id)sender{ - [[[[webView mainFrame] frameView] documentView] print:sender]; -} - -#pragma mark WebProgressNotifications - -- (void)webViewProgressStarted:(NSNotification *)n { -// NSLog(@"progress started: %@", progressIndicator); - [progressIndicator startAnimation:self]; -} - - -- (void)webViewProgressFinished:(NSNotification *)n { -// NSLog(@"progress stopped"); - [progressIndicator stopAnimation:self]; -} - -@end diff --git a/src/ext/sage/ext/mac-app/PreferencePanelController.h b/src/ext/sage/ext/mac-app/PreferencePanelController.h deleted file mode 100644 index 646d9518e89..00000000000 --- a/src/ext/sage/ext/mac-app/PreferencePanelController.h +++ /dev/null @@ -1,29 +0,0 @@ -// -// PreferencePanelController.h -// -// Created by Ivan Andrus on 26/6/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import - -@interface PreferencePanelController : NSObject { - IBOutlet id appController; - IBOutlet id prefWindow; - - IBOutlet id showInDock; - IBOutlet id TerminalApplescript; - IBOutlet id TerminalEmulator; - IBOutlet id SessionType; - IBOutlet id DefaultArgs; -} - -- (IBAction)apply:(id)sender; -- (IBAction)resetTerminalApplescript:(id)sender; -- (IBAction)addToPATH:(id)sender; -- (void)windowDidBecomeKey:(NSNotification *)aNotification; -- (void)comboBoxWillDismiss:(NSNotification *)notification; -- (void)controlTextDidEndEditing:(NSNotification *)aNotification; -- (void)updateForComboBoxChanges; - -@end diff --git a/src/ext/sage/ext/mac-app/PreferencePanelController.m b/src/ext/sage/ext/mac-app/PreferencePanelController.m deleted file mode 100644 index 171700beacc..00000000000 --- a/src/ext/sage/ext/mac-app/PreferencePanelController.m +++ /dev/null @@ -1,173 +0,0 @@ -// -// PreferencePanelController.m -// -// Created by Ivan Andrus on 26/6/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import "PreferencePanelController.h" -#import "MyDocument.h" -#import "AppController.h" - -@implementation PreferencePanelController - - -- (void)windowDidBecomeKey:(NSNotification *)aNotification{ - - NSUserDefaults *defaults; - defaults = [NSUserDefaults standardUserDefaults]; - NSString *terminalEmulator = [defaults stringForKey:@"TerminalEmulator"]; - - // Disable Showing in the Dock on Tiger - if ( [appController isTigerOrLess] ) { - [showInDock setEnabled:NO]; - } - - // Set up Terminal Emulation - - // We start with the items bundled with the application and - // overwrite with those the user has saved. This way the user - // gets any items added in later versions. - // TODO: we may want a way to delete them, but then we would never - // be able to delete default ones which might be confusing and - // frustrating - // TODO: ideally we would only save those that the user has added or changed. - NSMutableDictionary *terminalEmulatorList = - [[NSMutableDictionary dictionaryWithContentsOfFile: - [[NSBundle mainBundle] pathForResource:@"Defaults" ofType:@"plist"]] - objectForKey:@"TerminalEmulatorList"]; - - NSDictionary *savedTermEmuList = [defaults dictionaryForKey:@"TerminalEmulatorList"]; - NSEnumerator *enumerator = [savedTermEmuList keyEnumerator]; - id key; - // extra parens to suppress warning about using = instead of == - while( (key = [enumerator nextObject]) ) { - [terminalEmulatorList setObject:[savedTermEmuList objectForKey:key] forKey:key]; - } - // Save to defaults since that's how we look it up later - [defaults setObject:terminalEmulatorList forKey:@"TerminalEmulatorList"]; - // NSLog(@"TerminalEmulatorList:%@",terminalEmulatorList); - - // Add terminal emulators to UI - [TerminalEmulator removeAllItems]; - // This isn't a great sorting method, but it doesn't matter that much. I just want xterm and xterm -- don't exit next to each other - [TerminalEmulator addItemsWithObjectValues:[[terminalEmulatorList allKeys] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)]]; - [TerminalEmulator setStringValue:terminalEmulator]; - [TerminalApplescript setStringValue:[terminalEmulatorList objectForKey:terminalEmulator]]; - - // Set up Default Arguments - NSDictionary *defaultArgList = [defaults dictionaryForKey:@"DefaultArguments"]; - [SessionType removeAllItems]; - [SessionType addItemsWithObjectValues:[defaultArgList allKeys]]; -} - -- (IBAction)apply:(id)sender{ - NSUserDefaults *defaults; - defaults = [NSUserDefaults standardUserDefaults]; - - NSString *terminalEmulator = [TerminalEmulator stringValue]; - [defaults setObject:terminalEmulator forKey:@"TerminalEmulator"]; - - NSDictionary *terminalEmulatorList = [defaults dictionaryForKey:@"TerminalEmulatorList"]; - NSMutableDictionary *newList = [[terminalEmulatorList mutableCopy] autorelease]; - [newList setObject:[TerminalApplescript stringValue] forKey:terminalEmulator]; - - // NSLog(@"%@ is now %@", terminalEmulatorList, newList); - [defaults setObject:newList forKey:@"TerminalEmulatorList"]; - - NSString *sessionType = [SessionType stringValue]; - if ( [sessionType length] > 0 ) { - - [defaults setObject:terminalEmulator forKey:@"SessionType"]; - - NSDictionary *DefaultArgList = [defaults dictionaryForKey:@"DefaultArguments"]; - NSMutableDictionary *newList = [[DefaultArgList mutableCopy] autorelease]; - [newList setObject:[DefaultArgs stringValue] forKey:sessionType]; - - // NSLog(@"%@ is now %@", DefaultArgList, newList); - [defaults setObject:newList forKey:@"DefaultArguments"]; - } -} - -- (IBAction)resetTerminalApplescript:(id)sender{ - - NSDictionary *defaultTerminalEmulatorList = - [[NSDictionary dictionaryWithContentsOfFile: - [[NSBundle mainBundle] pathForResource:@"Defaults" ofType:@"plist"]] - objectForKey:@"TerminalEmulatorList"]; - - NSString *script = [defaultTerminalEmulatorList objectForKey:[TerminalEmulator stringValue]]; - if ( script != nil ) { - [TerminalApplescript setStringValue:script]; - } -} - --(IBAction)addToPATH:(id)sender{ - - NSAlert *alert = [[[NSAlert alloc] init] autorelease]; - [alert addButtonWithTitle:@"~/bin"]; - [alert addButtonWithTitle:@"/usr/local/bin"]; - [alert addButtonWithTitle:@"Cancel"]; - [alert setMessageText:@"Install link to Sage"]; - [alert setInformativeText:@"You are about to install a link to sage in one of two directories which are often in PATH. Any prior version of sage there will be overwritten. If you add it to /usr/local/bin it will require administrator privileges and will be available for all users of this computer.\nIf you install in ~/bin it will be available only for you, and you should make sure that you add it to PATH yourself. You can do this by adding to your ~/.profile (creating if it doesn't exists):\nPATH=$PATH:~/bin"]; - [alert setAlertStyle:NSWarningAlertStyle]; - - [alert beginSheetModalForWindow:prefWindow - modalDelegate:self - didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:) - contextInfo:nil]; -} - - -- (void)alertDidEnd:(NSAlert *)alert returnCode:(long)returnCode contextInfo:(void *)contextInfo { - - if (returnCode == NSAlertFirstButtonReturn) { - // ~/bin - // Yes we could do all of this without a shell script, but all the Obj-C methods require 10.5 - [appController terminalRun: - [NSString stringWithFormat: @"mkdir -p ~/bin; rm -f ~/bin/sage; ln -s '%@' ~/bin/sage", - [[NSUserDefaults standardUserDefaults] objectForKey:@"SageBinary"]]]; - - } else if (returnCode == NSAlertSecondButtonReturn) { - - // take the easy way out with respect to administrator privileges - [appController terminalRun: - [NSString stringWithFormat: @"sudo rm -f /usr/local/bin/sage; sudo ln -s '%@' /usr/local/bin/sage", - [[NSUserDefaults standardUserDefaults] objectForKey:@"SageBinary"]]]; - - } else { - // Cancel - } -} - -// This actually ensures the data will be correct -// http://www.cocoabuilder.com/archive/cocoa/221619-detecting-when-nscombobox-text-changed-by-list.html -- (void)controlTextDidEndEditing:(NSNotification *)aNotification{ - [appController setupPaths]; - [self updateForComboBoxChanges]; -} - -// This provides snappier feedback if selecting using the mouse -- (void)comboBoxWillDismiss:(NSNotification *)notification{ - [self updateForComboBoxChanges]; -} - --(void)updateForComboBoxChanges{ - NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - - NSDictionary *terminalEmulatorList = [defaults dictionaryForKey:@"TerminalEmulatorList"]; - NSString *terminalApplscript = [terminalEmulatorList objectForKey:[TerminalEmulator stringValue]]; - if ( terminalApplscript != nil ) { - [TerminalApplescript setStringValue:[terminalEmulatorList objectForKey:[TerminalEmulator stringValue]]]; - } - - if ([[SessionType stringValue] length] > 0 ) { - NSDictionary *defaultArgList = [defaults dictionaryForKey:@"DefaultArguments"]; - NSString *defArgstring = [defaultArgList objectForKey:[SessionType stringValue]]; - if ( defArgstring != nil ) { - [DefaultArgs setStringValue:defArgstring]; - } - } -} - -@end diff --git a/src/ext/sage/ext/mac-app/Sage-Info.plist b/src/ext/sage/ext/mac-app/Sage-Info.plist deleted file mode 100644 index 3e160096055..00000000000 --- a/src/ext/sage/ext/mac-app/Sage-Info.plist +++ /dev/null @@ -1,300 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleDocumentTypes - - - CFBundleTypeIconFile - sage-document-sage.icns - CFBundleTypeName - Sage Script - CFBundleTypeRole - Shell - LSHandlerRank - Default - LSItemContentTypes - - org.sagemath.sage-source - - NSDocumentClass - MyDocument - - - CFBundleTypeIconFile - sage-document-sws.icns - CFBundleTypeName - Sage Worksheet - CFBundleTypeRole - Editor - LSHandlerRank - Owner - LSItemContentTypes - - org.sagemath.sage-worksheet - com.pkware.zip-archive - - NSDocumentClass - MyDocument - - - CFBundleTypeIconFile - sage-document-spkg.icns - CFBundleTypeName - Sage Package - CFBundleTypeRole - Shell - LSHandlerRank - Owner - LSItemContentTypes - - org.sagemath.sage-package - - NSDocumentClass - MyDocument - - - CFBundleTypeIconFile - sage-document-py.icns - CFBundleTypeName - Python Script - CFBundleTypeOSTypes - - public.python-script - - CFBundleTypeRole - Shell - LSHandlerRank - Alternate - - - CFBundleTypeIconFile - sage-document.icns - CFBundleTypeName - HTML file - CFBundleTypeRole - Viewer - LSHandlerRank - Alternate - LSItemContentTypes - - public.html - - NSDocumentClass - MyDocument - - - CFBundleTypeName - Text File - CFBundleTypeRole - Viewer - LSHandlerRank - Alternate - CFBundleTypeIconFile - sage-document.icns - LSItemContentTypes - - public.text - - NSDocumentClass - MyDocument - - - CFBundleTypeName - Directory (to use as sage directory) - CFBundleTypeRole - Editor - LSHandlerRank - Alternate - LSItemContentTypes - - public.folder - - NSDocumentClass - MyDocument - - - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIconFile - appl.icns - CFBundleIdentifier - org.sagemath.Sage - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - APPL - CFBundleShortVersionString - SAGE_VERSION - CFBundleSignature - ???? - CFBundleURLTypes - - - CFBundleTypeRole - Viewer - CFBundleURLName - Web Page - CFBundleURLSchemes - - http - https - - - - CFBundleVersion - SAGE_VERSION - LSMinimumSystemVersion - ${MACOSX_DEPLOYMENT_TARGET} - LSUIElement - - NSHumanReadableCopyright - Sage SAGE_VERSION Copyright 2005-2011 The Sage Development Team - NSMainNibFile - MainMenu - NSPrincipalClass - NSApplication - UTExportedTypeDeclarations - - - UTTypeConformsTo - - public.source-code - public.shell-script - public.python-script - - UTTypeDescription - Sage Source Code - UTTypeIconFile - sage-document-sage.icns - UTTypeIdentifier - org.sagemath.sage-source - UTTypeReferenceURL - http://www.sagemath.org/doc/reference/ - UTTypeTagSpecification - - public.filename-extension - - sage - - - - - UTTypeConformsTo - - public.source-code - public.shell-script - public.python-script - - UTTypeDescription - Cython Source Code - UTTypeIconFile - sage-document-cython.icns - UTTypeIdentifier - org.cython.cython-source - UTTypeReferenceURL - http://cython.org/ - UTTypeTagSpecification - - public.filename-extension - - pyx - - - - - UTTypeConformsTo - - public.source-code - public.shell-script - public.python-script - - UTTypeDescription - Cython Declaration File - UTTypeIconFile - sage-document-cython.icns - UTTypeIdentifier - org.cython.cython-header - UTTypeReferenceURL - http://cython.org/ - UTTypeTagSpecification - - public.filename-extension - - pxd - - - - - UTTypeConformsTo - - public.source-code - public.shell-script - public.python-script - - UTTypeDescription - Sage Preparsed Cython Source Code - UTTypeIconFile - sage-document-cython.icns - UTTypeIdentifier - org.sagemath.sage-cython-source - UTTypeReferenceURL - http://cython.org/ - UTTypeTagSpecification - - public.filename-extension - - spyx - - - - - UTTypeConformsTo - - public.data - - UTTypeDescription - Sage Worksheet - UTTypeIconFile - sage-document-sws.icns - UTTypeIdentifier - org.sagemath.sage-worksheet - UTTypeReferenceURL - http://www.sagemath.org/doc/reference/sagenb/storage/filesystem_storage.html - UTTypeTagSpecification - - public.filename-extension - - sws - - - - - UTTypeConformsTo - - public.archive - public.data - - UTTypeDescription - Sage Package - UTTypeIconFile - sage-document-spkg.icns - UTTypeIdentifier - org.sagemath.sage-package - UTTypeReferenceURL - http://www.sagemath.org/doc/developer/producing_spkgs.html - UTTypeTagSpecification - - public.filename-extension - - spkg - - - - - - diff --git a/src/ext/sage/ext/mac-app/Sage.xcodeproj/project.pbxproj b/src/ext/sage/ext/mac-app/Sage.xcodeproj/project.pbxproj deleted file mode 100644 index f3576295932..00000000000 --- a/src/ext/sage/ext/mac-app/Sage.xcodeproj/project.pbxproj +++ /dev/null @@ -1,431 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 42; - objects = { - -/* Begin PBXBuildFile section */ - 1910AF4B11E60B80003E9A14 /* loading-page.html in Resources */ = {isa = PBXBuildFile; fileRef = 1910AF4A11E60B80003E9A14 /* loading-page.html */; }; - 1943B14412411601007C0641 /* MainMenu.nib in Resources */ = {isa = PBXBuildFile; fileRef = 1943B14212411601007C0641 /* MainMenu.nib */; }; - 1943B14712411613007C0641 /* MyDocument.nib in Resources */ = {isa = PBXBuildFile; fileRef = 1943B14512411613007C0641 /* MyDocument.nib */; }; - 1967A67411D6521700ABC39D /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1967A67311D6521700ABC39D /* WebKit.framework */; }; - 1967A6A811D6543A00ABC39D /* appl.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1967A69D11D6543A00ABC39D /* appl.icns */; }; - 1967A6A911D6543A00ABC39D /* Defaults.plist in Resources */ = {isa = PBXBuildFile; fileRef = 1967A69E11D6543A00ABC39D /* Defaults.plist */; }; - 1967A6AA11D6543A00ABC39D /* sage-document-py.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1967A69F11D6543A00ABC39D /* sage-document-py.icns */; }; - 1967A6AB11D6543A00ABC39D /* sage-document-sage.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1967A6A011D6543A00ABC39D /* sage-document-sage.icns */; }; - 1967A6AC11D6543A00ABC39D /* sage-document-spkg.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1967A6A111D6543A00ABC39D /* sage-document-spkg.icns */; }; - 1967A6AD11D6543A00ABC39D /* sage-document-sws.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1967A6A211D6543A00ABC39D /* sage-document-sws.icns */; }; - 1967A6AE11D6543A00ABC39D /* sage-small-blue.png in Resources */ = {isa = PBXBuildFile; fileRef = 1967A6A311D6543A00ABC39D /* sage-small-blue.png */; }; - 1967A6AF11D6543A00ABC39D /* sage-small-green.png in Resources */ = {isa = PBXBuildFile; fileRef = 1967A6A411D6543A00ABC39D /* sage-small-green.png */; }; - 1967A6B011D6543A00ABC39D /* sage-small-grey.png in Resources */ = {isa = PBXBuildFile; fileRef = 1967A6A511D6543A00ABC39D /* sage-small-grey.png */; }; - 1967A6B111D6543A00ABC39D /* sage-small-red.png in Resources */ = {isa = PBXBuildFile; fileRef = 1967A6A611D6543A00ABC39D /* sage-small-red.png */; }; - 1967A6B211D6543A00ABC39D /* start-sage.sh in Resources */ = {isa = PBXBuildFile; fileRef = 1967A6A711D6543A00ABC39D /* start-sage.sh */; }; - 1967A6B511D6544C00ABC39D /* AppController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1967A6B411D6544C00ABC39D /* AppController.m */; }; - 1967A6BC11D6569000ABC39D /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1967A6BB11D6569000ABC39D /* Carbon.framework */; }; - 1967A85811D6630300ABC39D /* PreferencePanelController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1967A85711D6630300ABC39D /* PreferencePanelController.m */; }; - 1967A9A311D67FBE00ABC39D /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1967A9A111D67FBE00ABC39D /* AppDelegate.m */; }; - 198C6B7612425E8E002A1494 /* sage-is-running-on-port.sh in Resources */ = {isa = PBXBuildFile; fileRef = 198C6B7512425E8D002A1494 /* sage-is-running-on-port.sh */; }; - 19BDCA2411D6C3EA0041A693 /* open-location.sh in Resources */ = {isa = PBXBuildFile; fileRef = 19BDCA2311D6C3EA0041A693 /* open-location.sh */; }; - 19D397B212365C2600CE35F5 /* InputPanelController.m in Sources */ = {isa = PBXBuildFile; fileRef = 19D397B012365C2600CE35F5 /* InputPanelController.m */; }; - 19E3984612E249B300D062D1 /* sage-document-cython.icns in Resources */ = {isa = PBXBuildFile; fileRef = 19E3984512E249B300D062D1 /* sage-document-cython.icns */; }; - 8D15AC2C0486D014006FF6A4 /* Credits.html in Resources */ = {isa = PBXBuildFile; fileRef = 2A37F4B9FDCFA73011CA2CEA /* Credits.html */; }; - 8D15AC2F0486D014006FF6A4 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165FFE840EACC02AAC07 /* InfoPlist.strings */; }; - 8D15AC310486D014006FF6A4 /* MyDocument.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A37F4ACFDCFA73011CA2CEA /* MyDocument.m */; settings = {ATTRIBUTES = (); }; }; - 8D15AC320486D014006FF6A4 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A37F4B0FDCFA73011CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; - 8D15AC340486D014006FF6A4 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A7FEA54F5311CA2CBB /* Cocoa.framework */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 089C1660FE840EACC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; - 1058C7A7FEA54F5311CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; - 13E42FBA07B3F13500E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = ""; }; - 1910AF4A11E60B80003E9A14 /* loading-page.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "loading-page.html"; sourceTree = ""; }; - 1943B14312411601007C0641 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/MainMenu.nib; sourceTree = ""; }; - 1943B14612411613007C0641 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/MyDocument.nib; sourceTree = ""; }; - 1967A67311D6521700ABC39D /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; }; - 1967A69D11D6543A00ABC39D /* appl.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = appl.icns; sourceTree = ""; }; - 1967A69E11D6543A00ABC39D /* Defaults.plist */ = {isa = PBXFileReference; explicitFileType = text.plist.xml; path = Defaults.plist; sourceTree = ""; }; - 1967A69F11D6543A00ABC39D /* sage-document-py.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = "sage-document-py.icns"; sourceTree = ""; }; - 1967A6A011D6543A00ABC39D /* sage-document-sage.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = "sage-document-sage.icns"; sourceTree = ""; }; - 1967A6A111D6543A00ABC39D /* sage-document-spkg.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = "sage-document-spkg.icns"; sourceTree = ""; }; - 1967A6A211D6543A00ABC39D /* sage-document-sws.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = "sage-document-sws.icns"; sourceTree = ""; }; - 1967A6A311D6543A00ABC39D /* sage-small-blue.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "sage-small-blue.png"; sourceTree = ""; }; - 1967A6A411D6543A00ABC39D /* sage-small-green.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "sage-small-green.png"; sourceTree = ""; }; - 1967A6A511D6543A00ABC39D /* sage-small-grey.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "sage-small-grey.png"; sourceTree = ""; }; - 1967A6A611D6543A00ABC39D /* sage-small-red.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "sage-small-red.png"; sourceTree = ""; }; - 1967A6A711D6543A00ABC39D /* start-sage.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "start-sage.sh"; sourceTree = ""; }; - 1967A6B311D6544C00ABC39D /* AppController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppController.h; sourceTree = ""; }; - 1967A6B411D6544C00ABC39D /* AppController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppController.m; sourceTree = ""; }; - 1967A6BB11D6569000ABC39D /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = System/Library/Frameworks/Carbon.framework; sourceTree = SDKROOT; }; - 1967A85611D6630300ABC39D /* PreferencePanelController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PreferencePanelController.h; sourceTree = ""; }; - 1967A85711D6630300ABC39D /* PreferencePanelController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PreferencePanelController.m; sourceTree = ""; }; - 1967A9A111D67FBE00ABC39D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; - 1967A9A211D67FBE00ABC39D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; - 198C6B7512425E8D002A1494 /* sage-is-running-on-port.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "sage-is-running-on-port.sh"; sourceTree = ""; }; - 19BDCA2311D6C3EA0041A693 /* open-location.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "open-location.sh"; sourceTree = ""; }; - 19D397B012365C2600CE35F5 /* InputPanelController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InputPanelController.m; sourceTree = ""; }; - 19D397B112365C2600CE35F5 /* InputPanelController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InputPanelController.h; sourceTree = ""; }; - 19E3984512E249B300D062D1 /* sage-document-cython.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = "sage-document-cython.icns"; sourceTree = ""; }; - 2564AD2C0F5327BB00F57823 /* Sage_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Sage_Prefix.pch; sourceTree = ""; }; - 2A37F4ACFDCFA73011CA2CEA /* MyDocument.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MyDocument.m; sourceTree = ""; }; - 2A37F4AEFDCFA73011CA2CEA /* MyDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MyDocument.h; sourceTree = ""; }; - 2A37F4B0FDCFA73011CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - 2A37F4BAFDCFA73011CA2CEA /* English */ = {isa = PBXFileReference; lastKnownFileType = text.html; name = English; path = English.lproj/Credits.html; sourceTree = ""; }; - 2A37F4C4FDCFA73011CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; - 2A37F4C5FDCFA73011CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; - 8D15AC360486D014006FF6A4 /* Sage-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Sage-Info.plist"; sourceTree = ""; }; - 8D15AC370486D014006FF6A4 /* Sage.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Sage.app; sourceTree = BUILT_PRODUCTS_DIR; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 8D15AC330486D014006FF6A4 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 8D15AC340486D014006FF6A4 /* Cocoa.framework in Frameworks */, - 1967A67411D6521700ABC39D /* WebKit.framework in Frameworks */, - 1967A6BC11D6569000ABC39D /* Carbon.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 1058C7A6FEA54F5311CA2CBB /* Linked Frameworks */ = { - isa = PBXGroup; - children = ( - 1967A67311D6521700ABC39D /* WebKit.framework */, - 1967A6BB11D6569000ABC39D /* Carbon.framework */, - 1058C7A7FEA54F5311CA2CBB /* Cocoa.framework */, - ); - name = "Linked Frameworks"; - sourceTree = ""; - }; - 1058C7A8FEA54F5311CA2CBB /* Other Frameworks */ = { - isa = PBXGroup; - children = ( - 2A37F4C4FDCFA73011CA2CEA /* AppKit.framework */, - 13E42FBA07B3F13500E4EEF1 /* CoreData.framework */, - 2A37F4C5FDCFA73011CA2CEA /* Foundation.framework */, - ); - name = "Other Frameworks"; - sourceTree = ""; - }; - 19C28FB0FE9D524F11CA2CBB /* Products */ = { - isa = PBXGroup; - children = ( - 8D15AC370486D014006FF6A4 /* Sage.app */, - ); - name = Products; - sourceTree = ""; - }; - 2A37F4AAFDCFA73011CA2CEA /* Sage */ = { - isa = PBXGroup; - children = ( - 2A37F4ABFDCFA73011CA2CEA /* Classes */, - 2A37F4AFFDCFA73011CA2CEA /* Other Sources */, - 2A37F4B8FDCFA73011CA2CEA /* Resources */, - 2A37F4C3FDCFA73011CA2CEA /* Frameworks */, - 19C28FB0FE9D524F11CA2CBB /* Products */, - ); - name = Sage; - sourceTree = ""; - }; - 2A37F4ABFDCFA73011CA2CEA /* Classes */ = { - isa = PBXGroup; - children = ( - 1967A6B311D6544C00ABC39D /* AppController.h */, - 1967A6B411D6544C00ABC39D /* AppController.m */, - 1967A9A211D67FBE00ABC39D /* AppDelegate.h */, - 1967A9A111D67FBE00ABC39D /* AppDelegate.m */, - 19D397B112365C2600CE35F5 /* InputPanelController.h */, - 19D397B012365C2600CE35F5 /* InputPanelController.m */, - 2A37F4AEFDCFA73011CA2CEA /* MyDocument.h */, - 2A37F4ACFDCFA73011CA2CEA /* MyDocument.m */, - 1967A85611D6630300ABC39D /* PreferencePanelController.h */, - 1967A85711D6630300ABC39D /* PreferencePanelController.m */, - ); - name = Classes; - sourceTree = ""; - }; - 2A37F4AFFDCFA73011CA2CEA /* Other Sources */ = { - isa = PBXGroup; - children = ( - 2564AD2C0F5327BB00F57823 /* Sage_Prefix.pch */, - 2A37F4B0FDCFA73011CA2CEA /* main.m */, - ); - name = "Other Sources"; - sourceTree = ""; - }; - 2A37F4B8FDCFA73011CA2CEA /* Resources */ = { - isa = PBXGroup; - children = ( - 1967A69D11D6543A00ABC39D /* appl.icns */, - 1967A69F11D6543A00ABC39D /* sage-document-py.icns */, - 1967A6A011D6543A00ABC39D /* sage-document-sage.icns */, - 19E3984512E249B300D062D1 /* sage-document-cython.icns */, - 1967A6A111D6543A00ABC39D /* sage-document-spkg.icns */, - 1967A6A211D6543A00ABC39D /* sage-document-sws.icns */, - 1967A6A311D6543A00ABC39D /* sage-small-blue.png */, - 1967A6A411D6543A00ABC39D /* sage-small-green.png */, - 1967A6A511D6543A00ABC39D /* sage-small-grey.png */, - 1967A6A611D6543A00ABC39D /* sage-small-red.png */, - 1967A6A711D6543A00ABC39D /* start-sage.sh */, - 198C6B7512425E8D002A1494 /* sage-is-running-on-port.sh */, - 19BDCA2311D6C3EA0041A693 /* open-location.sh */, - 1910AF4A11E60B80003E9A14 /* loading-page.html */, - 2A37F4B9FDCFA73011CA2CEA /* Credits.html */, - 1967A69E11D6543A00ABC39D /* Defaults.plist */, - 8D15AC360486D014006FF6A4 /* Sage-Info.plist */, - 089C165FFE840EACC02AAC07 /* InfoPlist.strings */, - 1943B14212411601007C0641 /* MainMenu.nib */, - 1943B14512411613007C0641 /* MyDocument.nib */, - ); - name = Resources; - sourceTree = ""; - }; - 2A37F4C3FDCFA73011CA2CEA /* Frameworks */ = { - isa = PBXGroup; - children = ( - 1058C7A6FEA54F5311CA2CBB /* Linked Frameworks */, - 1058C7A8FEA54F5311CA2CBB /* Other Frameworks */, - ); - name = Frameworks; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 8D15AC270486D014006FF6A4 /* Sage */ = { - isa = PBXNativeTarget; - buildConfigurationList = C05733C708A9546B00998B17 /* Build configuration list for PBXNativeTarget "Sage" */; - buildPhases = ( - 8D15AC2B0486D014006FF6A4 /* Resources */, - 8D15AC300486D014006FF6A4 /* Sources */, - 8D15AC330486D014006FF6A4 /* Frameworks */, - 1967A8B911D6696A00ABC39D /* ShellScript */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = Sage; - productInstallPath = "$(HOME)/Applications"; - productName = Sage; - productReference = 8D15AC370486D014006FF6A4 /* Sage.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 2A37F4A9FDCFA73011CA2CEA /* Project object */ = { - isa = PBXProject; - attributes = { - BuildIndependentTargetsInParallel = NO; - }; - buildConfigurationList = C05733CB08A9546B00998B17 /* Build configuration list for PBXProject "Sage" */; - compatibilityVersion = "Xcode 2.4"; - developmentRegion = English; - hasScannedForEncodings = 1; - knownRegions = ( - English, - Japanese, - French, - German, - ); - mainGroup = 2A37F4AAFDCFA73011CA2CEA /* Sage */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 8D15AC270486D014006FF6A4 /* Sage */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 8D15AC2B0486D014006FF6A4 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 8D15AC2C0486D014006FF6A4 /* Credits.html in Resources */, - 8D15AC2F0486D014006FF6A4 /* InfoPlist.strings in Resources */, - 1967A6A811D6543A00ABC39D /* appl.icns in Resources */, - 1967A6A911D6543A00ABC39D /* Defaults.plist in Resources */, - 1967A6AA11D6543A00ABC39D /* sage-document-py.icns in Resources */, - 1967A6AB11D6543A00ABC39D /* sage-document-sage.icns in Resources */, - 1967A6AC11D6543A00ABC39D /* sage-document-spkg.icns in Resources */, - 1967A6AD11D6543A00ABC39D /* sage-document-sws.icns in Resources */, - 1967A6AE11D6543A00ABC39D /* sage-small-blue.png in Resources */, - 1967A6AF11D6543A00ABC39D /* sage-small-green.png in Resources */, - 1967A6B011D6543A00ABC39D /* sage-small-grey.png in Resources */, - 1967A6B111D6543A00ABC39D /* sage-small-red.png in Resources */, - 1967A6B211D6543A00ABC39D /* start-sage.sh in Resources */, - 19BDCA2411D6C3EA0041A693 /* open-location.sh in Resources */, - 1910AF4B11E60B80003E9A14 /* loading-page.html in Resources */, - 1943B14412411601007C0641 /* MainMenu.nib in Resources */, - 1943B14712411613007C0641 /* MyDocument.nib in Resources */, - 198C6B7612425E8E002A1494 /* sage-is-running-on-port.sh in Resources */, - 19E3984612E249B300D062D1 /* sage-document-cython.icns in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 1967A8B911D6696A00ABC39D /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "# Probably not the variables I should be using, but...\nSAGE_DIR_TARGET=\"$TARGET_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH/sage\"\n\n# make sure the log file exists, otherwise it will fail when we try to get it's path\ntouch \"$SAGE_DIR_TARGET\".log"; - showEnvVarsInLog = 0; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 8D15AC300486D014006FF6A4 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 8D15AC310486D014006FF6A4 /* MyDocument.m in Sources */, - 8D15AC320486D014006FF6A4 /* main.m in Sources */, - 1967A6B511D6544C00ABC39D /* AppController.m in Sources */, - 1967A85811D6630300ABC39D /* PreferencePanelController.m in Sources */, - 1967A9A311D67FBE00ABC39D /* AppDelegate.m in Sources */, - 19D397B212365C2600CE35F5 /* InputPanelController.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXVariantGroup section */ - 089C165FFE840EACC02AAC07 /* InfoPlist.strings */ = { - isa = PBXVariantGroup; - children = ( - 089C1660FE840EACC02AAC07 /* English */, - ); - name = InfoPlist.strings; - sourceTree = ""; - }; - 1943B14212411601007C0641 /* MainMenu.nib */ = { - isa = PBXVariantGroup; - children = ( - 1943B14312411601007C0641 /* English */, - ); - name = MainMenu.nib; - sourceTree = ""; - }; - 1943B14512411613007C0641 /* MyDocument.nib */ = { - isa = PBXVariantGroup; - children = ( - 1943B14612411613007C0641 /* English */, - ); - name = MyDocument.nib; - sourceTree = ""; - }; - 2A37F4B9FDCFA73011CA2CEA /* Credits.html */ = { - isa = PBXVariantGroup; - children = ( - 2A37F4BAFDCFA73011CA2CEA /* English */, - ); - name = Credits.html; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - C05733C808A9546B00998B17 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = Sage_Prefix.pch; - INFOPLIST_FILE = "Sage-Info.plist"; - INSTALL_PATH = "$(HOME)/Applications"; - PRODUCT_NAME = Sage; - }; - name = Debug; - }; - C05733C908A9546B00998B17 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_MODEL_TUNING = G5; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = Sage_Prefix.pch; - INFOPLIST_FILE = "Sage-Info.plist"; - INSTALL_PATH = "$(HOME)/Applications"; - PRODUCT_NAME = Sage; - }; - name = Release; - }; - C05733CC08A9546B00998B17 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = "$(ONLY_ACTIVE_ARCH_PRE_XCODE_3_1)"; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IBC_FLATTEN_NIBS = NO; - INFOPLIST_OUTPUT_FORMAT = xml; - MACOSX_DEPLOYMENT_TARGET = 10.4; - ONLY_ACTIVE_ARCH_PRE_XCODE_3_1 = "$(NATIVE_ARCH)"; - PLIST_FILE_OUTPUT_FORMAT = xml; - PREBINDING = NO; - RUN_CLANG_STATIC_ANALYZER = YES; - }; - name = Debug; - }; - C05733CD08A9546B00998B17 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_BIT_PRE_XCODE_3_1)"; - ARCHS_STANDARD_32_BIT_PRE_XCODE_3_1 = "ppc i386"; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.4; - PREBINDING = NO; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - C05733C708A9546B00998B17 /* Build configuration list for PBXNativeTarget "Sage" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - C05733C808A9546B00998B17 /* Debug */, - C05733C908A9546B00998B17 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - C05733CB08A9546B00998B17 /* Build configuration list for PBXProject "Sage" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - C05733CC08A9546B00998B17 /* Debug */, - C05733CD08A9546B00998B17 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 2A37F4A9FDCFA73011CA2CEA /* Project object */; -} diff --git a/src/ext/sage/ext/mac-app/Sage_Prefix.pch b/src/ext/sage/ext/mac-app/Sage_Prefix.pch deleted file mode 100644 index b6366650551..00000000000 --- a/src/ext/sage/ext/mac-app/Sage_Prefix.pch +++ /dev/null @@ -1,7 +0,0 @@ -// -// Prefix header for all source files of the 'Sage' target in the 'Sage' project -// - -#ifdef __OBJC__ - #import -#endif diff --git a/src/ext/sage/ext/mac-app/appl.icns b/src/ext/sage/ext/mac-app/appl.icns deleted file mode 100644 index eaaddd3aab1ee04c51f7ef603846f7256bf27cfa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 37640 zcmeHwcbFW-wQtYNu6BjZy?(y;`|hn(29YrtVUh^~fw5(LtYjfVovAgU2s>94|Ui{vFSN(m`c6Xgq=hVqnUETB4#ju_`vz8?FU;e&gUh#~F?T(4ihFoDe6nE2M3R7->Rxs*6^`@Bv5 z^pu47M{X=RcI!)oJZ*k)+sQj0`4xHey&FG!=r!{6;^)uWaC|l)J0Bp=Bz-}iJNM1Y zV>j<5q;w%6-))}%+Uz%%&L>~Ro>LS{7A?zu`wfzE4I%UM_Uu}C-?n4rJ611BIpey& z{9}vUv+tR$bB@ePt*zO+`q@8US9&`kOaJ^9ApdBzk>%>{qWHPJQCWBoZ;dIQtK?63G9SVN!#| z5m#?$D@~$?#>zNqY-vqTpfg*W8k)O?TvAO-9KGGrDh;(XHCE)=2MX&bts1Ota~GFq z(TcYGp7J_conMpQI%uY}y_{Az_0pP*hU~_Zos`1AyL_V(u77E4}f?Md0!S$)#nXYO)3I-6@s^K6Bb7L_(oTGLw|OAT2a zvD8@DlO9WdR@YrgXr!@>V7Y^p;mozyG5@>YGP*Y!hPgiAr5{$T@IJc8{lA0tIO@Px@>Nn$Lj+P^yc?k-Bz~)CvKYv7)QYE zwtDP13;29Cr`IofJ$A3n?sR*ZxDQ7kPbR0I+1LHV zgUfz@%e9wZaOTpBHe_<7p-$;4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Xj0lr<7fuLf8<$-=o6+V2mdkYk;lJ4 zU*A2XcNG5mkD}M{6B_@q>M_T^Ab-d}sV^aQWn}_?gE4HP)Nc#dIcGxCU1)`MYO#kw zs8t(!(Ux+9zyCdM>bLVfq2Y&wy=JQaP3S0L#Kt=fb||X~)fpI@`kj0?Z1^Ga{m?j^ zKG8pQ;WZv{+_NFJiV87ZlImPj5o<^rW2Ej6-_JBb-~4vjByFK4M^FqHARkL8^}`d# zNZmL2d^psvwQM@?UvYTN02TRyfne$%N9sYTgwdJkbpOhUTE^UWht%s*%SqS2EcIaL zE2sDVodR#;zfP+j!4v%k{z}uAdXT(z@igB*R52#nnT|vmT5b+?KJ{78FQ@tbrQVf2 z+z@qPOxM=+PC|c|Pxt-P5Q
w;J7k5KbZI^*x33e$T3HoRM%G^FnRDYhQohjOmG ze=7*ndH*;ZH|Ph`_VRG-(7E>hF(hy#baNVKT0zA|t)or@a|B56{cG63l<%L1W9lou w<0s#6$Vtw_-#>>DO!@wOcvntE1Jj+&g=4Dc;qTu+_4u>*fd0>KmIdMe0{5C9v;Y7A diff --git a/src/ext/sage/ext/mac-app/loading-page.html b/src/ext/sage/ext/mac-app/loading-page.html deleted file mode 100644 index 1283c0c4052..00000000000 --- a/src/ext/sage/ext/mac-app/loading-page.html +++ /dev/null @@ -1,274 +0,0 @@ - - -Starting, please wait... - - - - - - - - - - - -

The Sage server is currently starting. Please wait...

- -

A page will be opened automatically.

- -

In the mean time terminal sessions work normally.

- -

You may safely close this window at any time, or navigate to somewhere else.

- -

If the server is already running, feel free to access the notebook interface at any time.

- -

If you think you have waited long enough...

- -

Try View Log under the Server menu (or at the root of the menubar item's menu) which may give you some clues as to why it has not started.

-

If the problem persists email for support, ask a question on the question and answer site - or try one of the other many avenues of support.

- - -
- -

Did you know?

- -

Show a random tip. - Show all.

- - -

Typing pdb in a shell session will allow debugging when an exception is - thrown.

- -

The file $HOME/.sage/init.sage is run every time Sage is started.

- -

Shift clicking on the blue bar above every cell of a worksheet will open a "word - processor" allowing you to add commentary to your worksheet.

- -

You can configure Sage.app to use any shell you like. Applescripts are given for - iTerm, Terminal, and xterm.

- -

You can add default arguments for shell sessions in the Preferences. For example, - typing gap in the Session field and -b -o 2g in the Default Arguments field means that - GAP sessions will be started with no banner and a limit of 2G of RAM.

- -

Holding Command while starting a terminal session from the menu gives you an opportunity - to add command line arguments or change the command that is actually run. You can also set a preference to - always prompt for arguments.

- -

Sage.app usually uses the Sage distribution bundled inside of itself, but you can point - it to any copy of Sage you want. This is handy for development. In fact, you can even delete the copy of Sage - inside of Sage.app. You can use the menu Development > Reveal in Finder to find it.

- -

Sage.app contains a rudimentary browser for interacting with the notebook, but most - people prefer using the system default browser. You can also set the environment - variable SAGE_BROWSER to use a specific browser, but for technical reasons this is slower.

- -

Sage.app contains a rudimentary browser for interacting with the notebook, but most - people prefer using the system default browser. You can also set sage.misc.viewer.BROWSER - in ~/.sage/init.sage to use a different browser.

- -

Sage comes with many open source software systems (GAP, pari/gp, singular, maxima, R, - etc.), many of which are available for direct use. This can be by running a terminal session of the desired - type or by choosing it from one of the dropdown buttons in the notebook.

- -

Holding option in the menus will show alternate commands.

- -

There are Sage development aids - for Emacs - and vim.

- -

You can set up bash completion - for Sage.

- -

Add color - to your command line by uncommenting the color scheme you like - in $HOME/.sage/ipython/ipythonrc.

- -

Sage can be integrated with LaTeX - using SageTeX.

- -

If you find that LaTeX doesn't work, try - adding os.environ["PATH"]+=":/usr/texbin:/usr/local/bin" to $HOME/.sage/init.sage

- -

You can use Sage - inside WeBWork an online homework system.

- -

You can use Sage to create interactive - calculation.

- -

Sage can be used - to solve - a Rubik's cube.

- -

You can start an interactive GAP session in the middle of a sage session - calling gap_console(). Similarly - for gp_console, singular_console, maxima_console, r_console, and so - forth.

- -

Reading the Sage Tutorial is an - enjoyable way to spend an evening.

- -

The Sage interactive shell is based on IPython so it - can be customized in the same way. In particular see the directory $HOME/.sage/ipython/.

- -

You can add your own tips about Sage to - the wiki.

- -

Sometimes the best way to find a bug is to explain it to a rubber duck in enough - detail for the duck to understand.

- - - - -

A mathematician is a blind man in a dark room looking for a black cat which isn't there. -
--Charles R. Darwin

- -

Mathematics is the art of reducing any problem to linear algebra. -
--William Stein

- -

If people do not believe that mathematics is simple, it is only because they do not - realize how complicated life is. -
--John von Neumann

- -

So, although broken, things are broken as expected ;-) -
--Harald Schilly

- -

If the code and the comments disagree, then both are probably wrong.

- -

Rounding Errors are ok. Otherwise they'd be called actual errors. -
--Scott Hunt

- -

Any fool can write code that a computer can understand. Good programmers write code - that humans can understand. -
--Martin Fowler

- -

∀∀∃∃

- -

In mathematics you don't understand things. You just get used to them. -
--John von Neumann

- -

A mathematician is a machine for turning coffee into theorems. -
--Alfréd Rényi
-
- Of course, by categorical duality, a comathematician is then a machine for turning cotheorems into ffee. -
--Harg

- -

Programs must be written for people to read, and only incidentally for machines to - execute. -
--Abelson & Sussman, SICP, preface to the first edition

- - - -
- - - - - diff --git a/src/ext/sage/ext/mac-app/main.m b/src/ext/sage/ext/mac-app/main.m deleted file mode 100644 index 8c3670a5288..00000000000 --- a/src/ext/sage/ext/mac-app/main.m +++ /dev/null @@ -1,14 +0,0 @@ -// -// main.m -// Sage -// -// Created by Ivan Andrus on 26/6/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import - -int main(int argc, char *argv[]) -{ - return NSApplicationMain(argc, (const char **) argv); -} diff --git a/src/ext/sage/ext/mac-app/open-location.sh b/src/ext/sage/ext/mac-app/open-location.sh deleted file mode 100755 index 55e89c895e2..00000000000 --- a/src/ext/sage/ext/mac-app/open-location.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -# open-location.sh -# Sage -# -# Created by Ivan Andrus on 16/1/10. -# Copyright 2010 Ivan Andrus. All rights reserved. - -if [ "x$1" = "x" ]; then - echo "usage: $0 URL" - echo " open URL in SageNotebook" - exit -fi - -# Find path to this app -BROWSER=`readlink -n "$0" 2> /dev/null` || \ -BROWSER=`realpath "$0" 2> /dev/null` || \ -BROWSER="$0" -BROWSER="${SAGE_BROWSER%.app*}.app" - -# Tell it to open in this browser -open -a "$BROWSER" "$1" diff --git a/src/ext/sage/ext/mac-app/sage-document-cython.icns b/src/ext/sage/ext/mac-app/sage-document-cython.icns deleted file mode 100644 index d5af0d61e82dee3a7d9b3763df0b084d18ea9eee..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 47738 zcmeHw33wDm+J7g35ORk=Lc$?#ew}`|0}ax-Q^>tAHT7cwf8gdNH{O$R!|` z2qFkxhys#h?%a1Wx$k>sGWSe(PhZpBQ~$RoBqW#w5P0_ap8pIX>F#>#_r6v2zE#y# zzwTMR^0l`yO#a^LSAIJm!@^EY@FD@Vu1T1bGC6coeE9q?_L~rcys2oS7rD_JYaKNm zEy=B+Ep4^R1CQpzB{8KxY2^{I)7F<_3hguX^(gMilaiAAla_tPw_6OU#?YSjvfR=; zeMw2DlMaX-w!UPO%p9ukQ?xhVR*Wd*m7!2c+tM$*opzHs)f8{&EotCNew&ME0U&dD|A`BNh@*CwDt7Hj}fyxV^Ehxv^gH)8UNFyDJcnyuS1= zQIFGRaailj4vVd|s3B{^`u8@hyVEt0{~+qcZFp~0ZBt`qMQ&MRWvQn4c>bzSK(#Ob zA*3g4eI@ehnv!P28eK(ueOqf=tuyug0fDcOp4C-!R96wbl%v8`-CbwHyU^B`5!nxL z7#Z1CTbHe@k->YaIkT?LN*mFxmj=?0AQRJLHZ)qRn^0Ywn>3W!*rDlPBMaAQ?ywN< zVsq^pyWlbwmkWJp&*}kyZ;*}cGk1Au){$S_(OT75(=3{Xq<;(PwYrw}=El}aRVUG9 zYNG@T`fM=&cgP`{v^uAg5IW3=q1wB6j{|)^nEpL-3L;+Ki#Wc)_AgSPYG_UzDsU9J zybSLsZWayAJ$83}Beb3a?HdI60pUpCkVVzl)$3|*sy2H$fw>#bEv);fxo(N#Yt04}V3GhYJUWBuh;xAkt>; zgFm7OjzJDfZ*AB23V2h4v98rcwzRX|UA5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WJ(d`pG==(z=O4*u0`O6MHFIr%>i0i2uva}VGg{hxCH=j#7l12|{@=NQ1b`#-k; z&V&DR3gCSBKbHW`i~n;7;QaVM`vA_9|FaI@eEC1y0M48Lvkc(;`9He=&ZGac3gCSD zKbru~tN*hI;Qadk{sEk4|KB@+^X-2!fHR*JpLhS00sP@iA56}_|A_#^d%|MR=)vRy z_*Vmv*xMqG`^RKX_5gSx{6hdDvM!rgAvl@eqn}?8{}6zHN)zIaIyuGP7sfvXz@xv1 zpFtP6VE*AN_HtrRzdmz;{KHa)gzkzu`cDO&`~qAk|7s6-Ir{XA0~gZ&s<_0{jsX|a z|LVk~|55*i$;tnt{?~;3huZ(-L(fFXh0MQD{|n{+>F&Ux{&&{v->1YS>is{If1&&f z<=?4qfT8gxH2$0=e+-Skr)YuD{U>z)4b4A7^N-N{BQ*awRSSgXU!nO|X#RCJ`yWp+ z`GTU*{3|s73eCSl^RLkS>r}H3jV3hz2+co2^N-N{q4`&6{uP>k z{qLWDo!$Fyr+#4$zV-b75&o`6jO-7b??e68{naUFkpJ^8-24;%t*g`R{|ZZ-_tXa; z?Am$$k6l~0{xer`KJG<0nfO%!xeR@S};0pSNV$@(Xb+T|9So#Ho`X zO2Z?gXUD}~h$Aj0YSw8_UyUF<;=&x^XX5>|4HPmspDpm@V^7})dhxd^8qNO&&)gJD diff --git a/src/ext/sage/ext/mac-app/sage-document-sage.icns b/src/ext/sage/ext/mac-app/sage-document-sage.icns deleted file mode 100644 index a4b8b06c3d6b1a4159c691539dcbbc218da5d879..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 43061 zcmeI52Y4LSx%XGHRjghtTax7l#$X^ofExm#ID`NaB znKS2iX0+;|$DdZIKK{2=k6v}9N|of;f?{O39L35=D0jsT#C166|9=+D;ZpB}ev^x)N+wQ&&HOq;*sK#(ZwIXRSNYK3QXRnK>k{ zJ-R!?>+yJfe!s`lXhp7GMwW|F9uzn3_jtX2SE#SiYOz`dI=da?1O1|s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%PQ6X1Ivlg`Tzg` diff --git a/src/ext/sage/ext/mac-app/sage-document-spkg.icns b/src/ext/sage/ext/mac-app/sage-document-spkg.icns deleted file mode 100644 index 69acb78518c7ba7fb871ba9d303d2399c7273cb5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 43811 zcmeHw2V7KF+V=p0DAGg(5iE&GG<}ooX4A9T>?ZFfyI-=KWLq}bP2SDML_zA%nW2MX z?}}mtv7w^aP*jj2U8Hvgm|pJOI=7tfxmbcasEPW$@Av!7jREGK=lq}Nl;@mt&;L1h z=6@X+Dv|7cbpC=DUyw*9>Q*2-LC8S%0%9|U9fuUd91_xzqkznv!-~{Fr@qeW1_lXf zBe%L$L#e~#6+M?v)l-O1y?!rwc%o9JRCJ$hXeJS#GIF~|qm-%K;r5V1G1%L4p<}p` zMnW>02FQ@6QYp1+l@2FJ3@hzI$|h0}l137HwJNm=>l6~-$y>5>^}5dL;hxrJPE6#H zxlgCo=mx0axK2!=-uUa2$K&HIA`Ka>i&`w;3DTwRoL!_QQQhh3}`rmRCzSe>l{-KT0 zkwZ7qhbbeq^Wx?@E&g^{P(2zt{nj6mh916=uA~Xyd?r|5!R>M%cPK4)H9@Taf-nen{tdj%Nkx6pIjpvjWeJPB$VBSy+x` za71bdj^}9>?ifb$dqMjc5icMLM~Fm&DTqRxOmMuOF1DW$Sy2C)Rn1$Zo9dRIFRY7| zHz5WYZ|FB78eRF%)}il-+|6JA1AU8@9!B^z{Hys{q&T0tK8+|?mKa?ZO>I5}#l5Ou zOxHvHj*R6OLV`B7?Cn@}cGH(d$ULfiU>_9Ah-6x^ASkyWwGVz>(+|CV(4;l0bY@kD zR;xB>bbY%U2(8{I_K!s5%lEf+v~{+(c6PUSbhLN0cN_X!+S}U{&^I5Hhbo5$x^DAO znR3$b(9rNe|Ao$L4l26-i1T`=)hdm_VASa@cB0{198^C*6t1i|ak2PJQ~gly%?_#^ z##Dy}48xj|m6bfpTm)u)fOiIp9D6-aw!#b#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^MN^d+w=b?{QGHy^YHa85BOquGfMNk2mhb`@YbK{?swI1=Qe%ercF6pAN-ZGVZ$H2 z?izt>=j=1<>0iG3Fs@(BojJwvZo`knankh1<~{W=uDNrjPH?!h^Fyk=O#@Gr*hljv$fzUoz|`egFUf diff --git a/src/ext/sage/ext/mac-app/sage-document-sws.icns b/src/ext/sage/ext/mac-app/sage-document-sws.icns deleted file mode 100644 index db11423161d56a76fb74335ac14b7dd09c0a2314..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 42074 zcmeHw2Y6i7weCo^WLsU9ZOO9a0vK!zgq8vc^(KLP!_6b1BoLC^K*Gf&Aq4`VW+Yp( z47eL?svRH((~E7Dsp`F#Q5m)A_4GQY?7NO+%d#~txP14$_s#KV&FJj4|Fw2q`|Nf8 zt+fw5_P9>>-u-L;aLv^^T~g0B6sM{iQM`(zjot*0%PS+b1SP15wtHR0?!<9>OQ(p` z4HLIU{GMX(9M@>Kp@TK%BQ8mNJ*Tbpmx{1WGkU!w3>}uhyAH4kD&RzBv?`VIYtR*Ul z9uEhCVJGi>-cGp!um4*`*$dC>Up^qMLrWmhNd$4fYJKRb%|*ZX*~NFg_KE5J_utvl zfaC&{rzMkN!q@V{gtdSA!KTXp{>A<+U40!rt@Thiy_QZnSr2;n=kKn4kUxODKg0g; z`4e7`%RS5;Nq4b+b=TlWLwD#A_4!)V_|W5aCQP~5Bk3Lv6TWIOJm2!W0`#|6Bg}yx z4~SvTGnMY;3I4shH`_zZ&9#5(Kpx{wKSe>oJC*JeSgOLb2eGK04cRPkMzueshj_!1`3V&G`H#7L&R`+IsF=oK@f!<*hjSY%pyP!c%Q z_v3ewpgvLOLXL-n3eQWysr(^DP)Mcad(WW{pMR@y{IRDHp$bZvIa0o`B1FJA!~7>+ z-P8H>llPY*269ZMXF>g8D56M8L=rbHePVaJj1;|`5JA{fel1;=RRQr85<)U5$+9v% zoj|gx$^sH-m8BU0q~TYDPvlPpd`L$MijYVV3e+S*Q5Co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KcTrrMNZ&@#t z9r=tkRye{QNe#vTVk(acC|hR)a<-r=6f{!apv`#5cCaRboMrWJ3MA?;uPpZ=8DWMR zn3Sgks)4t8JP~sOqra>H%#Wzda8LrJCLA#8E4xbvpk+o5^#alRs6bQln;l`BUK!%tkAl%{lG9?+O8t3 zyos+i)7qKn$QBwwB=x}<%M0!*VAby68=H@WZ6YUjM6P>HaSXC_o z$f%*lG;uKhF#=I&fLl?%ipEW4r6yBpSq%ny733)^Yu36rR$g8U6_R?aK(vMd3~H#O zv8l@eBUJ0;!a$F9j0lPhb$cc%b-KXJ&aH6+fsClCFT$7NBfrcX&^th8f|?D|@rnX- zl=f50IeGW2d4h*$o|Cc*&nK7giHVbzZ=O79`Pj2qXD24k`I=XvmPI?4cKQj;$D*F@ zZ*j9v<9yiYV6*1NpS=NdhELnEU5!WYEbi%ZZ1*M3BBh$bB1=E!O4qftDHo^Q{%Ndp*!QwmeD_zRj88AQJ z3Ow&)&rP0ogz`zgLZc}W}JU5&cq{s{p!RG zaK7|wJ>cm%r`{YmpZbfE(@r@DoKO85($fD|^_OI1{IBZY7}FoC{}WF=6Dj9&{KfiT zZ2X_f1IPN`8Sj6eG-9Ip|JeA8jlbCVJGldl%|EgE=M3YIvHABTH4yVZG5;G|f5g@w zvGqr6{c*Ayh^@b3>#x}Q>rCE%Jjvntz/dev/null; then - grep -Eoe 'port=[0-9]+' ~/.sage/sage_notebook.sagenb/twistedconf.tac | cut -f 2 -d= - exit 0 -fi - -# It's not running so return failure -echo 0 -exit 1 diff --git a/src/ext/sage/ext/mac-app/sage-small-blue.png b/src/ext/sage/ext/mac-app/sage-small-blue.png deleted file mode 100644 index ce7639838aeeb4e412daf09c8c3f90b888c001e4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1594 zcmV-A2F3Y_P)4Tx0C)j~RL^S@K@|QrZmG~B2wH0nvUrdpNm;9CMbtL^5n^i$+aIn^?(HA4aZWV5ov6ELTdbo0FI&wK{O>*+w4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-;SqKaiZP z#NgmBJUxk^q+h;RSkDxdmluK6RVR**9~ev>7wqP0v z0hwOlFpZ8ni0>5y9KlYa%jIR0&&tx^`T31h=|n@rA$E7&0RnQE1Y!A56p0gxssI20 diff --git a/src/ext/sage/ext/mac-app/sage-small-green.png b/src/ext/sage/ext/mac-app/sage-small-green.png deleted file mode 100644 index 7225ce2f75520701532e75ebc3f7de874389114f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3580 zcmV4Tx0C)kNmUmPX*B8g%%xo{TU6vwc>AklFq%OTk zl_mFQv@x1^BM1TV}0C2duqR=S6 zXn?LjUp6xrb&~O43j*NvEr418u3H3zGns$s|L;SQD-ufpfWpxLJ03rmi*g~#S@{x? zOrJ!Vo{}kJ7$ajbnjp%mGEV!%=70KpVow?KvV}a4moSaFCQKV=XBIPnpP$8-NG!rR+)R#`$7JVZi#Wn10DSspSrkx`)s~4C z+0n+?(b2-z5-tDd^^cpMz5W?wz5V3zGUCskL5!X++LzcbT23thtSPiMTfS&1I{|20 z4}j|3FPi>70OSh+Xzlyzdl<5LNtZ}OE>>3g`T3RtKG#xK(9i3CI(+v0d-&=+OWAp! zYsd8Ar*foO5~i%E+?=c&shF87;&Ay)i~kOmCIB-Z!^JGdti+UJsxgN!t(Y#%b<8kk67vyD#cE*9urAm@ zY#cTXn~yERR$}Y1E!Yd#o7hq8Ya9;8z!~A3Z~?e@Tn26#t`xT$*Ni)h>&K1Yrto;Y z8r}@=h7ZGY@Dh9xekcA2{tSKqKZ<`tAQQ9+wgf*y0zpVvOQ<9qCY&Y=5XJ~ILHOG0j2XwBQ%7jM`P2tv~{#P+6CGu9Y;5!2hua> zCG_v;z4S?CC1rc%807-x8s$^ULkxsr$OvR)G0GUn7`GVjR5Vq*RQM{JRGL%DRgX~5SKp(4L49HleU9rK?wsN|$L8GC zfHh1tA~lw29MI^|n9|hJ^w$(=?$kW5IibbS^3=-Es?a*EHLgw5cGnhYS7@Kne#%s4 zdNH$@Rm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%H_00QetL_t(I z5j|5$EM!p>J@x&XsUqE)Qbn7^MvEb)*jS0!*oz^E1i{X*AtJFcELcfMBv`PKNGyby zA~7e1R$6OKml%Sst|~*RQhwj}3=Ng!WahI}R^sL62Dj7G?D}D`9UYKf zUvWmjzNaVdXCR6N0$?}M-ycyeEqJ-Q0(?HOO4MdEH1ugBBB1&D6~DW>pirxE*3-iQ z*dg$PoYAeV2rDf`P;M>+oem83<>CUDV`Dg|sKCR)0Su|BxSyRxSaC5+<0gbxRUvs| z0*_WJY=eW)#>Bv}xe53AIc}z=cq^L7NZ40baY_}K3Cu$+M%34H0MYAo;#Ye+wDIxy z)7J;-`56p!zr39H%%TFbvS43c#^doZ2hzpG!H}H%UV-%XhR2f=J_9ZF2~mWTScs$7 zWHY9x!?C{3uQ!vEFr=h#Fo9YZ*zjImF8F(3fO%uGIH9nHy);&su{5LG4< zv@|3V1w7Z+&?h87O+NOyDA7_~4e#wO1eFTTtu6TJ_4rORN*ox#QDY-SeN+^_QD00X z%8(FvNC!*{ZkrANsPCYR4E$(rhHGz+SH`GibUN17Adz0g1A4(kynf2dgMEG;cf_-7 zs^DNac6L6JnO`D#n@URXv#E)PaUorej^gjq6224_A-J$m&d2Bcd^{6F>;VWo6l#kF z9%@ORl_*DFj*P&MXt5CgdeVe_Wd*?n1vu^OgrLzNC?|*0XD%y)wXRN1gUA*_UZ#to zA!tbVffUR((d%&V$s5wr;B&iSrz#I?YvJ79<^X(|7EPu@NK&E /dev/null` || \ -SAGE_EXECUTABLE="$1" - -# Strip the last section off -- this should be SAGE_ROOT. We could -# just call `sage --root`, but I'm afraid this may not work (if there -# are spaces). But if sageBinary is not set, the "sage" gets passed -# in, and we have no choice, but to call `sage --root`, and it should -# work in that case (assuming of course that sage is in PATH) -if [ "x$SAGE_EXECUTABLE" = "xsage" ]; then - SAGE_ROOT=`sage --root` -else - SAGE_ROOT="${SAGE_EXECUTABLE%/*}/" -fi -SAGE_LOG="$2" - -# Work around spaces in the path (and perhaps cut down on location changes). -# We delete and recreate the symlink every time to ensure we are in the right place -rm -f /tmp/sage-mac-app -ln -s "$SAGE_ROOT" /tmp/sage-mac-app - -# Move to a fake SAGE_ROOT -- without spaces -cd /tmp/sage-mac-app || exit 1 - -# Set SAGE_ROOT and all the other environment variables by sourcing -# sage-env. In order to support older versions 4.x of Sage, we try both -# spkg/bin/sage-env and local/bin/sage-env. -echo Setting environment variables >> "$SAGE_LOG" -{ . spkg/bin/sage-env || . local/bin/sage-env; } >> "$SAGE_LOG" 2>> "$SAGE_LOG" || exit 1 -export SAGE_ROOT - -# Mac OS X app bundles are *intended* to be moved around, and/or given away -# So always run first the respective script handling this -# (This should also catch Intel vs. PPC or 32Bit vs. 64Bit conflicts - untested) -echo Checking install location >> "$SAGE_LOG" -./local/bin/sage-location >> "$SAGE_LOG" 2>> "$SAGE_LOG" || exit 1 - -echo Checking existence of notebook directory >> "$SAGE_LOG" -if [ -d $DOT_SAGE/sage_notebook.sagenb ]; then - echo Starting Notebook >> "$SAGE_LOG" - ./sage --notebook >> "$SAGE_LOG" 2>> "$SAGE_LOG" -else - # if Terminal.app is not running before it is activated by - # osascript, then it inherits the environment from osascript. - # This includes SAGE_ENV_SOURCED which causes problems because - # PATH can get messed up and we'll end up calling the system - # python instead of the sage version. We unset it here so that - # sage-env will be sourced and PATH set up properly. - SAGE_ENV_SOURCED= - echo Starting Notebook in Terminal >> "$SAGE_LOG" - sage-native-execute osascript \ - -e 'tell app "Terminal"' \ - -e ' activate' \ - -e " do script \"'$SAGE_ROOT'/sage --notebook\"" \ - -e 'end' -fi -exit 0 From 4fd031e9c04a2538c78143032bcd14bb5b176678 Mon Sep 17 00:00:00 2001 From: "R. Andrew Ohana" Date: Mon, 2 Sep 2013 10:50:59 -0700 Subject: [PATCH 69/85] Makefile: separate out clean targets to the appropriate directory (when possible) --- Makefile | 20 ++------------------ src/Makefile | 12 ++++++++++++ src/doc/Makefile | 7 +++++++ 3 files changed, 21 insertions(+), 18 deletions(-) create mode 100644 src/Makefile create mode 100644 src/doc/Makefile diff --git a/Makefile b/Makefile index e219c561349..3fb82a61cb4 100644 --- a/Makefile +++ b/Makefile @@ -62,30 +62,14 @@ doc-pdf: build $(PIPE) "./sage --docbuild all pdf $(SAGE_DOCBUILD_OPTS) 2>&1" "tee -a logs/docpdf.log" doc-clean: - @echo "Deleting generated docs..." - rm -rf src/doc/en/reference/*/sage - rm -rf src/doc/en/reference/*/sagenb - rm -rf src/doc/en/reference/sage - rm -rf src/doc/en/reference/sagenb - rm -rf src/doc/output + cd src/doc && $(MAKE) clean clean: @echo "Deleting package build directories..." rm -rf local/var/tmp/sage/build lib-clean: - @echo "Deleting Sage library build artifacts..." - rm -f src/c_lib/.sconsign.dblite - find src/c_lib -name '*.os' | xargs rm -f - find src/c_lib -name '*.so' | xargs rm -f - rm -rf src/build - find src -name '*.pyc' | xargs rm -f - find src -name '*.pyx' | sed 's/pyx$$/c/' | xargs rm -f - find src -name '*.pyx' | sed 's/pyx$$/cpp/' | xargs rm -f - rm -rf src/sage/libs/pari/gen.h - rm -rf src/sage/modular/arithgroup/farey_symbol.h - rm -rf src/sage/rings/real_mpfi.h - rm -rf src/sage/symbolic/pynac.h + cd src && $(MAKE) clean bdist-clean: clean @echo "Deleting miscellaneous artifacts generated by build system ..." diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 00000000000..78ce35584ee --- /dev/null +++ b/src/Makefile @@ -0,0 +1,12 @@ +clean: + @echo "Deleting Sage library build artifacts..." + rm -f c_lib/.sconsign.dblite + find c_lib -name '*.os' | xargs rm -f + find c_lib -name '*.so' | xargs rm -f + rm -rf build + find -name '*.pyc' | xargs rm -f + find -name '*.pyx' | sed 's/pyx$$/c/' | xargs rm -f + find -name '*.pyx' | sed 's/pyx$$/cpp/' | xargs rm -f + rm -rf sage/modular/arithgroup/farey_symbol.h + rm -rf sage/rings/real_mpfi.h + rm -rf sage/symbolic/pynac.h diff --git a/src/doc/Makefile b/src/doc/Makefile new file mode 100644 index 00000000000..098b32bbbcf --- /dev/null +++ b/src/doc/Makefile @@ -0,0 +1,7 @@ +clean: + @echo "Deleting generated docs..." + rm -rf en/reference/*/sage + rm -rf en/reference/*/sagenb + rm -rf en/reference/sage + rm -rf en/reference/sagenb + rm -rf output From 6ed41fca37069fa1ec8b30564da7c97b25614dfb Mon Sep 17 00:00:00 2001 From: "R. Andrew Ohana" Date: Mon, 2 Sep 2013 10:59:06 -0700 Subject: [PATCH 70/85] install: use env variables instead of absolute file names also add comment for the `@mkdir -p "$(@D)"` line --- build/install | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/build/install b/build/install index 1cc46854b3d..c4a53b9e251 100755 --- a/build/install +++ b/build/install @@ -15,7 +15,7 @@ SAGE_SPKG_INST="$SAGE_LOCAL/var/lib/sage/installed" SAGE_VERSION=`cat $SAGE_ROOT/VERSION.txt | sed 's+.*\ \(.*\),.*+\1+'` PATH="$SAGE_ROOT/src/bin:$SAGE_LOCAL/bin:$PATH" PYTHONPATH="$SAGE_LOCAL" -export SAGE_ROOT SAGE_SRC SAGE_LOCAL SAGE_LOGS SAGE_SPKG_INST SAGE_VERSION PATH PYTHONPATH +export SAGE_ROOT SAGE_SRC SAGE_LOCAL SAGE_EXTCODE SAGE_LOGS SAGE_SPKG_INST SAGE_VERSION PATH PYTHONPATH # Storing the start time of the build process. The time is stored in # seconds since 1970-01-01 in a hidden file called @@ -469,32 +469,34 @@ echo >&3 echo >&3 'SCRIPT_SOURCES = \' for file in "$SAGE_SRC/bin/"*; do - echo >&3 " $file \\" + echo >&3 " \$(SAGE_SRC)${file#$SAGE_SRC} \\" done echo >&3 echo >&3 'SCRIPT_TARGETS = \' for file in "$SAGE_SRC/bin/"*; do - echo >&3 " ${SAGE_LOCAL}${file#$SAGE_SRC} \\" + echo >&3 " \$(SAGE_LOCAL)${file#$SAGE_SRC} \\" done echo >&3 echo >&3 'EXTCODE_SOURCES = \' for file in `find "$SAGE_SRC"/ext -type f`; do - echo >&3 " $file \\" + echo >&3 " \$(SAGE_SRC)${file#$SAGE_SRC} \\" done echo >&3 echo >&3 'EXTCODE_TARGETS = \' for file in `find "$SAGE_SRC"/ext -type f`; do - echo >&3 " ${SAGE_EXTCODE}${file#$SAGE_SRC/ext} \\" + echo >&3 " \$(SAGE_EXTCODE)${file#$SAGE_SRC/ext} \\" done echo >&3 cat >&3 < Date: Mon, 2 Sep 2013 11:03:14 -0700 Subject: [PATCH 71/85] replace instances of [ A == B ] by [ A = B ] --- build/install | 4 ++-- src/bin/sage-spkg | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/build/install b/build/install index c4a53b9e251..08fd8f2ebd8 100755 --- a/build/install +++ b/build/install @@ -456,10 +456,10 @@ EOF # $(TOOLCHAIN) variable containing prerequisites for the build echo >&3 -n 'TOOLCHAIN =' -if [ "$SAGE_INSTALL_CCACHE" == yes ]; then +if [ "$SAGE_INSTALL_CCACHE" = yes ]; then echo >&3 -n ' $(INST)/ccache' fi -if [ "$need_to_install_gcc" == yes ]; then +if [ "$need_to_install_gcc" = yes ]; then echo >&3 -n ' $(INST)/$(GCC)' # Use this option for the prereq configure script, such that it # will skip all compiler checks. diff --git a/src/bin/sage-spkg b/src/bin/sage-spkg index cad789b28ef..0098aec98e3 100755 --- a/src/bin/sage-spkg +++ b/src/bin/sage-spkg @@ -279,7 +279,7 @@ elif [ -z "$PKG_HAS_PATH" ]; then PKG_VER="${PKG_VER#-}" PKG_SCRIPTS="$SAGE_ROOT/build/pkgs/$PKG_BASE" LOCAL_PKG_VER=`cat $PKG_SCRIPTS/package-version.txt 2>/dev/null` - if [ -n "$LOCAL_PKG_VER" ] && [ -z "$PKG_VER" -o "$PKG_VER" == "$LOCAL_PKG_VER" ]; then + if [ -n "$LOCAL_PKG_VER" ] && [ -z "$PKG_VER" -o "$PKG_VER" = "$LOCAL_PKG_VER" ]; then PKG_VER="$LOCAL_PKG_VER" if [ -z "$PKG_VER" ]; then PKG_NAME="${PKG_BASE}" @@ -316,7 +316,7 @@ elif [ -z "$PKG_HAS_PATH" ]; then fi fi -if [ $INFO -ne 0 -a "$USE_LOCAL_SCRIPTS" == yes ]; then +if [ $INFO -ne 0 -a "$USE_LOCAL_SCRIPTS" = yes ]; then cat "$PKG_SCRIPTS/SPKG.txt" exit 0 fi @@ -345,7 +345,7 @@ if [ ! -f "$PKG_SRC" ]; then if [ -n "$PKG_HAS_PATH" ]; then PKG_URL="$PKG_SRC" else - if [ "$USE_LOCAL_SCRIPTS" == yes ]; then + if [ "$USE_LOCAL_SCRIPTS" = yes ]; then PKG_URL="$SAGE_UPSTREAM/$PKG_BASE/$PKG_NAME_UPSTREAM" else # Handle cases 2a and 3, where the package name is something @@ -444,7 +444,7 @@ if [ ! -f "$PKG_SRC" ]; then # Download to a temporary file (such that we don't end up with a # corrupted .spkg file). PKG_TMP="${PKG_URL##*/}.tmp" - if [ "$USE_LOCAL_SCRIPTS" == yes ]; then + if [ "$USE_LOCAL_SCRIPTS" = yes ]; then EXT_LIST=".tar.bz2 .tar.gz .tar" else EXT_LIST=".spkg" @@ -466,12 +466,12 @@ if [ ! -f "$PKG_SRC" ]; then fi PKG_SRC="`pwd`/${PKG_URL##*/}${EXT#.spkg}" - if [ "$USE_LOCAL_SCRIPTS" == yes ]; then + if [ "$USE_LOCAL_SCRIPTS" = yes ]; then verify_checksum "$PKG_TMP" "$PKG_SCRIPTS/checksums.ini" fi mv -f "$PKG_TMP" "$PKG_SRC" else - if [ "$USE_LOCAL_SCRIPTS" == yes ]; then + if [ "$USE_LOCAL_SCRIPTS" = yes ]; then verify_checksum "$PKG_SRC" "$PKG_SCRIPTS/checksums.ini" fi fi @@ -569,7 +569,7 @@ fi # Extract the package ################################################################## -if [ "$USE_LOCAL_SCRIPTS" == yes ]; then +if [ "$USE_LOCAL_SCRIPTS" = yes ]; then echo "Setting up build directory for $PKG_NAME" cp -Rp "$PKG_SCRIPTS" "$PKG_NAME" cd "$PKG_NAME" @@ -584,7 +584,7 @@ if [ $? -ne 0 ]; then exit 1 fi -if [ "$USE_LOCAL_SCRIPTS" == yes ]; then +if [ "$USE_LOCAL_SCRIPTS" = yes ]; then mv "$PKG_NAME_UPSTREAM" src cd .. echo "Finished set up" From 1a65c42fcce72b927d76fe7dfc9d6779c80c0cef Mon Sep 17 00:00:00 2001 From: "R. Andrew Ohana" Date: Mon, 2 Sep 2013 11:11:03 -0700 Subject: [PATCH 72/85] sage-spkg: add comment explaining USE_LOCAL_SCRIPTS --- src/bin/sage-spkg | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/bin/sage-spkg b/src/bin/sage-spkg index 0098aec98e3..bd00c97b915 100755 --- a/src/bin/sage-spkg +++ b/src/bin/sage-spkg @@ -263,6 +263,11 @@ fi PKG_NAME=`basename "$PKG_SRC" | sed 's/\.spkg$//'` PKG_BASE=`echo "$PKG_NAME" | sed 's/-[0-9].*//'` +# USE_LOCAL_SCRIPTS is a flag that if non-empty will cause +# this script to try to install the package using local metadata +# i.e. use upstream tarballs (vs spkgs) and scripts located in build/pkgs/$PKG_BASE +# the value of this flag is set in the next codeblock +USE_LOCAL_SCRIPTS= if [ -f "$PKG_SRC" ]; then # PKG_SRC is a file. If it is given by a relative path, prepend `pwd` From 50e57d75d53601bc073a855ce995d7aa92506a92 Mon Sep 17 00:00:00 2001 From: "R. Andrew Ohana" Date: Thu, 5 Sep 2013 12:23:47 -0700 Subject: [PATCH 73/85] mac's output dylib's instead of so's --- src/c_lib/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/src/c_lib/.gitignore b/src/c_lib/.gitignore index a1efc751bf8..9475000998b 100644 --- a/src/c_lib/.gitignore +++ b/src/c_lib/.gitignore @@ -1,3 +1,4 @@ *.os *.so +*.dylib .sconsign.dblite From c101a0664d57261c8c0310a59efcb0eb78d4ce52 Mon Sep 17 00:00:00 2001 From: Jeroen Demeyer Date: Fri, 6 Sep 2013 08:11:55 +0000 Subject: [PATCH 74/85] Trac #14694: sympy-0.7.3 (Eviatar Bach, 17 August 2013) * Trac #14694: new upstream release * updating SymPy download URL --- build/pkgs/sympy/SPKG.txt | 6 +++++- build/pkgs/sympy/get-orig-sources | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/build/pkgs/sympy/SPKG.txt b/build/pkgs/sympy/SPKG.txt index c2cd80c18b7..3583078383d 100644 --- a/build/pkgs/sympy/SPKG.txt +++ b/build/pkgs/sympy/SPKG.txt @@ -20,7 +20,7 @@ New BSD: http://www.opensource.org/licenses/bsd-license.php sympy mailinglist: http://groups.google.com/group/sympy == Dependencies == - * Python 2.4 or later + * Python 2.5 or later == Special Update/Build Instructions == @@ -28,6 +28,10 @@ sympy mailinglist: http://groups.google.com/group/sympy == Changelog == +=== sympy-0.7.3 (Eviatar Bach, 17 August 2013) == + * Trac #14694: new upstream release + * updating SymPy download URL + === sympy-0.7.1.p0 (Francois Bissey, 22 February 2012) === * Trac #12563: add -S option to python to prevent sympy's installer from importing sage. diff --git a/build/pkgs/sympy/get-orig-sources b/build/pkgs/sympy/get-orig-sources index 0d4ac1acdb2..5325efc45bb 100755 --- a/build/pkgs/sympy/get-orig-sources +++ b/build/pkgs/sympy/get-orig-sources @@ -1,8 +1,8 @@ #! /bin/sh #execute this script from the same directory, where spkg-install is. #it will remove the src dir (!) and create a new one instead -ver=0.7.1 -wget http://sympy.googlecode.com/files/sympy-$ver.tar.gz +ver=0.7.3 +wget https://github.com/sympy/sympy/releases/download/sympy-$ver/sympy-$ver.tar.gz tar xzf sympy-$ver.tar.gz rm -rf src sympy-$ver.tar.gz mv sympy-$ver src From be8a70f50cfcdb4559bd61db0a68bfb558d3eac7 Mon Sep 17 00:00:00 2001 From: Jeroen Demeyer Date: Fri, 6 Sep 2013 10:36:24 +0000 Subject: [PATCH 75/85] 5.12.beta5 --- src/sage/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/version.py b/src/sage/version.py index 39d2ca3fd7c..e3f999b38bd 100644 --- a/src/sage/version.py +++ b/src/sage/version.py @@ -1,2 +1,2 @@ """nodoctests""" -version='5.12.beta4'; date='2013-08-30' +version='5.12.beta5'; date='2013-09-06' From 317062bc5a859efd14d134b8be7e2ce1f8c8d35a Mon Sep 17 00:00:00 2001 From: Jeroen Demeyer Date: Fri, 6 Sep 2013 10:37:23 +0000 Subject: [PATCH 76/85] 5.12.beta5 --- src/bin/sage-banner | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/sage-banner b/src/bin/sage-banner index 3374db96d20..e60dc01fe22 100644 --- a/src/bin/sage-banner +++ b/src/bin/sage-banner @@ -1,5 +1,5 @@ ┌────────────────────────────────────────────────────────────────────┐ -│ Sage Version 5.12.beta4, Release Date: 2013-08-30 │ +│ Sage Version 5.12.beta5, Release Date: 2013-09-06 │ │ Type "notebook()" for the browser-based notebook interface. │ │ Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ From c29a7554ab4cfd9f0d17a8a242558db5b820b12a Mon Sep 17 00:00:00 2001 From: "R. Andrew Ohana" Date: Fri, 6 Sep 2013 09:48:14 -0700 Subject: [PATCH 77/85] sage-spkg: simpler parameter lookup --- src/bin/sage-spkg | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/bin/sage-spkg b/src/bin/sage-spkg index bd00c97b915..1938d7ea303 100755 --- a/src/bin/sage-spkg +++ b/src/bin/sage-spkg @@ -83,8 +83,7 @@ lookup_param() { local param=$1 local file=$2 - RESULT=`GREP_OPTIONS= grep "^$param\ *=" $file| sed "s/^$param\ *=\ *//"` - echo $RESULT + sed -n "s/^${param} *= *//p" $file } verify_checksum() From f7875741cac7e52f32cd639cc79aa3020da59a32 Mon Sep 17 00:00:00 2001 From: "R. Andrew Ohana" Date: Fri, 13 Sep 2013 14:07:01 -0700 Subject: [PATCH 78/85] [FIXUP] 5.12.beta5: update git specific files These currently include * VERSION.txt * package-version.txt * checksums.ini --- VERSION.txt | 2 +- build/pkgs/atlas/package-version.txt | 2 +- build/pkgs/sympy/checksums.ini | 6 +++--- build/pkgs/sympy/package-version.txt | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/VERSION.txt b/VERSION.txt index 287f0a854ec..02c39c2632c 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -Sage version 5.12.beta4, released 2013-08-30 +Sage version 5.12.beta5, released 2013-09-06 diff --git a/build/pkgs/atlas/package-version.txt b/build/pkgs/atlas/package-version.txt index 2e0c3c8ef38..89c332ce3b7 100644 --- a/build/pkgs/atlas/package-version.txt +++ b/build/pkgs/atlas/package-version.txt @@ -1 +1 @@ -3.10.1.p3 +3.10.1.p5 diff --git a/build/pkgs/sympy/checksums.ini b/build/pkgs/sympy/checksums.ini index 0be04008878..d1ab1661cc5 100644 --- a/build/pkgs/sympy/checksums.ini +++ b/build/pkgs/sympy/checksums.ini @@ -1,3 +1,3 @@ -sha1=a0d16a887379f254b2df49639c5133404e030f46 -md5=3820ff064ae58ae290bed39ba9c8830c -cksum=313394503 +sha1=205a4ad990d220dc4ca93e49d0b3033028726136 +md5=1ae4861f5564b88328e435c262ea349f +cksum=3342505975 diff --git a/build/pkgs/sympy/package-version.txt b/build/pkgs/sympy/package-version.txt index f5a7e5d6dc5..f38fc5393ff 100644 --- a/build/pkgs/sympy/package-version.txt +++ b/build/pkgs/sympy/package-version.txt @@ -1 +1 @@ -0.7.1.p0 +0.7.3 From ef2506a999a243fc99b70f82817e7bd444680345 Mon Sep 17 00:00:00 2001 From: "R. Andrew Ohana" Date: Fri, 13 Sep 2013 14:34:47 -0700 Subject: [PATCH 79/85] sage-sdist: fix remote origin --- src/bin/sage-sdist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/sage-sdist b/src/bin/sage-sdist index b8979ba5fc6..8113c5c5911 100755 --- a/src/bin/sage-sdist +++ b/src/bin/sage-sdist @@ -40,7 +40,7 @@ mkdir -p "$TMP_DIR/$TARGET" git clone "$SAGE_ROOT" "$TMP_DIR/$TARGET" cd "$TMP_DIR/$TARGET" -git remote set-url origin git://github.com/sagemath/sage.git +git remote set-url origin "$SAGE_REPO_ANONYMOUS" # Update Sage version file in SAGE_ROOT. echo "Sage version $SAGE_VERSION, released $SAGE_RELEASE_DATE" > VERSION.txt From 476bbba0152c3c9edd053f76db649c01ceacd7af Mon Sep 17 00:00:00 2001 From: Julian Rueth Date: Mon, 9 Sep 2013 16:33:59 +0200 Subject: [PATCH 80/85] Updated the anonymous repository sage.env --- src/bin/sage-env | 2 +- src/sage/env.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bin/sage-env b/src/bin/sage-env index afb372021d4..703cb5da83b 100644 --- a/src/bin/sage-env +++ b/src/bin/sage-env @@ -315,7 +315,7 @@ if [ "$SAGE_UPSTREAM" = "" ]; then export SAGE_UPSTREAM fi if [ -z "$SAGE_REPO_ANONYMOUS" ]; then - SAGE_REPO_ANONYMOUS="git://github.com/sagemath/sage.git" + SAGE_REPO_ANONYMOUS="http://trac.sagemath.org/sage.git" export SAGE_REPO_ANONYMOUS fi if [ -z "$SAGE_REPO_AUTHENTICATED" ]; then diff --git a/src/sage/env.py b/src/sage/env.py index 132bb05c92f..f6ee9a04cba 100644 --- a/src/sage/env.py +++ b/src/sage/env.py @@ -106,7 +106,7 @@ def _add_variable_or_fallback(key, fallback, force=False): _add_variable_or_fallback('REALM', 'sage.math.washington.edu') _add_variable_or_fallback('TRAC_SERVER_URI', 'https://trac.sagemath.org') _add_variable_or_fallback('SAGE_REPO_AUTHENTICATED', 'ssh://git@trac.sagemath.org:2222/sage.git') -_add_variable_or_fallback('SAGE_REPO_ANONYMOUS', 'git://github.com/sagemath/sage.git') +_add_variable_or_fallback('SAGE_REPO_ANONYMOUS', 'http://trac.sagemath.org/sage.git') _add_variable_or_fallback('SAGE_VERSION', version.version) _add_variable_or_fallback('SAGE_DATE', version.date) From 86a61958f775df75bfabb035ffeeaffd69ffdec6 Mon Sep 17 00:00:00 2001 From: Julian Rueth Date: Fri, 13 Sep 2013 23:08:35 +0200 Subject: [PATCH 81/85] Use git://trac.sagemath.org/sage.git for unauthenticated access to the repository. One reason for doing this is that git does not always build with the http module. --- src/bin/sage-env | 2 +- src/sage/env.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bin/sage-env b/src/bin/sage-env index 703cb5da83b..62dc358aa52 100644 --- a/src/bin/sage-env +++ b/src/bin/sage-env @@ -315,7 +315,7 @@ if [ "$SAGE_UPSTREAM" = "" ]; then export SAGE_UPSTREAM fi if [ -z "$SAGE_REPO_ANONYMOUS" ]; then - SAGE_REPO_ANONYMOUS="http://trac.sagemath.org/sage.git" + SAGE_REPO_ANONYMOUS="git://trac.sagemath.org/sage.git" export SAGE_REPO_ANONYMOUS fi if [ -z "$SAGE_REPO_AUTHENTICATED" ]; then diff --git a/src/sage/env.py b/src/sage/env.py index f6ee9a04cba..d56d2c5ba6e 100644 --- a/src/sage/env.py +++ b/src/sage/env.py @@ -106,7 +106,7 @@ def _add_variable_or_fallback(key, fallback, force=False): _add_variable_or_fallback('REALM', 'sage.math.washington.edu') _add_variable_or_fallback('TRAC_SERVER_URI', 'https://trac.sagemath.org') _add_variable_or_fallback('SAGE_REPO_AUTHENTICATED', 'ssh://git@trac.sagemath.org:2222/sage.git') -_add_variable_or_fallback('SAGE_REPO_ANONYMOUS', 'http://trac.sagemath.org/sage.git') +_add_variable_or_fallback('SAGE_REPO_ANONYMOUS', 'git://trac.sagemath.org/sage.git') _add_variable_or_fallback('SAGE_VERSION', version.version) _add_variable_or_fallback('SAGE_DATE', version.date) From e11727c3e33d4f8407324d83e13d69a3e14730f1 Mon Sep 17 00:00:00 2001 From: Volker Braun Date: Sun, 15 Sep 2013 16:22:12 +0100 Subject: [PATCH 82/85] revert the change to .gitignore --- .gitignore | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 50bfc48db38..b59740af6c5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,6 @@ -ignored -ignored_dir \ No newline at end of file +*.pyc +/.BUILDSTART +/dist +/local +/logs +/upstream From 0f00389935f11b2801f29a64e08fb157dde6c349 Mon Sep 17 00:00:00 2001 From: Jeroen Demeyer Date: Tue, 1 Oct 2013 11:06:28 +0000 Subject: [PATCH 83/85] 5.12.rc0 --- src/sage/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/version.py b/src/sage/version.py index e3f999b38bd..4e58e9bfebe 100644 --- a/src/sage/version.py +++ b/src/sage/version.py @@ -1,2 +1,2 @@ """nodoctests""" -version='5.12.beta5'; date='2013-09-06' +version='5.12.rc0'; date='2013-10-01' From 45a79e8a9414a93f932bf2e8b460010180493c8e Mon Sep 17 00:00:00 2001 From: Jeroen Demeyer Date: Tue, 1 Oct 2013 11:08:54 +0000 Subject: [PATCH 84/85] 5.12.rc0 --- src/bin/sage-banner | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/sage-banner b/src/bin/sage-banner index e60dc01fe22..5c95f42bad9 100644 --- a/src/bin/sage-banner +++ b/src/bin/sage-banner @@ -1,5 +1,5 @@ ┌────────────────────────────────────────────────────────────────────┐ -│ Sage Version 5.12.beta5, Release Date: 2013-09-06 │ +│ Sage Version 5.12.rc0, Release Date: 2013-10-01 │ │ Type "notebook()" for the browser-based notebook interface. │ │ Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ From 56d80d07ad270272a64e8c71fd7a9bc632f37ba6 Mon Sep 17 00:00:00 2001 From: "R. Andrew Ohana" Date: Wed, 2 Oct 2013 00:59:38 -0700 Subject: [PATCH 85/85] [FIXUP] 5.12.rc0: update git specific files These currently include * VERSION.txt * package-version.txt * checksums.ini --- VERSION.txt | 2 +- build/pkgs/singular/package-version.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION.txt b/VERSION.txt index 02c39c2632c..8d9e99691f3 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -Sage version 5.12.beta5, released 2013-09-06 +Sage version 5.12.rc0, released 2013-10-01 diff --git a/build/pkgs/singular/package-version.txt b/build/pkgs/singular/package-version.txt index 950a5f8bbfd..8bbb0577c8d 100644 --- a/build/pkgs/singular/package-version.txt +++ b/build/pkgs/singular/package-version.txt @@ -1 +1 @@ -3.1.5.p8 +3.1.5.p9