#10042: Doctest failure in sage/rings/polynomial/polynomial_element.pyx
---------------------------------------+------------------------------------
   Reporter:  mpatel                   |       Owner:  mvngu     
       Type:  defect                   |      Status:  needs_work
   Priority:  blocker                  |   Milestone:  sage-4.6  
  Component:  doctest                  |    Keywords:            
     Author:                           |    Upstream:  N/A       
   Reviewer:                           |      Merged:            
Work_issues:  report upstream (numpy)  |  
---------------------------------------+------------------------------------

Comment(by zimmerma):

 > Feel free to place any commands here that would enable someone to easily
 replicate what you found on another machine, by the way.

 Here is what I did on Dave's machine:
 {{{
 R.<x> = RealField(200)[]
 f = x^2 - R(pi)
 import numpy
 coeffs = f.list()
 ty = float
 numpy_dtype='double'
 numpy_array=numpy.array([ty(c) for c in
 reversed(coeffs)],dtype=numpy_dtype)
 ext_rts1 = numpy.roots(numpy_array)
 ext_rts1[0]
 ext_rts1[1]
 p=numpy_array
 from numpy.lib.shape_base import hstack, atleast_1d
 p = atleast_1d(p)
 import numpy.core.numeric as NX
 non_zero = NX.nonzero(NX.ravel(p))[0]
 trailing_zeros = len(p) - non_zero[-1] - 1
 p = p[int(non_zero[0]):int(non_zero[-1])+1]
 N = len(p)
 from numpy.lib.twodim_base import diag, vander
 A = diag(NX.ones((N-2,), p.dtype), -1)
 A[0, :] = -p[1:] / p[0]
 from numpy.linalg import eigvals, lstsq
 roots = eigvals(A)
 roots[0]
 roots[1]
 from numpy.core import asarray, inexact, complexfloating, zeros, double
 a = copy(A)
 a = asarray(a)
 wrap = getattr(a, "__array_wrap__", a.__array_wrap__)
 t = double
 result_t = double
 from numpy.linalg import lapack_lite
 n = a.shape[0]
 dummy = zeros((1,), t)
 wr = zeros((n,), t)
 wi = zeros((n,), t)
 lwork = 1
 work = zeros((lwork,), t)
 lapack_routine = lapack_lite.dgeev
 results = lapack_routine('N', 'N', n, a, n, wr, wi,
                          dummy, 1, dummy, 1, work, -1, 0)

 res=wr.astype(result_t)
 res[0]
 res[1]
 }}}
 Paul

 PS: it seems the final {{{wr}}} value is not always correctly set,
 sometimes I got 0.0 for
 res[0] and res[1].

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10042#comment:25>
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