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

fix:don't assume that arma::eig_sym() always succeeds #2088

Merged
merged 3 commits into from
Feb 8, 2020

Conversation

jeffin143
Copy link
Member

Handling : #1840

@conradsnicta - Let me know if I am missed something.

Copy link
Member

@rcurtin rcurtin left a comment

Choose a reason for hiding this comment

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

Hey @jeffin143, thanks for handling this! Just a couple comments, let me know if I can clarify them further. :)

src/mlpack/core/math/lin_alg.cpp Outdated Show resolved Hide resolved
src/mlpack/methods/gmm/positive_definite_constraint.hpp Outdated Show resolved Hide resolved
@rcurtin
Copy link
Member

rcurtin commented Dec 28, 2019

Hey @jeffin143, just wanted to see if you had had a chance to look into this one. I think it's really close and we could have it merged quickly and resolve #1840. :)

@jeffin143
Copy link
Member Author

@rcurtin , slightly busy with Christmas seasons and new year :) , will take a look by 5th Jan and close the issue

@rcurtin
Copy link
Member

rcurtin commented Dec 28, 2019

@jeffin143 no worries, enjoy the Christmas season. Just wanted to make sure it hadn't fallen off your list or anything. :)

@mlpack-bot
Copy link

mlpack-bot bot commented Jan 27, 2020

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions! 👍

@mlpack-bot mlpack-bot bot added the s: stale label Jan 27, 2020
@zoq
Copy link
Member

zoq commented Jan 28, 2020

Let's keep the issue open.

@mlpack-bot mlpack-bot bot removed the s: stale label Jan 28, 2020
@jeffin143
Copy link
Member Author

This is ready to be reviewed, Let's get this off the list

covariance = arma::symmatu(covariance);
if (!arma::eig_sym(eigenvalues, eigenvectors, covariance))
{
Log::Warn << "applying to constraint could not be accomplished."
Copy link
Member

Choose a reason for hiding this comment

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

If arma::eig_sym() fails, eigval is reset so that it has no elements -- see the eig_sym() documentation.

So I don't think we can recover from that, I guess instead we could throw a std::runtime_error?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I would agree with that. The same is true for all the other situations too, in my opinion. You could use Log::Fatal too, that throws a std::runtime_error; or you can directly throw a std::runtime_error---personally I don't have a preference which.

Copy link
Member Author

Choose a reason for hiding this comment

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

The issue have been resolved, changed all occurrences of Log::warn with Log::fatal

Copy link
Member

@rcurtin rcurtin left a comment

Choose a reason for hiding this comment

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

@jeffin143 thanks for working on it---I agree, let's get it off the list. :)

covariance = arma::symmatu(covariance);
if (!arma::eig_sym(eigenvalues, eigenvectors, covariance))
{
Log::Warn << "applying to constraint could not be accomplished."
Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I would agree with that. The same is true for all the other situations too, in my opinion. You could use Log::Fatal too, that throws a std::runtime_error; or you can directly throw a std::runtime_error---personally I don't have a preference which.

Copy link
Member

@zoq zoq left a comment

Choose a reason for hiding this comment

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

Thanks for looking into this one, no further comments from my side.

Copy link

@mlpack-bot mlpack-bot bot left a comment

Choose a reason for hiding this comment

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

Second approval provided automatically after 24 hours. 👍

Copy link
Member

@rcurtin rcurtin left a comment

Choose a reason for hiding this comment

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

Awesome, great to have this solved! Thank you @jeffin143. 👍

@rcurtin rcurtin merged commit 034bf1c into mlpack:master Feb 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants