23 #ifndef PERSISTENT_COHOMOLOGY_PERSISTENT_COHOMOLOGY_COLUMN_H_
24 #define PERSISTENT_COHOMOLOGY_PERSISTENT_COHOMOLOGY_COLUMN_H_
26 #include <boost/tuple/tuple.hpp>
27 #include <boost/intrusive/set.hpp>
28 #include <boost/intrusive/list.hpp>
34 namespace persistent_cohomology {
36 template<
typename SimplexKey,
typename ArithmeticElement>
37 class Persistent_cohomology_column;
44 typedef boost::intrusive::list_base_hook<boost::intrusive::tag<cam_h_tag>,
45 boost::intrusive::link_mode<boost::intrusive::auto_unlink>
48 typedef boost::intrusive::list_base_hook<boost::intrusive::tag<cam_v_tag>,
49 boost::intrusive::link_mode<boost::intrusive::normal_link>
56 template<
typename SimplexKey,
typename ArithmeticElement>
57 class Persistent_cohomology_cell :
public base_hook_cam_h,
58 public base_hook_cam_v {
60 template<
class T1,
class T2>
friend class Persistent_cohomology;
61 friend class Persistent_cohomology_column<
SimplexKey, ArithmeticElement>;
63 typedef Persistent_cohomology_column<SimplexKey, ArithmeticElement> Column;
65 Persistent_cohomology_cell(
SimplexKey key, ArithmeticElement x,
73 ArithmeticElement coefficient_;
86 template<
typename SimplexKey,
typename ArithmeticElement>
87 class Persistent_cohomology_column :
public boost::intrusive::set_base_hook<
88 boost::intrusive::link_mode<boost::intrusive::normal_link> > {
89 template<
class T1,
class T2>
friend class Persistent_cohomology;
92 typedef Persistent_cohomology_cell<SimplexKey, ArithmeticElement> Cell;
93 typedef boost::intrusive::list<Cell,
94 boost::intrusive::constant_time_size<false>,
95 boost::intrusive::base_hook<base_hook_cam_v> > Col_type;
98 explicit Persistent_cohomology_column(
SimplexKey key)
103 bool is_null()
const {
114 friend bool operator<(
const Persistent_cohomology_column& c1,
115 const Persistent_cohomology_column& c2) {
116 typename Col_type::const_iterator it1 = c1.col_.begin();
117 typename Col_type::const_iterator it2 = c2.col_.begin();
118 while (it1 != c1.col_.end() && it2 != c2.col_.end()) {
119 if (it1->key_ == it2->key_) {
120 if (it1->coefficient_ == it2->coefficient_) {
124 return it1->coefficient_ < it2->coefficient_;
127 return it1->key_ < it2->key_;
130 return (it2 != c2.col_.end());
141 #endif // PERSISTENT_COHOMOLOGY_PERSISTENT_COHOMOLOGY_COLUMN_H_
Key type used as simplex identifier.
Definition: SimplexKey.h:27