-
Notifications
You must be signed in to change notification settings - Fork 67
Support for order kwarg in Lambdify #188
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
@raphaelquast I thought you might be interested. Any feedback (you can look at the test cases) is much appreciated. |
Running times for
Using this PR:
|
I wouldn't worry much about |
I saw that one -- impressive! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure whether we want order
at both initialization and eval. Otherwise looks good to me.
symengine/lib/symengine_wrapper.pyx
Outdated
@@ -4399,16 +4365,20 @@ cdef class _Lambdify(object): | |||
cdef list out_shapes | |||
cdef readonly bint real | |||
cdef readonly int n_exprs | |||
cdef readonly str order |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make this a char?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried that, but Cython seems to inject logic expecting an integer then.
symengine/lib/symengine_wrapper.pyx
Outdated
self.numpy_dtype = np.float64 if self.real else np.complex128 | ||
self.out_shapes = [get_shape(expr) for expr in exprs] | ||
self.out_shapes = [np.asarray(expr).shape for expr in exprs] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is creating a numpy array just to get the shape. Isn't that expensive? I guess it doesn't matter much because this is in setup phase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could be more expensive, that's true. This was mostly the get rid of some non-trivial logic (the get_shape function). Maybe we should benchmark the creation of Lambdify
instances as well.
Since both args and exprs have |
One of the travis jobs needs a restart. |
Ok, I think I'm happy with this on my side. Anything else you'd like me to change @isuruf ? EDIT: if one uses e.g. |
@bjodah thanks a lot for getting this issue running! I haven't had the time to check the changes so far, |
symengine/lib/symengine_wrapper.pyx
Outdated
|
||
def __cinit__(self, args, *exprs, cppbool real=True): | ||
def __cinit__(self, args, *exprs, cppbool real=True, order='C'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about moving all the stuff from here to __init__
and remove storing args
and exprs
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch. Works locally, pushed now.
No plans yet. I was thinking of a release every six months.
That was the initial plan, but we felt it's a waste of CI resources. So, whenever someone wants a new binary, a PR is made, like https://github.com/symengine/python-symengine-feedstock/pull/2/files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. I'll merge when tests pass.
Thanks for the PR. |
unfortunately i don't fully get what you mean by that... |
This addresses gh-174.