Changeset 8369:238a1cb9aba0
- Timestamp:
- 11/07/07 18:15:24 (6 years ago)
- Branch:
- default
- Location:
- sage/rings/number_field
- Files:
-
- 3 edited
-
totallyreal.py (modified) (1 diff)
-
totallyreal_data.pyx (modified) (3 diffs)
-
totallyreal_dsage.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
sage/rings/number_field/totallyreal.py
r8367 r8369 193 193 # Trivial case 194 194 if n == 1: 195 if print_return_seqs:196 return [ 1,[1,-1]]195 if return_seqs: 196 return [[0,0,0,0],[[1,[-1,1]]]] 197 197 else: 198 return [ 1,pari('x-1')]198 return [[1,pari('x-1')]] 199 199 200 200 if verbose: -
sage/rings/number_field/totallyreal_data.pyx
r8368 r8369 449 449 450 450 # Bounds come from an application of Lagrange multipliers in degrees 2,3. 451 self.b_lower = 1./n*(-self.a[n-1] - 452 (n-1)*sqrt((1.*self.a[n-1])**2 - 2.*(1-1./n)*self.a[n-2])) 453 self.b_upper = -(2.*self.a[n-1]/n + self.b_lower) 451 self.b_lower = -1./n*(self.a[n-1] + (n-1.)*sqrt((1.*self.a[n-1])**2 - 2.*(1+1./(n-1))*self.a[n-2])) 452 self.b_upper = -1./n*(self.a[n-1] - (n-1.)*sqrt((1.*self.a[n-1])**2 - 2.*(1+1./(n-1))*self.a[n-2])) 454 453 if k < n-2: 455 454 bminmax = __lagrange_degree_3(n,a[n-1],a[n-2],a[n-3]) … … 603 602 break 604 603 604 # Knowing a[n-1] and a[n-2] means we can apply bounds from 605 # the Lagrange multiplier in degree 2, which can be solved 606 # immediately. 607 self.b_lower = -1./n*(self.a[n-1] + (n-1.)*sqrt((1.*self.a[n-1])**2 - 2.*(1+1./(n-1))*self.a[n-2])) 608 self.b_upper = -1./n*(self.a[n-1] - (n-1.)*sqrt((1.*self.a[n-1])**2 - 2.*(1+1./(n-1))*self.a[n-2])) 609 605 610 # Initialize the second derivative. 606 self.b_lower = 1./n*(-self.a[n-1] -607 (n-1)*sqrt((1.*self.a[n-1])**2 - 2.*(1+1./(n-1))*self.a[n-2]))608 self.b_upper = -(2.*self.a[n-1]/n + self.b_lower)609 611 self.beta[k*np1+0] = self.b_lower 610 612 self.beta[k*np1+1] = -self.a[n-1]*1./n … … 644 646 break 645 647 646 if k == n-3 and n > 3: 647 # Knowing a[n-1] and a[n-2] means we can apply bounds from 648 # the Lagrange multiplier in degree 2, which can be solved 649 # immediately. 650 self.b_lower = 1./n*(-self.a[n-1] - 651 (n-1)*sqrt((1.*self.a[n-1])**2 - 2.*(1-1./n)*self.a[n-2])) 652 self.b_upper = -(2.*self.a[n-1]/n + self.b_lower) 648 # Bounds come from an application of Lagrange multipliers in degrees 2,3. 649 if k == n-3: 650 self.b_lower = -1./n*(self.a[n-1] + (n-1.)*sqrt((1.*self.a[n-1])**2 - 2.*(1+1./(n-1))*self.a[n-2])) 651 self.b_upper = -1./n*(self.a[n-1] - (n-1.)*sqrt((1.*self.a[n-1])**2 - 2.*(1+1./(n-1))*self.a[n-2])) 653 652 elif k == n-4: 654 653 # New bounds from Lagrange multiplier in degree 3. -
sage/rings/number_field/totallyreal_dsage.py
r8368 r8369 218 218 # For each completed job, add the fields to the list. 219 219 while i < len(self.jobs): 220 self.jobs[i].get_job() 221 if type(self.jobs[i][1]) <> str and self.jobs[i][1].status == 'completed' and self.jobs[i][1].result <> 'None': 222 job = self.jobs.pop(i) 223 224 # Add the timings. 225 self.cputime += job[1].cpu_time 226 self.walltime += job[1].wall_time 227 228 if write_result: 229 fsock = open(filename_start + str(job[0]).replace(' ','') + '.out', 'w') 230 fsock.write("Cpu time = " + timestr(job[1].cpu_time) + "\n") 231 fsock.write("Wall time = " + timestr(job[1].wall_time) + "\n") 232 233 # Output from dsage comes as a string, so convert. 234 S = job[1].result 235 # Add the counts of polynomials checked. 236 for j in range(4): 237 self.counts[j] += S[0][j] 238 if write_result: 239 fsock.write("Counts: " + str(S[0]) + "\n") 240 fsock.write("Total number of fields: " + str(len(S[1])) + "\n\n") 241 242 # Convert the sequences to pari objects, and compile. 243 S = S[1] 244 for j in range(len(S)): 245 S[j][1] = pari(str(S[j][1])).Polrev() 246 self.S += S 247 if write_result: 220 if type(self.jobs[i][1]) <> str: 221 self.jobs[i][1].get_job() 222 if self.jobs[i][1].status == 'completed' and self.jobs[i][1].result <> 'None': 223 job = self.jobs.pop(i) 224 225 # Add the timings. 226 self.cputime += job[1].cpu_time 227 self.walltime += job[1].wall_time 228 229 if write_result: 230 fsock = open(filename_start + str(job[0]).replace(' ','') + '.out', 'w') 231 fsock.write("Cpu time = " + timestr(job[1].cpu_time) + "\n") 232 fsock.write("Wall time = " + timestr(job[1].wall_time) + "\n") 233 234 # Output from dsage comes as a string, so convert. 235 S = job[1].result 236 # Add the counts of polynomials checked. 237 for j in range(4): 238 self.counts[j] += S[0][j] 239 if write_result: 240 fsock.write("Counts: " + str(S[0]) + "\n") 241 fsock.write("Total number of fields: " + str(len(S[1])) + "\n\n") 242 243 # Convert the sequences to pari objects, and compile. 244 S = S[1] 248 245 for j in range(len(S)): 249 fsock.write(str(S[j]) + "\n") 250 251 fsock.close() 252 253 # Otherwise, continue. 254 # Note we do not add 1 to i if we just popped jobs! 246 S[j][1] = pari(str(S[j][1])).Polrev() 247 self.S += S 248 if write_result: 249 for j in range(len(S)): 250 fsock.write(str(S[j]) + "\n") 251 252 fsock.close() 253 254 # Otherwise, continue. 255 # Note we do not add 1 to i if we just popped jobs! 256 else: 257 i += 1 255 258 else: 256 259 i += 1
Note: See TracChangeset
for help on using the changeset viewer.
