18#ifndef PM_RU_REP_CYCLES_H 
   19#define PM_RU_REP_CYCLES_H 
   26namespace persistence_matrix {
 
   50template <
class Master_matrix>
 
   54  using Index = 
typename Master_matrix::Index;  
 
   55  using Bar = 
typename Master_matrix::Bar;      
 
   56  using Cycle = 
typename Master_matrix::Cycle;  
 
  105    base1.representativeCycles_.swap(base2.representativeCycles_);
 
  106    base1.birthToCycle_.swap(base2.birthToCycle_);
 
  110  using Master_RU_matrix = 
typename Master_matrix::Master_RU_matrix;
 
  112  std::vector<Cycle> representativeCycles_; 
 
  113  std::vector<Index> birthToCycle_;         
 
  115  constexpr Master_RU_matrix* _matrix() { 
return static_cast<Master_RU_matrix*
>(
this); }
 
  116  constexpr const Master_RU_matrix* _matrix()
 const { 
return static_cast<const Master_RU_matrix*
>(
this); }
 
  119template <
class Master_matrix>
 
  123template <
class Master_matrix>
 
  126    : representativeCycles_(matrixToCopy.representativeCycles_), birthToCycle_(matrixToCopy.birthToCycle_) 
 
  129template <
class Master_matrix>
 
  132    : representativeCycles_(std::move(other.representativeCycles_)), birthToCycle_(std::move(other.birthToCycle_)) 
 
  135template <
class Master_matrix>
 
  138  if constexpr (Master_matrix::Option_list::is_z2) {
 
  139    birthToCycle_.clear();
 
  140    birthToCycle_.resize(_matrix()->reducedMatrixR_.get_number_of_columns(), -1);
 
  142    for (
Index i = 0; i < _matrix()->reducedMatrixR_.get_number_of_columns(); i++) {
 
  143      if (_matrix()->reducedMatrixR_.is_zero_column(i)) {
 
  144        birthToCycle_[i] = c;
 
  148    representativeCycles_.clear();
 
  149    representativeCycles_.resize(c);
 
  150    for (
Index i = 0; i < _matrix()->mirrorMatrixU_.get_number_of_columns(); i++) {
 
  151      for (
const auto& entry : _matrix()->mirrorMatrixU_.get_column(i)) {
 
  152        auto idx = birthToCycle_[entry.get_row_index()];
 
  153        if (idx != Master_matrix::template get_null_value<Index>()) {
 
  154          representativeCycles_[idx].push_back(i);
 
  159    birthToCycle_.clear();
 
  160    birthToCycle_.resize(_matrix()->reducedMatrixR_.get_number_of_columns(), -1);
 
  161    for (
Index i = 0; i < _matrix()->reducedMatrixR_.get_number_of_columns(); i++) {
 
  162      if (_matrix()->reducedMatrixR_.is_zero_column(i)) {
 
  163        representativeCycles_.push_back(
Cycle());
 
  164        for (
const auto& entry : _matrix()->mirrorMatrixU_.get_column(i)) {
 
  165          representativeCycles_.back().push_back(entry.get_row_index());
 
  167        if constexpr (std::is_same_v<typename Master_matrix::Column, typename Master_matrix::Matrix_heap_column> ||
 
  168                      std::is_same_v<
typename Master_matrix::Column,
 
  169                                     typename Master_matrix::Matrix_unordered_set_column>)
 
  170          std::sort(representativeCycles_.back().begin(), representativeCycles_.back().end());
 
  171        birthToCycle_[i] = representativeCycles_.size() - 1;
 
  177template <
class Master_matrix>
 
  178inline const std::vector<typename RU_representative_cycles<Master_matrix>::Cycle>&
 
  181  if (representativeCycles_.empty()) update_representative_cycles();
 
  182  return representativeCycles_;
 
  185template <
class Master_matrix>
 
  189  if (representativeCycles_.empty()) update_representative_cycles();
 
  190  return representativeCycles_[birthToCycle_[bar.birth]];
 
  193template <
class Master_matrix>
 
  197  representativeCycles_.
swap(other.representativeCycles_);
 
  198  birthToCycle_.swap(other.birthToCycle_);
 
Class managing the representative cycles for RU_matrix if the option was enabled.
Definition: ru_rep_cycles.h:52
 
const Cycle & get_representative_cycle(const Bar &bar)
Returns the representative cycle corresponding to the given bar. If the matrix is modified later afte...
Definition: ru_rep_cycles.h:187
 
typename Master_matrix::Index Index
Definition: ru_rep_cycles.h:54
 
RU_representative_cycles()
Default constructor.
Definition: ru_rep_cycles.h:120
 
friend void swap(RU_representative_cycles &base1, RU_representative_cycles &base2)
Swap operator.
Definition: ru_rep_cycles.h:104
 
typename Master_matrix::Bar Bar
Definition: ru_rep_cycles.h:55
 
const std::vector< Cycle > & get_representative_cycles()
Returns the current representative cycles. If the matrix is modified later after the first call,...
Definition: ru_rep_cycles.h:179
 
typename Master_matrix::Cycle Cycle
Definition: ru_rep_cycles.h:56
 
void update_representative_cycles()
Computes the current representative cycles of the matrix.
Definition: ru_rep_cycles.h:136
 
RU_representative_cycles & operator=(RU_representative_cycles other)
Assign operator.
Definition: ru_rep_cycles.h:194
 
Gudhi namespace.
Definition: SimplicialComplexForAlpha.h:14
 
Empty structure. Inherited instead of RU_representative_cycles, when the computation of the represent...
Definition: ru_rep_cycles.h:36