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