> On Jul 16, 3:54 pm, Ethan Van Andel <evlu...@gmail.com> wrote:
>> Sorry to keep spamming sage-support.
>>
>> I have a class instance m with a method riemann_map so that
>> m.riemann_map(z) returns a (numpy) complex value. I want to do a
>> complex_plot of that function. If I try:
>> complex_plot(m.riemann_map,(-2,2),(-2,2)) I get this error:
>> ...
>> File "fast_eval.pyx", line 1272, in
>> sage.ext.fast_eval.fast_float_constant (sage/ext/fast_eval.c:7989)
>> File "fast_eval.pyx", line 513, in
>> sage.ext.fast_eval.FastDoubleFunc.__init__ (sage/ext/fast_eval.c:
>> 3451)
>> TypeError: a float is required
>>
>> In regular sage I just plot lambda x: m.riemann_map(x). However, I
>> want to move that call to cython to reduce overhead, and it seems
>> like
>> lambda doesn't work in cython.
If you're calling complex_plot, you don't need to be worrying about
the overhead...
> According to
> http://sage.math.washington.edu/home/mhansen/sage-epydoc/
> sage.misc.cython-module.html#cython_lambda
> which is probably semi-official (I couldn't find it in reference
> manual but it seems okay), there is a cython_lambda which should work
> okay. Someone else will certainly be able to clarify more :)
This seems a bit hackish for what you need, and I don't think it will
even work in this case. Is there any reason you can't use an ordinary
function instead of a lambda? The two best options I see are either
writing that part in Python (quick and easy), or fixing complex_plot
to take any callable (which it really should do).
- Robert