25namespace persistence_matrix {
 
   48template <
class Master_matrix, 
class Base_matrix>
 
   52  using Index = 
typename Master_matrix::Index;                        
 
   53  using ID_index = 
typename Master_matrix::ID_index;                  
 
  103    base1.indexToRow_.swap(base2.indexToRow_);
 
  104    base1.rowToIndex_.swap(base2.rowToIndex_);
 
  105    std::swap(base1.rowSwapped_, base2.rowSwapped_);
 
  109  using Index_dictionary = 
typename Master_matrix::template Dictionary<Index>;
 
  110  using Row_dictionary = 
typename Master_matrix::template Dictionary<ID_index>;
 
  112  Index_dictionary indexToRow_; 
 
  113  Row_dictionary rowToIndex_;   
 
  123template <
class Master_matrix, 
class Base_matrix>
 
  127template <
class Master_matrix, 
class Base_matrix>
 
  129    : indexToRow_(numberOfColumns), rowToIndex_(numberOfColumns), rowSwapped_(false)
 
  131  for (
Index i = 0; i < numberOfColumns; i++) {
 
  137template <
class Master_matrix, 
class Base_matrix>
 
  139    : indexToRow_(std::move(other.indexToRow_)),
 
  140      rowToIndex_(std::move(other.rowToIndex_)),
 
  141      rowSwapped_(std::exchange(other.rowSwapped_, 0))
 
  144template <
class Master_matrix, 
class Base_matrix>
 
  147  swap(_matrix()->matrix_.at(columnIndex1), _matrix()->matrix_.at(columnIndex2));
 
  148  if constexpr (Master_matrix::Option_list::has_row_access) rowSwapped_ = 
true; 
 
  151template <
class Master_matrix, 
class Base_matrix>
 
  156  if constexpr (Master_matrix::Option_list::has_map_column_container) {
 
  157    auto it1 = indexToRow_.find(rowIndex1);
 
  158    auto it2 = indexToRow_.find(rowIndex2);
 
  160    if (it1 == indexToRow_.end() && it2 == indexToRow_.end()) 
return;
 
  162    if (it1 == indexToRow_.end()) {
 
  163      indexToRow_.emplace(rowIndex1, it2->second);
 
  164      rowToIndex_.at(it2->second) = rowIndex1;
 
  165      indexToRow_.erase(it2->second);
 
  169    if (it2 == indexToRow_.end()) {
 
  170      indexToRow_.emplace(rowIndex2, it1->second);
 
  171      rowToIndex_.at(it1->second) = rowIndex2;
 
  172      indexToRow_.erase(it1);
 
  176    std::swap(rowToIndex_.at(it1->second), rowToIndex_.at(it2->second));
 
  177    std::swap(it1->second, it2->second);
 
  179    for (
auto i = indexToRow_.size(); i <= std::max(rowIndex1, rowIndex2); ++i) indexToRow_.push_back(i);
 
  181    std::swap(rowToIndex_[indexToRow_[rowIndex1]], rowToIndex_[indexToRow_[rowIndex2]]);
 
  182    std::swap(indexToRow_[rowIndex1], indexToRow_[rowIndex2]);
 
  186template <
class Master_matrix, 
class Base_matrix>
 
  189  indexToRow_.
swap(other.indexToRow_);
 
  190  rowToIndex_.swap(other.rowToIndex_);
 
  191  std::swap(rowSwapped_, other.rowSwapped_);
 
  195template <
class Master_matrix, 
class Base_matrix>
 
  198  for (
unsigned int i = 0; i < _matrix()->get_number_of_columns(); i++) {
 
  199    _matrix()->matrix_.at(i).reorder(rowToIndex_, i);
 
  201  for (Index i = 0; i < _matrix()->get_number_of_columns(); i++) {
 
A basic matrix structure allowing to easily manipulate and access entire columns and rows,...
Definition: Base_matrix.h:39
 
Class managing the column and row swaps in Base_matrix and Boundary_matrix.
Definition: base_swap.h:49
 
Base_swap(const Base_swap &matrixToCopy)=default
Copy constructor.
 
Base_swap & operator=(Base_swap other)
Assign operator.
Definition: base_swap.h:187
 
friend void swap(Base_swap &base1, Base_swap &base2)
Swap operator.
Definition: base_swap.h:102
 
void swap_rows(ID_index rowIndex1, ID_index rowIndex2)
Swaps the two rows at the given indices, but in a lazy manner. That is, the swap is registered but no...
Definition: base_swap.h:152
 
Base_swap()
Default constructor.
Definition: base_swap.h:124
 
void swap_columns(Index columnIndex1, Index columnIndex2)
Swaps the two columns at given indices in the column container. Does not updates the column index val...
Definition: base_swap.h:145
 
typename Master_matrix::Index Index
Definition: base_swap.h:52
 
typename Master_matrix::Column_container Column_container
Definition: base_swap.h:51
 
typename Master_matrix::ID_index ID_index
Definition: base_swap.h:53
 
Data structure for matrices, and in particular thought for matrices representing filtered complexes i...
Definition: Matrix.h:144
 
Gudhi namespace.
Definition: SimplicialComplexForAlpha.h:14
 
Empty structure. Inherited instead of Base_swap, when the column and row swaps are not enabled.
Definition: base_swap.h:33