Re: [sage-devel] Re: Integer from mpz_t

2015-08-20 Thread Jeroen Demeyer
On 2015-08-19 11:31, Jean-Pierre Flori wrote: On Wednesday, August 19, 2015 at 12:21:36 PM UTC+2, vdelecroix wrote: Note that all the solutions given will *copy* the mpz_t to the Integer. Is that what you want? It is also possible to avoid the copy if it is worth it (i.e. you have

Re: [sage-devel] Re: Integer from mpz_t

2015-08-19 Thread Jean-Pierre Flori
On Wednesday, August 19, 2015 at 12:21:36 PM UTC+2, vdelecroix wrote: Note that all the solutions given will *copy* the mpz_t to the Integer. Is that what you want? It is also possible to avoid the copy if it is worth it (i.e. you have a big integer). And one shall not use PY_NEW but

Re: [sage-devel] Re: Integer from mpz_t

2015-08-19 Thread Vincent Delecroix
On 19/08/15 12:31, Jean-Pierre Flori wrote: On Wednesday, August 19, 2015 at 12:21:36 PM UTC+2, vdelecroix wrote: Note that all the solutions given will *copy* the mpz_t to the Integer. Is that what you want? It is also possible to avoid the copy if it is worth it (i.e. you have a big

Re: [sage-devel] Re: Integer from mpz_t

2015-08-19 Thread Jean-Pierre Flori
On Wednesday, August 19, 2015 at 12:36:07 PM UTC+2, vdelecroix wrote: On 19/08/15 12:31, Jean-Pierre Flori wrote: On Wednesday, August 19, 2015 at 12:21:36 PM UTC+2, vdelecroix wrote: Note that all the solutions given will *copy* the mpz_t to the Integer. Is that what you

Re: [sage-devel] Re: Integer from mpz_t

2015-08-19 Thread Vincent Delecroix
Note that all the solutions given will *copy* the mpz_t to the Integer. Is that what you want? It is also possible to avoid the copy if it is worth it (i.e. you have a big integer). On 19/08/15 11:52, Jean-Pierre Flori wrote: On Wednesday, August 19, 2015 at 11:19:30 AM UTC+2, Ralf Stephan

[sage-devel] Re: Integer from mpz_t

2015-08-19 Thread Jean-Pierre Flori
On Wednesday, August 19, 2015 at 11:19:30 AM UTC+2, Ralf Stephan wrote: Given an mpz_t, how to most effectively create an Integer? The best I can come up with is through the string representation. Or, of course, by patching integer.pyx. Am I missing something? From Cython you can use the