Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc improvements to integer.pyx #10596

Closed
sagetrac-spancratz mannequin opened this issue Jan 12, 2011 · 28 comments
Closed

Misc improvements to integer.pyx #10596

sagetrac-spancratz mannequin opened this issue Jan 12, 2011 · 28 comments

Comments

@sagetrac-spancratz
Copy link
Mannequin

sagetrac-spancratz mannequin commented Jan 12, 2011

Generic code clean-up such as line breaks, empty lines, use of GMP functions etc

Before:

sage: x = factorial(2**14)
sage: timeit('y = odd_part(x)')
625 loops, best of 3: 10.6 µs per loop
sage: odd_part(0)
---------------------------------------------------------------------------
...
TypeError: unsupported operands for >>: 0, +Infinity

After:

sage: x = factorial(2**14)
sage: timeit('y = x.odd_part()')
625 loops, best of 3: 4.52 µs per loop
sage: ZZ(0).odd_part()
0

Apply attachment: trac_10596.patch, attachment: trac_10596_remove_trailing_whitespaces.patch

CC: @sagetrac-jthurber @zimmermann6

Component: basic arithmetic

Author: Sebastian Pancratz, André Apitzsch

Reviewer: Aly Deines, John Cremona

Merged: sage-5.0.beta0

Issue created by migration from https://trac.sagemath.org/ticket/10596

@sagetrac-spancratz sagetrac-spancratz mannequin added this to the sage-4.8 milestone Jan 12, 2011
@sagetrac-spancratz

This comment has been minimized.

@sagetrac-spancratz
Copy link
Mannequin Author

sagetrac-spancratz mannequin commented Jan 12, 2011

Attachment: trac-10596.patch.gz

@sagetrac-spancratz

This comment has been minimized.

@sagetrac-spancratz sagetrac-spancratz mannequin changed the title Misc improvements to arithmetic Misc improvements to integer.pyx Jan 12, 2011
@sagetrac-jthurber
Copy link
Mannequin

sagetrac-jthurber mannequin commented Jan 12, 2011

comment:5

I had the following failures to apply, 4.6.1.rc1 on OS X.
This doesn't have 5945 as a prerequisite, does it?

22:14:56johnthurber~/sage/sage-4.6.1.rc1/devel/sage$ hg qpush
applying trac-10596.patch
patching file sage/rings/integer.pyx
Hunk #10 FAILED at 1268
Hunk #37 succeeded at 3276 with fuzz 1 (offset -106 lines).
Hunk #42 FAILED at 3577
Hunk #58 succeeded at 4302 with fuzz 1 (offset -106 lines).
Hunk #62 succeeded at 4643 with fuzz 2 (offset -106 lines).
Hunk #73 FAILED at 5289
3 out of 82 hunks FAILED -- saving rejects to file sage/rings/integer.pyx.rej
patch failed, unable to continue (try -v)
patch failed, rejects left in working dir
errors during apply, please fix and refresh trac-10596.patch

@adeines
Copy link
Mannequin

adeines mannequin commented Jan 12, 2011

comment:6

I had the same thing happen as well.

@adeines adeines mannequin added s: needs work and removed s: needs review labels Jan 12, 2011
@adeines
Copy link
Mannequin

adeines mannequin commented Jan 12, 2011

Reviewer: Aly Deines

@sagetrac-spancratz
Copy link
Mannequin Author

sagetrac-spancratz mannequin commented Jan 12, 2011

comment:8

I'm sorry, I think this is because I was working on this with 4.6.0 rather than 4.6.1.rc0. I will fix that this morning. Sebastian

@sagetrac-spancratz
Copy link
Mannequin Author

sagetrac-spancratz mannequin commented Jan 12, 2011

Attachment: trac-10596-461rc0.patch.gz

Version for 4.6.1.rc0

@adeines
Copy link
Mannequin

adeines mannequin commented Jan 13, 2011

comment:9

All tests pass for me.

There's some of code I don't understand . . . so I'm not giving this a positive review.

@adeines adeines mannequin added s: needs review and removed s: needs work labels Jan 13, 2011
@a-andre
Copy link

a-andre commented Jan 14, 2011

comment:10

integer.pyx: ndigits(): unsigned long b is never used. (rc0 patch version)

@loefflerd
Copy link
Mannequin

loefflerd mannequin commented Jan 18, 2011

comment:11

Hi Sebastian,

Hope you're well. Trivial comment: it's the done thing to put full names, not trac usernames, in the Author and Reviewer fields because they're used for compiling the release notes.

Less trivial: can you perhaps do a micro-patch that gets rid of the unused variable in ndigits? The rest of the code looks fine to me, and it would be good to get this positively reviewed soon, because any patch that changes quite so many lines of code is going to be highly vulnerable to bitrotting (it already conflicts with my patch at #10625, sigh).

Regards, David

@loefflerd
Copy link
Mannequin

loefflerd mannequin commented Jan 18, 2011

Changed author from spancratz to Sebastian Pancratz

@mstreng
Copy link

mstreng commented Feb 14, 2011

comment:12

Replying to @loefflerd:

it would be good to get this positively reviewed soon, because any patch that changes quite so many lines of code is going to be highly vulnerable to bitrotting

Bitrotting happened: failed to apply trac-10596-461rc0.patch on sage-4.6.2.alpha4

@a-andre
Copy link

a-andre commented Nov 13, 2011

comment:13

Rebased the patch by spancratz and added a patch that removes some trailing whitespaces.

Apply trac_10596_remove_trailing_whitespaces.patch after trac_10596.patch

@a-andre

This comment has been minimized.

@a-andre
Copy link

a-andre commented Nov 26, 2011

@a-andre
Copy link

a-andre commented Nov 26, 2011

comment:16

I removed the ndigits() part because problem was fixed in #11796.

@a-andre

This comment has been minimized.

@JohnCremona
Copy link
Member

comment:17

The patches apply cleanly to 4.8.alpha4: but there are quite a few warning on rebuilding, about variables being referenced before assignment. Does this matter?

@JohnCremona
Copy link
Member

comment:18

Replying to @JohnCremona:

The patches apply cleanly to 4.8.alpha4: but there are quite a few warning on rebuilding, about variables being referenced before assignment. Does this matter?

All tests pass and docbuild is clean. I would give a positive review were it not for those warnings. If someone knows that they are not serious, please tell me.

@JohnCremona
Copy link
Member

Changed reviewer from Aly Deines to Aly Deines, John Cremona

@JohnCremona
Copy link
Member

comment:19

Replying to @JohnCremona:

Replying to @JohnCremona:

The patches apply cleanly to 4.8.alpha4: but there are quite a few warning on rebuilding, about variables being referenced before assignment. Does this matter?

All tests pass and docbuild is clean. I would give a positive review were it not for those warnings. If someone knows that they are not serious, please tell me.

The warnings seem not to be caused by this patch at since when I popped the patch and rebuilt they came up again. So, do they matter?

@a-andre
Copy link

a-andre commented Dec 19, 2011

comment:20

Warnings are caused by lines like

cdef mpz_t tmp
mpz_init(tmp)

This seems to be a Cython problem, see http://trac.cython.org/cython_trac/ticket/714 and http://mail.python.org/pipermail/cython-devel/2011-September/001437.html, so warnings shouldn't matter.

@a-andre
Copy link

a-andre commented Dec 19, 2011

comment:21

See also #11761 comment:17.

@mstreng
Copy link

mstreng commented Jan 12, 2012

comment:22

Replying to @JohnCremona:

I would give a positive review were it not for those warnings.

And #11761 shows that the warnings are ok.

@a-andre
Copy link

a-andre commented Jan 12, 2012

Changed author from Sebastian Pancratz to Sebastian Pancratz, André Apitzsch

@jdemeyer jdemeyer modified the milestones: sage-4.8, sage-5.0 Jan 12, 2012
@jdemeyer
Copy link

Merged: sage-5.0.beta0

@loefflerd
Copy link
Mannequin

loefflerd mannequin commented Mar 11, 2012

comment:26

Apply trac_10596.patch, trac_10596_remove_trailing_whitespaces.patch

(for the patchbot, so it understands the prerequisites for building #12116 against Sage 4.8)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants