Loading...
Searching...
No Matches
Boundary_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 Inria
6 *
7 * Modification(s):
8 * - YYYY/MM Author: Description of the modification
9 */
10
16
17#ifndef PM_BOUNDARY_MATRIX_H
18#define PM_BOUNDARY_MATRIX_H
19
20#include <cassert>
21#include <iostream> //print() only
22#include <vector>
23#include <utility> //std::swap, std::move & std::exchange
24
25namespace Gudhi {
26namespace persistence_matrix {
27
28// TODO: factorize/inherit/compose with Base_matrix?
39template <class Master_matrix>
40class Boundary_matrix : public Master_matrix::Matrix_dimension_option,
41 public Master_matrix::template Base_swap_option<Boundary_matrix<Master_matrix> >,
42 public Master_matrix::Base_pairing_option,
43 protected Master_matrix::Matrix_row_access_option
44{
45 private:
46 using Dim_opt = typename Master_matrix::Matrix_dimension_option;
47 using Swap_opt = typename Master_matrix::template Base_swap_option<Boundary_matrix<Master_matrix> >;
48 using Pair_opt = typename Master_matrix::Base_pairing_option;
49 using RA_opt = typename Master_matrix::Matrix_row_access_option;
50
51 static constexpr bool activeDimOption_ =
52 Master_matrix::Option_list::has_matrix_maximal_dimension_access || Master_matrix::maxDimensionIsNeeded;
53 static constexpr bool activeSwapOption_ =
54 Master_matrix::Option_list::has_column_and_row_swaps || Master_matrix::Option_list::has_vine_update;
55 static constexpr bool activePairingOption_ = Master_matrix::Option_list::has_column_pairings &&
56 !Master_matrix::Option_list::has_vine_update &&
57 !Master_matrix::Option_list::can_retrieve_representative_cycles;
58
59 public:
60 using Index = typename Master_matrix::Index;
61 using ID_index = typename Master_matrix::ID_index;
62 using Dimension = typename Master_matrix::Dimension;
66 using Field_operators = typename Master_matrix::Field_operators;
67 using Field_element = typename Master_matrix::Element;
68 using Column = typename Master_matrix::Column;
69 using Boundary = typename Master_matrix::Boundary;
70 using Row = typename Master_matrix::Row;
72 using Entry_constructor = typename Master_matrix::Entry_constructor;
73 using Column_settings = typename Master_matrix::Column_settings;
75
105 template <class Boundary_range = Boundary>
106 Boundary_matrix(const std::vector<Boundary_range>& orderedBoundaries, Column_settings* colSettings);
114 Boundary_matrix(unsigned int numberOfColumns, Column_settings* colSettings);
124 Boundary_matrix(const Boundary_matrix& matrixToCopy, Column_settings* colSettings = nullptr);
131
132 ~Boundary_matrix() = default;
133
157 template <class Boundary_range = Boundary>
158 Index insert_boundary(const Boundary_range& boundary,
159 Dimension dim = Master_matrix::template get_null_value<Dimension>());
178 template <class Boundary_range = Boundary>
180 const Boundary_range& boundary,
181 Dimension dim = Master_matrix::template get_null_value<Dimension>());
193 Column& get_column(Index columnIndex);
206 Row& get_row(Index rowIndex);
229 void erase_empty_row(Index rowIndex);
230
237
245
256 void add_to(Index sourceColumnIndex, Index targetColumnIndex);
269 void multiply_target_and_add_to(Index sourceColumnIndex, const Field_element& coefficient, Index targetColumnIndex);
282 void multiply_source_and_add_to(const Field_element& coefficient, Index sourceColumnIndex, Index targetColumnIndex);
283
293 void zero_entry(Index columnIndex, Index rowIndex);
302 void zero_column(Index columnIndex);
311 bool is_zero_entry(Index columnIndex, Index rowIndex) const;
319 bool is_zero_column(Index columnIndex);
320
327 Index get_pivot(Index columnIndex);
328
335 void reset(Column_settings* colSettings)
336 {
337 if constexpr (activeDimOption_) Dim_opt::_reset();
338 if constexpr (activeSwapOption_) Swap_opt::_reset();
339 if constexpr (activePairingOption_) Pair_opt::_reset();
340 matrix_.clear();
341 nextInsertIndex_ = 0;
342 colSettings_ = colSettings;
343 }
344
353
357 friend void swap(Boundary_matrix& matrix1, Boundary_matrix& matrix2) noexcept
358 {
359 swap(static_cast<Dim_opt&>(matrix1), static_cast<Dim_opt&>(matrix2));
360 swap(static_cast<Swap_opt&>(matrix1), static_cast<Swap_opt&>(matrix2));
361 swap(static_cast<Pair_opt&>(matrix1), static_cast<Pair_opt&>(matrix2));
362 matrix1.matrix_.swap(matrix2.matrix_);
363 std::swap(matrix1.nextInsertIndex_, matrix2.nextInsertIndex_);
364 std::swap(matrix1.colSettings_, matrix2.colSettings_);
365
366 if constexpr (Master_matrix::Option_list::has_row_access) {
367 swap(static_cast<RA_opt&>(matrix1), static_cast<RA_opt&>(matrix2));
368 }
369 }
370
371 void print(); // for debug
372
373 private:
374 using Column_container = typename Master_matrix::Column_container;
375
376 friend Swap_opt;
377 friend Pair_opt;
378
379 Column_container matrix_;
380 Index nextInsertIndex_;
381 Column_settings* colSettings_;
382
383 void _orderRowsIfNecessary();
384 const Column& _get_column(Index columnIndex) const;
385 Column& _get_column(Index columnIndex);
386 Index _get_real_row_index(Index rowIndex) const;
387 template <class Container>
388 void _container_insert(const Container& column, Index pos, Dimension dim);
389 void _container_insert(const Column& column, [[maybe_unused]] Index pos = 0);
390};
391
392template <class Master_matrix>
394 : Dim_opt(Master_matrix::template get_null_value<Dimension>()),
395 Swap_opt(),
396 Pair_opt(),
397 RA_opt(),
398 nextInsertIndex_(0),
399 colSettings_(colSettings)
400{}
401
402template <class Master_matrix>
403template <class Boundary_range>
404inline Boundary_matrix<Master_matrix>::Boundary_matrix(const std::vector<Boundary_range>& orderedBoundaries,
405 Column_settings* colSettings)
406 : Dim_opt(Master_matrix::template get_null_value<Dimension>()),
407 Swap_opt(orderedBoundaries.size()),
408 Pair_opt(),
409 RA_opt(orderedBoundaries.size()),
410 nextInsertIndex_(orderedBoundaries.size()),
411 colSettings_(colSettings)
412{
413 matrix_.reserve(orderedBoundaries.size());
414
415 for (Index i = 0; i < orderedBoundaries.size(); i++) {
416 _container_insert(orderedBoundaries[i], i, orderedBoundaries[i].size() == 0 ? 0 : orderedBoundaries[i].size() - 1);
417 }
418}
419
420template <class Master_matrix>
421inline Boundary_matrix<Master_matrix>::Boundary_matrix(unsigned int numberOfColumns, Column_settings* colSettings)
422 : Dim_opt(Master_matrix::template get_null_value<Dimension>()),
423 Swap_opt(numberOfColumns),
424 Pair_opt(),
425 RA_opt(numberOfColumns),
426 matrix_(!Master_matrix::Option_list::has_map_column_container && Master_matrix::Option_list::has_row_access
427 ? 0
428 : numberOfColumns),
429 nextInsertIndex_(0),
430 colSettings_(colSettings)
431{
432 if constexpr (!Master_matrix::Option_list::has_map_column_container && Master_matrix::Option_list::has_row_access)
433 matrix_.reserve(numberOfColumns);
434}
435
436template <class Master_matrix>
438 Column_settings* colSettings)
439 : Dim_opt(static_cast<const Dim_opt&>(matrixToCopy)),
440 Swap_opt(static_cast<const Swap_opt&>(matrixToCopy)),
441 Pair_opt(static_cast<const Pair_opt&>(matrixToCopy)),
442 RA_opt(static_cast<const RA_opt&>(matrixToCopy)),
443 nextInsertIndex_(matrixToCopy.nextInsertIndex_),
444 colSettings_(colSettings == nullptr ? matrixToCopy.colSettings_ : colSettings)
445{
446 matrix_.reserve(matrixToCopy.matrix_.size());
447 for (const auto& cont : matrixToCopy.matrix_) {
448 if constexpr (Master_matrix::Option_list::has_map_column_container) {
449 _container_insert(cont.second, cont.first);
450 } else {
451 _container_insert(cont);
452 }
453 }
454}
455
456template <class Master_matrix>
458 : Dim_opt(std::move(static_cast<Dim_opt&>(other))),
459 Swap_opt(std::move(static_cast<Swap_opt&>(other))),
460 Pair_opt(std::move(static_cast<Pair_opt&>(other))),
461 RA_opt(std::move(static_cast<RA_opt&>(other))),
462 matrix_(std::move(other.matrix_)),
463 nextInsertIndex_(std::exchange(other.nextInsertIndex_, 0)),
464 colSettings_(std::exchange(other.colSettings_, nullptr))
465{
466}
467
468template <class Master_matrix>
469template <class Boundary_range>
471 const Boundary_range& boundary,
472 Dimension dim)
473{
474 return insert_boundary(nextInsertIndex_, boundary, dim);
475}
476
477template <class Master_matrix>
478template <class Boundary_range>
480Boundary_matrix<Master_matrix>::insert_boundary(ID_index cellIndex, const Boundary_range& boundary, Dimension dim)
481{
482 if (dim == Master_matrix::template get_null_value<Dimension>()) dim = boundary.size() == 0 ? 0 : boundary.size() - 1;
483
484 _orderRowsIfNecessary();
485
486 // updates container sizes
487 if constexpr (Master_matrix::Option_list::has_row_access && !Master_matrix::Option_list::has_removable_rows) {
488 if (boundary.size() != 0) {
489 // row container
490 RA_opt::_resize(Master_matrix::get_row_index(*std::prev(boundary.end())));
491 }
492 }
493
494 // row swap map containers
495 if constexpr (activeSwapOption_) {
496 Swap_opt::_initialize_row_index(cellIndex);
497 }
498
499 // maps for possible shifting between column content and position indices used for birth events
500 if constexpr (activePairingOption_) {
501 if (cellIndex != nextInsertIndex_) {
502 Pair_opt::_insert_id_position(cellIndex, nextInsertIndex_);
503 if constexpr (Master_matrix::Option_list::has_removable_columns) {
504 Pair_opt::PIDM::map_.emplace(nextInsertIndex_, cellIndex);
505 }
506 }
507 }
508
509 _container_insert(boundary, nextInsertIndex_, dim);
510
511 return nextInsertIndex_++;
512}
513
514template <class Master_matrix>
516{
517 _orderRowsIfNecessary();
518
519 return _get_column(columnIndex);
520}
521
522template <class Master_matrix>
524{
525 static_assert(Master_matrix::Option_list::has_row_access, "'get_row' is not implemented for the chosen options.");
526
527 _orderRowsIfNecessary();
528
529 return RA_opt::get_row(rowIndex);
530}
531
532template <class Master_matrix>
534{
535 static_assert(Master_matrix::Option_list::has_removable_columns,
536 "'remove_last' is not implemented for the chosen options.");
537
538 if (nextInsertIndex_ == 0) return Master_matrix::template get_null_value<Index>(); // empty matrix
539 --nextInsertIndex_;
540
541 // updates dimension max
542 if constexpr (activeDimOption_) {
543 Dim_opt::_update_down(matrix_.at(nextInsertIndex_).get_dimension());
544 }
545
546 // computes pivot and removes column from matrix_
547 ID_index pivot;
548 if constexpr (Master_matrix::Option_list::has_map_column_container) {
549 auto it = matrix_.find(nextInsertIndex_);
550 pivot = it->second.get_pivot();
551 if constexpr (activeSwapOption_) {
552 // if the removed column is positive, the pivot won't change value
553 if (Swap_opt::_row_were_swapped() && pivot != Master_matrix::template get_null_value<ID_index>()) {
554 Swap_opt::_orderRows();
555 pivot = it->second.get_pivot();
556 }
557 }
558 matrix_.erase(it);
559 } else {
560 pivot = matrix_[nextInsertIndex_].get_pivot();
561 if constexpr (activeSwapOption_) {
562 // if the removed column is positive, the pivot won't change value
563 if (Swap_opt::_row_were_swapped() && pivot != Master_matrix::template get_null_value<ID_index>()) {
564 Swap_opt::_orderRows();
565 pivot = matrix_[nextInsertIndex_].get_pivot();
566 }
567 }
568 if constexpr (Master_matrix::Option_list::has_row_access) {
569 GUDHI_CHECK(nextInsertIndex_ == matrix_.size() - 1,
570 std::logic_error("Boundary_matrix::remove_last - Indexation problem."));
571 matrix_.pop_back();
572 } else {
573 matrix_[nextInsertIndex_].clear();
574 }
575 }
576
577 erase_empty_row(nextInsertIndex_); // maximal, so empty
578
579 // updates barcode
580 if constexpr (activePairingOption_) {
581 Pair_opt::_remove_last(nextInsertIndex_);
582 }
583
584 return pivot;
585}
586
587template <class Master_matrix>
589{
590 // computes real row index and erases it if necessary from the row swap map containers
591 ID_index rowID = rowIndex;
592 if constexpr (activeSwapOption_) {
593 rowID = Swap_opt::_erase_row(rowIndex);
594 }
595
596 if constexpr (Master_matrix::Option_list::has_row_access && Master_matrix::Option_list::has_removable_rows) {
597 RA_opt::erase_empty_row(rowID);
598 }
599}
600
601template <class Master_matrix>
603{
604 if constexpr (Master_matrix::Option_list::has_map_column_container) {
605 return matrix_.size();
606 } else {
607 return nextInsertIndex_; // matrix could have been resized much bigger while insert
608 }
609}
610
611template <class Master_matrix>
613 Index columnIndex) const
614{
615 return _get_column(columnIndex).get_dimension();
616}
617
618template <class Master_matrix>
619inline void Boundary_matrix<Master_matrix>::add_to(Index sourceColumnIndex, Index targetColumnIndex)
620{
621 _get_column(targetColumnIndex) += _get_column(sourceColumnIndex);
622}
623
624template <class Master_matrix>
626 const Field_element& coefficient,
627 Index targetColumnIndex)
628{
629 _get_column(targetColumnIndex).multiply_target_and_add(coefficient, _get_column(sourceColumnIndex));
630}
631
632template <class Master_matrix>
634 Index sourceColumnIndex,
635 Index targetColumnIndex)
636{
637 _get_column(targetColumnIndex).multiply_source_and_add(_get_column(sourceColumnIndex), coefficient);
638}
639
640template <class Master_matrix>
642{
643 _get_column(columnIndex).clear(_get_real_row_index(rowIndex));
644}
645
646template <class Master_matrix>
648{
649 _get_column(columnIndex).clear();
650}
651
652template <class Master_matrix>
653inline bool Boundary_matrix<Master_matrix>::is_zero_entry(Index columnIndex, Index rowIndex) const
654{
655 return !(_get_column(columnIndex).is_non_zero(_get_real_row_index(rowIndex)));
656}
657
658template <class Master_matrix>
660{
661 return _get_column(columnIndex).is_empty();
662}
663
664template <class Master_matrix>
666{
667 _orderRowsIfNecessary();
668
669 return _get_column(columnIndex).get_pivot();
670}
671
672template <class Master_matrix>
674{
675 if (this == &other) return *this;
676
677 Dim_opt::operator=(other);
678 Swap_opt::operator=(other);
679 Pair_opt::operator=(other);
680 RA_opt::operator=(other);
681
682 matrix_.clear();
683 nextInsertIndex_ = other.nextInsertIndex_;
684 colSettings_ = other.colSettings_;
685
686 matrix_.reserve(other.matrix_.size());
687 for (const auto& cont : other.matrix_) {
688 if constexpr (Master_matrix::Option_list::has_map_column_container) {
689 _container_insert(cont.second, cont.first);
690 } else {
691 _container_insert(cont);
692 }
693 }
694
695 return *this;
696}
697
698template <class Master_matrix>
700{
701 if (this == &other) return *this;
702
703 Dim_opt::operator=(std::move(other));
704 Swap_opt::operator=(std::move(other));
705 Pair_opt::operator=(std::move(other));
706 RA_opt::operator=(std::move(other));
707
708 matrix_ = std::move(other.matrix_);
709 nextInsertIndex_ = std::exchange(other.nextInsertIndex_, 0);
710 colSettings_ = std::exchange(other.colSettings_, nullptr);
711
712 return *this;
713}
714
715template <class Master_matrix>
716inline void Boundary_matrix<Master_matrix>::print()
717{
718 if constexpr (activeSwapOption_) {
719 if (Swap_opt::_row_were_swapped()) Swap_opt::_orderRows();
720 }
721 std::cout << "Boundary_matrix:\n";
722 for (Index i = 0; i < nextInsertIndex_; ++i) {
723 Column& col = matrix_[i];
724 for (auto e : col.get_content(nextInsertIndex_)) {
725 if (e == 0U)
726 std::cout << "- ";
727 else
728 std::cout << e << " ";
729 }
730 std::cout << "\n";
731 }
732 std::cout << "\n";
733 if constexpr (Master_matrix::Option_list::has_row_access) {
734 std::cout << "Row Matrix:\n";
735 for (ID_index i = 0; i < nextInsertIndex_; ++i) {
736 const auto& row = RA_opt::get_row(i);
737 for (const typename Column::Entry& entry : row) {
738 std::cout << entry.get_column_index() << " ";
739 }
740 std::cout << "(" << i << ")\n";
741 }
742 std::cout << "\n";
743 }
744}
745
746template <class Master_matrix>
747inline void Boundary_matrix<Master_matrix>::_orderRowsIfNecessary()
748{
749 if constexpr (activeSwapOption_) {
750 if (Swap_opt::_row_were_swapped()) Swap_opt::_orderRows();
751 }
752}
753
754template <class Master_matrix>
755inline const typename Boundary_matrix<Master_matrix>::Column& Boundary_matrix<Master_matrix>::_get_column(
756 Index columnIndex) const
757{
758 if constexpr (Master_matrix::Option_list::has_map_column_container) {
759 return matrix_.at(columnIndex);
760 } else {
761 return matrix_[columnIndex];
762 }
763}
764
765template <class Master_matrix>
766inline typename Boundary_matrix<Master_matrix>::Column& Boundary_matrix<Master_matrix>::_get_column(Index columnIndex)
767{
768 if constexpr (Master_matrix::Option_list::has_map_column_container) {
769 return matrix_.at(columnIndex);
770 } else {
771 return matrix_[columnIndex];
772 }
773}
774
775template <class Master_matrix>
776inline typename Boundary_matrix<Master_matrix>::Index Boundary_matrix<Master_matrix>::_get_real_row_index(
777 Index rowIndex) const
778{
779 if constexpr (Master_matrix::Option_list::has_column_and_row_swaps || Master_matrix::Option_list::has_vine_update) {
780 return Swap_opt::_get_row_index(rowIndex);
781 } else {
782 return rowIndex;
783 }
784}
785
786template <class Master_matrix>
787template <class Container>
788inline void Boundary_matrix<Master_matrix>::_container_insert(const Container& column, Index pos, Dimension dim)
789{
790 if constexpr (Master_matrix::Option_list::has_map_column_container) {
791 if constexpr (Master_matrix::Option_list::has_row_access) {
792 matrix_.try_emplace(pos, Column(pos, column, dim, RA_opt::_get_rows_ptr(), colSettings_));
793 } else {
794 matrix_.try_emplace(pos, Column(column, dim, colSettings_));
795 }
796 } else {
797 if constexpr (Master_matrix::Option_list::has_row_access) {
798 matrix_.emplace_back(pos, column, dim, RA_opt::_get_rows_ptr(), colSettings_);
799 } else {
800 if (matrix_.size() <= pos) {
801 matrix_.emplace_back(column, dim, colSettings_);
802 } else {
803 matrix_[pos] = Column(column, dim, colSettings_);
804 }
805 }
806 }
807 if constexpr (activeDimOption_) {
808 Dim_opt::_update_up(dim);
809 }
810}
811
812template <class Master_matrix>
813inline void Boundary_matrix<Master_matrix>::_container_insert(const Column& column, [[maybe_unused]] Index pos)
814{
815 if constexpr (Master_matrix::Option_list::has_map_column_container) {
816 if constexpr (Master_matrix::Option_list::has_row_access) {
817 matrix_.try_emplace(pos, Column(column, column.get_column_index(), RA_opt::_get_rows_ptr(), colSettings_));
818 } else {
819 matrix_.try_emplace(pos, Column(column, colSettings_));
820 }
821 } else {
822 if constexpr (Master_matrix::Option_list::has_row_access) {
823 matrix_.emplace_back(column, column.get_column_index(), RA_opt::_get_rows_ptr(), colSettings_);
824 } else {
825 matrix_.emplace_back(column, colSettings_);
826 }
827 }
828}
829
830} // namespace persistence_matrix
831} // namespace Gudhi
832
833#endif // PM_BOUNDARY_MATRIX_H
typename Matrix< PersistenceMatrixOptions >::Dimension Dimension
Definition Boundary_matrix.h:62
Boundary_matrix(unsigned int numberOfColumns, Column_settings *colSettings)
Constructs a new empty matrix and reserves space for the given number of columns.
Definition Boundary_matrix.h:421
typename Matrix< PersistenceMatrixOptions >::Entry_constructor Entry_constructor
Definition Boundary_matrix.h:72
typename Matrix< PersistenceMatrixOptions >::Element Field_element
Definition Boundary_matrix.h:67
Boundary_matrix(const std::vector< Boundary_range > &orderedBoundaries, Column_settings *colSettings)
Constructs a new matrix from the given ranges of Matrix::Entry_representative. Each range corresponds...
Definition Boundary_matrix.h:404
void erase_empty_row(Index rowIndex)
If PersistenceMatrixOptions::has_row_access and PersistenceMatrixOptions::has_removable_rows are true...
Definition Boundary_matrix.h:588
Boundary_matrix & operator=(Boundary_matrix &&other) noexcept
Move assign operator.
Definition Boundary_matrix.h:699
typename Matrix< PersistenceMatrixOptions >::Column_settings Column_settings
Definition Boundary_matrix.h:73
typename Matrix< PersistenceMatrixOptions >::Index Index
Definition Boundary_matrix.h:60
Dimension get_column_dimension(Index columnIndex) const
Returns the dimension of the given column.
Definition Boundary_matrix.h:612
void zero_entry(Index columnIndex, Index rowIndex)
Zeroes the entry at the given coordinates.
Definition Boundary_matrix.h:641
Boundary_matrix(Boundary_matrix &&other) noexcept
Move constructor.
Definition Boundary_matrix.h:457
Index remove_last()
Only available if PersistenceMatrixOptions::has_removable_columns is true. Removes the last cell in t...
Definition Boundary_matrix.h:533
bool is_zero_column(Index columnIndex)
Indicates if the column at given index has value zero.
Definition Boundary_matrix.h:659
Index insert_boundary(ID_index cellIndex, const Boundary_range &boundary, Dimension dim=Master_matrix::template get_null_value< Dimension >())
It does the same as the other version, but allows the boundary cells to be identified without restric...
Definition Boundary_matrix.h:480
Boundary_matrix(const Boundary_matrix &matrixToCopy, Column_settings *colSettings=nullptr)
Copy constructor. If colSettings is not a null pointer, its value is kept instead of the one in the c...
Definition Boundary_matrix.h:437
void zero_column(Index columnIndex)
Zeroes the column at the given index.
Definition Boundary_matrix.h:647
friend void swap(Boundary_matrix &matrix1, Boundary_matrix &matrix2) noexcept
Swap operator.
Definition Boundary_matrix.h:357
Index get_number_of_columns() const
Returns the current number of columns in the matrix.
Definition Boundary_matrix.h:602
bool is_zero_entry(Index columnIndex, Index rowIndex) const
Indicates if the entry at given coordinates has value zero.
Definition Boundary_matrix.h:653
typename Matrix< PersistenceMatrixOptions >::Boundary Boundary
Definition Boundary_matrix.h:69
void reset(Column_settings *colSettings)
Resets the matrix to an empty matrix.
Definition Boundary_matrix.h:335
typename Matrix< PersistenceMatrixOptions >::Row Row
Definition Boundary_matrix.h:70
Index get_pivot(Index columnIndex)
Returns the pivot of the given column.
Definition Boundary_matrix.h:665
Column & get_column(Index columnIndex)
Returns the column at the given MatIdx index. The type of the column depends on the chosen options,...
Definition Boundary_matrix.h:515
Index insert_boundary(const Boundary_range &boundary, Dimension dim=Master_matrix::template get_null_value< Dimension >())
Inserts at the end of the matrix a new ordered column corresponding to the given boundary....
Definition Boundary_matrix.h:470
typename Matrix< PersistenceMatrixOptions >::Column Column
Definition Boundary_matrix.h:68
void add_to(Index sourceColumnIndex, Index targetColumnIndex)
Adds column at sourceColumnIndex onto the column at targetColumnIndex in the matrix.
Definition Boundary_matrix.h:619
typename Matrix< PersistenceMatrixOptions >::ID_index ID_index
Definition Boundary_matrix.h:61
Boundary_matrix(Column_settings *colSettings)
Constructs an empty matrix.
Definition Boundary_matrix.h:393
void multiply_source_and_add_to(const Field_element &coefficient, Index sourceColumnIndex, Index targetColumnIndex)
Multiplies the source column with the coefficient before adding it to the target column....
Definition Boundary_matrix.h:633
void multiply_target_and_add_to(Index sourceColumnIndex, const Field_element &coefficient, Index targetColumnIndex)
Multiplies the target column with the coefficient and then adds the source column to it....
Definition Boundary_matrix.h:625
Row & get_row(Index rowIndex)
Only available if PersistenceMatrixOptions::has_row_access is true. Returns the row at the given row ...
Definition Boundary_matrix.h:523
typename Matrix< PersistenceMatrixOptions >::Field_operators Field_operators
Definition Boundary_matrix.h:66
Boundary_matrix & operator=(const Boundary_matrix &other)
Assign operator.
Definition Boundary_matrix.h:673
Persistence matrix namespace.
Definition FieldOperators.h:18
Gudhi namespace.
Definition SimplicialComplexForAlpha.h:14