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

tickets/DM-16384 #72

Merged
merged 1 commit into from Nov 3, 2018
Merged

tickets/DM-16384 #72

merged 1 commit into from Nov 3, 2018

Conversation

natelust
Copy link
Contributor

Update Mixure api to use Eigen

Add Eigen interfaces to some Mixure methods in addition to ndarray
interfaces

Copy link
Member

@TallJimbo TallJimbo left a comment

Choose a reason for hiding this comment

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

Looks good! Just a couple of minor style comments.

(void (Mixture::*)(ndarray::Array<Scalar const, 1, 1> const &,
ndarray::Array<Scalar,1,1> const &,
ndarray::Array<Scalar,2,1> const &) const)
&Mixture::evaluateDerivatives, "x"_a, "gradient"_a, "hessian"_a);
Copy link
Member

Choose a reason for hiding this comment

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

Should use py::overload_cast instead.

hessian.deep() = 0.0;
gradient.setZero();

if (computeHessian) {
Copy link
Member

Choose a reason for hiding this comment

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

Might want to add an assert(hessian) here if internal logic is supposed to guarantee that it's always nonnull when computeHessian is true, or an exception-throwing check if there's no internal guarantee on that.

void evaluateDerivativesImpl(A const & x,
B & gradient,
C * hessian,
bool computeHessian = true) const;
Copy link
Member

Choose a reason for hiding this comment

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

Might want to start this with an underscores (we aren't universally consistent about whether to do that on all private methods, but we do seem to be doing it in other methods in this class).

Add Eigen interfaces to some Mixure methods in addition to ndarray
interfaces
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants