Loading...
Searching...
No Matches
base_matrix.h
Go to the documentation of this file.
1/* This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT.
2 * See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details.
3 * Author(s): Hannah Schreiber
4 *
5 * Copyright (C) 2022-24 Inria
6 *
7 * Modification(s):
8 * - YYYY/MM Author: Description of the modification
9 */
10
17#ifndef PM_BASE_MATRIX_H
18#define PM_BASE_MATRIX_H
19
20#include <iostream> //print() only
21#include <vector>
22#include <utility> //std::swap, std::move & std::exchange
23
24namespace Gudhi {
25namespace persistence_matrix {
26
36template <class Master_matrix>
37class Base_matrix : public Master_matrix::template Base_swap_option<Base_matrix<Master_matrix> >,
38 protected Master_matrix::Matrix_row_access_option
39{
40 public:
41 using index = typename Master_matrix::index;
42 using dimension_type = typename Master_matrix::dimension_type;
46 using Field_operators = typename Master_matrix::Field_operators;
47 using Field_element_type = typename Master_matrix::element_type;
48 using Column_type = typename Master_matrix::Column_type;
49 using container_type = typename Master_matrix::boundary_type;
50 using Row_type = typename Master_matrix::Row_type;
52 using Cell_constructor = typename Master_matrix::Cell_constructor;
53 using Column_settings = typename Master_matrix::Column_settings;
62 Base_matrix(Column_settings* colSettings);
73 template <class Container_type = container_type>
74 Base_matrix(const std::vector<Container_type>& columns,
75 Column_settings* colSettings);
83 Base_matrix(unsigned int numberOfColumns, Column_settings* colSettings);
93 Base_matrix(const Base_matrix& matrixToCopy,
94 Column_settings* colSettings = nullptr);
100 Base_matrix(Base_matrix&& other) noexcept;
101
110 template <class Container_type = container_type>
111 void insert_column(const Container_type& column);
123 template <class Container_type = container_type>
124 void insert_column(const Container_type& column, index columnIndex);
133 template <class Boundary_type>
134 void insert_boundary(const Boundary_type& boundary, dimension_type dim = -1);
146 Column_type& get_column(index columnIndex);
159 Row_type& get_row(index rowIndex);
173 void remove_column(index columnIndex);
190 void remove_last();
206 void erase_empty_row(index rowIndex);
207
214
223 template <class Cell_range_or_column_index>
224 void add_to(const Cell_range_or_column_index& sourceColumn, index targetColumnIndex);
235 template <class Cell_range_or_column_index>
236 void multiply_target_and_add_to(const Cell_range_or_column_index& sourceColumn,
237 const Field_element_type& coefficient,
238 index targetColumnIndex);
249 template <class Cell_range_or_column_index>
250 void multiply_source_and_add_to(const Field_element_type& coefficient,
251 const Cell_range_or_column_index& sourceColumn,
252 index targetColumnIndex);
253
260 void zero_cell(index columnIndex, index rowIndex);
266 void zero_column(index columnIndex);
275 bool is_zero_cell(index columnIndex, index rowIndex) const;
283 bool is_zero_column(index columnIndex);
284
291 void reset(Column_settings* colSettings) {
292 matrix_.clear();
293 nextInsertIndex_ = 0;
294 colSettings_ = colSettings;
295 }
296
300 Base_matrix& operator=(const Base_matrix& other);
304 friend void swap(Base_matrix& matrix1, Base_matrix& matrix2) {
305 swap(static_cast<typename Master_matrix::template Base_swap_option<Base_matrix<Master_matrix> >&>(matrix1),
306 static_cast<typename Master_matrix::template Base_swap_option<Base_matrix<Master_matrix> >&>(matrix2));
307 matrix1.matrix_.swap(matrix2.matrix_);
308 std::swap(matrix1.nextInsertIndex_, matrix2.nextInsertIndex_);
309 std::swap(matrix1.colSettings_, matrix2.colSettings_);
310
311 if constexpr (Master_matrix::Option_list::has_row_access) {
312 swap(static_cast<typename Master_matrix::Matrix_row_access_option&>(matrix1),
313 static_cast<typename Master_matrix::Matrix_row_access_option&>(matrix2));
314 }
315 }
316
317 void print(); // for debug
318
319 private:
320 using swap_opt = typename Master_matrix::template Base_swap_option<Base_matrix<Master_matrix> >;
321 using ra_opt = typename Master_matrix::Matrix_row_access_option;
322 using matrix_type = typename Master_matrix::column_container_type;
323 using cell_rep_type =
324 typename std::conditional<Master_matrix::Option_list::is_z2,
325 index,
326 std::pair<index, Field_element_type>
327 >::type;
328
329 friend swap_opt; // direct access to matrix_ to avoid row reorder.
330
331 matrix_type matrix_;
332 index nextInsertIndex_;
333 Column_settings* colSettings_;
335 template <class Container_type = container_type>
336 void _insert(const Container_type& column, index columnIndex, dimension_type dim);
337 void _orderRowsIfNecessary();
338 const Column_type& _get_column(index columnIndex) const;
339 Column_type& _get_column(index columnIndex);
340 index _get_real_row_index(index rowIndex) const;
341 template <class Container_type>
342 void _container_insert(const Container_type& column, index pos, dimension_type dim);
343 void _container_insert(const Column_type& column, [[maybe_unused]] index pos = 0);
344};
345
346template <class Master_matrix>
348 : swap_opt(), ra_opt(), nextInsertIndex_(0), colSettings_(colSettings)
349{}
350
351template <class Master_matrix>
352template <class Container_type>
353inline Base_matrix<Master_matrix>::Base_matrix(const std::vector<Container_type>& columns,
354 Column_settings* colSettings)
355 : swap_opt(columns.size()),
356 // not ideal if max row index is much smaller than max column index, does that happen often?
357 ra_opt(columns.size()),
358 matrix_(!Master_matrix::Option_list::has_map_column_container && Master_matrix::Option_list::has_row_access
359 ? 0
360 : columns.size()),
361 nextInsertIndex_(columns.size()),
362 colSettings_(colSettings)
363{
364 if constexpr (!Master_matrix::Option_list::has_map_column_container && Master_matrix::Option_list::has_row_access)
365 matrix_.reserve(columns.size());
366
367 for (index i = 0; i < columns.size(); i++) {
368 _container_insert(columns[i], i, columns[i].size() == 0 ? 0 : columns[i].size() - 1);
369 }
370}
371
372template <class Master_matrix>
373inline Base_matrix<Master_matrix>::Base_matrix(unsigned int numberOfColumns,
374 Column_settings* colSettings)
375 : swap_opt(numberOfColumns),
376 ra_opt(numberOfColumns),
377 matrix_(!Master_matrix::Option_list::has_map_column_container && Master_matrix::Option_list::has_row_access
378 ? 0
379 : numberOfColumns),
380 nextInsertIndex_(0),
381 colSettings_(colSettings)
382{
383 if constexpr (!Master_matrix::Option_list::has_map_column_container && Master_matrix::Option_list::has_row_access)
384 matrix_.reserve(numberOfColumns);
385}
386
387template <class Master_matrix>
389 Column_settings* colSettings)
390 : swap_opt(static_cast<const swap_opt&>(matrixToCopy)),
391 ra_opt(static_cast<const ra_opt&>(matrixToCopy)),
392 nextInsertIndex_(matrixToCopy.nextInsertIndex_),
393 colSettings_(colSettings == nullptr ? matrixToCopy.colSettings_ : colSettings)
394{
395 matrix_.reserve(matrixToCopy.matrix_.size());
396 for (const auto& cont : matrixToCopy.matrix_){
397 if constexpr (Master_matrix::Option_list::has_map_column_container){
398 _container_insert(cont.second, cont.first);
399 } else {
400 _container_insert(cont);
401 }
402 }
403}
404
405template <class Master_matrix>
407 : swap_opt(std::move(static_cast<swap_opt&>(other))),
408 ra_opt(std::move(static_cast<ra_opt&>(other))),
409 matrix_(std::move(other.matrix_)),
410 nextInsertIndex_(std::exchange(other.nextInsertIndex_, 0)),
411 colSettings_(std::exchange(other.colSettings_, nullptr))
412{}
413
414template <class Master_matrix>
415template <class Container_type>
416inline void Base_matrix<Master_matrix>::insert_column(const Container_type& column)
417{
418 //TODO: dim not actually stored right now, so either get rid of it or store it again
419 _insert(column, nextInsertIndex_, column.size() == 0 ? 0 : column.size() - 1);
420 ++nextInsertIndex_;
421}
422
423template <class Master_matrix>
424template <class Container_type>
425inline void Base_matrix<Master_matrix>::insert_column(const Container_type& column, index columnIndex)
426{
427 static_assert(!Master_matrix::Option_list::has_row_access,
428 "Columns have to be inserted at the end of the matrix when row access is enabled.");
429
430 if (columnIndex >= nextInsertIndex_) nextInsertIndex_ = columnIndex + 1;
431 //TODO: dim not actually stored right now, so either get rid of it or store it again
432 _insert(column, columnIndex, column.size() == 0 ? 0 : column.size() - 1);
433}
434
435template <class Master_matrix>
436template <class Boundary_type>
437inline void Base_matrix<Master_matrix>::insert_boundary(const Boundary_type& boundary, dimension_type dim)
438{
439 if (dim == -1) dim = boundary.size() == 0 ? 0 : boundary.size() - 1;
440 //TODO: dim not actually stored right now, so either get rid of it or store it again
441 _insert(boundary, nextInsertIndex_++, dim);
442}
443
444template <class Master_matrix>
446{
447 _orderRowsIfNecessary();
448 return _get_column(columnIndex);
449}
450
451template <class Master_matrix>
453{
454 static_assert(Master_matrix::Option_list::has_row_access, "Row access has to be enabled for this method.");
455
456 _orderRowsIfNecessary();
457 return ra_opt::get_row(rowIndex);
458}
459
460template <class Master_matrix>
462{
463 static_assert(Master_matrix::Option_list::has_map_column_container,
464 "'remove_column' is not implemented for the chosen options.");
465
466 // assumes that eventual "holes" left at unused indices are considered as empty columns.
467 if (columnIndex == nextInsertIndex_ - 1) --nextInsertIndex_;
468
469 matrix_.erase(columnIndex);
470}
471
472template <class Master_matrix>
474{
475 if (nextInsertIndex_ == 0) return; //empty matrix
476 --nextInsertIndex_; // assumes that eventual "holes" left at unused indices are considered as empty columns.
477
478 if constexpr (Master_matrix::Option_list::has_map_column_container) {
479 matrix_.erase(nextInsertIndex_);
480 } else {
481 if constexpr (Master_matrix::Option_list::has_row_access) {
482 GUDHI_CHECK(nextInsertIndex_ == matrix_.size() - 1,
483 std::logic_error("Base_matrix::remove_last - Indexation problem."));
484 matrix_.pop_back();
485 } else {
486 matrix_[nextInsertIndex_].clear();
487 }
488 }
489}
490
491template <class Master_matrix>
493{
494 if constexpr (Master_matrix::Option_list::has_row_access && Master_matrix::Option_list::has_removable_rows) {
495 ra_opt::erase_empty_row(_get_real_row_index(rowIndex));
496 }
497 if constexpr ((Master_matrix::Option_list::has_column_and_row_swaps || Master_matrix::Option_list::has_vine_update) &&
498 Master_matrix::Option_list::has_map_column_container) {
499 auto it = swap_opt::indexToRow_.find(rowIndex);
500 swap_opt::rowToIndex_.erase(it->second);
501 swap_opt::indexToRow_.erase(it);
502 }
503}
504
505template <class Master_matrix>
507{
508 if constexpr (Master_matrix::Option_list::has_map_column_container) {
509 return matrix_.size();
510 } else {
511 return nextInsertIndex_; // matrix could have been resized much bigger while insert
512 }
513}
514
515template <class Master_matrix>
516template <class Cell_range_or_column_index>
517inline void Base_matrix<Master_matrix>::add_to(const Cell_range_or_column_index& sourceColumn,
518 index targetColumnIndex)
519{
520 if constexpr (std::is_integral_v<Cell_range_or_column_index>) {
521 _get_column(targetColumnIndex) += _get_column(sourceColumn);
522 } else {
523 _get_column(targetColumnIndex) += sourceColumn;
524 }
525}
526
527template <class Master_matrix>
528template <class Cell_range_or_column_index>
529inline void Base_matrix<Master_matrix>::multiply_target_and_add_to(const Cell_range_or_column_index& sourceColumn,
530 const Field_element_type& coefficient,
531 index targetColumnIndex)
532{
533 if constexpr (std::is_integral_v<Cell_range_or_column_index>) {
534 _get_column(targetColumnIndex).multiply_target_and_add(coefficient, _get_column(sourceColumn));
535 } else {
536 _get_column(targetColumnIndex).multiply_target_and_add(coefficient, sourceColumn);
537 }
538}
539
540template <class Master_matrix>
541template <class Cell_range_or_column_index>
543 const Cell_range_or_column_index& sourceColumn,
544 index targetColumnIndex)
545{
546 if constexpr (std::is_integral_v<Cell_range_or_column_index>) {
547 _get_column(targetColumnIndex).multiply_source_and_add(_get_column(sourceColumn), coefficient);
548 } else {
549 _get_column(targetColumnIndex).multiply_source_and_add(sourceColumn, coefficient);
550 }
551}
552
553template <class Master_matrix>
554inline void Base_matrix<Master_matrix>::zero_cell(index columnIndex, index rowIndex)
555{
556 _get_column(columnIndex).clear(_get_real_row_index(rowIndex));
557}
558
559template <class Master_matrix>
561 _get_column(columnIndex).clear();
562}
563
564template <class Master_matrix>
565inline bool Base_matrix<Master_matrix>::is_zero_cell(index columnIndex, index rowIndex) const
566{
567 return !(_get_column(columnIndex).is_non_zero(_get_real_row_index(rowIndex)));
568}
569
570template <class Master_matrix>
572{
573 return _get_column(columnIndex).is_empty();
574}
575
576template <class Master_matrix>
578{
579 swap_opt::operator=(other);
580 ra_opt::operator=(other);
581 matrix_.clear();
582 nextInsertIndex_ = other.nextInsertIndex_;
583 colSettings_ = other.colSettings_;
584
585 matrix_.reserve(other.matrix_.size());
586 for (const auto& cont : other.matrix_){
587 if constexpr (Master_matrix::Option_list::has_map_column_container){
588 _container_insert(cont.second, cont.first);
589 } else {
590 _container_insert(cont);
591 }
592 }
593
594 return *this;
595}
596
597template <class Master_matrix>
599{
600 _orderRowsIfNecessary();
601 std::cout << "Base_matrix:\n";
602 for (index i = 0; i < nextInsertIndex_; ++i) {
603 const Column_type& col = matrix_[i];
604 for (const auto& e : col.get_content(nextInsertIndex_)) {
605 if (e == 0u)
606 std::cout << "- ";
607 else
608 std::cout << e << " ";
609 }
610 std::cout << "\n";
611 }
612 std::cout << "\n";
613 if constexpr (Master_matrix::Option_list::has_row_access) {
614 std::cout << "Row Matrix:\n";
615 for (index i = 0; i < nextInsertIndex_; ++i) {
616 const auto& row = ra_opt::rows_[i];
617 for (const auto& cell : row) {
618 std::cout << cell.get_column_index() << " ";
619 }
620 std::cout << "(" << i << ")\n";
621 }
622 std::cout << "\n";
623 }
624}
625
626template <class Master_matrix>
627template <class Container_type>
628inline void Base_matrix<Master_matrix>::_insert(const Container_type& column, index columnIndex, dimension_type dim)
629{
630 _orderRowsIfNecessary();
631
632 //resize of containers when necessary:
633 index pivot = 0;
634 if (column.begin() != column.end()) {
635 //first, compute pivot of `column`
636 if constexpr (Master_matrix::Option_list::is_z2) {
637 pivot = *std::prev(column.end());
638 } else {
639 pivot = std::prev(column.end())->first;
640 }
641 //row container
642 if constexpr (Master_matrix::Option_list::has_row_access && !Master_matrix::Option_list::has_removable_rows)
643 if (ra_opt::rows_->size() <= pivot) ra_opt::rows_->resize(pivot + 1);
644 }
645
646 //row swap map containers
647 if constexpr (Master_matrix::Option_list::has_map_column_container) {
648 if constexpr (Master_matrix::Option_list::has_column_and_row_swaps || Master_matrix::Option_list::has_vine_update) {
649 for (auto id : column) {
650 index idx;
651 if constexpr (Master_matrix::Option_list::is_z2) {
652 idx = id;
653 } else {
654 idx = id.first;
655 }
656 swap_opt::indexToRow_[idx] = idx;
657 swap_opt::rowToIndex_[idx] = idx;
658 }
659 }
660 } else {
661 if constexpr (Master_matrix::Option_list::has_column_and_row_swaps || Master_matrix::Option_list::has_vine_update) {
662 index size = swap_opt::indexToRow_.size();
663 if (size <= pivot) {
664 for (index i = size; i <= pivot; i++) {
665 swap_opt::indexToRow_.push_back(i);
666 swap_opt::rowToIndex_.push_back(i);
667 }
668 }
669 }
670 //column container
671 if constexpr (!Master_matrix::Option_list::has_row_access) {
672 if (matrix_.size() <= columnIndex) {
673 matrix_.resize(columnIndex + 1);
674 }
675 }
676 }
677
678 _container_insert(column, columnIndex, dim);
679}
680
681template <class Master_matrix>
683{
684 if constexpr (Master_matrix::Option_list::has_column_and_row_swaps || Master_matrix::Option_list::has_vine_update) {
685 if (swap_opt::rowSwapped_) swap_opt::_orderRows();
686 }
687}
688
689template <class Master_matrix>
691 index columnIndex) const
692{
693 if constexpr (Master_matrix::Option_list::has_map_column_container) {
694 return matrix_.at(columnIndex);
695 } else {
696 return matrix_[columnIndex];
697 }
698}
699
700template <class Master_matrix>
702{
703 if constexpr (Master_matrix::Option_list::has_map_column_container) {
704 return matrix_.at(columnIndex);
705 } else {
706 return matrix_[columnIndex];
707 }
708}
709
710template <class Master_matrix>
712{
713 if constexpr (Master_matrix::Option_list::has_column_and_row_swaps || Master_matrix::Option_list::has_vine_update) {
714 if constexpr (Master_matrix::Option_list::has_map_column_container) {
715 return swap_opt::indexToRow_.at(rowIndex);
716 } else {
717 return swap_opt::indexToRow_[rowIndex];
718 }
719 } else {
720 return rowIndex;
721 }
722}
723
724template <class Master_matrix>
725template <class Container_type>
726inline void Base_matrix<Master_matrix>::_container_insert(const Container_type& column, index pos, dimension_type dim){
727 if constexpr (Master_matrix::Option_list::has_map_column_container) {
728 if constexpr (Master_matrix::Option_list::has_row_access) {
729 matrix_.try_emplace(pos, Column_type(pos, column, dim, ra_opt::rows_, colSettings_));
730 } else {
731 matrix_.try_emplace(pos, Column_type(column, dim, colSettings_));
732 }
733 } else {
734 if constexpr (Master_matrix::Option_list::has_row_access) {
735 matrix_.emplace_back(pos, column, dim, ra_opt::rows_, colSettings_);
736 } else {
737 matrix_[pos] = Column_type(column, dim, colSettings_);
738 }
739 }
740}
741
742template <class Master_matrix>
743inline void Base_matrix<Master_matrix>::_container_insert(const Column_type& column, [[maybe_unused]] index pos){
744 if constexpr (Master_matrix::Option_list::has_map_column_container) {
745 if constexpr (Master_matrix::Option_list::has_row_access) {
746 matrix_.try_emplace(pos, Column_type(column, column.get_column_index(), ra_opt::rows_, colSettings_));
747 } else {
748 matrix_.try_emplace(pos, Column_type(column, colSettings_));
749 }
750 } else {
751 if constexpr (Master_matrix::Option_list::has_row_access) {
752 matrix_.emplace_back(column, column.get_column_index(), ra_opt::rows_, colSettings_);
753 } else {
754 matrix_.emplace_back(column, colSettings_);
755 }
756 }
757}
758
759} // namespace persistence_matrix
760} // namespace Gudhi
761
762#endif // PM_BASE_MATRIX_H
A basic matrix structure allowing to easily manipulate and access entire columns and rows,...
Definition base_matrix.h:39
void insert_column(const Container_type &column)
Inserts a new ordered column at the end of the matrix by copying the given range of Matrix::cell_rep_...
Definition base_matrix.h:416
void add_to(const Cell_range_or_column_index &sourceColumn, index targetColumnIndex)
Adds column represented by sourceColumn onto the column at targetColumnIndex in the matrix.
Definition base_matrix.h:517
friend void swap(Base_matrix &matrix1, Base_matrix &matrix2)
Swap operator.
Definition base_matrix.h:304
typename Master_matrix::dimension_type dimension_type
Definition base_matrix.h:42
Row_type & get_row(index rowIndex)
Only available if PersistenceMatrixOptions::has_row_access is true. Returns the row at the given row ...
Definition base_matrix.h:452
bool is_zero_column(index columnIndex)
Indicates if the column at given index has value zero.
Definition base_matrix.h:571
void remove_column(index columnIndex)
Only available if PersistenceMatrixOptions::has_map_column_container is true. Otherwise,...
Definition base_matrix.h:461
void reset(Column_settings *colSettings)
Resets the matrix to an empty matrix.
Definition base_matrix.h:291
index get_number_of_columns() const
Returns the current number of columns in the matrix.
Definition base_matrix.h:506
Base_matrix & operator=(const Base_matrix &other)
Assign operator.
Definition base_matrix.h:577
typename Master_matrix::Field_operators Field_operators
Field operators class. Necessary only if PersistenceMatrixOptions::is_z2 is false.
Definition base_matrix.h:46
typename Master_matrix::index index
Definition base_matrix.h:41
void remove_last()
Removes the last column from the matrix. The last column is at index , where:
Definition base_matrix.h:473
typename Master_matrix::Column_settings Column_settings
Definition base_matrix.h:54
typename Master_matrix::boundary_type container_type
Definition base_matrix.h:49
void multiply_target_and_add_to(const Cell_range_or_column_index &sourceColumn, const Field_element_type &coefficient, index targetColumnIndex)
Multiplies the target column with the coefficiant and then adds the source column to it....
Definition base_matrix.h:529
void insert_boundary(const Boundary_type &boundary, dimension_type dim=-1)
Same as insert_column, only for interface purposes. The given dimension is ignored and not stored.
Definition base_matrix.h:437
void erase_empty_row(index rowIndex)
If PersistenceMatrixOptions::has_row_access and PersistenceMatrixOptions::has_removable_rows are true...
Definition base_matrix.h:492
typename Master_matrix::Row_type Row_type
Definition base_matrix.h:51
void zero_cell(index columnIndex, index rowIndex)
Zeroes the cell at the given coordinates.
Definition base_matrix.h:554
void zero_column(index columnIndex)
Zeroes the column at the given index.
Definition base_matrix.h:560
Column_type & get_column(index columnIndex)
Returns the column at the given MatIdx index. The type of the column depends on the choosen options,...
Definition base_matrix.h:445
void multiply_source_and_add_to(const Field_element_type &coefficient, const Cell_range_or_column_index &sourceColumn, index targetColumnIndex)
Multiplies the source column with the coefficiant before adding it to the target column....
Definition base_matrix.h:542
typename Master_matrix::Column_type Column_type
Definition base_matrix.h:48
bool is_zero_cell(index columnIndex, index rowIndex) const
Indicates if the cell at given coordinates has value zero.
Definition base_matrix.h:565
typename Master_matrix::Cell_constructor Cell_constructor
Definition base_matrix.h:52
typename Master_matrix::element_type Field_element_type
Definition base_matrix.h:47
Data structure for matrices, and in particular thought for matrices representing filtered complexes i...
Definition matrix.h:143
bool is_zero_cell(index columnIndex, id_index rowIndex)
Indicates if the cell at given coordinates has value zero.
Definition matrix.h:1880
void zero_cell(index columnIndex, id_index rowIndex)
Zeroes the cell at the given coordinates. Not available for chain matrices and for base matrices with...
Definition matrix.h:1836
bool is_zero_column(index columnIndex)
Indicates if the column at given index has value zero.
Definition matrix.h:1899
returned_column_type & get_column(index columnIndex)
Returns the column at the given MatIdx index. For RU matrices, is equivalent to get_column(columnInde...
Definition matrix.h:1609
void erase_empty_row(id_index rowIndex)
The effect varies depending on the matrices and the options:
Definition matrix.h:1680
typename std::conditional< PersistenceMatrixOptions::has_intrusive_rows, boost::intrusive::list< Cell_type, boost::intrusive::constant_time_size< false >, boost::intrusive::base_hook< base_hook_matrix_row > >, std::set< Cell_type, RowCellComp > >::type Row_type
Type of the rows stored in the matrix. Is either an intrusive list of Cell_type (not ordered) if Pers...
Definition matrix.h:281
returned_row_type & get_row(id_index rowIndex)
Only available if PersistenceMatrixOptions::has_row_access is true. Returns the row at the given row ...
Definition matrix.h:1637
typename std::conditional< PersistenceMatrixOptions::column_type==Column_types::HEAP, Heap_column_type, typename std::conditional< PersistenceMatrixOptions::column_type==Column_types::LIST, List_column_type, typename std::conditional< PersistenceMatrixOptions::column_type==Column_types::SET, Set_column_type, typename std::conditional< PersistenceMatrixOptions::column_type==Column_types::UNORDERED_SET, Unordered_set_column_type, typename std::conditional< PersistenceMatrixOptions::column_type==Column_types::VECTOR, Vector_column_type, typename std::conditional< PersistenceMatrixOptions::column_type==Column_types::INTRUSIVE_LIST, Intrusive_list_column_type, typename std::conditional< PersistenceMatrixOptions::column_type==Column_types::NAIVE_VECTOR, Naive_vector_column_type, Intrusive_set_column_type >::type >::type >::type >::type >::type >::type >::type Column_type
Type of the columns stored in the matrix. The type depends on the value of PersistenceMatrixOptions::...
Definition matrix.h:370
typename PersistenceMatrixOptions::index_type index
Definition matrix.h:146
std::enable_if_t< std::is_integral_v< Index_type > > add_to(Index_type sourceColumnIndex, Index_type targetColumnIndex)
Adds column at sourceColumnIndex onto the column at targetColumnIndex in the matrix....
Definition matrix.h:1757
insertion_return_type insert_boundary(const Boundary_type &boundary, dimension_type dim=-1)
Inserts at the end of the matrix a new ordered column corresponding to the given boundary....
Definition matrix.h:1572
std::enable_if_t< std::is_integral_v< Index_type > > multiply_target_and_add_to(Index_type sourceColumnIndex, int coefficient, Index_type targetColumnIndex)
Multiplies the target column with the coefficient and then adds the source column to it....
Definition matrix.h:1777
void insert_column(const Container_type &column)
Inserts a new ordered column at the end of the matrix by copying the given range of cell_rep_type....
Definition matrix.h:1538
void remove_last()
Removes the last inserted column/face from the matrix. If the matrix is non basic,...
Definition matrix.h:1718
void zero_column(index columnIndex)
Zeroes the column at the given index. Not available for chain matrices and for base matrices with col...
Definition matrix.h:1858
void remove_column(index columnIndex)
Only available for base matrices without column compression and if PersistenceMatrixOptions::has_map_...
Definition matrix.h:1670
Matrix & operator=(Matrix other)
Assign operator.
Definition matrix.h:1939
std::enable_if_t< std::is_integral_v< Index_type > > multiply_source_and_add_to(int coefficient, Index_type sourceColumnIndex, Index_type targetColumnIndex)
Multiplies the source column with the coefficient before adding it to the target column....
Definition matrix.h:1807
index get_number_of_columns() const
Returns the current number of columns in the matrix.
Definition matrix.h:1741
Gudhi namespace.
Definition SimplicialComplexForAlpha.h:14