Skip to content

add binding for xtensor_fixed #276

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 4, 2022

Conversation

gouarin
Copy link
Member

@gouarin gouarin commented Mar 4, 2022

No description provided.

@tdegeus
Copy link
Member

tdegeus commented Mar 4, 2022

Awesome! LGTM

Copy link
Member

@JohanMabille JohanMabille left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! With a slight change to simplify the code it will be perfect ;)

static bool run(const B& buf)
{
auto shape = FSH();
for (std::size_t i = 0; i < shape.size(); ++i)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be simplified with std::equal

Copy link
Member Author

@gouarin gouarin Mar 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I implemented the first version with std::equal. The problem is that buf.shape()is not an iterator.

Copy link
Member

@JohanMabille JohanMabille Mar 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then you can use &(buf.shape(0)) and we should definitely open an issue on the pybind11 repo so that they provide an iterator API for the shape.

@JohanMabille JohanMabille merged commit 9cf4028 into xtensor-stack:master Mar 4, 2022
@gouarin gouarin deleted the add-xtensor-fixed branch March 4, 2022 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants