[sage-devel] Re: abs(-pi)=-pi

2015-11-13 Thread Dima Pasechnik


On Friday, 13 November 2015 11:43:42 UTC, Anthony Wickstead wrote:
>
> I have just discovered that in Sage 6.7 abs(-pi)=-pi, 
> abs(-sqrt(2))=-sqrt(2) etc. Previous version I used was 6.2 and I am fairly 
> sure it was not the case then. Can't find earlier reference to this bug.
>

6.7 is old. Try 6.9.
E.g I see that in (forthcoming) 6.10 it should be OK:
sage: version()
'SageMath Version 6.10.beta3, Release Date: 2015-11-05'
sage: abs(-sqrt(2))
sqrt(2)
sage: abs(-pi)
pi

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: abs(-pi)=-pi

2015-11-13 Thread Anthony Wickstead

Glad to hear it is fixed. This arose in a university computer lab setting 
where updates to the image are only feasible annually. Won't get new 
version running until next autumn!

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: Error installing package conway_polynomials-0.4.p0

2015-11-13 Thread Dima Pasechnik


On Friday, 13 November 2015 03:41:05 UTC, Yueru Sun wrote:
>
> Alternatively, is it possible to find prebuilt binaries of older versions 
> of Sage somewhere? The official site only has binaries of the current 
> version; I also googled for them with no luck.
>

It will be a struggle to work with Sage 6.4. Can you rather upgrade that 
package you  talk about? Or at least mention why it's hard to do...

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] abs(-pi)=-pi

2015-11-13 Thread Anthony Wickstead
I have just discovered that in Sage 6.7 abs(-pi)=-pi, 
abs(-sqrt(2))=-sqrt(2) etc. Previous version I used was 6.2 and I am fairly 
sure it was not the case then. Can't find earlier reference to this bug.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: random seed is not renewed for parallel functions

2015-11-13 Thread Dima Pasechnik
shouldn't each thread run its own random number generator?

On Friday, 13 November 2015 11:11:57 UTC, Sébastien Labbé wrote:
>
> Is this a feature or a bug?
>
> sage: @parallel
> : def f(a):
> : return a+random()
> : 
> sage: [v for _,v in f(range(10))]
> [0.20150303719720475,
>  1.2015030371972046,
>  2.2015030371972046,
>  3.2015030371972046,
>  4.201503037197205,
>  5.201503037197205,
>  6.201503037197205,
>  7.201503037197205,
>  8.201503037197204,
>  9.201503037197204]
>
> Sébastien
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] MPIR division bug fixed

2015-11-13 Thread 'Bill Hart' via sage-devel
Hi all,

A while ago the Sage project reported a bug in basecase division in MPIR on
32 bit machines [1].

Since then we found a rare bug in basecase division on a 64 bit machine,
likely caused by the same issue.

Fortunately most modern x86_64 machines were tuned to not use the broken
implementation at all (k10 being an exception).

To fix this but I have simply removed the broken basecase division
implementation from MPIR altogether. It was rarely used and didn't provide
much of an improvement, so I decided it was best to just remove it.

The new divide-and-conquer routine remains in use of course, since that
gives a substantial improvement of around 20% over a significant range, and
no bugs are known in it.

As soon as we have checked if there are any other bits and pieces that need
to be put into the release, we will issue MPIR-2.7.1 to fix this issue.

In the mean time one can obtain a patched version of MPIR at my github [2].

I recommend all users upgrade as soon as we release MPIR-2.7.1.

Bill.

[1] http://trac.sagemath.org/ticket/19280
[2] https://github.com/wbhart/mpir

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: [mpir-devel] Re: MPIR division bug fixed

2015-11-13 Thread 'Bill Hart' via sage-devel
Not in the published divide-and-conquer algorithm, no.

There was a bug in the implementation of the new basecase algorithm, which
was not published, nor very important. On most machines it was switched
off. And even on the machines where it was used (with the exception of
itanium where it seemed to be used a lot), it was only used for *very*
small operands.

I'm slightly surprised that there was a bug, since I literally ran tests
for hours to check it. But it's simply not worth debugging to find the
exact cause. The whole thing can be ditched without anyone really noticing
anything, performance-wise.

