11#ifndef PERSISTENT_COHOMOLOGY_PERSISTENT_COHOMOLOGY_COLUMN_H_
12#define PERSISTENT_COHOMOLOGY_PERSISTENT_COHOMOLOGY_COLUMN_H_
14#include <boost/intrusive/set.hpp>
15#include <boost/intrusive/list.hpp>
21namespace persistent_cohomology {
23template<
typename SimplexKey,
typename ArithmeticElement>
24class Persistent_cohomology_column;
31typedef boost::intrusive::list_base_hook<boost::intrusive::tag<cam_h_tag>,
32 boost::intrusive::link_mode<boost::intrusive::auto_unlink>
35typedef boost::intrusive::list_base_hook<boost::intrusive::tag<cam_v_tag>,
36 boost::intrusive::link_mode<boost::intrusive::normal_link>
43template<
typename SimplexKey,
typename ArithmeticElement>
44class Persistent_cohomology_cell :
public base_hook_cam_h,
45 public base_hook_cam_v {
48 friend class Persistent_cohomology_column<
SimplexKey, ArithmeticElement>;
50 typedef Persistent_cohomology_column<SimplexKey, ArithmeticElement> Column;
52 Persistent_cohomology_cell(
SimplexKey key, ArithmeticElement x,
60 ArithmeticElement coefficient_;
73template<
typename SimplexKey,
typename ArithmeticElement>
74class Persistent_cohomology_column :
public boost::intrusive::set_base_hook<
75 boost::intrusive::link_mode<boost::intrusive::normal_link> > {
79 typedef Persistent_cohomology_cell<SimplexKey, ArithmeticElement> Cell;
80 typedef boost::intrusive::list<Cell,
81 boost::intrusive::constant_time_size<false>,
82 boost::intrusive::base_hook<base_hook_cam_v> > Col_type;
85 explicit Persistent_cohomology_column(
SimplexKey key)
90 bool is_null()
const {
101 friend bool operator<(
const Persistent_cohomology_column& c1,
102 const Persistent_cohomology_column& c2) {
103 typename Col_type::const_iterator it1 = c1.col_.begin();
104 typename Col_type::const_iterator it2 = c2.col_.begin();
105 while (it1 != c1.col_.end() && it2 != c2.col_.end()) {
106 if (it1->key_ == it2->key_) {
107 if (it1->coefficient_ == it2->coefficient_) {
111 return it1->coefficient_ < it2->coefficient_;
114 return it1->key_ < it2->key_;
117 return (it2 != c2.col_.end());
Computes the persistent cohomology of a filtered complex.
Definition: Persistent_cohomology.h:52
Key type used as simplex identifier.
Definition: SimplexKey.h:15