Add type_caster classes for xt::xtensor, xt::xarray, and xt::xexpression.#113
Conversation
They enable casing ndarray to xexpression<pyarray> and casing xarray to ndarray
|
Thanks @yoshipon, we really like this solution. |
|
The main remark is about code formatting. Our convention is the following Regarding formatting, here is the current convention: namespace bar
{ // indent in namespace
class Foo
{ // new line before {
public:
// empty line after public / private / protected
Foo();
};
Foo::Foo()
{
}
} // no use of PYBIND macros for NAMESPACE_END NAMESPACE_BEGIN |
|
@SylvainCorlay Thank you for the comments. |
|
@yoshipon Thanks for this PR. Not sure about that, but the errors may be due to the fact that we do not use the same versions of pybind. The CI (travis and appveyor) install |
|
@JohanMabille Exactly, my code could not be compiled with pybind11 2.1.1 due to the following two reasons:
I fixed these bugs. However, even now there are several problems on Travis CI, I'm still working for debugging. |
|
The Travis CI errors seem to be coming from the new miniconda that was released yesterday. (Hence the build flag which seem to come from their python/distutils build). Downloading |
|
@SylvainCorlay Thank you for the information. I re-pushed with a modified |
|
Success! For your information, I have reported the issue upstream the new miniconda build (in their gitter channel). |
|
Merging 🎉 congrats on your first PR into xtensor! |
|
@yoshipon regardin the xtensor/xarray to ndarray cast, one thing that we will probably try to do before the next release is not make use of It should probably be a matter of adding a constructor to |
|
@SylvainCorlay Thank you very much! Actually, this is my first PR. It was very impressive. |
They enable casing
ndarraytoxt::xexpression<xt::pyarray>and casingxt::xarraytondarray.With the following code,
the Foo.x can be modified from python as follows: