/usr/include/polymake/topaz/hasse_diagram.h is in libpolymake-dev-common 3.2r2-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | /* Copyright (c) 1997-2018
Ewgenij Gawrilow, Michael Joswig (Technische Universitaet Berlin, Germany)
http://www.polymake.org
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version: http://www.gnu.org/licenses/gpl.txt.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
--------------------------------------------------------------------------------
*/
#ifndef POLYMAKE_TOPAZ_HASSE_DIAGRAM_H
#define POLYMAKE_TOPAZ_HASSE_DIAGRAM_H
#include "polymake/PowerSet.h"
#include "polymake/graph/BasicLatticeTypes.h"
namespace polymake { namespace topaz {
using graph::lattice::BasicDecoration;
using graph::lattice::FaceIndexingData;
// Iterate either over all maximal cells (for the artificial top node)
// or over all subsets less one element.
class simplicial_closure_iterator {
public:
typedef std::forward_iterator_tag iterator_category;
typedef Set<int> value_type;
typedef const value_type& reference;
typedef const value_type* pointer;
typedef ptrdiff_t difference_type;
template <typename Iterable>
simplicial_closure_iterator(const Iterable& f) {
for(auto f_it = entire(f); !f_it.at_end(); ++f_it)
data.push_back(*f_it);
it = entire(data);
}
reference operator* () const { return it.operator*(); }
pointer operator->() const { return it.operator->(); }
simplicial_closure_iterator& operator++ () { ++it; return *this; }
const simplicial_closure_iterator operator++ (int) { simplicial_closure_iterator copy = *this; operator++(); return copy; }
bool at_end() const { return it.at_end(); }
protected:
std::list<Set<int> > data;
Entire<std::list<Set<int> > >::const_iterator it;
};
template <typename Decoration = BasicDecoration>
class SimplicialClosure {
public:
typedef Set<int> ClosureData;
SimplicialClosure(const IncidenceMatrix<>& facets) : facets(facets), total_size(facets.cols()) {}
const ClosureData closure_of_empty_set() const {
return sequence(0,facets.cols()+1);
}
const ClosureData compute_closure_data(const Decoration& face) const {
return face.face;
}
FaceIndexingData get_indexing_data(const ClosureData& data) {
int &fi = face_index_map[data];
return FaceIndexingData(fi, fi == -1, fi == -2);
}
simplicial_closure_iterator get_closure_iterator(const ClosureData& face) const {
return face.size() > total_size?
simplicial_closure_iterator(rows(facets)) :
simplicial_closure_iterator(Subsets_less_1<Set<int> >(face));
}
protected:
const IncidenceMatrix<> facets;
const int total_size;
FaceMap<> face_index_map;
};
class SimplicialDecorator {
protected:
const Set<int> artificial_set;
int top_rank;
public:
SimplicialDecorator(int top_rank, const Set<int> artificial_set) : artificial_set(artificial_set), top_rank(top_rank) {}
template <typename TSet>
const BasicDecoration compute_initial_decoration(const GenericSet<TSet,int> &face) const {
return BasicDecoration( artificial_set, top_rank);
}
template <typename TSet>
const BasicDecoration compute_decoration(const GenericSet<TSet,int>& face,
const BasicDecoration& predecessor_data) const {
return BasicDecoration( face, face.top().size());
}
const BasicDecoration compute_artificial_decoration(const NodeMap<Directed, BasicDecoration> &decor,
const std::list<int>& max_nodes) const {
return BasicDecoration( Set<int>(), 0);
}
};
graph::Lattice<graph::lattice::BasicDecoration> hasse_diagram_from_facets( const Array<Set<int> >&facets, const graph::lattice::RankRestriction& rr = graph::lattice::RankRestriction());
perl::Object upper_hasse_diagram(perl::Object complex, int boundary_rank);
}}
#endif
|