Changeset 7673:a5be33abd723
- Timestamp:
- 11/08/07 08:57:43 (6 years ago)
- Branch:
- default
- Location:
- sage
- Files:
-
- 3 edited
-
rings/finite_field.py (modified) (2 diffs)
-
schemes/elliptic_curves/ell_finite_field.py (modified) (3 diffs)
-
schemes/hyperelliptic_curves/hyperelliptic_finite_field.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sage/rings/finite_field.py
r7155 r7673 193 193 if name is None: 194 194 raise TypeError, "you must specify the generator name" 195 if order < 2**16:195 if order < zech_log_bound: 196 196 # DO *NOT* use for prime subfield, since that would lead to 197 197 # a circular reference in the call to ParentWithGens in the … … 437 437 """ 438 438 return 1 439 440 zech_log_bound = 2**16 -
sage/schemes/elliptic_curves/ell_finite_field.py
r7366 r7673 185 185 sage: type(P) 186 186 <class 'sage.schemes.elliptic_curves.ell_point.EllipticCurvePoint_finite_field'> 187 sage: P in E 188 True 187 189 188 190 sage: k.<a> = GF(7^5) … … 191 193 sage: type(P) 192 194 <class 'sage.schemes.elliptic_curves.ell_point.EllipticCurvePoint_finite_field'> 195 sage: P in E 196 True 197 198 sage: k.<a> = GF(2^5) 199 sage: E = EllipticCurve(k,[a^2,a,1,a+1,1]) 200 sage: P = E.random_element() 201 sage: type(P) 202 <class 'sage.schemes.elliptic_curves.ell_point.EllipticCurvePoint_finite_field'> 203 sage: P in E 204 True 193 205 194 206 """ … … 197 209 return self(0) 198 210 a1, a2, a3, a4, a6 = self.ainvs() 199 while True: 200 x = k.random_element() 201 d = 4*x**3 + (a1**2 + 4*a2)*x**2 + (2*a3*a1 + 4*a4)*x + (a3**2 + 4*a6) 202 try: 203 m = d.sqrt(extend=False) 204 y = (-(a1*x + a3) + m) / k(2) 211 212 if k.characteristic() == 2: 213 P = PolynomialRing(k,'y') 214 y = P.gen() 215 while True: 216 x = k.random_element() 217 f = y**2 + a1*x*y + a3*y - x**3 + a2*x**2 + a4*x + a6 218 roots = f.roots() 219 if roots == []: 220 continue 221 if random.random() < 0.5: 222 y = roots[0][0] 223 else: 224 y = roots[1][0] 205 225 return self([x,y]) 206 except ValueError: 207 pass 226 else: 227 while True: 228 x = k.random_element() 229 d = 4*x**3 + (a1**2 + 4*a2)*x**2 + (2*a3*a1 + 4*a4)*x + (a3**2 + 4*a6) 230 try: 231 m = d.sqrt(extend=False) 232 y = (-(a1*x + a3) + m) / k(2) 233 return self([x,y]) 234 except ValueError: 235 pass 208 236 209 237 def trace_of_frobenius(self): -
sage/schemes/hyperelliptic_curves/hyperelliptic_finite_field.py
r7000 r7673 179 179 122 180 180 """ 181 from sage.rings.finite_field import zech_log_bound 181 182 try: 182 183 return self.__points … … 186 187 self.__points = self._points_cache_sqrt() 187 188 else: 188 self.__points = self._points_fast_sqrt() 189 if self.base_ring().order() < zech_log_bound: 190 self.__points = self._points_fast_sqrt() # this is fast using Zech logarithms 191 else: 192 self.__points = self._points_cache_sqrt() 189 193 190 194 return self.__points
Note: See TracChangeset
for help on using the changeset viewer.
