summaryrefslogtreecommitdiff
path: root/src/Rips_complex/example
diff options
context:
space:
mode:
Diffstat (limited to 'src/Rips_complex/example')
-rw-r--r--src/Rips_complex/example/example_one_skeleton_rips_from_correlation_matrix.cpp22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/Rips_complex/example/example_one_skeleton_rips_from_correlation_matrix.cpp b/src/Rips_complex/example/example_one_skeleton_rips_from_correlation_matrix.cpp
index a34ce15c..1343f24d 100644
--- a/src/Rips_complex/example/example_one_skeleton_rips_from_correlation_matrix.cpp
+++ b/src/Rips_complex/example/example_one_skeleton_rips_from_correlation_matrix.cpp
@@ -34,24 +34,22 @@ int main() {
double threshold = 0;
for (size_t i = 0; i != correlations.size(); ++i) {
for (size_t j = 0; j != correlations[i].size(); ++j) {
- //Here we check if our data comes from corelation matrix.
- if ( (correlations[i][j]<-1) || (correlations[i][j]>1) )
- {
- std::cerr << "The input matrix is not a correlation matrix. The program will now terminate.\n";
- throw "The input matrix is not a correlation matrix. The program will now terminate.\n";
- }
- correlations[i][j] = 1 - correlations[i][j];
- //Here we make sure that we will get the treshold value equal to maximal
- //distance in the matrix.
- if ( correlations[i][j] > threshold )threshold = correlations[i][j];
- }
+ // Here we check if our data comes from corelation matrix.
+ if ((correlations[i][j] < -1) || (correlations[i][j] > 1)) {
+ std::cerr << "The input matrix is not a correlation matrix. The program will now terminate.\n";
+ throw "The input matrix is not a correlation matrix. The program will now terminate.\n";
+ }
+ correlations[i][j] = 1 - correlations[i][j];
+ // Here we make sure that we will get the treshold value equal to maximal
+ // distance in the matrix.
+ if (correlations[i][j] > threshold) threshold = correlations[i][j];
+ }
}
//-----------------------------------------------------------------------------
// Now the correlation matrix is a distance matrix and can be processed further.
//-----------------------------------------------------------------------------
Distance_matrix distances = correlations;
-
Rips_complex rips_complex_from_points(distances, threshold);