23 #ifndef PERSISTENT_COHOMOLOGY_PERSISTENT_COHOMOLOGY_COLUMN_H_ 24 #define PERSISTENT_COHOMOLOGY_PERSISTENT_COHOMOLOGY_COLUMN_H_ 26 #include <boost/intrusive/set.hpp> 27 #include <boost/intrusive/list.hpp> 33 namespace persistent_cohomology {
35 template<
typename SimplexKey,
typename ArithmeticElement>
36 class Persistent_cohomology_column;
43 typedef boost::intrusive::list_base_hook<boost::intrusive::tag<cam_h_tag>,
44 boost::intrusive::link_mode<boost::intrusive::auto_unlink>
47 typedef boost::intrusive::list_base_hook<boost::intrusive::tag<cam_v_tag>,
48 boost::intrusive::link_mode<boost::intrusive::normal_link>
55 template<
typename SimplexKey,
typename ArithmeticElement>
56 class Persistent_cohomology_cell :
public base_hook_cam_h,
57 public base_hook_cam_v {
60 friend class Persistent_cohomology_column<
SimplexKey, ArithmeticElement>;
62 typedef Persistent_cohomology_column<SimplexKey, ArithmeticElement> Column;
64 Persistent_cohomology_cell(
SimplexKey key, ArithmeticElement x,
72 ArithmeticElement coefficient_;
85 template<
typename SimplexKey,
typename ArithmeticElement>
86 class Persistent_cohomology_column :
public boost::intrusive::set_base_hook<
87 boost::intrusive::link_mode<boost::intrusive::normal_link> > {
91 typedef Persistent_cohomology_cell<SimplexKey, ArithmeticElement> Cell;
92 typedef boost::intrusive::list<Cell,
93 boost::intrusive::constant_time_size<false>,
94 boost::intrusive::base_hook<base_hook_cam_v> > Col_type;
97 explicit Persistent_cohomology_column(
SimplexKey key)
102 bool is_null()
const {
113 friend bool operator<(
const Persistent_cohomology_column& c1,
114 const Persistent_cohomology_column& c2) {
115 typename Col_type::const_iterator it1 = c1.col_.begin();
116 typename Col_type::const_iterator it2 = c2.col_.begin();
117 while (it1 != c1.col_.end() && it2 != c2.col_.end()) {
118 if (it1->key_ == it2->key_) {
119 if (it1->coefficient_ == it2->coefficient_) {
123 return it1->coefficient_ < it2->coefficient_;
126 return it1->key_ < it2->key_;
129 return (it2 != c2.col_.end());
140 #endif // PERSISTENT_COHOMOLOGY_PERSISTENT_COHOMOLOGY_COLUMN_H_ Computes the persistent cohomology of a filtered complex.
Definition: Persistent_cohomology.h:64
Definition: SimplicialComplexForAlpha.h:26
Key type used as simplex identifier.
Definition: SimplexKey.h:27