3 #include <Eigen/Sparse>
14 template<
typename diff_t>
28 AMT(std::vector<diff_t>& A,
bool compute_original_to_reduced,
bool compute_reduced_to_original);
33 AMT(std::vector<diff_t>& A,
bool compute_original_to_reduced,
bool compute_reduced_to_original,
bool onlyresize);
35 typedef typename diff_t::StorageIndex
ind;
40 std::vector<std::map<ind, ind>>
morse;
60 std::vector<diff_t> f;
61 std::vector<diff_t> g;
62 std::vector<std::map<ind, ind>> morse_inverse;
63 std::vector<std::map<ind, scalar_t>> normalizing_coefficients;
64 size_t compute_size()
const;
67 void kill_dead_paths();
68 auto zig_zag_differential(
int k,
ind col)
const;
69 auto zig_zag_f(
int k,
ind col)
const;
70 auto zig_zag_g(
int k,
ind col)
const;
73 void reduce_diff(
int k);
82 template<
typename rank_t,
typename diff_t>
95 std::vector<std::vector<int64_t>> rank_sums;
96 auto find_index(
int k,
ind element)
const;
97 auto find_orbit(
int k,
ind element)
const;
98 auto find_non_equivariant_matching(
int k)
const;
100 void compute_ranks();
104 #include "impl/Morse.ipp"
Contains the classes mackey::Arrow, mackey::Chains and mackey::Junction.
Performs algebraic Morse theory reduction.
Definition: Morse.hpp:15
diff_t::StorageIndex ind
The storage type of the differential matrices (eg size_t)
Definition: Morse.hpp:35
void erase_matchings(int k, const std::vector< std::pair< ind, ind >> &toremove)
Erase the given morse matchings (eg if they are not equivariant).
std::vector< std::map< ind, ind > > morse
The morse matching.
Definition: Morse.hpp:40
void reduce()
Performs the reduction and sets the "change of basis" f,g.
const auto & reduced_to_original() const
Returns vector of "change of basis" matrices from the reduced to the original basis.
const auto & original_to_reduced() const
Returns vector of "change of basis" matrices from the original to the reduced basis.
double reduction_ratio() const
Returns the average compression ratio as a double in [0,1]. Ideally as close to 0 as possible.
std::vector< diff_t > & diff
The reduced differential.
Definition: Morse.hpp:39
diff_t::Scalar scalar_t
The scalar type of the differential matrices (eg int or Z2)
Definition: Morse.hpp:36
AMT(std::vector< diff_t > &A, bool compute_original_to_reduced, bool compute_reduced_to_original)
Constructor that reduces.
void find_Morse_matching(int k, bool normalize)
Sets the morse matchiing and normalizes diff if normalize=1 (this speeds up the AMT algorithm)
Eigen::SparseMatrix< scalar_t, 1, ind > row_major_t
The type of row major of the differential matrices (eg size_t)
Definition: Morse.hpp:37
AMT(std::vector< diff_t > &A, bool compute_original_to_reduced, bool compute_reduced_to_original, bool onlyresize)
Constructor that allows only to resize.
void normalize(int k)
Normalize diff if not done in find_Morse_matching.
std::vector< std::vector< ind > > critical
The critical basis elements.
Definition: Morse.hpp:41
Performs algebraic Morse theory reduction preserving equivariance.
Definition: Morse.hpp:83
EquivariantAMT(Chains< rank_t, diff_t > &C, bool compute_original_to_reduced, bool compute_reduced_to_original)
Constructor that performs the computation.
Everything in this library is under this namespace.
Definition: Box.hpp:9