Orbiter 2022
Combinatorial Objects
cyclotomic_sets.cpp
Go to the documentation of this file.
1/*
2 * cyclotomic_sets.cpp
3 *
4 * Created on: Sep 30, 2021
5 * Author: betten
6 */
7
8
9
10#include "foundations.h"
11
12using namespace std;
13
14namespace orbiter {
15namespace layer1_foundations {
16namespace number_theory {
17
18
20{
21 n = 0;
22 q = 0;
23 m = 0;
24 qm = 0;
25 Index = NULL;
26 S = NULL;
27}
28
30{
31 if (Index) {
33 }
34 if (S) {
36 }
37}
38
39void cyclotomic_sets::init(field_theory::finite_field *F, int n, int verbose_level)
40{
41 int f_v = (verbose_level >= 1);
42
43 if (f_v) {
44 cout << "cyclotomic_sets::init, n=" << n << endl;
45 }
48 //longinteger_object Qm1, Idx;
49 //longinteger_domain D;
51
52 m = NT.order_mod_p(q, n);
53 if (f_v) {
54 cout << "cyclotomic_sets::init order of q mod n is m=" << m << endl;
55 }
56
57 qm = NT.i_power_j(q, m);
58 if (f_v) {
59 cout << "cyclotomic_sets::init qm = " << qm << endl;
60 }
61
62 //D.create_qnm1(Qm1, q, m);
63
64 //D.integral_division_by_int(Qm1, n, Idx, r);
65
66 int i;
67 int *f_taken;
68 int *transversal;
69 long int *set;
70 int sz;
71 int tl;
72
73 Index = NEW_int(n);
74 f_taken = NEW_int(n);
75 transversal = NEW_int(n);
76 for (i = 0; i < n; i++) {
77 f_taken[i] = FALSE;
78 }
79
80
82
83 if (f_v) {
84 cout << "cyclotomic_sets::init before S->init_simple" << endl;
85 }
86
87 S->init_simple(n /* underlying_set_size */,
88 n /* nb_sets */, 0 /* verbose_level */);
89
90 if (f_v) {
91 cout << "cyclotomic_sets::init after S->init_simple" << endl;
92 }
93
94 tl = 0;
95
96 for (i = 0; i < n; i++) {
97 if (f_taken[i]) {
98 cout << q << "-cyclotomic coset of "
99 << i << " already taken" << endl;
100 continue;
101 }
102 transversal[tl] = i;
103 f_taken[i] = TRUE;
104 set = NEW_lint(n);
105 set[0] = i;
106 sz = 1;
107 Index[i] = tl;
108 if (f_v) {
109 cout << q << "-cyclotomic coset of "
110 << i << " : " << i;
111 }
112 while (TRUE) {
113 i = (q * i) % n;
114 if (f_taken[i]) {
115 break;
116 }
117 f_taken[i] = TRUE;
118 set[sz++] = i;
119 Index[i] = tl;
120 }
121 S->Sets[tl] = set;
122 S->Set_size[tl] = sz;
123 tl++;
124 if (f_v) {
125 cout << " has size = " << sz << endl;
126 }
127 }
128 S->nb_sets = tl;
129
130 if (f_v) {
131 cout << "cyclotomic_sets::init cyclotomic sets are:" << endl;
132 S->print_table();
133 cout << "cyclotomic_sets::init Index:" << endl;
134 Int_vec_print(cout, Index, n);
135 cout << endl;
136 }
137
138
139
140 if (f_v) {
141 cout << "cyclotomic_sets::init done" << endl;
142 }
143}
144
146{
147 S->print_table();
148}
149
150void cyclotomic_sets::print_latex(std::ostream &ost)
151{
153}
154
155void cyclotomic_sets::print_latex_with_selection(std::ostream &ost, int *Selection, int nb_sel)
156{
157 S->print_table_latex_simple_with_selection(ost, Selection, nb_sel);
158}
159
160
161}}}
162
163
164
void print_table_latex_simple_with_selection(std::ostream &ost, int *Selection, int nb_sel)
void init_simple(int underlying_set_size, int nb_sets, int verbose_level)
Definition: set_of_sets.cpp:67
void print_latex_with_selection(std::ostream &ost, int *Selection, int nb_sel)
void init(field_theory::finite_field *F, int n, 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
#define NEW_lint(n)
Definition: foundations.h:628
#define Int_vec_print(A, B, C)
Definition: foundations.h:685
the orbiter library for the classification of combinatorial objects