diff options
author | Ulrich Bauer <mail@ulrich-bauer.org> | 2019-07-26 09:58:08 +0200 |
---|---|---|
committer | Ulrich Bauer <mail@ulrich-bauer.org> | 2019-07-26 09:58:08 +0200 |
commit | 71eb0504440143b5a3d3636342310054923b6d15 (patch) | |
tree | f0215d4594b0a0f6926fe975c33ab4f91c3eab12 | |
parent | 63900ffee56d2fec6e847977cd1380b952e1bfb4 (diff) |
changed index_t to size_t for several loop variables
-rw-r--r-- | ripser.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -221,8 +221,8 @@ template <compressed_matrix_layout Layout> struct compressed_distance_matrix { : distances(mat.size() * (mat.size() - 1) / 2), rows(mat.size()) { init_rows(); - for (index_t i = 1; i < size(); ++i) - for (index_t j = 0; j < i; ++j) rows[i][j] = mat(i, j); + for (size_t i = 1; i < size(); ++i) + for (size_t j = 0; j < i; ++j) rows[i][j] = mat(i, j); } value_t operator()(const index_t i, const index_t j) const; @@ -235,7 +235,7 @@ typedef compressed_distance_matrix<UPPER_TRIANGULAR> compressed_upper_distance_m template <> void compressed_lower_distance_matrix::init_rows() { value_t* pointer = &distances[0]; - for (index_t i = 1; i < size(); ++i) { + for (size_t i = 1; i < size(); ++i) { rows[i] = pointer; pointer += i; } @@ -243,7 +243,7 @@ template <> void compressed_lower_distance_matrix::init_rows() { template <> void compressed_upper_distance_matrix::init_rows() { value_t* pointer = &distances[0] - 1; - for (index_t i = 0; i < size() - 1; ++i) { + for (size_t i = 0; i < size() - 1; ++i) { rows[i] = pointer; pointer += size() - i - 2; } @@ -275,8 +275,8 @@ struct sparse_distance_matrix { sparse_distance_matrix(const DistanceMatrix& mat, const value_t threshold) : neighbors(mat.size()), num_edges(0) { - for (index_t i = 0; i < size(); ++i) - for (index_t j = 0; j < size(); ++j) + for (size_t i = 0; i < size(); ++i) + for (size_t j = 0; j < size(); ++j) if (i != j && mat(i, j) <= threshold) { ++num_edges; neighbors[i].push_back({j, mat(i, j)}); @@ -608,7 +608,7 @@ public: #ifdef INDICATE_PROGRESS std::chrono::steady_clock::time_point next = std::chrono::steady_clock::now() + time_step; #endif - for (index_t index_column_to_reduce = 0; index_column_to_reduce < columns_to_reduce.size(); + for (size_t index_column_to_reduce = 0; index_column_to_reduce < columns_to_reduce.size(); ++index_column_to_reduce) { diameter_entry_t column_to_reduce(columns_to_reduce[index_column_to_reduce], 1); @@ -889,7 +889,7 @@ sparse_distance_matrix read_sparse_distance_matrix(std::istream& input_stream) { } } - for (index_t i = 0; i < neighbors.size(); ++i) + for (size_t i = 0; i < neighbors.size(); ++i) std::sort(neighbors[i].begin(), neighbors[i].end()); return sparse_distance_matrix(std::move(neighbors), num_edges); @@ -1097,9 +1097,9 @@ int main(int argc, char** argv) { if (threshold == std::numeric_limits<value_t>::max()) { value_t enclosing_radius = std::numeric_limits<value_t>::infinity(); - for (index_t i = 0; i < dist.size(); ++i) { + for (size_t i = 0; i < dist.size(); ++i) { value_t r_i = -std::numeric_limits<value_t>::infinity(); - for (index_t j = 0; j < dist.size(); ++j) r_i = std::max(r_i, dist(i, j)); + for (size_t j = 0; j < dist.size(); ++j) r_i = std::max(r_i, dist(i, j)); enclosing_radius = std::min(enclosing_radius, r_i); } threshold = enclosing_radius; |