# Ticket #1243: 1243.patch

File 1243.patch, 5.5 KB (added by mhansen, 14 years ago)
• ## sage/misc/misc.py

# HG changeset patch
# User Mike Hansen <mhansen@gmail.com>
# Date 1196909332 21600
# Node ID 84f1e44f1b04430f13c980148c4f1980edf43900
# Parent  224f92c7866ca84624b21ca5b334134a4da1eaa1
Fixed #1243.

diff -r 224f92c7866c -r 84f1e44f1b04 sage/misc/misc.py
 a def ellipsis_range(*args, **kwds): sage: ellipsis_range(0,Ellipsis,10,Ellipsis,20,step=2) [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20] Sometimes one or more ranges is emtpy. Sometimes one or more ranges is empty. sage: ellipsis_range(100,Ellipsis,10,Ellipsis,20,step=2) [10, 12, 14, 16, 18, 20] sage: ellipsis_range(0,Ellipsis,10,Ellipsis,-20,step=2) def exists(S, P): (True, 5) The following example is similar to one in the MAGMA handbook.  We check whether certain integers are a some of two (small) cubes: check whether certain integers are a sum of two (small) cubes: sage: cubes = [t**3 for t in range(-10,11)] sage: exists([(x,y) for x in cubes for y in cubes], lambda v : v[0]+v[1] == 218) def getitem(v, n): EXAMPLES: sage: v = [1,2,3] The following use to fail in SAGE <= 1.3.7.  Now it works fine: The following used to fail in SAGE <= 1.3.7.  Now it works fine: sage: v[ZZ(1)] 2
• ## sage/rings/polynomial/polynomial_element.pyx

diff -r 224f92c7866c -r 84f1e44f1b04 sage/rings/polynomial/polynomial_element.pyx
 a cdef class Polynomial(CommutativeAlgebra return generic_power(self, right) def _pow(self, right): # TODO: fit __pow__ into the arithmatic structure # TODO: fit __pow__ into the arithmetic structure if self.degree() <= 0: return self.parent()(self[0]**right) if right < 0:
• ## sage/schemes/elliptic_curves/ell_point.py

diff -r 224f92c7866c -r 84f1e44f1b04 sage/schemes/elliptic_curves/ell_point.py
 a class EllipticCurvePoint_finite_field(El def make_point(X, v): # TODO: Unpickled parents with base sometimes have thier base set to None. # This causes a segfault in the module arithmatic architecture. # This causes a segfault in the module arithmetic architecture. # # sage: H = HomsetWithBase(QQ, RR, base=ZZ); H # sage: H0 = loads(dumps(H))
• ## sage/structure/coerce.pxi

diff -r 224f92c7866c -r 84f1e44f1b04 sage/structure/coerce.pxi
 a cdef inline arith_error_message(x, y, op return "unsupported operand parent(s) for '%s': '%s' and '%s'"%(n, parent_c(x), parent_c(y)) ################################################################################# # Inline arithmatic dispatchers for ModuleElements and RingElements # Inline arithmetic dispatchers for ModuleElements and RingElements ################################################################################# cdef inline ModuleElement _add_c(ModuleElement left, ModuleElement right): cdef inline RingElement _idiv_c(RingElem return left._idiv_c_impl(right) cdef enum: # 3 references: handle, scope container, and arithmatic call stack # 3 references: handle, scope container, and arithmetic call stack inplace_threshold = 0
• ## sage/structure/coerce.pyx

diff -r 224f92c7866c -r 84f1e44f1b04 sage/structure/coerce.pyx
 a cdef class CoercionModel_profile(Coercio We can read of this data that the most expensive operation was the creation of the action of $\Q$ on $\Z[x]$ (whose result lies in $\Q[x]$. This has been cached as illistrated below. been cached as illustrated below. sage: coerce.flush() sage: z = 1/2 * x + .5
• ## sage/structure/element.pyx

diff -r 224f92c7866c -r 84f1e44f1b04 sage/structure/element.pyx
 a and classes are similar. There are four implementations of either _add_ or _add_c_impl. For speed, there are also {\bf inplace} version of the arithmatic commands. For speed, there are also {\bf inplace} version of the arithmetic commands. DD NOT call them directly, they may mutate the object and will be called when and only when it has been determined that the old object will no longer be accessible from the calling function after this operation.
• ## sage/structure/parent_base.pyx

diff -r 224f92c7866c -r 84f1e44f1b04 sage/structure/parent_base.pyx
 a include "../ext/stdsage.pxi" include "../ext/stdsage.pxi" # TODO: Unpickled parents with base sometimes have thier base set to None. # This causes a segfault in the module arithmatic architecture. # This causes a segfault in the module arithmetic architecture. # # sage: H = HomsetWithBase(QQ, RR, base=ZZ); H # sage: H0 = loads(dumps(H))