diff options
author | Ulrich Bauer <mail@ulrich-bauer.org> | 2016-12-17 14:05:20 +0100 |
---|---|---|
committer | Ulrich Bauer <mail@ulrich-bauer.org> | 2016-12-17 14:05:20 +0100 |
commit | 8b42fb2a7885b0e371ff6b0e1bbe31332ae63adb (patch) | |
tree | 2a7926fc79cb175ac382c97843141efd4e39621d /ripser.cpp | |
parent | d32402d37998dd0d2c24be8e5a139ebc525a0a56 (diff) |
cleanup compressed distance matrix access
Diffstat (limited to 'ripser.cpp')
-rw-r--r-- | ripser.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -206,13 +206,11 @@ template <> void compressed_distance_matrix<UPPER_TRIANGULAR>::init_rows() { } template <> value_t compressed_distance_matrix<UPPER_TRIANGULAR>::operator()(index_t i, index_t j) const { - if (i > j) std::swap(i, j); - return i == j ? 0 : rows[i][j]; + return i == j ? 0 : i > j ? rows[j][i] : rows[i][j]; } template <> value_t compressed_distance_matrix<LOWER_TRIANGULAR>::operator()(index_t i, index_t j) const { - if (i > j) std::swap(i, j); - return i == j ? 0 : rows[j][i]; + return i == j ? 0 : i < j ? rows[j][i] : rows[i][j]; } typedef compressed_distance_matrix<LOWER_TRIANGULAR> compressed_lower_distance_matrix; |