If I had more time I'd be more thorough with the postmortem, but right at
the moment there are infinitely many, infinitely more important things I
must be getting on with.

Bill.

On 13 November 2015 at 18:34, Jean-Pierre Flori  wrote:

> Hi Bill,
>
> Do you mean there was an issue in your new division algorithm?
>
> Best,
> JP
>
> --
> You received this message because you are subscribed to the Google Groups
> "mpir-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to mpir-devel+unsubscr...@googlegroups.com.
> To post to this group, send email to mpir-de...@googlegroups.com.
> Visit this group at http://groups.google.com/group/mpir-devel.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: MPIR division bug fixed

2015-11-13 Thread Jean-Pierre Flori
Hi Bill,

Do you mean there was an issue in your new division algorithm?

Best,
JP

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: MPIR division bug fixed

2015-11-13 Thread 'Bill Hart' via sage-devel
Brian and I are now happy with the state of things for 2.7.1, so I will put
up the release when I get the chance, possibly over the weekend, Monday at
the latest (barring unforeseen interruptions).

Bill.

On 13 November 2015 at 16:08, Bill Hart  wrote:

> Hi all,
>
> A while ago the Sage project reported a bug in basecase division in MPIR
> on 32 bit machines [1].
>
> Since then we found a rare bug in basecase division on a 64 bit machine,
> likely caused by the same issue.
>
> Fortunately most modern x86_64 machines were tuned to not use the broken
> implementation at all (k10 being an exception).
>
> To fix this but I have simply removed the broken basecase division
> implementation from MPIR altogether. It was rarely used and didn't provide
> much of an improvement, so I decided it was best to just remove it.
>
> The new divide-and-conquer routine remains in use of course, since that
> gives a substantial improvement of around 20% over a significant range, and
> no bugs are known in it.
>
> As soon as we have checked if there are any other bits and pieces that
> need to be put into the release, we will issue MPIR-2.7.1 to fix this issue.
>
> In the mean time one can obtain a patched version of MPIR at my github [2].
>
> I recommend all users upgrade as soon as we release MPIR-2.7.1.
>
> Bill.
>
> [1] http://trac.sagemath.org/ticket/19280
> [2] https://github.com/wbhart/mpir
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: [mpir-devel] Re: MPIR division bug fixed

2015-11-13 Thread Jean-Pierre Flori


On Friday, November 13, 2015 at 9:40:27 AM UTC-8, Bill Hart wrote:
>
> Not in the published divide-and-conquer algorithm, no.
>
> There was a bug in the implementation of the new basecase algorithm, which 
> was not published, nor very important. On most machines it was switched 
> off. And even on the machines where it was used (with the exception of 
> itanium where it seemed to be used a lot), it was only used for *very* 
> small operands.
>
> To be verbose, do you mean the basecase schoolbook multiprecision division 
using 3by2 small division using a new 1 word precomputed inverse is broken?
So is the code from BDSNT broken as wel?
https://github.com/wbhart/bsdnt/blob/master/helper.c#L186
https://github.com/wbhart/bsdnt/blob/master/nn_quadratic.c#L240

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] random seed is not renewed for parallel functions

2015-11-13 Thread William Stein
On Friday, November 13, 2015, Sébastien Labbé  wrote:

> Is this a feature or a bug?
>
>
Feature - the calls all happen at once starting with the same state of sage
including the random state.



>
> sage: @parallel
> : def f(a):
> : return a+random()
> :
> sage: [v for _,v in f(range(10))]
> [0.20150303719720475,
>  1.2015030371972046,
>  2.2015030371972046,
>  3.2015030371972046,
>  4.201503037197205,
>  5.201503037197205,
>  6.201503037197205,
>  7.201503037197205,
>  8.201503037197204,
>  9.201503037197204]
>
> Sébastien
>







> --
> You received this message because you are subscribed to the Google Groups
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-devel+unsubscr...@googlegroups.com
> 
> .
> To post to this group, send email to sage-devel@googlegroups.com
> .
> Visit this group at http://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Sent from my massive iPhone 6 plus.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: [mpir-devel] Re: MPIR division bug fixed

