File: descent.h

package info (click to toggle)
normaliz 3.10.4%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 40,260 kB
  • sloc: cpp: 47,283; makefile: 2,207; sh: 1
file content (156 lines) | stat: -rw-r--r-- 5,104 bytes parent folder | download | duplicates (4)
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
/*
 * Normaliz
 * Copyright (C) 2007-2022  W. Bruns, B. Ichim, Ch. Soeger, U. v. d. Ohe
 * 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 3 of the License, or
 * (at your option) any later version.
 *
 * 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.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 *
 * As an exception, when this program is distributed through (i) the App Store
 * by Apple Inc.; (ii) the Mac App Store by Apple Inc.; or (iii) Google Play
 * by Google Inc., then that store may impose any digital rights management,
 * device limits and/or redistribution restrictions that are required by its
 * terms of service.
 */

#ifndef LIBNORMALIZ_DESCENT_H_
#define LIBNORMALIZ_DESCENT_H_

#include <vector>
#include <set>
#include <list>
#include <map>

#include <libnormaliz/general.h>
#include <libnormaliz/matrix.h>
#include <libnormaliz/sublattice_representation.h>
#include "libnormaliz/dynamic_bitset.h"
#include "libnormaliz/automorph.h"

namespace libnormaliz {
using std::map;
using std::pair;
using std::vector;

template <typename Integer>
class IsoType;

template <typename Integer>
class OrbitInfo {
   public:
    vector<key_t> FacetInOrbit;  // the selected facet in the orbit
    vector<size_t> SizeOfOrbit;
    vector<Integer> HeightFixPointOverFacet;  // the height of the fix_point
    vector<Integer> fix_point;
    mpz_class deg_fix_point;
};

template <typename Integer>
class DescentSystem;

template <typename Integer>
class DescentFace {
    template <typename>
    friend class DescentSystem;

    bool dead;  // to be skipped in next round.
    // size_t dim; // cone dimension of the face
    mpq_class coeff;
    // OrbitInfo<Integer>* Orbits;
    // bool simplicial;
    size_t tree_size;  // the number of paths in the tree from top to to this face
    // dynamic_bitset own_facets; // own_facets[i]==true <==> SuppHyps[i] contains this face

    dynamic_bitset FacetsOfFace;  // an indicator picking for each facet F of *this a facet of the cone
                                  // cutting out F from *this
#ifdef NMZ_HASHLIBRARY
    vector<unsigned char> ERC_Hash;
#else
    vector<long> ERC_Hash;
#endif
   public:
    DescentFace();
    // DescentFace(const size_t dim_given, const dynamic_bitset& facets_given);

    void compute(DescentSystem<Integer>& FF,  // comments see cpp
                 const size_t dim,
                 const dynamic_bitset& own_facets,
                 vector<key_t>& mother_key,
                 vector<key_t>& CuttingFacet,
                 list<pair<dynamic_bitset, DescentFace<Integer> > >& Children);

    void compute_with_orbits(DescentSystem<Integer>& FF,
                             const size_t dim,
                             const dynamic_bitset& signature,
                             list<pair<dynamic_bitset, DescentFace<Integer> > >& Children);
};

template <typename Integer>
class DescentSystem {
    template <typename>
    friend class DescentFace;

    bool verbose;
    bool facet_based;

    Matrix<Integer> Gens;
    Matrix<Integer> SuppHyps;
    vector<Integer> Grading;
    vector<Integer> GradGens;
    vector<mpz_class> GradGens_mpz;

    bool SimplePolytope;
    bool exploit_automorphisms;
    bool strict_type_check;

    size_t dim;
    size_t nr_supphyps;
    size_t nr_gens;

    size_t descent_steps;
    size_t nr_simplicial;
    size_t tree_size;
    size_t system_size;

    vector<dynamic_bitset> SuppHypInd;

    map<dynamic_bitset, DescentFace<Integer> > OldFaces;
    map<dynamic_bitset, DescentFace<Integer> > NewFaces;

    list<OrbitInfo<Integer> > OldFacesOrbitInfos;

    vector<size_t> OldNrFacetsContainingGen;
    vector<size_t> NewNrFacetsContainingGen;

    mpq_class multiplicity;

    /* mpq_class mult_simp( const dynamic_bitset&  SimpInds, const vector<key_t>& SimpKeys,
                            const Sublattice_Representation<Integer>& sub_latt,
                            const vector<Integer>&  selected_apex, const mpz_class& deg_selected_apex) const;
    void find_iso_type_and_orbit_data(IsoType<Integer>& IT, const dynamic_bitset& GensInd,
                                      DescentFace<Integer>& F, OrbitInfo<Integer>& MyOrbits);*/

    void collect_old_faces_in_iso_classes(size_t& nr_iso_classes);
    void make_orbits_global();

   public:
    DescentSystem(Matrix<Integer>& Gens, Matrix<Integer>& SuppHyps, vector<Integer>& Grading, bool swap_allowed = true);
    DescentSystem();
    void compute();
    bool set_verbose(bool onoff);
    void setExploitAutoms(bool exploit);
    void setStrictIsoTypeCheck(bool check);
    mpq_class getMultiplicity();
};

}  // namespace libnormaliz

#endif /* DESCENT_H_ */