Conversation
Marcel-Rodekamp
requested changes
May 7, 2024
|
|
||
| add_subdirectory(Documentation EXCLUDE_FROM_ALL) | ||
|
|
||
| add_subdirectory(Python) No newline at end of file |
Owner
There was a problem hiding this comment.
Add CMake option to turn off Python binding
Owner
There was a problem hiding this comment.
make install should move library to system directory @GioPede
|
|
||
| // Conversion from Python to C++ | ||
| bool load(handle src, bool) { | ||
| if (!isinstance<dict>(src)) { |
Owner
There was a problem hiding this comment.
should this be be py::dict?
| static handle cast(const Configuration<Type>& src, return_value_policy policy, handle parent) { | ||
| py::dict out_dict; | ||
| for (const auto& item : src) { | ||
| out_dict[item.first.c_str()] = py::cast(item.second, policy, parent); |
Owner
There was a problem hiding this comment.
check if c_str() is necessary, check that utf-8 is supported
| } | ||
|
|
||
| class SumAction : public NSL::Action::BaseAction<NSL::complex<double>, NSL::complex<double>>{ | ||
| py::args _baseActionList; |
Owner
There was a problem hiding this comment.
private block at end of class
Owner
There was a problem hiding this comment.
Consider rewriting the NSL::Action in a similar way to get rid of the variadic template
| } | ||
| } | ||
|
|
||
| #define STRINGIFY(x) #x |
Owner
There was a problem hiding this comment.
Delete Macro at end of file
| }); | ||
| } | ||
|
|
||
| void bindTensor(py::module &m) { |
Owner
There was a problem hiding this comment.
Check if this is still used
| @@ -39,5 +39,31 @@ class Integrator{ | |||
| NSL::Action::Action<ActionTermTypes...> action_; | |||
| }; | |||
|
|
|||
| .def("__call__", [](NSL::Integrator::Leapfrog<NSL::Python::SumAction> &integrator, py::args args){ | ||
| if (args.size() == 1){ | ||
| throw std::runtime_error("Invalid number of arguments"); | ||
| } else if (args.size() == 2){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The python interface is now at a point where we can completely generate MarkovChains from python. The purpose of this new feature is simplification of the workflow and accessibility to non power users.
The interface includes exposed classes and functions for:
And type casters:
An example can be found here.
Due to the amount of templates in our C++ code, some type specifications/simplifications were necessary.