2015-11-13 Thread 'Bill Hart' via sage-devel
On 13 November 2015 at 21:41, Jean-Pierre Flori  wrote:

>
>
> On Friday, November 13, 2015 at 12:34:41 PM UTC-8, Bill Hart wrote:
>>
>>
>>
>> On 13 November 2015 at 19:10, Jean-Pierre Flori  wrote:
>>
>>>
>>>
>>> On Friday, November 13, 2015 at 9:40:27 AM UTC-8, Bill Hart wrote:

 Not in the published divide-and-conquer algorithm, no.

 There was a bug in the implementation of the new basecase algorithm,
 which was not published, nor very important. On most machines it was
 switched off. And even on the machines where it was used (with the
 exception of itanium where it seemed to be used a lot), it was only used
 for *very* small operands.

 To be verbose, do you mean the basecase schoolbook multiprecision
>>> division using 3by2 small division using a new 1 word precomputed inverse
>>> is broken?
>>>
>>
>> Yes it was a 3by2 version using a new 1 word precomputed inverse
>> (unrelated to the 3by2 division originally used in MPIR and GMP).
>>
> So do you still trust the 3by2 algorithm in your preprint?
>

I don't have any reason to not trust it. I believe this was just an
implementation bug.

If you look at the most recent commit to the MPIR repository from me,
you'll see why I think that.

https://github.com/wbhart/mpir/commit/8435273a1ae6c033bec43fc54966bf121b73cf62


>
>>
>>> So is the code from BDSNT broken as wel?
>>> https://github.com/wbhart/bsdnt/blob/master/helper.c#L186
>>> https://github.com/wbhart/bsdnt/blob/master/nn_quadratic.c#L240
>>>
>>>
>> Doubtful. The implementation in MPIR was much, much more complex.
>>
>> The algorithm itself is quite straightforward.
>>
>> On the other hand, bsdnt does not have many users, so if bugs exist
>> there, it is much less likely they will be detected, so beware.
>>
>> Yup, I did an implementation myself for another project using your
> precomputed reciprocal and a naive schoolbook long division.
> I tested the values mentioned on http://trac.sagemath.org/ticket/19280
> and get a correct remainder.
>

Good to know. Thanks.


> Note that I don't store the quotient but it should be correct as well.
> If you are aware of any other values triggered wrong answer in MPIR, I'd
> be more than happy to pass them to my implementation.
>

I'm not aware of other values that triggered it, though there may well have
been others. This was certainly a rare corner case. As I said, I had tested
the original implementation on a variety of inputs for hours.

Bill.

> --
> You received this message because you are subscribed to the Google Groups
> "mpir-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to mpir-devel+unsubscr...@googlegroups.com.
> To post to this group, send email to mpir-de...@googlegroups.com.
> Visit this group at http://groups.google.com/group/mpir-devel.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] random seed is not renewed for parallel functions

2015-11-13 Thread Dima Pasechnik


On Friday, 13 November 2015 18:02:14 UTC, William wrote:
>
>
>
> On Friday, November 13, 2015, Sébastien Labbé  > wrote:
>
>> Is this a feature or a bug?
>>
>>
> Feature - the calls all happen at once starting with the same state of 
> sage including the random state. 
>

how one would then run a randomised algorithm in parallel? (e.g. testing 
property with random input)
In such a case one certainly need something orthogonal to this.
  

>
>  
>
>>
>> sage: @parallel
>> : def f(a):
>> : return a+random()
>> : 
>> sage: [v for _,v in f(range(10))]
>> [0.20150303719720475,
>>  1.2015030371972046,
>>  2.2015030371972046,
>>  3.2015030371972046,
>>  4.201503037197205,
>>  5.201503037197205,
>>  6.201503037197205,
>>  7.201503037197205,
>>  8.201503037197204,
>>  9.201503037197204]
>>
>> Sébastien
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] random seed is not renewed for parallel functions

2015-11-13 Thread Sébastien Labbé


> Feature - the calls all happen at once starting with the same state of 
>> sage including the random state.
>>  
>>
>
> how one would then run a randomised algorithm in parallel? (e.g. testing 
> property with random input)
> In such a case one certainly need something orthogonal to this.
>

