Re: [sage-support] How to return an RDF (or CDF) value from a Cython function ?

2016-10-17 Thread Emmanuel Charpentier
I think I already understood this distinction between type and parent. What was not clear (and still is not, but I have homework to do about this before making new noise on the list...) is how this translates in terms of (Python) programming. Provisorily, I conclude : - type : look for

Re: [sage-support] How to return an RDF (or CDF) value from a Cython function ?

2016-10-17 Thread Jeroen Demeyer
On 2016-10-17 15:10, Emmanuel Charpentier wrote: Thank you Vincent. this is much clearer. It seems that I have some things left to understand about the Sage class and types hierarchies. There is a difference between a type and a parent. A parent is a mathematical object. It is the

Re: [sage-support] How to return an RDF (or CDF) value from a Cython function ?

2016-10-17 Thread Emmanuel Charpentier
Thank you Vincent. this is much clearer. It seems that I have some things left to understand about the Sage class and types hierarchies. Sorry for the noise... -- Emmanuel Charpentier Le lundi 17 octobre 2016 13:55:14 UTC+2, vdelecroix a écrit : > > CDF is the name of a Python variable not a

Re: [sage-support] How to return an RDF (or CDF) value from a Cython function ?

2016-10-17 Thread Vincent Delecroix
CDF is the name of a Python variable not a type. sage: a = CDF.an_element() sage: type(a) You need to use this ComplexDoubleElement to type your function. -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and

Re: [sage-support] How to return an RDF (or CDF) value from a Cython function ?

2016-10-17 Thread Emmanuel Charpentier
Dear Jeroen, Le lundi 17 octobre 2016 09:58:38 UTC+2, Jeroen Demeyer a écrit : > > On 2016-10-17 09:53, Emmanuel Charpentier wrote: > > I need to use a fast random (complex) number generatot. > > > > The following : > > > > sage: %%cython > > : from sage.misc.prandom import random > >

[sage-support] How to return an RDF (or CDF) value from a Cython function ?

2016-10-17 Thread Emmanuel Charpentier
I need to use a fast random (complex) number generatot. The following : sage: %%cython : from sage.misc.prandom import random : cpdef complex crand(double x): : return x*random()+x*1j*random() is about 77 times faster than its Python equivalent : sage: def prand(x): :