8000 reducer: add keep dims option by wolfv · Pull Request #1312 · xtensor-stack/xtensor · GitHub
[go: up one dir, main page]

Skip to content

reducer: add keep dims option #1312

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

Closed
wants to merge 9 commits into from

Conversation

wolfv
Copy link
Member
@wolfv wolfv commented Dec 18, 2018

No description provided.

@wolfv wolfv changed the title Reducer: add keep dims option WIP reducer: add keep dims option Dec 18, 2018
@wolfv wolfv force-pushed the reducer_keep_dims branch from 2e36570 to 6ee8d78 Compare January 13, 2019 11:06
@wolfv wolfv force-pushed the reducer_keep_dims branch 3 times, most recently from b34cad8 to 98b0e55 Compare January 30, 2019 11:26
@wolfv wolfv changed the title WIP reducer: add keep dims option reducer: add keep dims option Jan 30, 2019
@wolfv wolfv force-pushed the reducer_keep_dims branch from c105445 to 2617025 Compare February 21, 2019 13:02
@wolfv
Copy link
Member Author
wolfv commented Feb 21, 2019

@JohanMabille can we merge this one for the 0.20 branch!?

{
};

struct _immediate : xt::detail::option_base {};
Copy link
Member

Choose a reason for hiding this comment

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

names starting with _ are reserved for the standard. This could be replaced with immediate_t for instance.


template <class ST, class X>
struct xreducer_shape_type;
struct _keep_dims : xt::detail::option_base {};
Copy link
Member

Choose a reason for hiding this comment

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

Same remarke regarding the name starting with _.

inline void shape_computation(RS& result_shape, R& result, E& expr,
const AX& axes, std::enable_if_t<!detail::is_fixed<RS>::value, int> = 0)
{
if (KD())
Copy link
Member

Choose a reason for hiding this comment

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

It's a bit weird to mix std::false_type with reducer options unrelated to boolean constants (and rely on their conversion to bool). Besides, this is true for any value of KD that do not implement a boolean conversion operator returning false. If the KD template parameter cannot be changed for a bool compile-time value, a static constexpr function comparing KD with keep_dims option would be more expressive.

@wolfv wolfv force-pushed the reducer_keep_dims branch from 4114767 to 7adb4e8 Compare March 21, 2019 14:44
@JohanMabille
Copy link
Member

Superseded by #1474

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.

2 participants
0