Skip to content

Commit

Permalink
Note why we use minCoeff in matrix_is_pos_semidef
Browse files Browse the repository at this point in the history
  • Loading branch information
kdm9 committed Jan 10, 2016
1 parent 913df63 commit cd26a8c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/kwip-utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ bool
matrix_is_pos_semidef(MatrixXd &mat)
{
VectorXd eigenvalues = mat.eigenvalues().real();
// To be PSD, all eigenvalues must be greater than negative 1e-5. So check
// that the smallest is (as (eigenvalues > -1e-5).all() doesn't work).
return eigenvalues.minCoeff() > -1e-5;
}

Expand Down

0 comments on commit cd26a8c

Please sign in to comment.