Skip to content

Commit 322f794

Browse files
authored
fixed indentation and code style
1 parent e7e8252 commit 322f794

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

examples/correlation_matrices/sampler.cpp

+16-11
Original file line numberDiff line numberDiff line change
@@ -91,22 +91,27 @@ void write_to_file(std::string filename, std::vector<PointType> const& randPoint
9191

9292
bool is_correlation_matrix(const MT& matrix){
9393

94-
const double tol = 1e-8;
95-
96-
//check if all the diagonal elements are ones
97-
for(int i=0 ; i<matrix.rows() ; i++){
98-
if(std::abs(matrix(i, i)-1.0) > tol){
99-
return false;
100-
}
94+
const double tol = 1e-8;
95+
96+
//check if all the diagonal elements are ones
97+
for(int i=0 ; i<matrix.rows() ; i++)
98+
{
99+
if(std::abs(matrix(i, i)-1.0) > tol)
100+
{
101+
return false;
101102
}
103+
}
102104

103105
//check if the matrix is positive definite
104-
Eigen::SelfAdjointEigenSolver<MT> eigen_solver(matrix);
106+
Eigen::SelfAdjointEigenSolver<MT> eigen_solver(matrix);
105107

106-
if(eigen_solver.info() != Eigen::Success) return false;
108+
if(eigen_solver.info() != Eigen::Success)
109+
{
110+
return false;
111+
}
107112

108-
//the matrix is positive definite if all eigenvalues are positive
109-
return eigen_solver.eigenvalues().minCoeff() > -tol;
113+
//the matrix is positive definite if all eigenvalues are positive
114+
return eigen_solver.eigenvalues().minCoeff() > -tol;
110115
}
111116

112117
template<typename WalkType>

0 commit comments

Comments
 (0)