Skip to content

Commit

Permalink
updated tol as a function parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
atrayees authored Jun 12, 2024
1 parent 322f794 commit 56ea104
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions examples/correlation_matrices/sampler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,7 @@ void write_to_file(std::string filename, std::vector<PointType> const& randPoint
std::cout.rdbuf(coutbuf);
}

bool is_correlation_matrix(const MT& matrix){

const double tol = 1e-8;

bool is_correlation_matrix(const MT& matrix, const double tol = 1e-8){
//check if all the diagonal elements are ones
for(int i=0 ; i<matrix.rows() ; i++)
{
Expand All @@ -102,7 +99,7 @@ bool is_correlation_matrix(const MT& matrix){
}
}

//check if the matrix is positive definite
//check if the matrix is positive definite
Eigen::SelfAdjointEigenSolver<MT> eigen_solver(matrix);

if(eigen_solver.info() != Eigen::Success)
Expand Down

0 comments on commit 56ea104

Please sign in to comment.