Re: [sage-devel] Cross-type comparisons

2016-12-04 Thread Jeroen Demeyer
On 2016-12-04 19:39, Marc Mezzarobba wrote: Hi, Does Element.__richcmp__() (via CoercionModel_cache_maps.richcmp()) really need to fall back on comparing by type/id when no common parent is found? No. As far as I know, It does so for historical reasons only. I am in favour of making elements

Re: [sage-devel] Return false or raise error on some situations

2016-12-04 Thread Jeroen Demeyer
On 2016-12-04 08:59, Jori Mäntysalo wrote: Currently Posets.PentagonPoset().is_antichain_of_poset([2,3,'junk']) returns False and Posets.PentagonPoset().is_antichain_of_poset(['junk',2,3]) raises an error. At https://trac.sagemath.org/ticket/19078 I and Travis have different opinion about whi

[sage-devel] Re: Cross-type comparisons

2016-12-04 Thread Marc Mezzarobba
Travis Scrimshaw wrote: > We need to be very careful about defining "not knowing". I (stongly) > believe when the objects/types are incomparable (say the rings ZZ and > QQ), then == should return False and != should return True. Sorry, I don't understand your example: I think everyone agrees that

[sage-devel] Re: Cross-type comparisons

2016-12-04 Thread Travis Scrimshaw
On Sunday, December 4, 2016 at 1:59:00 PM UTC-6, Frédéric Chapoton wrote: > > There is currently an effort being made (by me and a few referees) to get > rid of cmp() in all pyx files. And the Element/Parent is one of the hardest > cases remaining. Getting rid of all calls to cmp( ) is necessar

[sage-devel] License of the SageMath documentation

2016-12-04 Thread than...@debian.org
Hi, I found conflicting information about the license of the SageMath documentation. While it says nothing in COPYING.txt, it says in src/doc/en/reference/history_and_license/index.rst that "All documentation is released under the GNU Free Documentation License." On the other hand, there are

[sage-devel] Re: Cross-type comparisons

2016-12-04 Thread Marc Mezzarobba
Frédéric Chapoton wrote: > richcmp, when not knowing what to do, should most probably return > NotImplemented In the case of Element.__richcmp__: not when both operands are Elements, IMO, but perhaps indeed when the other one is a non-Element. > I do not think we should whitelist comparison with

[sage-devel] Re: Cross-type comparisons

2016-12-04 Thread Volker Braun
In the Python3 spirit, it would be nice to get a type error instead of ordering by id: $ python3 >>> 1 < 'a' Traceback (most recent call last): File "", line 1, in TypeError: unorderable types: int() < str() The current behavior is certainly not great, and was just defaulted because thats wh

[sage-devel] Re: Cross-type comparisons

2016-12-04 Thread Frédéric Chapoton
There is currently an effort being made (by me and a few referees) to get rid of cmp() in all pyx files. And the Element/Parent is one of the hardest cases remaining. Getting rid of all calls to cmp( ) is necessary for compatibility with python3. The intermediate objective is to be able to comp

Re: [sage-devel] Re: three.js on 7.5 beta 5: cpu...

2016-12-04 Thread William Stein
On Sun, Dec 4, 2016 at 10:37 AM, Dima Pasechnik wrote: > > > On Saturday, December 3, 2016 at 10:34:50 PM UTC, Paul Masson wrote: >> >> >> >> On Saturday, December 3, 2016 at 2:30:36 PM UTC-8, William wrote: >>> >>> On Sat, Dec 3, 2016 at 2:28 PM, Paul Masson >>> wrote: >>> > There's apparently

[sage-devel] Cross-type comparisons

2016-12-04 Thread Marc Mezzarobba
Hi, Does Element.__richcmp__() (via CoercionModel_cache_maps.richcmp()) really need to fall back on comparing by type/id when no common parent is found? Since comparison operators are part of the coercion framework, it would seem more sensible to raise an error. Moreover, having an essentially ar

Re: [sage-devel] Re: three.js on 7.5 beta 5: cpu...

