#10792: Upgrade numpy to 1.5.1
------------------------+---------------------------------------------------
Reporter: jason | Owner: tbd
Type: task | Status: needs_work
Priority: major | Milestone: sage-4.7
Component: packages | Keywords:
Author: | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
------------------------+---------------------------------------------------
Changes (by jason):
* cc: evanandel (added)
Comment:
CCing Ethan, since he was the original author on the riemann.pyx file.
Ethan: I've been looking at the code that seems to cause two problems.
First is a ComplexWarnings that now appears in numpy 1.5.1, which I
believe comes from a temporary array that was assumed to be real, but
maybe should be complex. I've rewritten the affected lines to not use a
temporary array.
The other problem seems like it is a problem even before the upgrade---I
keep getting `Warning: invalid value encountered in divide`, and the error
happens in these lines in the `_generate_theta_array` function in
calculus/riemann.pyx:
{{{
K = np.array(
[-TWOPI / N * sadp * sadp[t] * 1 / (TWOPI * I) *
((dp / adp) / (cp - cp[t]) -
((dp[t] / adp[t]) / (cp - cp[t])).conjugate())
for t in np.arange(NB)], dtype=np.complex128)
}}}
I noticed several things that could be pulled out of the inner loop, and
so rewrote this line in the attached patch (which I'll update shortly).
However, I don't know this code or the algorithms very well---can you look
at the patch?
It appears that the warnings happen when there is a division by zero, as
in this test case:
{{{
sage: import numpy as np
sage: a=np.array([1,2],dtype=np.complex128)
sage: b=np.array([0,1],dtype=np.complex128)
sage: a/b
Warning: invalid value encountered in divide
array([ nan nanj, 2. +0.j])
sage: a[0]/b[0]
(nan+nan*j)
}}}
So should we turn off the error checking for this error when doing this
operation since at least one entry in cp-cp[t] will be zero? Or should we
check for this entry and not calculate it?
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10792#comment:11>
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.