Calling the same function f with the parallel decorator iteratively gives:

sage: [f(a) for a in range(10)]
[0.5456150826695888,
 1.5274761438193447,
 2.6261975603956875,
 3.311480135021058,
 4.622068879474614,
 5.056304819780978,
 6.850777826232956,
 7.652224224628873,
 8.419067022860219,
 9.356877740213488]

That's why, as a user, I was expecting the same behavior for f(range(10)).

Also, I realized using @parallel(p_iter='reference') gives what I was 
expecting and @parallel(p_iter='multiprocessing') gives a intermediate 
(pairs of results with same random part, two because I have two cpus I 
guess). So between using p_iter='fork' with a random input or using 
p_iter='reference', is there some reason to choose one instead of the other?

Sébastien

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] MPIR-2.7.1 released

2015-11-13 Thread 'Bill Hart' via sage-devel
Hi all,

We have released MPIR-2.7.1 to fix some rare bugs and a few other issues:

* Fix bug in Karatsuba assembly code on Windows
* Fix bug in basecase division code
* Add some missing information in AUTHORS
* Travis continuous integration
* Add building of tests to command line build for Windows
* Improved Windows MSVC build

We recommend everyone update due to the critical bug fixes.

Note that any previous patches for the basecase division bug, including
those reported to the Sage project [1], are no longer needed and should be
removed.

Build/test reports welcome.

Note, we are now in a position to start moving towards a 2.8.0 release,
which at a minimum will merge JP's mulmod port from the GMP project and
bring the MPIR interface into line with GMP 6.0.0 and 6.1.0.

However, I will not personally be available to work on a new release until
mid-February at the earliest due to many time critical things happening
right now where I work.

If someone would like to volunteer to take over the 2.8.0 release process,
we'd be happy to have someone do that. We can easily give access to our
development server if needed.

We hope to hire someone starting March next year who might be able to help
us with releases. However, so far no applications have been received for
the position [2].

Bill and Brian.

[1] http://trac.sagemath.org/ticket/19280
[2] http://opendreamkit.org/2015/07/01/developer-position2-kaiserslautern/

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: What in Sage uses Boost ? And who maintains it ?

2015-11-13 Thread Emmanuel Charpentier
I ported 1.58.0 headers in Trac #19582 
, which needs review. 

HTH,

__
Emmanuel Charpentier

Le vendredi 13 novembre 2015 07:38:53 UTC+1, Emmanuel Charpentier a écrit :
>
> FYI,
>
> Just for the hell of it, I *did* update boost_cropped to 1.59.0 in a 
> private branch. The resultant Sage passes ptestlong with no errors, and 
> *can* run rstan with no error.
>
> This should be considered for Sage itself (maybe with 1.58.0, which is the 
> version that many distros (including Debian and Ubuntu) and other packages 
> (including R) are up to now).
>
> Porting the whole of Boost should also be considered, but maybe after 
> considering what uses the non-headers parts of Boost. AFAICT, The R package 
> is headers-only.
>
> HTH,
>
> --
> Emmanuel Charpentier
>
> Le mercredi 11 novembre 2015 13:06:21 UTC+1, Emmanuel Charpentier a écrit :
>>
>> Dear list,
>>
>> I just discovered that Sage installs a Boost library (it's, curiously, 
>> called boost-cropped, but according to its SPKG.txt, currently contains all 
>> of Boost, without patches).
>>
>> The current version is 1.52. I discovered that this version is too old at 
>> least for the rstan package of R (a diabolically efficient MCMC sampler), 
>> which needs Boost>=1.58. See this thread on stan-users 
>>  for 
>> details.
>>
>> Hence two questions :
>>
>> 1) What in Sage uses Boost ?
>>
>> 2) Is someone maintaining it ?
>>
>> Sincerely yours,
>>
>> --
>> Emmanuel Charpentier
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: [mpir-devel] Re: MPIR division bug fixed

2015-11-13 Thread 'Bill Hart' via sage-devel
On 13 November 2015 at 19:10, Jean-Pierre Flori  wrote:

