On Wed, Aug 3, 2011 at 2:52 PM, Victor Miller <victorsmil...@gmail.com> wrote: > Good news (so far) -- I tracked down the source of the bug. I had a long > calculation (the details of which are irrelevant) which produced a pair of > points on an elliptic curve, say P1 and P2, over a finite field of the form > GF(2^n). In order to check the calculation I needed to check > > Q1 == 2**(1+m)*P1 and > Q2 == 2**(1+m)*P2 > > where Q1,Q2 were another pair of points, and m was some integer (actually > calculated as len(x) where x was some list). I put in tracing in both the > .py and .pyx version and saw that P1,P2, Q1,Q2 were the same in each > version, but the comparisons weren't!
Interesting. To clarify, the string representations that were printed out were identical, but the == operator returned False? Could you pickle these points and send them? > I should say that in this case n was > 251 and m 200. So far I can't get an isolated case like this where I choose > P1 to be a random point, but according to the traces everything computed up > to that point was the same. > > Victor > > On Aug 3, 8:38 am, VictorMiller <victorsmil...@gmail.com> wrote: >> Robert, I'll see what I can do. As you suspected, the files are not >> disclosable :-(. >> >> Victor >> >> On Aug 3, 3:03 am, Robert Bradshaw <rober...@math.washington.edu> >> wrote: >> >> > This is exactly the kind if thing we try to avoid. I'd like to see the >> > files (if they're disclosable of course), or perhaps you could come up >> > with a whittled-down example. >> >> > On Tue, Aug 2, 2011 at 7:22 PM, VictorMiller <victorsmil...@gmail.com> >> > wrote: >> > > Robert, The .py and .pyx files are identical. I copied one to the >> > > other, and just in case I checked with diff. It's very puzzling. >> >> > > Victor >> >> > > On Aug 2, 8:19 pm, Robert Bradshaw <rober...@math.washington.edu> >> > > wrote: >> > >> On Tue, Aug 2, 2011 at 11:29 AM, William Stein <wst...@gmail.com> >> > >> wrote: >> > >> > On Tue, Aug 2, 2011 at 11:09 AM, VictorMiller >> > >> > <victorsmil...@gmail.com> wrote: >> > >> >> I've written a bunch of functions (some organized in classes) to >> > >> >> do >> > >> >> some large computations in a particular finite field (always >> > >> >> GF(2^n) >> > >> >> for some odd n). This seems to work fine. I'd like the >> > >> >> computation >> > >> >> to be as fast as possible, so the first thing I did was to copy >> > >> >> the .py file to a .pyx file. The good news is that the compiled >> > >> >> cython is at least 30% faster (sometimes more) than the >> > >> >> interpreted .py version. The bad news is that it gives different >> > >> >> results! In trying to track down where things go awry, I made the >> > >> >> following declaration in each >> >> > >> >> from sage.misc.decorators import sage_wrap >> > >> >> from string import join >> > >> >> def logged(func): >> > >> >> @sage_wrap(func) >> > >> >> def with_logging(*args, **kwds): >> > >> >> print func.__name__ + '(' + join([str(_) for _ in >> > >> >> args],',') >> > >> >> + ')' >> > >> >> return func(*args,**kwds) >> > >> >> return with_logging >> >> > >> >> I then put >> > >> >> @logged >> >> > >> >> in from of the defs of a bunch of functions. >> >> > >> >> This works as expected with .py version, but when I try to compile >> > >> >> the .pyx version I get the message: >> >> > >> >> .... in update_wrapper >> > >> >> setattr(wrapper, attr, getattr(wrapped, attr)) >> > >> >> AttributeError: attribute '__doc__' of >> > >> >> 'builtin_function_or_method' >> > >> >> objects not writable >> >> > >> >> I think that I understand what's going on here, but are there any >> >> > >> > You often can't use decorators with Cython code, >> >> > >> yet... >> >> > >> > since it is compiled (not dynamic). >> >> > >> >> suggestions as to how to get to the bottom of the differences >> > >> >> between >> > >> >> the cython compiled version and the interpreted version? >> >> > >> > Put in print statements? >> >> > >> You could also write your own with_logging that doesn't try to access >> > >> __name__ or __doc__ and decorate with that. >> >> > >> I'm very curious what goes awry. Did you make any changes other than >> > >> changing the file from .py to .pyx and compiling it? >> >> > >> - Robert >> >> > > -- >> > > To post to this group, send email to sage-support@googlegroups.com >> > > To unsubscribe from this group, send email to >> > > sage-support+unsubscr...@googlegroups.com >> > > For more options, visit this group >> > > athttp://groups.google.com/group/sage-support >> > > URL:http://www.sagemath.org >> >> > > -- > To post to this group, send email to sage-support@googlegroups.com > To unsubscribe from this group, send email to > sage-support+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/sage-support > URL: http://www.sagemath.org > -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org