-
Notifications
You must be signed in to change notification settings - Fork 64
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
Enable pickling for LLVMDouble class #213
Conversation
You're (insanely) fast @isuruf :) -- I was just going to start looking into this. |
symengine/lib/symengine_wrapper.pyx
Outdated
@@ -4369,7 +4369,7 @@ cdef class _Lambdify(object): | |||
cdef vector[int] accum_out_sizes | |||
cdef object numpy_dtype | |||
|
|||
def __init__(self, args, *exprs, cppbool real=True, order='C', cppbool cse=False): | |||
def __init__(self, args, *exprs, cppbool real=True, order='C', cppbool cse=False, cppbool load=False): |
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.
maybe we should name the kwarg _load
to signal that end-users should be touching it?
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.
Good suggestion. I'll change this
@@ -4639,6 +4661,8 @@ IF HAVE_SYMENGINE_LLVM: | |||
addr2 = cast(<size_t>&self.lambda_double[0], c_void_p) | |||
return create_low_level_callable(self, addr1, addr2) | |||
|
|||
def llvm_loading_func(*args): | |||
return LLVMDouble(args, _load=True) |
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.
Actually I think the _load
kwarg could go into __cinit__
if we cdef
the return value here:
def llvm_loading_func(*args):
cdef LLVMDouble llvm_double = LLVMDouble(args, _load=True)
return llvm_double
(untested)
cf. e.g. this
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 I follow. Can you elaborate more? (Or a PR. 😃)
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's not important (actually not sure it matters much), so let's leave it for now (and I can try to make a PR against master after this is merged if I can find a way to hide the _load kwarg).
Somewhat unrelated: in SymEngine (the C++ library) all EDIT: I just saw #205, I guess that is the place for this discussion. |
I know nothing about serialization in C++. Can you open an issue about it in the C++ repo, so that we can ask those who know about it? |
I opened symengine/symengine#1394 |
Fixes #212