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 #100

Merged
merged 2 commits into from May 6, 2019

Conversation

@conradsnicta
Copy link
Contributor

commented Apr 5, 2019

if we assume arma::eig_sym() succeeds, but in fact it fails, accessing elements in the evals vector will result either in a crash or an out-of-bounds error.

conradsnicta added some commits Apr 5, 2019

@rcurtin
Copy link
Member

left a comment

Thanks, this looks good to me. When it gets merged I'll be sure to add a note to HISTORY.md (unless you want to, but don't feel obligated). I saw one other use of eig_sym(), but a quick glance at the code suggests it will not crash if eig_sym() does not succeed.

@zoq

zoq approved these changes Apr 12, 2019

const auto evals = arma::eig_sym(X);
return (evals(0) > 1e-20);
arma::vec evals;
if(!arma::eig_sym(evals, X))

This comment has been minimized.

Copy link
@zoq

zoq Apr 12, 2019

Member

Just a minor style issue, missing space right after the `ìf``, can be fixed in the merge process.

@conradsnicta conradsnicta merged commit 3f4ee70 into mlpack:master May 6, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.