>
>
> On Friday, November 13, 2015 at 9:40:27 AM UTC-8, Bill Hart wrote:
>>
>> Not in the published divide-and-conquer algorithm, no.
>>
>> There was a bug in the implementation of the new basecase algorithm,
>> which was not published, nor very important. On most machines it was
>> switched off. And even on the machines where it was used (with the
>> exception of itanium where it seemed to be used a lot), it was only used
>> for *very* small operands.
>>
>> To be verbose, do you mean the basecase schoolbook multiprecision
> division using 3by2 small division using a new 1 word precomputed inverse
> is broken?
>

Yes it was a 3by2 version using a new 1 word precomputed inverse (unrelated
to the 3by2 division originally used in MPIR and GMP).


> So is the code from BDSNT broken as wel?
> https://github.com/wbhart/bsdnt/blob/master/helper.c#L186
> https://github.com/wbhart/bsdnt/blob/master/nn_quadratic.c#L240
>
>
Doubtful. The implementation in MPIR was much, much more complex.

The algorithm itself is quite straightforward.

On the other hand, bsdnt does not have many users, so if bugs exist there,
it is much less likely they will be detected, so beware.

Bill.

> --
> You received this message because you are subscribed to the Google Groups
> "mpir-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to mpir-devel+unsubscr...@googlegroups.com.
> To post to this group, send email to mpir-de...@googlegroups.com.
> Visit this group at http://groups.google.com/group/mpir-devel.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] random seed is not renewed for parallel functions

2015-11-13 Thread Nils Bruin
On Friday, November 13, 2015 at 1:53:25 PM UTC-8, Nils Bruin wrote:
>
> I would think this is the kind of thing that is worth documenting 
> somewhere. 
>
Particularly because the behaviour depends on the underlying 
parallellization mechanism:

@parallel(p_iter="multiprocessing")
def f(a):
return a+random()

sage: [v for _,v in f(range(10))]
[0.09820437376053981,
 1.0982043737605398,
 3.808951613936986,
 2.09820437376054,
 5.109106333045528,
 6.808951613936986,
 4.09820437376054,
 9.109106333045528,
 7.808951613936986,
 8.741294697680337]

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] random seed is not renewed for parallel functions

2015-11-13 Thread Nils Bruin
On Friday, November 13, 2015 at 1:18:07 PM UTC-8, Dima Pasechnik wrote:
>
> how one would then run a randomised algorithm in parallel? (e.g. testing 
> property with random input)
> In such a case one certainly need something orthogonal to this.
>
 
Something like this?

@parallel
> def f(a):
> 
> sage.misc.randstate.set_random_seed(sage.misc.randstate.current_randstate().seed()+os.getpid())
> return a+random()
>

You might want to use a better source, because the pid will not have much 
entropy. I would think this is the kind of thing that is worth documenting 
somewhere. 

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: [mpir-devel] Re: MPIR division bug fixed

2015-11-13 Thread Jean-Pierre Flori


On Friday, November 13, 2015 at 12:34:41 PM UTC-8, Bill Hart wrote:
>
>
>
> On 13 November 2015 at 19:10, Jean-Pierre Flori  > wrote:
>
>>
>>
>> On Friday, November 13, 2015 at 9:40:27 AM UTC-8, Bill Hart wrote:
>>>
>>> Not in the published divide-and-conquer algorithm, no.
>>>
>>> There was a bug in the implementation of the new basecase algorithm, 
>>> which was not published, nor very important. On most machines it was 
>>> switched off. And even on the machines where it was used (with the 
>>> exception of itanium where it seemed to be used a lot), it was only used 
>>> for *very* small operands.
>>>
>>> To be verbose, do you mean the basecase schoolbook multiprecision 
>> division using 3by2 small division using a new 1 word precomputed inverse 
>> is broken?
>>
>
> Yes it was a 3by2 version using a new 1 word precomputed inverse 
> (unrelated to the 3by2 division originally used in MPIR and GMP).
>
So do you still trust the 3by2 algorithm in your preprint? 

