Orbiter 2022
Combinatorial Objects
decomposition.cpp
Go to the documentation of this file.
1// decomposition.cpp
2//
3// Anton Betten
4//
5// December 1, 2012
6
7#include "foundations.h"
8
9using namespace std;
10
11
12
13namespace orbiter {
14namespace layer1_foundations {
15namespace geometry {
16
17
19{
20 null();
21}
22
24{
25 freeself();
26}
27
29{
30 Inc = 0;
31 I = 0;
32 Stack = NULL;
36}
37
39{
40 if (Inc) {
42 }
43 if (I) {
45 }
46 if (Stack) {
48 }
54 }
55 if (f_has_row_scheme) {
57 }
58 if (f_has_col_scheme) {
60 }
61 null();
62}
63
67 int verbose_level)
68{
69 int f_v = (verbose_level >= 1);
70
71 if (f_v) {
72 cout << "decomposition::init_inc_and_stack" << endl;
73 }
74 nb_points = Inc->nb_rows;
75 nb_blocks = Inc->nb_cols;
76 I = Inc;
78 if (f_v) {
79 cout << "decomposition::init_inc_and_stack done" << endl;
80 }
81}
82
84 int m, int n, int *M, int verbose_level)
85// copies the incidence matrix
86{
87 int f_v = (verbose_level >= 1);
88 int i;
89
90 if (f_v) {
91 cout << "decomposition::init_incidence_matrix" << endl;
92 }
93 nb_points = m;
94 nb_blocks = n;
96 for (i = 0; i < nb_points * nb_blocks; i++) {
97 Inc[i] = M[i];
98 }
99}
100
102{
103 int f_v = (verbose_level >= 1);
104
105 if (f_v) {
106 cout << "decomposition::setup_default_partition" << endl;
107 }
109 if (f_v) {
110 cout << "decomposition::setup_default_partition "
111 "before I->init_by_matrix" << endl;
112 }
114 Inc, 0 /* verbose_level */);
115 if (f_v) {
116 cout << "decomposition::setup_default_partition "
117 "after I->init_by_matrix" << endl;
118 }
121 0 /* verbose_level */);
123 Stack->split_cell(0 /* verbose_level */);
124 Stack->sort_cells();
125 if (f_v) {
126 cout << "decomposition::setup_default_partition done" << endl;
127 }
128}
129
130void decomposition::compute_TDO(int max_depth, int verbose_level)
131// put max_depth = INT_MAX if you want full depth
132{
133 int f_v = (verbose_level >= 1);
134 //int depth = INT_MAX;
135
136 if (f_v) {
137 cout << "decomposition::compute_TDO" << endl;
138 }
139
140
141
142 if (f_v) {
143 cout << "decomposition::compute_TDO "
144 "before I->compute_TDO_safe" << endl;
145 }
146 I->compute_TDO_safe(*Stack, max_depth, verbose_level /*- 2 */);
147 if (f_v) {
148 cout << "decomposition::compute_TDO "
149 "after I->compute_TDO_safe" << endl;
150 }
151
155 0);
157
158
159 if (f_v) {
160 cout << "decomposition::compute_TDO done" << endl;
161 }
162
163}
164
165void decomposition::get_row_scheme(int verbose_level)
166{
167 int f_v = (verbose_level >= 1);
168
169 if (f_v) {
170 cout << "decomposition::get_row_scheme" << endl;
171 }
172 if (!f_has_decomposition) {
173 cout << "decomposition::get_row_scheme "
174 "!f_has_decomposition" << endl;
175 exit(1);
176 }
182 row_scheme, 0);
183 if (f_v) {
184 cout << "decomposition::get_row_scheme done" << endl;
185 }
186}
187
188void decomposition::get_col_scheme(int verbose_level)
189{
190 int f_v = (verbose_level >= 1);
191
192 if (f_v) {
193 cout << "decomposition::get_col_scheme" << endl;
194 }
195 if (!f_has_decomposition) {
196 cout << "decomposition::get_col_scheme "
197 "!f_has_decomposition" << endl;
198 exit(1);
199 }
205 col_scheme, 0);
206 if (f_v) {
207 cout << "decomposition::get_col_scheme done" << endl;
208 }
209}
210
212 std::ostream &ost,
213 int f_enter_math, int f_print_subscripts,
214 int verbose_level)
215{
216 int f_v = (verbose_level >= 1);
217
218 if (f_v) {
219 cout << "decomposition::print_row_decomposition_tex" << endl;
220 }
221 if (!f_has_row_scheme) {
222 cout << "decomposition::print_row_decomposition_tex "
223 "!f_has_row_scheme" << endl;
224 exit(1);
225 }
226 //I->get_and_print_row_tactical_decomposition_scheme_tex(
227 // file, FALSE /* f_enter_math */, *Stack);
229 ost, f_enter_math,
232 row_scheme, f_print_subscripts);
233}
234
236 std::ostream &ost,
237 int f_enter_math, int f_print_subscripts,
238 int verbose_level)
239{
240 int f_v = (verbose_level >= 1);
241
242 if (f_v) {
243 cout << "decomposition::print_column_decomposition_tex" << endl;
244 }
245 //I->get_and_print_column_tactical_decomposition_scheme_tex(
246 // file, FALSE /* f_enter_math */, *Stack);
248 ost, f_enter_math,
251 col_scheme, f_print_subscripts);
252}
253
254
255}}}
256
257
data structure for set partitions following Jeffrey Leon
void allocate_and_get_decomposition(int *&row_classes, int *&row_class_inv, int &nb_row_classes, int *&col_classes, int *&col_class_inv, int &nb_col_classes, int verbose_level)
void print_row_tactical_decomposition_scheme_tex(std::ostream &ost, int f_enter_math_mode, int *row_classes, int nb_row_classes, int *col_classes, int nb_col_classes, int *row_scheme, int f_print_subscripts)
void print_column_tactical_decomposition_scheme_tex(std::ostream &ost, int f_enter_math_mode, int *row_classes, int nb_row_classes, int *col_classes, int nb_col_classes, int *col_scheme, int f_print_subscripts)
data_structures::partitionstack * Stack
Definition: geometry.h:408
void print_row_decomposition_tex(std::ostream &ost, int f_enter_math, int f_print_subscripts, int verbose_level)
void compute_TDO(int max_depth, int verbose_level)
void init_incidence_matrix(int m, int n, int *M, int verbose_level)
void init_inc_and_stack(incidence_structure *Inc, data_structures::partitionstack *Stack, int verbose_level)
void print_column_decomposition_tex(std::ostream &ost, int f_enter_math, int f_print_subscripts, int verbose_level)
interface for various incidence geometries
Definition: geometry.h:1099
void get_col_decomposition_scheme(data_structures::partitionstack &PStack, int *row_classes, int *row_class_inv, int nb_row_classes, int *col_classes, int *col_class_inv, int nb_col_classes, int *col_scheme, int verbose_level)
void get_row_decomposition_scheme(data_structures::partitionstack &PStack, int *row_classes, int *row_class_inv, int nb_row_classes, int *col_classes, int *col_class_inv, int nb_col_classes, int *row_scheme, int verbose_level)
void init_by_matrix(int m, int n, int *M, int verbose_level)
void compute_TDO_safe(data_structures::partitionstack &PStack, int depth, int verbose_level)
#define FREE_int(p)
Definition: foundations.h:640
#define NEW_OBJECT(type)
Definition: foundations.h:638
#define FREE_OBJECT(p)
Definition: foundations.h:651
#define NEW_int(n)
Definition: foundations.h:625
#define TRUE
Definition: foundations.h:231
#define FALSE
Definition: foundations.h:234
the orbiter library for the classification of combinatorial objects