diff options
author | Ulrich Bauer <ulrich.bauer@tum.de> | 2016-08-04 10:46:51 +0200 |
---|---|---|
committer | Ulrich Bauer <ulrich.bauer@tum.de> | 2016-08-04 10:46:51 +0200 |
commit | b9094739598846b0e61642351d10deb48bf23dcf (patch) | |
tree | 8e90ad9e903cf3bdaa1770fcfe6d672e3ffa6405 /ripser.cpp | |
parent | 28cc281ad7a051077fa710406868e875c1476ce5 (diff) |
precompute distance in point cloud
Diffstat (limited to 'ripser.cpp')
-rw-r--r-- | ripser.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -778,11 +778,22 @@ int main(int argc, char** argv) { if (!point.empty()) points.push_back(point); } - euclidean_distance_matrix dist(std::move(points)); - index_t n = dist.size(); + euclidean_distance_matrix eucl_dist(std::move(points)); + + index_t n = eucl_dist.size(); std::cout << "point cloud with " << n << " points" << std::endl; + std::vector<value_t> distances; + + for (int i = 0; i < n; ++i) + for (int j = 0; j < i; ++j) + if (i > j) distances.push_back(eucl_dist(i,j)); + + compressed_lower_distance_matrix dist(std::move(distances)); + + std::cout << "distance matrix with " << n << " points" << std::endl; + #endif #ifdef FILE_FORMAT_LOWER_TRIANGULAR_CSV |