-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make contiguous_slice a special instance of cstride_slice
This makes the code much simpler to reason about and removes a lot of redundancy between contiguous_slice and cstride_slice.
- Loading branch information
1 parent
c991b29
commit 7158247
Showing
21 changed files
with
168 additions
and
486 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
@@ -1,20 +1,20 @@ | ||
#ifndef PYTHONIC_INCLUDE_NUMPY_FLIPLR_HPP | ||
#define PYTHONIC_INCLUDE_NUMPY_FLIPLR_HPP | ||
|
||
#include "pythonic/include/utils/functor.hpp" | ||
#include "pythonic/include/types/ndarray.hpp" | ||
#include "pythonic/include/utils/functor.hpp" | ||
|
||
PYTHONIC_NS_BEGIN | ||
|
||
namespace numpy | ||
{ | ||
template <class E> | ||
auto fliplr(E &&expr) -> decltype(std::forward<E>(expr)( | ||
types::contiguous_slice{builtins::None, builtins::None}, | ||
types::cstride_slice<1>{builtins::None, builtins::None}, | ||
types::slice{builtins::None, builtins::None, -1})); | ||
|
||
DEFINE_FUNCTOR(pythonic::numpy, fliplr); | ||
} | ||
} // namespace numpy | ||
PYTHONIC_NS_END | ||
|
||
#endif |
This file contains 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 |
---|---|---|
@@ -1,20 +1,20 @@ | ||
#ifndef PYTHONIC_INCLUDE_NUMPY_TRIMZEROS_HPP | ||
#define PYTHONIC_INCLUDE_NUMPY_TRIMZEROS_HPP | ||
|
||
#include "pythonic/include/utils/functor.hpp" | ||
#include "pythonic/include/types/numpy_gexpr.hpp" | ||
#include "pythonic/include/utils/functor.hpp" | ||
|
||
PYTHONIC_NS_BEGIN | ||
|
||
namespace numpy | ||
{ | ||
template <class T> | ||
|
||
types::numpy_gexpr<T, types::contiguous_normalized_slice> | ||
types::numpy_gexpr<T, types::cstride_normalized_slice<1>> | ||
trim_zeros(T const &expr, types::str const &trim = "fb"); | ||
|
||
DEFINE_FUNCTOR(pythonic::numpy, trim_zeros) | ||
} | ||
} // namespace numpy | ||
PYTHONIC_NS_END | ||
|
||
#endif |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.