# 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
|
b
|
def ellipsis_range(*args, **kwds): |
825 | 825 | sage: ellipsis_range(0,Ellipsis,10,Ellipsis,20,step=2) |
826 | 826 | [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20] |
827 | 827 | |
828 | | Sometimes one or more ranges is emtpy. |
| 828 | Sometimes one or more ranges is empty. |
829 | 829 | sage: ellipsis_range(100,Ellipsis,10,Ellipsis,20,step=2) |
830 | 830 | [10, 12, 14, 16, 18, 20] |
831 | 831 | sage: ellipsis_range(0,Ellipsis,10,Ellipsis,-20,step=2) |
… |
… |
def exists(S, P): |
1232 | 1232 | (True, 5) |
1233 | 1233 | |
1234 | 1234 | The following example is similar to one in the MAGMA handbook. We |
1235 | | check whether certain integers are a some of two (small) cubes: |
| 1235 | check whether certain integers are a sum of two (small) cubes: |
1236 | 1236 | |
1237 | 1237 | sage: cubes = [t**3 for t in range(-10,11)] |
1238 | 1238 | sage: exists([(x,y) for x in cubes for y in cubes], lambda v : v[0]+v[1] == 218) |
… |
… |
def getitem(v, n): |
1432 | 1432 | EXAMPLES: |
1433 | 1433 | sage: v = [1,2,3] |
1434 | 1434 | |
1435 | | The following use to fail in SAGE <= 1.3.7. Now it works fine: |
| 1435 | The following used to fail in SAGE <= 1.3.7. Now it works fine: |
1436 | 1436 | sage: v[ZZ(1)] |
1437 | 1437 | 2 |
1438 | 1438 | |
diff -r 224f92c7866c -r 84f1e44f1b04 sage/rings/polynomial/polynomial_element.pyx
a
|
b
|
cdef class Polynomial(CommutativeAlgebra |
913 | 913 | return generic_power(self, right) |
914 | 914 | |
915 | 915 | def _pow(self, right): |
916 | | # TODO: fit __pow__ into the arithmatic structure |
| 916 | # TODO: fit __pow__ into the arithmetic structure |
917 | 917 | if self.degree() <= 0: |
918 | 918 | return self.parent()(self[0]**right) |
919 | 919 | if right < 0: |
diff -r 224f92c7866c -r 84f1e44f1b04 sage/schemes/elliptic_curves/ell_point.py
a
|
b
|
class EllipticCurvePoint_finite_field(El |
640 | 640 | |
641 | 641 | def make_point(X, v): |
642 | 642 | # TODO: Unpickled parents with base sometimes have thier base set to None. |
643 | | # This causes a segfault in the module arithmatic architecture. |
| 643 | # This causes a segfault in the module arithmetic architecture. |
644 | 644 | # |
645 | 645 | # sage: H = HomsetWithBase(QQ, RR, base=ZZ); H |
646 | 646 | # sage: H0 = loads(dumps(H)) |
diff -r 224f92c7866c -r 84f1e44f1b04 sage/structure/coerce.pxi
a
|
b
|
cdef inline arith_error_message(x, y, op |
71 | 71 | return "unsupported operand parent(s) for '%s': '%s' and '%s'"%(n, parent_c(x), parent_c(y)) |
72 | 72 | |
73 | 73 | ################################################################################# |
74 | | # Inline arithmatic dispatchers for ModuleElements and RingElements |
| 74 | # Inline arithmetic dispatchers for ModuleElements and RingElements |
75 | 75 | ################################################################################# |
76 | 76 | |
77 | 77 | cdef inline ModuleElement _add_c(ModuleElement left, ModuleElement right): |
… |
… |
cdef inline RingElement _idiv_c(RingElem |
144 | 144 | return left._idiv_c_impl(right) |
145 | 145 | |
146 | 146 | cdef enum: |
147 | | # 3 references: handle, scope container, and arithmatic call stack |
| 147 | # 3 references: handle, scope container, and arithmetic call stack |
148 | 148 | inplace_threshold = 0 |
149 | 149 | |
150 | 150 | |
diff -r 224f92c7866c -r 84f1e44f1b04 sage/structure/coerce.pyx
a
|
b
|
cdef class CoercionModel_profile(Coercio |
518 | 518 | |
519 | 519 | We can read of this data that the most expensive operation was the creation |
520 | 520 | of the action of $\Q$ on $\Z[x]$ (whose result lies in $\Q[x]$. This has |
521 | | been cached as illistrated below. |
| 521 | been cached as illustrated below. |
522 | 522 | |
523 | 523 | sage: coerce.flush() |
524 | 524 | sage: z = 1/2 * x + .5 |
diff -r 224f92c7866c -r 84f1e44f1b04 sage/structure/element.pyx
a
|
b
|
and classes are similar. There are four |
152 | 152 | implementations of either _add_ or _add_c_impl. |
153 | 153 | |
154 | 154 | |
155 | | For speed, there are also {\bf inplace} version of the arithmatic commands. |
| 155 | For speed, there are also {\bf inplace} version of the arithmetic commands. |
156 | 156 | DD NOT call them directly, they may mutate the object and will be called |
157 | 157 | when and only when it has been determined that the old object will no longer |
158 | 158 | be accessible from the calling function after this operation. |
diff -r 224f92c7866c -r 84f1e44f1b04 sage/structure/parent_base.pyx
a
|
b
|
include "../ext/stdsage.pxi" |
9 | 9 | include "../ext/stdsage.pxi" |
10 | 10 | |
11 | 11 | # TODO: Unpickled parents with base sometimes have thier base set to None. |
12 | | # This causes a segfault in the module arithmatic architecture. |
| 12 | # This causes a segfault in the module arithmetic architecture. |
13 | 13 | # |
14 | 14 | # sage: H = HomsetWithBase(QQ, RR, base=ZZ); H |
15 | 15 | # sage: H0 = loads(dumps(H)) |