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

Feature/lazy get #4358

Merged
merged 1 commit into from Jul 8, 2018
Merged

Conversation

karlnapf
Copy link
Member

@karlnapf karlnapf commented Jul 6, 2018

No description provided.

@karlnapf
Copy link
Member Author

karlnapf commented Jul 6, 2018

@lisitsyn your stuff in action
@shubham808 @FaroukY @vinx13 here is how you can now port examples that use method calls in machines that are not part of CMachine's interface: you register then as lazy methods and then can just use get.

@@ -726,6 +731,22 @@ class CSGObject
std::bind(method, dynamic_cast<const S*>(this));
create_parameter(tag, AnyParameter(make_any(bind_method), properties));
}

/** Puts a pointer to a (lazily evaluated) function into the parameter map.
Copy link
Member Author

Choose a reason for hiding this comment

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

@lisitsyn there is the question whether we really want to allow this for non-const methods ---- they might alter the state of the object, which probably is not what you would expect from a get

Copy link
Member Author

Choose a reason for hiding this comment

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

but for this example, due to some weird design, get_cluster_centers is actually non-const and it cannot easily be made const since it calls get_lhs on the internal distance object, which increases the reference counter, which cannot be const. gna!
Object counter inside SGObject are not really ideas. ... is there maybe a way to fix this nicely?

@karlnapf karlnapf merged commit 56b78da into shogun-toolbox:develop Jul 8, 2018
@karlnapf karlnapf deleted the feature/lazy_get branch July 8, 2018 09:40
ktiefe pushed a commit to ktiefe/shogun that referenced this pull request Jul 30, 2019
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.

None yet

1 participant