#11543: Hashing algebraic numbers takes far too long
-----------------------+----------------------------------------------------
   Reporter:  rbeezer  |          Owner:  AlexGhitza
       Type:  defect   |         Status:  new       
   Priority:  major    |      Milestone:  sage-4.7.2
  Component:  algebra  |       Keywords:            
Work_issues:           |       Upstream:  N/A       
   Reviewer:           |         Author:            
     Merged:           |   Dependencies:            
-----------------------+----------------------------------------------------
 Hashing algebraic numbers can take a very long time.  I've traced this to
 line 2421 of  sage/rings/qqbar.py  which can be re-created by the
 following code.

 {{{
 sage: A=matrix(QQ, 4, 4, [1, 2, -2, 2, 1, 0, -1, -1, 0, -1, 1, 1, -1, 2,
 1/2, 0])
 sage: e = A.eigenvalues()[3]
 sage: K = (A-e).kernel()
 sage: P = K.basis_matrix()
 sage: x = P.list()[3]

 sage: from sage.rings.qqbar import ANExtensionElement, AlgebraicGenerator,
 ANRoot, AAPoly
 sage: QQbar_I_nf = QuadraticField(-1, 'I', embedding=CC.gen())
 sage: QQbar_I_generator = AlgebraicGenerator(QQbar_I_nf,
 ANRoot(AAPoly.gen()**2 + 1, CIF(0, 1)))
 sage: QQbar_hash_offset =
 AlgebraicNumber(ANExtensionElement(QQbar_I_generator, ~ZZ(123456789) +
 QQbar_I_nf.gen()/ZZ(987654321)))

 sage: time h = hash((x + QQbar_hash_offset).interval_exact(CIF))

 Time: CPU 58.31 s, Wall: 58.48 s
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11543>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to