From da86ef5fa75cb998b91e881c5a2455cd2a06c4f9 Mon Sep 17 00:00:00 2001 From: hschreiber Date: Wed, 25 Sep 2024 11:03:04 +0200 Subject: [PATCH] add std:: to size_t --- .../example_zzfiltration_from_file.cpp | 4 +- .../oscillating_rips_iterators.h | 56 +++++++++---------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/Zigzag_persistence/example/example_zzfiltration_from_file.cpp b/src/Zigzag_persistence/example/example_zzfiltration_from_file.cpp index 333194be6..4e04f2b00 100644 --- a/src/Zigzag_persistence/example/example_zzfiltration_from_file.cpp +++ b/src/Zigzag_persistence/example/example_zzfiltration_from_file.cpp @@ -27,7 +27,7 @@ lineType read_operation(std::string& line, std::vector& faces, double faces.clear(); ID_handle num; - size_t current = line.find_first_not_of(' ', 0); + std::size_t current = line.find_first_not_of(' ', 0); if (current == std::string::npos) return COMMENT; if (line[current] == 'i') @@ -46,7 +46,7 @@ lineType read_operation(std::string& line, std::vector& faces, double std::clog << "(2) Syntaxe error in file." << std::endl; exit(0); } - size_t next = line.find_first_of(' ', current); + std::size_t next = line.find_first_of(' ', current); timestamp = std::stod(line.substr(current, next - current)); current = line.find_first_not_of(' ', next); diff --git a/src/Zigzag_persistence/include/gudhi/Zigzag_persistence/oscillating_rips_iterators.h b/src/Zigzag_persistence/include/gudhi/Zigzag_persistence/oscillating_rips_iterators.h index 60e085250..d37bab5f3 100644 --- a/src/Zigzag_persistence/include/gudhi/Zigzag_persistence/oscillating_rips_iterators.h +++ b/src/Zigzag_persistence/include/gudhi/Zigzag_persistence/oscillating_rips_iterators.h @@ -346,7 +346,7 @@ class Oscillating_rips_edge_range Filtration_value nu_; /**< Lower multiplier. */ Filtration_value mu_; /**< Upper multiplier. */ Zigzag_edge currentEdge_; /**< Stores the current edge in the range. */ - size_t epsilonIndex_, rowIndex_, columnIndex_; /**< Indices indicating the next position in the range. */ + std::size_t epsilonIndex_, rowIndex_, columnIndex_; /**< Indices indicating the next position in the range. */ bool inPositiveDirection_, insertVertex_; /**< Next direction and indicates if next ''edge'' is a vertex. */ /** @@ -521,7 +521,7 @@ class Oscillating_rips_edge_range * @param i Epsilon value index. * @param direction Direction. */ - void _update_edge(size_t i, bool direction) + void _update_edge(std::size_t i, bool direction) { if constexpr (EdgeModifier::isActive_) currentEdge_.set(distanceMatrix_[rowIndex_][columnIndex_].first, @@ -589,7 +589,7 @@ class Oscillating_rips_edge_range // only at the very last step of the oscillating Rips filtration. std::vector > > edgesAdded, edgesRemoved; - size_t number_of_arrows = _compute_edges(nu, mu, epsilonValues, distanceMatrix, edgesAdded, edgesRemoved); + std::size_t number_of_arrows = _compute_edges(nu, mu, epsilonValues, distanceMatrix, edgesAdded, edgesRemoved); // Now, sort edges according to lengths, and put everything in edgeFiltration edgeFiltration.clear(); @@ -602,7 +602,7 @@ class Oscillating_rips_edge_range true); // epsilonValues[0], true); - for (size_t i = 0; i < n - 1; ++i) { // all ascending arrows eps_i + for (std::size_t i = 0; i < n - 1; ++i) { // all ascending arrows eps_i if constexpr (EdgeModifier::isActive_) { edgeFiltration.emplace_back(i + 1, i + 1, @@ -815,7 +815,7 @@ class Oscillating_rips_edge_range { GUDHI_CHECK((nu <= mu) && (nu >= 0), "Invalid parameters mu and nu"); - size_t n = points.size(); // number of points + std::size_t n = points.size(); // number of points PointRange sortedPoints; sortedPoints.reserve(n); @@ -873,16 +873,16 @@ class Oscillating_rips_edge_range static std::vector _compute_epsilon_values(const PointRange& sortedPoints, DistanceFunction&& distance) { - size_t n = sortedPoints.size(); + std::size_t n = sortedPoints.size(); std::vector eps_range(n, std::numeric_limits::infinity()); // compute all \f$\varepsilon_i\f$ values, such that eps_range[i] == // eps_i==d_H(P_i,P), for i=0 ... n-1: - for (size_t i = 0; i < n; ++i) { + for (std::size_t i = 0; i < n; ++i) { // entering step i, maintain eps_range[j] = eps_j for j= i. #ifdef GUDHI_USE_TBB - tbb::parallel_for(size_t(i + 1), n, [&](size_t k) { + tbb::parallel_for(std::size_t(i + 1), n, [&](std::size_t k) { // set eps_range[k] <- d(p_k, P_i) == // min{ d(p_k, P_{i-1}), d(p_k, p_i) } for k >= i. double dist_i_k = distance(sortedPoints[i], sortedPoints[k]); @@ -891,7 +891,7 @@ class Oscillating_rips_edge_range } }); #else - for (size_t k = i + 1; k < n; ++k) { + for (std::size_t k = i + 1; k < n; ++k) { // set eps_range[k] <- d(p_k, P_i) == // min{ d(p_k, P_{i-1}), d(p_k, p_i) } for k >= i. double dist_i_k = distance(sortedPoints[i], sortedPoints[k]); @@ -904,7 +904,7 @@ class Oscillating_rips_edge_range // to do: implement parallel version by dividing the vector // set eps_range[i] <- eps_i = d_H(P_i,P) = max_{k>i} d(p_k, P_i) double eps_i = 0.; - for (size_t k = i + 1; k < n; ++k) { + for (std::size_t k = i + 1; k < n; ++k) { if (eps_range[k] > eps_i) { eps_i = eps_range[k]; } @@ -936,10 +936,10 @@ class Oscillating_rips_edge_range { std::vector > > distanceMatrix(sortedPoints.size()); #ifdef GUDHI_USE_TBB - tbb::parallel_for(size_t(0), sortedPoints.size(), [&](size_t i) { + tbb::parallel_for(std::size_t(0), sortedPoints.size(), [&](std::size_t i) { // distanceMatrix[i] = std::vector< std::pair >(); distanceMatrix[i].resize(i); - for (size_t j = 0; j < i; ++j) { + for (std::size_t j = 0; j < i; ++j) { distanceMatrix[i][j] = std::make_pair(j, distance(sortedPoints[i], sortedPoints[j])); } // distanceMatrix[i] is sorted by (j, d(p_i,p_j)) < (k, d(p_i,p_k)) iff @@ -947,10 +947,10 @@ class Oscillating_rips_edge_range std::stable_sort(distanceMatrix[i].begin(), distanceMatrix[i].end(), Point_distance_comp()); }); #else - for (size_t i = 0; i < sortedPoints.size(); ++i) { // for all vertices + for (std::size_t i = 0; i < sortedPoints.size(); ++i) { // for all vertices // distanceMatrix[i] = std::vector< std::pair >(); distanceMatrix[i].resize(i); - for (size_t j = 0; j < i; ++j) { + for (std::size_t j = 0; j < i; ++j) { distanceMatrix[i][j] = std::make_pair(j, distance(sortedPoints[i], sortedPoints[j])); } std::stable_sort(distanceMatrix[i].begin(), distanceMatrix[i].end(), Point_distance_comp()); @@ -973,14 +973,14 @@ class Oscillating_rips_edge_range * * @return Total number of edges. */ - static size_t _compute_edges(Filtration_value nu, - Filtration_value mu, - const std::vector& epsilonValues, - std::vector > >& distanceMatrix, - std::vector > >& edgesAdded, - std::vector > >& edgesRemoved) + static std::size_t _compute_edges(Filtration_value nu, + Filtration_value mu, + const std::vector& epsilonValues, + std::vector > >& distanceMatrix, + std::vector > >& edgesAdded, + std::vector > >& edgesRemoved) { - size_t number_of_arrows = 0; + std::size_t number_of_arrows = 0; auto n = epsilonValues.size(); edgesAdded.resize(n); edgesRemoved.resize(n); @@ -994,7 +994,7 @@ class Oscillating_rips_edge_range // R({p_0, ... , p_{i+1}}, mu * eps_i) <- R({p_0, ... , p_{i+1}}, nu * eps_{i+1}) #ifdef GUDHI_USE_TBB // no need to consider the case i=n-1 in an oscillating Rips filtration - tbb::parallel_for(size_t(0), n - 1, [&](size_t i) { + tbb::parallel_for(std::size_t(0), n - 1, [&](std::size_t i) { typename std::vector >::iterator it; //----edgesAdded[i]: // consider first all edges added in inclusion: @@ -1002,7 +1002,7 @@ class Oscillating_rips_edge_range // i.e., all (p_j,p_k) with 0 <= k < j <= i with // nu eps_i < d(p_j,p_k) <= mu eps_i // these new edges get filtration value epsilonValues[i] - for (size_t j = 1; j <= i; ++j) { + for (std::size_t j = 1; j <= i; ++j) { // get very first edge (k,j), over all k >::iterator it; - for (size_t i = 0; i < n - 1; ++i) { + for (std::size_t i = 0; i < n - 1; ++i) { //----edgesAdded[i]: // consider first all edges added in inclusion: // R({p_0, ... , p_i}, nu * eps_i) -> R({p_0, ... , p_i}, mu * eps_i), // i.e., all (p_j,p_k) with 0 <= k < j <= i with // nu eps_i < d(p_j,p_k) <= mu eps_i // these new edges get filtration value epsilonValues[i] - for (size_t j = 1; j <= i; ++j) { + for (std::size_t j = 1; j <= i; ++j) { // get very first edge (k,j), over all k currentSimplices_; /**< Stores current simplex handles. */ StableFilteredComplex* complex_; /**< Pointer to the complex. */ - size_t currentSimplexIndex_; /**< Index to current position in currentSimplices_. */ + std::size_t currentSimplexIndex_; /**< Index to current position in currentSimplices_. */ EdgeRangeIterator currentEdgeIt_; /**< Iterator pointing to the next edge. */ EdgeRangeIterator endEdgeIt_; /**< End edge iterator. */ bool currentDirection_; /**< Current direction. */