Skip to content

Commit

Permalink
Drop empty templates.
Browse files Browse the repository at this point in the history
  • Loading branch information
bdice committed Jul 13, 2019
1 parent 536a97e commit be9d2cf
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions ripser/ripser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,29 +248,27 @@ class sparse_distance_matrix {
size_t size() const { return neighbors.size(); }
};

template <> void compressed_distance_matrix<LOWER_TRIANGULAR>::init_rows() {
void compressed_distance_matrix<LOWER_TRIANGULAR>::init_rows() {
value_t* pointer = &distances[0];
for (size_t i = 1; i < size(); ++i) {
rows[i] = pointer;
pointer += i;
}
}

template <> void compressed_distance_matrix<UPPER_TRIANGULAR>::init_rows() {
void compressed_distance_matrix<UPPER_TRIANGULAR>::init_rows() {
value_t* pointer = &distances[0] - 1;
for (size_t i = 0; i < size() - 1; ++i) {
rows[i] = pointer;
pointer += size() - i - 2;
}
}

template <>
value_t compressed_distance_matrix<UPPER_TRIANGULAR>::operator()(const index_t i,
const index_t j) const {
return i == j ? 0 : i > j ? rows[j][i] : rows[i][j];
}

template <>
value_t compressed_distance_matrix<LOWER_TRIANGULAR>::operator()(const index_t i,
const index_t j) const {
return i == j ? 0 : i < j ? rows[j][i] : rows[i][j];
Expand Down Expand Up @@ -816,7 +814,7 @@ template <typename DistanceMatrix> class ripser {
}
};

template <> class ripser<compressed_lower_distance_matrix>::simplex_coboundary_enumerator {
class ripser<compressed_lower_distance_matrix>::simplex_coboundary_enumerator {
private:
index_t idx_below, idx_above, v, k;
std::vector<index_t> vertices;
Expand Down Expand Up @@ -855,7 +853,7 @@ template <> class ripser<compressed_lower_distance_matrix>::simplex_coboundary_e
}
};

template <> class ripser<sparse_distance_matrix>::simplex_coboundary_enumerator {
class ripser<sparse_distance_matrix>::simplex_coboundary_enumerator {
private:
const ripser& parent;

Expand Down Expand Up @@ -930,7 +928,7 @@ template <> class ripser<sparse_distance_matrix>::simplex_coboundary_enumerator
}
};

template <> std::vector<diameter_index_t> ripser<compressed_lower_distance_matrix>::get_edges() {
std::vector<diameter_index_t> ripser<compressed_lower_distance_matrix>::get_edges() {
std::vector<diameter_index_t> edges;
for (index_t index = binomial_coeff(n, 2); index-- > 0;) {
value_t diameter = compute_diameter(index, 1);
Expand All @@ -939,7 +937,7 @@ template <> std::vector<diameter_index_t> ripser<compressed_lower_distance_matri
return edges;
}

template <> std::vector<diameter_index_t> ripser<sparse_distance_matrix>::get_edges() {
std::vector<diameter_index_t> ripser<sparse_distance_matrix>::get_edges() {
std::vector<diameter_index_t> edges;
for (index_t i = 0; i < n; ++i)
for (auto n : dist.neighbors[i]) {
Expand All @@ -949,17 +947,16 @@ template <> std::vector<diameter_index_t> ripser<sparse_distance_matrix>::get_ed
return edges;
}

template <> value_t ripser<compressed_lower_distance_matrix>::get_vertex_birth(index_t i) {
value_t ripser<compressed_lower_distance_matrix>::get_vertex_birth(index_t i) {
//TODO: Dummy for now; nonzero vertex births are only done through
//sparse matrices at the moment
return 0.0;
}

template <> value_t ripser<sparse_distance_matrix>::get_vertex_birth(index_t i) {
value_t ripser<sparse_distance_matrix>::get_vertex_birth(index_t i) {
return dist.vertex_births[i];
}

template <>
void ripser<compressed_lower_distance_matrix>::assemble_columns_to_reduce(
std::vector<diameter_index_t>& simplices, std::vector<diameter_index_t>& columns_to_reduce,
hash_map<index_t, index_t>& pivot_column_index, index_t dim) {
Expand All @@ -978,7 +975,6 @@ void ripser<compressed_lower_distance_matrix>::assemble_columns_to_reduce(
greater_diameter_or_smaller_index<diameter_index_t>());
}

template <>
void ripser<sparse_distance_matrix>::assemble_columns_to_reduce(
std::vector<diameter_index_t>& simplices, std::vector<diameter_index_t>& columns_to_reduce,
hash_map<index_t, index_t>& pivot_column_index, index_t dim) {
Expand Down

0 comments on commit be9d2cf

Please sign in to comment.