2016-12-04 Thread Dima Pasechnik
On Saturday, December 3, 2016 at 10:34:50 PM UTC, Paul Masson wrote: > > > > On Saturday, December 3, 2016 at 2:30:36 PM UTC-8, William wrote: >> >> On Sat, Dec 3, 2016 at 2:28 PM, Paul Masson >> wrote: >> > There's apparently no good way in general to test whether the scene is >> > unchanged

Re: [sage-devel] Re: devising a speed comparison test between different types

2016-12-04 Thread William Stein
On Sat, Dec 3, 2016 at 10:53 PM, Ralf Stephan <> wrote: “Both ZZ and numpy use libgmp internally “ No, ZZ uses libgmp (actually really MPIR, which is a fork of GMP), and numpy uses Python’s ints/longs. Python’s int/long type is arbitrary precision, despite the confusing naming. It only implements

Re: [sage-devel] Re: devising a speed comparison test between different types

2016-12-04 Thread Volker Braun
On Sunday, December 4, 2016 at 5:58:45 PM UTC+1, Pierre wrote: > -- numpy.int32 or int.64: like "int" initially, but works mod 2^32 or > 2^64, and gives an overflow warning when it happens. No increase in > speed, for general reasons which I will just call "overhead" for lack > of a better unde

Re: [sage-devel] Re: devising a speed comparison test between different types

2016-12-04 Thread Pierre Guillot
PPS come to think of it, my last PS explains it all. So in summary: -- ZZ= always arbitrary precision. -- int= a C int when the numbers stay < 2^64, so there is an increase of speed -- but not nearly as much of an increase as I expected, which is why I was confused at first, because I wasn't seein

[sage-devel] Re: devising a speed comparison test between different types

2016-12-04 Thread Pierre
PS actually, i am a little wrong with Python ints being arbitrary precision. In fact there is no such thing as just a python int, there is "int" and "long", but computations with ints can give you an answer which is "long"; presumably this mostly means that everything is as slow as if everythin

[sage-devel] Re: Return false or raise error on some situations

2016-12-04 Thread Travis Scrimshaw
To clarify slightly, I want both cases to return False, whereas Jori wants both cases to raise an error. Same reasoning for me as is_similar for matrices. Best, Travis On Sunday, December 4, 2016 at 1:59:47 AM UTC-6, Jori Mäntysalo wrote: > > Currently > > Posets.PentagonPoset().is_antichain_

[sage-devel] Re: devising a speed comparison test between different types

2016-12-04 Thread Pierre
Hi all, Thanks for your answers. There are a few things that I now understand, but i'm still confused. One crucial mistake I made was, as I see now thanks to Ralf's message, to believe that numpy.int meant "C int": no, it means python int ! For C ints, use numpy.int32 (or 64). In fact : sage:

Re: [sage-devel] Indexing Sage external packages (was: Giving back to the community)

2016-12-04 Thread Jeroen Demeyer
On 2016-11-28 20:14, Vincent Delecroix wrote: - Relying on Python packaging and PyPI might be too limited for Sage at some point (tricky dependencies, Sage recompilation needed) I would say it's limited only because it deals with Python packages, not other libraries. I don't quite get what you

[sage-devel] Re: devising a speed comparison test between different types

2016-12-04 Thread Simon King
PS: On 2016-12-03, Pierre wrote: > I thought about multiplying large matrices, but I'm afraid that completely > different algorithms/libraries will be used depending on the parent ring Yes, this would measure the efficiency of matrix arithmetics but would give no real clue about the efficiency

[sage-devel] Re: devising a speed comparison test between different types

2016-12-04 Thread Simon King
Hi Pierre, On 2016-12-03, Pierre wrote: > We are talking about very basic advice to give to a beginner, and so, I > knew enough to say that well, C ints (so I guess numpy.int's) will be fast, > but limited in size, and elements of ZZ can be as large as your memory > allows etc (and a similar,

[sage-devel] Return false or raise error on some situations

2016-12-04 Thread Jori Mäntysalo
Currently Posets.PentagonPoset().is_antichain_of_poset([2,3,'junk']) returns False and Posets.PentagonPoset().is_antichain_of_poset(['junk',2,3]) raises an error. At https://trac.sagemath.org/ticket/19078 I and Travis have different opinion about which one is the right answer. So please give