>  
>
>> So is the code from BDSNT broken as wel?
>> https://github.com/wbhart/bsdnt/blob/master/helper.c#L186
>> https://github.com/wbhart/bsdnt/blob/master/nn_quadratic.c#L240
>>
>>
> Doubtful. The implementation in MPIR was much, much more complex.
>
> The algorithm itself is quite straightforward.
>
> On the other hand, bsdnt does not have many users, so if bugs exist there, 
> it is much less likely they will be detected, so beware.
>
> Yup, I did an implementation myself for another project using your 
precomputed reciprocal and a naive schoolbook long division.
I tested the values mentioned on http://trac.sagemath.org/ticket/19280 and 
get a correct remainder.
Note that I don't store the quotient but it should be correct as well.
If you are aware of any other values triggered wrong answer in MPIR, I'd be 
more than happy to pass them to my implementation.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: [mpir-devel] Re: MPIR division bug fixed

2015-11-13 Thread 'Bill Hart' via sage-devel
Incidentally, whilst removing the basecase implementation I found and
removed a bug in the asymptotically fast division code. Or rather, removing
the basecase implementation also removed that bug. However, this could not
have been what caused the bug we observed in the basecase code.

Bill.

On 13 November 2015 at 22:02, Bill Hart  wrote:

>
>
> On 13 November 2015 at 21:41, Jean-Pierre Flori  wrote:
>
>>
>>
>> On Friday, November 13, 2015 at 12:34:41 PM UTC-8, Bill Hart wrote:
>>>
>>>
>>>
>>> On 13 November 2015 at 19:10, Jean-Pierre Flori 
>>> wrote:
>>>


 On Friday, November 13, 2015 at 9:40:27 AM UTC-8, Bill Hart wrote:
>
> Not in the published divide-and-conquer algorithm, no.
>
> There was a bug in the implementation of the new basecase algorithm,
> which was not published, nor very important. On most machines it was
> switched off. And even on the machines where it was used (with the
> exception of itanium where it seemed to be used a lot), it was only used
> for *very* small operands.
>
> To be verbose, do you mean the basecase schoolbook multiprecision
 division using 3by2 small division using a new 1 word precomputed inverse
 is broken?

>>>
>>> Yes it was a 3by2 version using a new 1 word precomputed inverse
>>> (unrelated to the 3by2 division originally used in MPIR and GMP).
>>>
>> So do you still trust the 3by2 algorithm in your preprint?
>>
>
> I don't have any reason to not trust it. I believe this was just an
> implementation bug.
>
> If you look at the most recent commit to the MPIR repository from me,
> you'll see why I think that.
>
>
> https://github.com/wbhart/mpir/commit/8435273a1ae6c033bec43fc54966bf121b73cf62
>
>
>>
>>>
 So is the code from BDSNT broken as wel?
 https://github.com/wbhart/bsdnt/blob/master/helper.c#L186
 https://github.com/wbhart/bsdnt/blob/master/nn_quadratic.c#L240


>>> Doubtful. The implementation in MPIR was much, much more complex.
>>>
>>> The algorithm itself is quite straightforward.
>>>
>>> On the other hand, bsdnt does not have many users, so if bugs exist
>>> there, it is much less likely they will be detected, so beware.
>>>
>>> Yup, I did an implementation myself for another project using your
>> precomputed reciprocal and a naive schoolbook long division.
>> I tested the values mentioned on http://trac.sagemath.org/ticket/19280
>> and get a correct remainder.
>>
>
> Good to know. Thanks.
>
>
>> Note that I don't store the quotient but it should be correct as well.
>> If you are aware of any other values triggered wrong answer in MPIR, I'd
>> be more than happy to pass them to my implementation.
>>
>
> I'm not aware of other values that triggered it, though there may well
> have been others. This was certainly a rare corner case. As I said, I had
> tested the original implementation on a variety of inputs for hours.
>
> Bill.
>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "mpir-devel" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to mpir-devel+unsubscr...@googlegroups.com.
>> To post to this group, send email to mpir-de...@googlegroups.com.
>> Visit this group at http://groups.google.com/group/mpir-devel.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: should "foo?" print TESTS: blocks or omit them?

2015-11-13 Thread John H Palmieri


