Changeset 2337:361b4570d4ff
- Timestamp:
- 01/11/07 17:31:58 (6 years ago)
- Branch:
- default
- Parents:
- 2335:f4df42f5af11 (diff), 2336:ca018d0ae6ed (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Location:
- sage
- Files:
-
- 22 edited
-
combinat/combinat.py (modified) (1 diff)
-
combinat/combinat.py (modified) (1 diff)
-
libs/pari/gen.pyx (modified) (1 diff)
-
libs/pari/gen.pyx (modified) (1 diff)
-
matrix/matrix0.pyx (modified) (4 diffs)
-
matrix/matrix0.pyx (modified) (5 diffs)
-
modular/modsym/ambient.py (modified) (3 diffs)
-
modular/modsym/ambient.py (modified) (3 diffs)
-
modular/ssmod/ssmod.py (modified) (1 diff)
-
modular/ssmod/ssmod.py (modified) (1 diff)
-
modules/complex_double_vector.pyx (modified) (1 diff)
-
modules/complex_double_vector.pyx (modified) (2 diffs)
-
plot/tachyon.py (modified) (2 diffs)
-
plot/tachyon.py (modified) (2 diffs)
-
rings/quotient_ring.py (modified) (1 diff)
-
rings/quotient_ring.py (modified) (1 diff)
-
server/notebook/cell.py (modified) (2 diffs)
-
server/notebook/cell.py (modified) (3 diffs)
-
server/notebook/worksheet.py (modified) (2 diffs)
-
server/notebook/worksheet.py (modified) (1 diff)
-
structure/element.pyx (modified) (1 diff)
-
structure/element.pyx (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sage/combinat/combinat.py
r2114 r2337 381 381 Traceback (most recent call last): 382 382 ... 383 TypeError 383 TypeError: no implicit coercion of element to the rational numbers 384 384 385 385 There was a conjecture that the sequence $L_n$ defined by -
sage/combinat/combinat.py
r2114 r2337 381 381 Traceback (most recent call last): 382 382 ... 383 TypeError 383 TypeError: no implicit coercion of element to the rational numbers 384 384 385 385 There was a conjecture that the sequence $L_n$ defined by -
sage/libs/pari/gen.pyx
r1816 r2337 884 884 remainder, with respect to v (to main variable if v is 885 885 omitted). 886 887 sage:888 886 """ 889 887 t0GEN(y) -
sage/libs/pari/gen.pyx
r1816 r2337 884 884 remainder, with respect to v (to main variable if v is 885 885 omitted). 886 887 sage:888 886 """ 889 887 t0GEN(y) -
sage/matrix/matrix0.pyx
r2320 r2337 5 5 6 6 EXAMPLES: 7 7 sage: matrix(2,[1,2,3,4]) 8 [1 2] 9 [3 4] 8 10 """ 9 11 … … 1643 1645 """ 1644 1646 Add two matrices with the same parent. 1645 1646 EXAMPLES:1647 sage:1648 1647 """ 1649 1648 cdef Py_ssize_t i, j … … 1663 1662 sage: a = matrix(2,2, [1,2,x*y,y*x]) 1664 1663 sage: b = matrix(2,2, [1,2,y*x,y*x]) 1665 1666 1667 1664 """ 1668 1665 return self._add_c_impl(right._left_scalar_multiply(-1)) … … 2133 2130 EXAMPLES: 2134 2131 EXAMPLE cmparing sparse and dense matrices: 2135 sage:2136 2132 sage: matrix(QQ,2,range(4)) == matrix(QQ,2,range(4),sparse=True) 2137 2133 True -
sage/matrix/matrix0.pyx
r2183 r2337 5 5 6 6 EXAMPLES: 7 7 sage: matrix(2,[1,2,3,4]) 8 [1 2] 9 [3 4] 8 10 """ 9 11 … … 1643 1645 """ 1644 1646 Add two matrices with the same parent. 1645 1646 EXAMPLES:1647 sage:1648 1647 """ 1649 1648 cdef Py_ssize_t i, j … … 1663 1662 sage: a = matrix(2,2, [1,2,x*y,y*x]) 1664 1663 sage: b = matrix(2,2, [1,2,y*x,y*x]) 1665 1666 1667 1664 """ 1668 1665 return self._add_c_impl(right._left_scalar_multiply(-1)) … … 2100 2097 if n < 0: 2101 2098 return (~self)**(-n) 2102 ans = self.parent()(1) 2099 if n == 1: 2100 return self 2101 ans = None 2103 2102 apow = self 2104 2103 while n != 0: 2105 2104 if n%2 != 0: 2106 ans = ans * apow 2105 if ans is None: 2106 ans = apow 2107 else: 2108 ans = ans * apow 2107 2109 n = n/2 2108 2110 if n == 0: # to not waste time doing an extra multiplication/increment … … 2128 2130 EXAMPLES: 2129 2131 EXAMPLE cmparing sparse and dense matrices: 2130 sage:2131 2132 sage: matrix(QQ,2,range(4)) == matrix(QQ,2,range(4),sparse=True) 2132 2133 True -
sage/modular/modsym/ambient.py
r2288 r2337 764 764 sage: M = ModularSymbols(Gamma0(22), 2); M 765 765 Modular Symbols space of dimension 7 for Gamma_0(22) of weight 2 with sign 0 over Rational Field 766 sage: for b, e inM.factorization():766 sage: M.factorization(): 767 767 ... print b.dimension(), b.level(), e 768 768 1 11 2 … … 798 798 2 26 1 799 799 2 26 1 800 800 801 801 An example with level divisible by a square: 802 802 sage: M = ModularSymbols(Gamma0(2*9),2); M … … 1110 1110 return self.__integral_structure 1111 1111 1112 1113 1112 1114 1113 class ModularSymbolsAmbient_wtk_g0(ModularSymbolsAmbient): -
sage/modular/modsym/ambient.py
r2288 r2337 764 764 sage: M = ModularSymbols(Gamma0(22), 2); M 765 765 Modular Symbols space of dimension 7 for Gamma_0(22) of weight 2 with sign 0 over Rational Field 766 sage: for b, e inM.factorization():766 sage: M.factorization(): 767 767 ... print b.dimension(), b.level(), e 768 768 1 11 2 … … 798 798 2 26 1 799 799 2 26 1 800 800 801 801 An example with level divisible by a square: 802 802 sage: M = ModularSymbols(Gamma0(2*9),2); M … … 1110 1110 return self.__integral_structure 1111 1111 1112 1113 1112 1114 1113 class ModularSymbolsAmbient_wtk_g0(ModularSymbolsAmbient): -
sage/modular/ssmod/ssmod.py
r2159 r2337 13 13 sage: D = a.decomposition() 14 14 sage: D[:3] 15 [(Vector space of degree 33 and dimension 1 over Finite Field of size 97 16 Basis matrix: 17 [ 0 0 0 1 96 96 1 0 95 1 1 1 1 95 2 96 0 0 96 96 0 0 96 2 96 96 2 0 0 1 1 95 0], 1), (Vector space of degree 33 and dimension 1 over Finite Field of size 97 18 Basis matrix: 19 [ 0 1 96 16 75 22 81 0 0 17 17 80 80 0 0 16 1 40 74 23 57 96 81 0 23 74 0 0 0 24 73 0 0], 1), (Vector space of degree 33 and dimension 1 over Finite Field of size 97 20 Basis matrix: 21 [ 0 1 96 90 90 7 7 0 0 6 91 6 91 0 0 7 13 0 91 6 0 84 90 0 91 6 0 0 0 90 7 0 0], 1)] 15 [ 16 (Vector space of degree 33 and dimension 1 over Finite Field of size 97 17 Basis matrix: 18 [ 0 0 0 1 96 96 1 0 95 1 1 1 1 95 2 96 0 0 96 96 0 0 96 2 96 96 2 0 0 1 1 95 0], 1), 19 (Vector space of degree 33 and dimension 1 over Finite Field of size 97 20 Basis matrix: 21 [ 0 1 96 16 75 22 81 0 0 17 17 80 80 0 0 16 1 40 74 23 57 96 81 0 23 74 0 0 0 24 73 0 0], 1), 22 (Vector space of degree 33 and dimension 1 over Finite Field of size 97 23 Basis matrix: 24 [ 0 1 96 90 90 7 7 0 0 6 91 6 91 0 0 7 13 0 91 6 0 84 90 0 91 6 0 0 0 90 7 0 0], 1) 25 ] 22 26 sage: len(D) 23 27 9 -
sage/modular/ssmod/ssmod.py
r2159 r2337 13 13 sage: D = a.decomposition() 14 14 sage: D[:3] 15 [(Vector space of degree 33 and dimension 1 over Finite Field of size 97 16 Basis matrix: 17 [ 0 0 0 1 96 96 1 0 95 1 1 1 1 95 2 96 0 0 96 96 0 0 96 2 96 96 2 0 0 1 1 95 0], 1), (Vector space of degree 33 and dimension 1 over Finite Field of size 97 18 Basis matrix: 19 [ 0 1 96 16 75 22 81 0 0 17 17 80 80 0 0 16 1 40 74 23 57 96 81 0 23 74 0 0 0 24 73 0 0], 1), (Vector space of degree 33 and dimension 1 over Finite Field of size 97 20 Basis matrix: 21 [ 0 1 96 90 90 7 7 0 0 6 91 6 91 0 0 7 13 0 91 6 0 84 90 0 91 6 0 0 0 90 7 0 0], 1)] 15 [ 16 (Vector space of degree 33 and dimension 1 over Finite Field of size 97 17 Basis matrix: 18 [ 0 0 0 1 96 96 1 0 95 1 1 1 1 95 2 96 0 0 96 96 0 0 96 2 96 96 2 0 0 1 1 95 0], 1), 19 (Vector space of degree 33 and dimension 1 over Finite Field of size 97 20 Basis matrix: 21 [ 0 1 96 16 75 22 81 0 0 17 17 80 80 0 0 16 1 40 74 23 57 96 81 0 23 74 0 0 0 24 73 0 0], 1), 22 (Vector space of degree 33 and dimension 1 over Finite Field of size 97 23 Basis matrix: 24 [ 0 1 96 90 90 7 7 0 0 6 91 6 91 0 0 7 13 0 91 6 0 84 90 0 91 6 0 0 0 90 7 0 0], 1) 25 ] 22 26 sage: len(D) 23 27 9 -
sage/modules/complex_double_vector.pyx
r2321 r2337 122 122 Traceback (most recent call last): 123 123 ... 124 IndexError: index 5out of range124 IndexError: index out of range 125 125 """ 126 126 cdef gsl_complex z_temp -
sage/modules/complex_double_vector.pyx
r2274 r2337 20 20 21 21 from sage.rings.complex_double cimport ComplexDoubleElement 22 from sage.rings.complex_double import CDF 22 from sage.rings.complex_double import CDF, new_ComplexDoubleElement 23 23 24 24 include '../ext/stdsage.pxi' … … 111 111 112 112 def __getitem__(self,size_t i): 113 """ 114 Return the ith entry of self. 115 116 EXAMPLES: 117 sage: v = vector(CDF, [1,CDF(3,2), -1]); v 118 (1.0, 3.0 + 2.0*I, -1.0) 119 sage: v[1] 120 3.0 + 2.0*I 121 sage: v[5] 122 Traceback (most recent call last): 123 ... 124 IndexError: index out of range 125 """ 113 126 cdef gsl_complex z_temp 127 cdef ComplexDoubleElement x 114 128 if i < 0 or i >= self.v.size: 115 raise IndexError 116 else: 117 z_temp = <gsl_complex> gsl_vector_complex_get(self.v,i)118 return CDF(GSL_REAL(z_temp),GSL_IMAG (z_temp))119 129 raise IndexError, 'index out of range' 130 else: 131 x = new_ComplexDoubleElement() 132 x._complex = <gsl_complex> gsl_vector_complex_get(self.v,i) 133 return x 120 134 121 135 cdef ModuleElement _add_c_impl(self, ModuleElement right): -
sage/plot/tachyon.py
r2334 r2337 85 85 sage: t.plane((0,-20,0), (0,1,0), 'white') 86 86 sage: t.plane((-20,0,0), (1,0,0), 'white') 87 sage:87 88 88 sage: k=0 89 89 sage: for i in srange(-1,1,0.05): … … 536 536 537 537 def get_colors(self, list): 538 return texture_recolor(self._tachyon,self._texture, list)538 return self._tachyon.texture_recolor(self._texture, list) 539 539 540 540 -
sage/plot/tachyon.py
r2334 r2337 85 85 sage: t.plane((0,-20,0), (0,1,0), 'white') 86 86 sage: t.plane((-20,0,0), (1,0,0), 'white') 87 sage:87 88 88 sage: k=0 89 89 sage: for i in srange(-1,1,0.05): … … 536 536 537 537 def get_colors(self, list): 538 return texture_recolor(self._tachyon,self._texture, list)538 return self._tachyon.texture_recolor(self._texture, list) 539 539 540 540 -
sage/rings/quotient_ring.py
r2014 r2337 113 113 sage: pi(5) 114 114 2 115 sage:116 115 sage: l = pi.lift() 117 116 -
sage/rings/quotient_ring.py
r2014 r2337 113 113 sage: pi(5) 114 114 2 115 sage:116 115 sage: l = pi.lift() 117 116 -
sage/server/notebook/cell.py
r2330 r2337 267 267 output = output[:i] 268 268 if len(output) > MAX_OUTPUT: 269 if not self.computing(): 270 file = "%s/full_output.txt"%self.directory() 271 open(file,"w").write(output) 272 html+="<br><a href='/%s' target='_new' class='file_link'>full_output.txt</a>"%file 269 273 if output.lstrip()[:len(TRACEBACK)] != TRACEBACK: 270 output = 'WARNING: Output truncated!\n' + output[:MAX_OUTPUT ] + '\n(truncated)'274 output = 'WARNING: Output truncated!\n' + output[:MAX_OUTPUT/2] + '...\n\n...' + output[-MAX_OUTPUT/2:] 271 275 else: 272 output = output[:MAX_OUTPUT ] + '\n(truncated)'276 output = output[:MAX_OUTPUT/2] + '...\n\n...' + output[-MAX_OUTPUT/2:] 273 277 self.__out = output 274 278 self.__out_html = html … … 495 499 images.append('<embed src="%s/%s" type="image/svg+xml" name="emap">'%(dir,F)) 496 500 else: 497 files.append('<a target="_new" href="%s/%s" >%s</a>'%(dir, F, F))501 files.append('<a target="_new" href="%s/%s" class="file_link">%s</a>'%(dir, F, F)) 498 502 if len(images) == 0: 499 503 images = '' -
sage/server/notebook/cell.py
r2336 r2337 41 41 self.__text = text 42 42 self.__worksheet = worksheet 43 44 def set_worksheet(self, worksheet, id=None): 45 self.__worksheet = worksheet 46 self.__dir = '%s/cells/%s'%(worksheet.directory(), self.relative_id()) 47 if not id is None: 48 self.__id = id 49 50 def relative_id(self): 51 return self.__id - self.__worksheet.id()*notebook.MAX_WORKSHEETS 43 52 44 53 def html(self, ncols, do_print=False, do_math_parse=True): … … 99 108 self.set_id(id) 100 109 self.__out_html = self.files_html() 110 111 def id(self): 112 return self.__id 113 114 def relative_id(self): 115 return self.__id - self.__worksheet.id()*notebook.MAX_WORKSHEETS 116 117 def set_id(self, id): 118 self.__id = int(id) 119 120 def worksheet(self): 121 return self.__worksheet 122 123 def notebook(self): 124 return self.__worksheet.notebook() 125 126 def directory(self): 127 if not os.path.exists(self.__dir): 128 os.makedirs(self.__dir) 129 return self.__dir 101 130 102 131 def __cmp__(self, right): … … 209 238 def computing(self): 210 239 return self in self.__worksheet.queue() 211 212 def directory(self):213 if not os.path.exists(self.__dir):214 os.makedirs(self.__dir)215 return self.__dir216 217 def id(self):218 return self.__id219 220 def relative_id(self):221 return self.__id - self.__worksheet.id()*notebook.MAX_WORKSHEETS222 223 def set_id(self, id):224 self.__id = int(id)225 226 def worksheet(self):227 return self.__worksheet228 229 def notebook(self):230 return self.__worksheet.notebook()231 240 232 241 def set_input_text(self, input): -
sage/server/notebook/worksheet.py
r2335 r2337 615 615 # Finished a computation. 616 616 self.__comp_is_running = False 617 del self.__queue[0] 617 618 out = self._process_output(out) 618 619 if C.introspect(): … … 636 637 self.notebook().add_to_history(history) 637 638 638 del self.__queue[0]639 639 return 'd', C 640 640 -
sage/server/notebook/worksheet.py
r2336 r2337 1103 1103 input = input.split('\n') 1104 1104 1105 # The following is all so the last line (or single lines) 1106 # will implicitly print as they should, unless they are 1107 # an assignment. "display hook" It's very complicated, 1108 # but it has to be... 1105 1109 i = len(input)-1 1106 1110 if i >= 0: -
sage/structure/element.pyx
r2321 r2337 297 297 298 298 def _is_atomic(self): 299 """ 300 Return True if and only if parenthesis are not required when *printing* out 301 any of x - self, x + self, x^self and x/self. 302 303 EXAMPLES: 304 sage: n = 5; n._is_atomic() 305 True 306 sage: n = x+1; n._is_atomic() 307 False 308 """ 299 309 if self._parent.is_atomic_repr(): 300 310 return True -
sage/structure/element.pyx
r2078 r2337 297 297 298 298 def _is_atomic(self): 299 """ 300 Return True if and only if parenthesis are not required when *printing* out 301 any of x - self, x + self, x^self and x/self. 302 303 EXAMPLES: 304 sage: n = 5; n._is_atomic() 305 True 306 sage: n = x+1; n._is_atomic() 307 False 308 """ 299 309 if self._parent.is_atomic_repr(): 300 310 return True … … 553 563 # self * right, where right need not be a ring element in the base ring 554 564 # This does type checking and canonical coercion then calls _lmul_c_impl. 555 if PY_TYPE_CHECK(right, Element) and (<Element>right)._parent is self._parent._base: 556 # No coercion needed 557 return self._lmul_c(right) 558 else: 559 # Otherwise we do an explicit canonical coercion. 560 try: 561 return self._lmul_c( self._parent._base._coerce_c(right) ) 562 except TypeError: 563 # that failed -- try to base extend right then do the multiply: 564 self = self.base_extend((<RingElement>right)._parent) 565 return (<ModuleElement>self)._lmul_c(right) 565 if PY_TYPE_CHECK(right, Element): 566 if (<Element>right)._parent is self._parent._base: 567 # No coercion needed 568 return self._lmul_c(right) 569 else: 570 # Otherwise we do an explicit canonical coercion. 571 try: 572 return self._lmul_c( self._parent._base._coerce_c(right) ) 573 except TypeError: 574 # that failed -- try to base extend right then do the multiply: 575 self = self.base_extend((<RingElement>right)._parent) 576 return (<ModuleElement>self)._lmul_c(right) 577 else: 578 # right is not an element at all 579 return (<ModuleElement>self)._lmul_c(self._parent._base._coerce_c(right)) 566 580 567 581 cdef ModuleElement _rmultiply_by_scalar(self, left): 568 582 # left * self, where left need not be a ring element in the base ring 569 583 # This does type checking and canonical coercion then calls _rmul_c_impl. 570 if PY_TYPE_CHECK(left, Element) and (<Element>self)._parent is self._parent._base: 571 # No coercion needed 572 return self._rmul_c(right) 573 else: 574 # Otherwise we do an explicit canonical coercion. 575 try: 576 return self._rmul_c(self._parent._base._coerce_c(left)) 577 except TypeError: 578 # that failed -- try to base extend self then do the multiply: 579 self = self.base_extend((<RingElement>left)._parent) 580 return (<ModuleElement>self)._rmul_c(left) 584 if PY_TYPE_CHECK(left, Element): 585 if (<Element>self)._parent is self._parent._base: 586 # No coercion needed 587 return self._rmul_c(right) 588 else: 589 # Otherwise we do an explicit canonical coercion. 590 try: 591 return self._rmul_c(self._parent._base._coerce_c(left)) 592 except TypeError: 593 # that failed -- try to base extend self then do the multiply: 594 self = self.base_extend((<RingElement>left)._parent) 595 return (<ModuleElement>self)._rmul_c(left) 596 else: 597 # now left is not an element at all. 598 return (<ModuleElement>self)._rmul_c(self._parent._base._coerce_c(left)) 581 599 582 600 cdef ModuleElement _lmul_nonscalar_c(left, right): … … 823 841 824 842 a = self 825 power = self.parent()(1)843 power = None 826 844 if n < 0: 827 845 n = -n 828 846 a = ~self 829 847 elif n == 0: 830 return power848 return self.parent()(1) 831 849 832 850 power = (<Element>self)._parent(1) 833 851 apow = a 834 852 while True: 835 if n&1 > 0: power = power*apow 853 if n&1 > 0: 854 if power is None: 855 power = apow 856 else: 857 power = power*apow 836 858 n = n >> 1 837 859 if n != 0:
Note: See TracChangeset
for help on using the changeset viewer.
