#17088: PeriodicRegion.__div__: use integer arithmetic
-------------------------------------+-------------------------------------
Reporter: jdemeyer | Owner:
Type: defect | Status: needs_review
Priority: critical | Milestone: sage-6.4
Component: elliptic curves | Resolution:
Keywords: | Merged in:
Authors: Jeroen Demeyer | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/jdemeyer/ticket/17088 | 15b7588e82c7d67bbbab14fec4c14c862bcc4c1f
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by cremona):
I just looked at the original Magma code but it has been changed too much
by RB to be of any help here.
For rigour it is important the overestimate, in the sense that if any part
of a tile contains a point for which the condition is True then the whole
tile should be included. If one overestimates and includes a tile
unnecessarily, then this may slow down the procedure a little but rigour
is preserved. The original subdivision is into r x c tiles. Division
first creates (n*r)x(n*c) smaller tiles, then shrinks these by a factor of
n. Before shrinking there are 2 integer indices, a*r+i and b*c+j running
through range(n*r) and range(n*c) respectively. [r and c are called rows
and cols in the code.] These then undergo rounded division to give a
pair of indices in range(r), range(c).
Here is the important part: when a*r+i is exactly divisible by n then
using (a*r+i)/n is fine, and similarly with column indices, BUT if a*r+i
is between two multiples of n then BOTH the quotients (rounded down AND
up) should be used. That is why up to 4 tiles may get tagged.
The old code was supposed to do this, but I don't think it did so
correctly. The following is, I think, what it should be like:
{{{
u = (a*rows+i)//n
v = (b*cols+j)//n
u_exact = (n*u==a*rows+i)
v_exact = (n*v==b*cols+j)
dat = data[i,j]
new_data[u,v] = dat
if not u_exact:
new_data[u+1,v] = dat
if not v_exact:
new_data[u+1,v+1] = dat
else:
if not v_exact:
new_data[u,v+1] = dat
}}}
--
Ticket URL: <http://trac.sagemath.org/ticket/17088#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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.