On Saturday, November 7, 2015 at 2:01:17 AM UTC-8, Volker Braun wrote:
>
> I don't really care about whether to display TESTS:: or not, but we really 
> should have a proper parser for our docstring style. This ticket adds yet 
> another regex hack. E.g. sphinxcontrib-napoleon is an example for how it is 
> done correctly: 
>

> * Nicer typeset output since the docbuilder has semantic knowledge, e.g. 
> http://bwanamarko.alwaysdata.net/napoleon/format_exception.html
>
> * Less ambiguity (single or double "--"?)
>
> * Fewer potential for mistakes as you don't have to do the formatting by 
> hand, no standard double backticks that always have to be put at a certain 
> place etc...
>
> * Potential for automatted testing: If you can parse the documented 
> argspec then you can compare with the actual argspec
>
> A slightly related question, do we really need a special Sage docstring 
> style. Its just unnecessary. Just use a standard that already has tooling 
> support (like sphinx-napoleon), or at least a minor extension thereof. Lots 
> of projects use Google style, e.g. Khan academy. 
>

I think it is several years too late for this sort of comment. Are we going 
to rewrite all of our docstrings to conform to a new style? Sounds like a 
nightmare. Modifying napoleon to deal with Sage's docstring style (and also 
allowing Google style docstrings, for example) sounds much more practical.

-- 
John

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Error installing package conway_polynomials-0.4.p0

2015-11-13 Thread Yueru Sun
This worked like a charm and I succeeded with the build. Thank you very
much!

On 13 November 2015 at 00:30, Jeroen Demeyer  wrote:

> On 2015-11-12 19:27, Yueru Sun wrote:
>
>> Hello,
>>
>> I was compiling sage 6.4(it is unfortunately the only version supported
>> by a math package I will be using) from the source on Ubuntu 14.04 with
>> the "make" command, and the process halted with the error below.
>>
>> Can someone please help me with this error?
>>
>
> I would guess that something went wrong with the build.
> I propose you run
>
> ./sage -ba
>
> and see if that helps.
>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "sage-devel" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/sage-devel/ig4zIXcqdYI/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> sage-devel+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-devel@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Re: Error installing package conway_polynomials-0.4.p0

2015-11-13 Thread Yueru Sun
At first I tried to use the package, Flagmatic-dev, in Sage 6.9, only to
run into "Exception AttributeError: "'int' object has no attribute
'parent'"" on multiple critical occasions. The author of the package kindly
informed me that it is meant to be used only in Sage 6.4, since signatures
of some basic functions in Sage may change from release to release, which
ultimately lead me here. Fortunately, it seems to work fine now in 6.4.

On 13 November 2015 at 06:39, Dima Pasechnik  wrote:

>
>
> On Friday, 13 November 2015 03:41:05 UTC, Yueru Sun wrote:
>>
>> Alternatively, is it possible to find prebuilt binaries of older versions
>> of Sage somewhere? The official site only has binaries of the current
>> version; I also googled for them with no luck.
>>
>
> It will be a struggle to work with Sage 6.4. Can you rather upgrade that
> package you  talk about? Or at least mention why it's hard to do...
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "sage-devel" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/sage-devel/ig4zIXcqdYI/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> sage-devel+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-devel@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] random seed is not renewed for parallel functions

2015-11-13 Thread Sébastien Labbé
Is this a feature or a bug?

sage: @parallel
: def f(a):
: return a+random()
: 
sage: [v for _,v in f(range(10))]
[0.20150303719720475,
 1.2015030371972046,
 2.2015030371972046,
 3.2015030371972046,
 4.201503037197205,
 5.201503037197205,
 6.201503037197205,
 7.201503037197205,
 8.201503037197204,
 9.201503037197204]

Sébastien

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: abs(-pi)=-pi

2015-11-13 Thread Dima Pasechnik


On Friday, 13 November 2015 11:59:29 UTC, Anthony Wickstead wrote:
>
>
> Glad to hear it is fixed. This arose in a university computer lab setting 
> where updates to the image are only feasible annually. Won't get new 
> version running until next autumn!
>

perhaps abs(-pi)=-pi gives you a good reason to demand an upgrade before 
next academic year... 

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.