FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix build error caused by upstream xtensor change (in xtensor master) by yungyuc · Pull Request #209 · xtensor-stack/xtensor-python · GitHub

Repository navigation

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .hpp  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
22 changes: 22 additions & 0 deletions include/xtensor-python/pycontainer.hpp
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
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ namespace xt
void reshape(S&& shape, layout_type layout = base_type::static_layout);

layout_type layout() const;
bool is_contiguous() const noexcept;

using base_type::operator();
using base_type::operator[];
Expand Down Expand Up @@ -442,6 +443,27 @@ namespace xt
}
}

/**
* Return whether or not the container uses contiguous buffer
* @return Boolean for contiguous buffer
*/
template <class D>
inline bool pycontainer<D>::is_contiguous() const noexcept
{
if (PyArray_CHKFLAGS(python_array(), NPY_ARRAY_C_CONTIGUOUS))
{
return 1 == this->strides().back();

yungyuc Oct 9, 2019 •
edited
Loading

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I assume this->strides() cannot be empty, and the element cannot be 0.

}
else if (PyArray_CHKFLAGS(python_array(), NPY_ARRAY_F_CONTIGUOUS))
{
return 1 == this->strides().front();
}
else
{
return false;
}
}

/**
* Import the numpy Python module.
*/
Expand Down

Back | FazBrowse Home | New Git URL