Skip to content

Commit 1ee58d1

Browse files
authored
fix spaces, add function parameter
1 parent f70e447 commit 1ee58d1

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

include/matrix_operations/EigenvaluesProblems.h

+4-6
Original file line numberDiff line numberDiff line change
@@ -442,19 +442,17 @@ class EigenvaluesProblems<NT, Eigen::Matrix<NT,Eigen::Dynamic,Eigen::Dynamic>, E
442442
/// Check if a matrix is indeed a correlation matrix
443443
/// return true if input matrix is found to be a correlation matrix
444444
/// |param[in] matrix
445-
bool is_correlation_matrix(const MT& matrix){
446-
447-
const double tol = 1e-8;
445+
bool is_correlation_matrix(const MT& matrix, const double tol = 1e-8){
448446

449447
//check if all the diagonal elements are ones
450-
for(int i=0 ; i<matrix.rows() ; i++){
451-
if(std::abs(matrix(i, i)-1.0) > tol){
448+
for (int i=0 ; i<matrix.rows() ; i++){
449+
if (std::abs(matrix(i, i)-1.0) > tol){
452450
return false;
453451
}
454452
}
455453

456454
//check if the matrix is positive definite
457-
if(isPositiveSemidefinite(matrix)) return true;
455+
if (isPositiveSemidefinite(matrix)) return true;
458456

459457
return false;
460458
}

0 commit comments

Comments
 (0)