Skip to content
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

Convert DimensionReductionMethod to a class instead of enum #94

Merged
merged 6 commits into from
May 6, 2024

Conversation

lisitsyn
Copy link
Owner

@lisitsyn lisitsyn commented May 6, 2024

No description provided.

@lisitsyn lisitsyn requested a review from iglesias May 6, 2024 13:44
bool needs_features;
};

static const KFDTraits RequiresKernel{true, false, false};
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe here consider std::bitset<3>, it will look a bit more concise, I think particularly below in the lookup with traits.test(i) instead of std::get<i>(traits). Although for readability or expressiveness below, probably a struct with three names fields would be preferable. I think all three are good and probably prefer the bitset one most :-)

@iglesias
Copy link
Collaborator

iglesias commented May 6, 2024

This is a nice cleanup, substituting the METHOD_THAT_NEEDS... and IF_NEEDS.... Cool!

{ \
throw unsupported_method_error("Features callback is missed"); \
} \
if (method.is(X)) { \
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could this be method == X so that Method::is(const Method&) is not needed? Just wild-asking, it can be that the method is required in other parts of the code. I was thinking toward removing Method or at least the inheritance relationship there for a bit more of code reduction.

@lisitsyn lisitsyn merged commit 2ceea82 into main May 6, 2024
5 checks passed
@lisitsyn lisitsyn deleted the refactor/dr-methods branch May 6, 2024 15:42
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