14namespace layer1_foundations {
31 char *prefix,
int *the_set,
int set_size,
32 int f_title,
const char *title,
int out_of,
34 int f_circle,
int circle_at,
int circle_rad,
35 int f_mu,
int f_sigma,
int nb_standard_deviations,
36 int f_v_grid,
int v_grid,
int f_h_grid,
int h_grid,
38 int f_switch_x,
int no,
int f_embedded,
41 int f_v = (verbose_level >= 1);
42 int f_vv = (verbose_level >= 2);
44 int factor_1000 = 1000;
54 cout <<
"plot_tools::draw_density" << endl;
58 for (i = 0; i < set_size; i++) {
63 cout <<
"plot_tools::draw_density read the "
64 "following " << set_size <<
" numbers:" << endl;
65 for (i = 0; i < set_size; i++) {
66 cout << the_set[i] << endl;
72 cout <<
"plot_tools::draw_density after sorting:" << endl;
73 for (i = 0; i < set_size; i++) {
74 cout << set[i] << endl;
78 outline_value =
NEW_int(set_size);
79 outline_number =
NEW_int(set_size);
83 for (i = 1; i <= set_size; i++) {
84 if (i == set_size || set[i] != prev) {
85 outline_value[outline_sz] = prev;
86 outline_number[outline_sz] = i - 1;
93 cout <<
"plot_tools::draw_density outline of size " << outline_sz <<
":" << endl;
94 for (i = 0; i < outline_sz; i++) {
95 cout << outline_value[i] <<
" " << outline_number[i] << endl;
101 fname_full.assign(prefix);
103 sprintf(str,
"_%d.mp", no);
105 fname_full.append(str);
111 G.
init(fname_full, Draw_options, verbose_level - 1);
114 x_min, y_min, x_max, y_max, f_embedded, f_sideways, verbose_level - 1);
120 cout <<
"xmax/ymax = " << xmax <<
" / " << ymax << endl;
128 outline_value, outline_number, outline_sz,
129 0, out_of, offset_x, f_switch_x,
132 f_circle, circle_at, circle_rad,
133 f_mu, f_sigma, nb_standard_deviations,
134 f_v_grid, v_grid, f_h_grid, h_grid);
143 cout <<
"plot_tools::draw_density written file " << fname_full
144 <<
" of size " << Fio.
file_size(fname_full) << endl;
153 int **Data,
int *Data_size,
int nb_data_sets,
154 int f_title,
const char *title,
int out_of,
156 int f_v_grid,
int v_grid,
int f_h_grid,
int h_grid,
157 int offset_x,
int f_switch_x,
158 int f_v_logarithmic,
double log_base,
int no,
int f_embedded,
161 int f_v = (verbose_level >= 1);
162 int f_v5 = (verbose_level >= 5);
164 int factor_1000 = 1000;
168 int **outline_number;
175 cout <<
"plot_tools::draw_density_multiple_curves" << endl;
179 for (curve = 0; curve < nb_data_sets; curve++) {
180 Data2[curve] =
NEW_int(Data_size[curve]);
181 for (i = 0; i < Data_size[curve]; i++) {
182 Data2[curve][i] = Data[curve][i];
186 cout <<
"after sorting:" << endl;
187 for (i = 0; i < Data_size[curve]; i++) {
188 cout << Data2[curve][i] << endl;
195 outline_value =
NEW_pint(nb_data_sets);
196 outline_number =
NEW_pint(nb_data_sets);
197 outline_sz =
NEW_int(nb_data_sets);
198 for (curve = 0; curve < nb_data_sets; curve++) {
199 outline_value[curve] =
NEW_int(Data_size[curve]);
200 outline_number[curve] =
NEW_int(Data_size[curve]);
201 outline_sz[curve] = 0;
202 max_x =
MAXIMUM(max_x, Data_size[curve]);
203 prev = Data2[curve][0];
205 for (i = 1; i <= Data_size[curve]; i++) {
206 if (i == Data_size[curve] || Data2[curve][i] != prev) {
207 outline_value[curve][outline_sz[curve]] = prev;
208 outline_number[curve][outline_sz[curve]] = i - 1;
210 prev = Data2[curve][i];
215 cout <<
"plot_tools::draw_density_multiple_curves outline "
216 "of size " << outline_sz[curve] <<
":" << endl;
217 for (i = 0; i < outline_sz[curve]; i++) {
218 cout << outline_value[curve][i] <<
" "
219 << outline_number[curve][i] << endl;
230 fname_full.assign(prefix);
232 sprintf(str,
"_%d.mp", no);
234 fname_full.append(str);
240 G.
init(fname_full, Draw_options, verbose_level - 1);
244 x_min, y_min, x_max, y_max, f_embedded, f_sideways, verbose_level - 1);
250 cout <<
"xmax/ymax = " << xmax <<
" / " << ymax << endl;
258 outline_value, outline_number, outline_sz, nb_data_sets,
259 0, max_x - 1, 0, out_of,
260 offset_x, f_switch_x,
263 f_v_grid, v_grid, f_h_grid, h_grid,
264 f_v_logarithmic, log_base);
273 cout <<
"plot_tools::draw_density written file " << fname_full
274 <<
" of size " << Fio.
file_size(fname_full) << endl;
276 for (curve = 0; curve < nb_data_sets; curve++) {
290 int min_x,
int min_y,
int max_x,
int max_y,
int f_switch_x)
292 Px[idx] = (int)(1000 * (
double)(x - min_x) / (
double)(max_x - min_x));
294 Px[idx] = 1000 - Px[idx];
296 Py[idx] = (int)(1000 * (
double)(y - min_y) / (
double)(max_y - min_y));
300 int min_x,
int min_y,
int max_x,
int max_y,
301 double log_base,
int f_switch_x)
303 Px[idx] = (int)(1000 * (
double)(x - min_x) / (
double)(max_x - min_x));
305 Px[idx] = 1000 - Px[idx];
307 Py[idx] = (int)(1000 * log((
double)(y - min_y + 1)) /
308 ((double)log(max_y - min_y + 1)));
314 int *outline_value,
int *outline_number,
int outline_sz)
320 f_found = Sorting.
int_vec_search(outline_value, outline_sz, y_in, idx);
322 x = outline_number[idx];
323 y = outline_value[idx];
325 cout <<
"y-value " << y_in <<
" found at " << x << endl;
330 cout <<
"y-value " << y_in <<
" not found" << endl;
332 x = outline_number[idx];
333 y = outline_value[idx];
335 cout <<
"x1=" << x <<
" y1=" << outline_value[idx] << endl;
338 x = outline_number[idx - 1];
340 cout <<
"x2=" << x <<
" y2=" << outline_value[idx - 1] << endl;
342 x = outline_number[idx - 1];
347 cout <<
"at the bottom" << endl;
356 int q,
int *Table,
int nb,
357 int f_point_labels,
char **Point_labels,
360 int f_v = (verbose_level >= 1);
361 int factor_1000 = 1000;
365 cout <<
"plot_tools::projective_plane_draw_grid" << endl;
370 fname_full.assign(fname);
371 fname_full.append(
"_draw.mp");
377 G.
init(fname_full, O, verbose_level - 1);
389 cout <<
"plot_tools::projective_plane_draw_grid" << endl;
397 cout <<
"plot_tools::projective_plane_draw_grid "
398 "before projective_plane_draw_grid2" << endl;
402 f_point_labels, Point_labels,
405 cout <<
"plot_tools::projective_plane_draw_grid "
406 "after projective_plane_draw_grid2" << endl;
415 cout <<
"written file " << fname_full <<
" of size "
418 cout <<
"plot_tools::projective_plane_draw_grid done" << endl;
429 int f_v = (verbose_level >= 1);
430 int factor_1000 = 1000;
434 cout <<
"plot_tools::draw_mod_n" << endl;
440 cout <<
"please use -file <fname>" << endl;
444 fname_full.assign(Descr->
fname);
445 fname_full.append(
"_draw.mp");
451 G.
init(fname_full, O, verbose_level);
463 G.tikz_global_scale = O->
scale;
473 cout <<
"plot_tools::draw_mod_n "
474 "before draw_mod_n_work" << endl;
481 cout <<
"plot_tools::draw_mod_n "
482 "after projective_plane_draw_grid2" << endl;
485 double move_out = 0.01;
498 cout <<
"written file " << fname_full <<
" of size "
501 cout <<
"plot_tools::draw_mod_n done" << endl;
514 int f_v = (verbose_level >= 1);
517 double x_stretch = 1.;
518 double y_stretch = 1.;
519 int dx = O->
xin * 0.25;
520 int dy = O->
yin * 0.25;
523 double start_angle = 0;
532 cout <<
"plot_tools::draw_mod_n_work number=" << n << endl;
548 for (i = 0; i < n; i++) {
551 for (i = 0; i < n; i++) {
552 Num.
on_circle_double(Dx, Dy, n + 1 + i, start_angle + i * 360. / (
double) n, 1.2);
554 for (i = 0; i < n; i++) {
555 Num.
on_circle_double(Dx, Dy, 2 * n + 1 + i, start_angle + i * 360. / (
double) n, .9);
557 for (i = 0; i < n; i++) {
558 Num.
on_circle_double(Dx, Dy, 3 * n + 1 + i, start_angle + i * 360. / (
double) n, 1.1);
566 for (i = 0; i < n; i++) {
567 cout <<
"i=" << i <<
" Dx=" << Dx[i] <<
" Dy=" << Dy[i] << endl;
570 for (i = 0; i < M; i++) {
571 Px[i] = Dx[i] * dx * x_stretch;
572 Py[i] = Dy[i] * dy * y_stretch;
576 G.
circle(Px[n], Py[n], (
int) dx * x_stretch);
580 for (i = 0; i < n; i++) {
581 cout <<
"drawing circle " << i <<
" at " << Px[i] <<
", " << Py[i]
582 <<
" with rad=" << O->
rad << endl;
585 if ((i % Descr->
mod_s) == 0) {
601 for (i = 0; i < n; i++) {
613 sprintf(str,
"%d", j);
617 if ((i % Descr->
mod_s) == 0) {
628 G.
text(Px[n + 1 + i], Py[n + 1 + i], str);
635 long int a, b, g, u, v;
642 for (a = 1; a < n; a++) {
655 cout <<
"inverse of " << a <<
" mod " << n <<
" is " << b << endl;
658 G.
polygon2(Px, Py, 2 * n + 1 + a, 3 * n + 1 + a);
665 cout <<
"the element " << a <<
" does not have an inverse mod " << n << endl;
680 for (a = 0; a < n; a++) {
685 cout <<
"negative of " << a <<
" mod " << n <<
" is " << b << endl;
688 G.
polygon2(Px, Py, 2 * n + 1 + a, 3 * n + 1 + a);
698 G.
polygon2(Px, Py, 4 * n + 1 + 0, 4 * n + 1 + 2);
699 G.
polygon2(Px, Py, 4 * n + 1 + 1, 4 * n + 1 + 3);
715 cout <<
"a1= " << a1 << endl;
716 cout <<
"n= " << n << endl;
728 cout <<
"a= " << a <<
" b= " << b << endl;
749 cout <<
"cyclotomic sets of ";
760 for (i = 0; i < nb_reps; i++) {
761 std::vector<int> cyclotomic_set;
767 for (h = 0; h < cyclotomic_set.size(); h++) {
768 a = cyclotomic_set[h];
769 if (h < cyclotomic_set.size() - 1) {
770 b = cyclotomic_set[h + 1];
773 b = cyclotomic_set[0];
792 for (i = 0; i < number; i++) {
793 G.
circle(Px[i], Py[i], rad3);
800 cout <<
"log(10) = " << log(10) << endl;
801 cout <<
"log(2.782) = " << log(2.782) << endl;
805 step = Delta_x / (double) N;
807 cout <<
"lo=" << lo << endl;
808 for (i = 0; i < N; i++) {
809 x = x_min + i * step;
815 for (i = 0; i < N; i += 5) {
817 G.
polygon6(Px, Py, i + 0, i + 1, i + 2, i + 3, i + 4, i + 5);
820 G.
polygon5(Px, Py, i + 0, i + 1, i + 2, i + 3, i + 4);
825 if (f_draw_triangles) {
827 for (i = 0; i < (int)x_max; i++) {
852 long int *Pts,
int nb_pts,
856 int f_v = (verbose_level >= 1);
861 cout <<
"plot_tools::draw_point_set_in_plane" << endl;
864 cout <<
"plot_tools::draw_point_set_in_plane n != 2" << endl;
869 for (i = 0; i < nb_pts; i++) {
872 if (f_point_labels) {
877 for (i = 0; i < nb_pts; i++) {
878 snprintf(str, 1000,
"%ld", Pts[i]);
879 Labels[i] =
NEW_char(strlen(str) + 1);
880 strcpy(Labels[i], str);
883 cout <<
"plot_tools::draw_point_set_in_plane "
884 "before projective_plane_draw_grid" << endl;
887 q, Table, nb_pts,
TRUE, Labels,
890 cout <<
"plot_tools::draw_point_set_in_plane "
891 "after projective_plane_draw_grid" << endl;
893 for (i = 0; i < nb_pts; i++) {
900 cout <<
"plot_tools::draw_point_set_in_plane "
901 "before projective_plane_draw_grid" << endl;
904 q, Table, nb_pts,
FALSE, NULL,
907 cout <<
"plot_tools::draw_point_set_in_plane "
908 "after projective_plane_draw_grid" << endl;
913 cout <<
"plot_tools::draw_point_set_in_plane done" << endl;
a collection of functions related to sorted vectors
int int_vec_search(int *v, int len, int a, int &idx)
void int_vec_heapsort(int *v, int len)
projective space PG(n,q) of dimension n over Fq
field_theory::finite_field * F
void unrank_point(int *v, long int rk)
options for drawing modulo n
std::string cyclotomic_sets_reps
int cyclotomic_sets_thickness
int f_cyclotomic_sets_thickness
options for drawing an object of type layered_graph
a general 2D graphical output interface (metapost, tikz, postscript)
void draw_density2(int no, int *outline_value, int *outline_number, int outline_sz, int min_value, int max_value, int offset_x, int f_switch_x, int f_title, const char *title, const char *label_x, int f_circle, int circle_at, int circle_rad, int f_mu, int f_sigma, int nb_standard_deviations, int f_v_grid, int v_grid, int f_h_grid, int h_grid)
void polygon2(int *Px, int *Py, int i1, int i2)
void frame(double move_out)
void sl_thickness(int line_thickness)
void polygon6(int *Px, int *Py, int i1, int i2, int i3, int i4, int i5, int i6)
void init(std::string &file_name, layered_graph_draw_options *Draw_options, int verbose_level)
void projective_plane_draw_grid2(layered_graph_draw_options *O, int q, int *Table, int nb, int f_point_labels, char **Point_labels, int verbose_level)
void sf_color(int fill_color)
void draw_density2_multiple_curves(int no, int **outline_value, int **outline_number, int *outline_sz, int nb_curves, int min_x, int max_x, int min_y, int max_y, int offset_x, int f_switch_x, int f_title, const char *title, const char *label_x, int f_v_grid, int v_grid, int f_h_grid, int h_grid, int f_v_logarithmic, double log_base)
void polygon5(int *Px, int *Py, int i1, int i2, int i3, int i4, int i5)
void circle(int x, int y, int rad)
void begin_figure(int factor_1000)
void polygon3(int *Px, int *Py, int i1, int i2, int i3)
void sl_color(int line_color)
void text(int x, int y, const char *p)
void sf_interior(int fill_interior)
basic number theoretic functions
long int gcd_lint(long int m, long int n)
void cyclotomic_set(std::vector< int > &cyclotomic_set, int a, int q, int n, int verbose_level)
void extended_gcd_lint(long int m, long int n, long int &g, long int &u, long int &v)
long int primitive_root(long int p, int verbose_level)
numerical functions, mostly concerned with double
void on_circle_double(double *Px, double *Py, int idx, double angle_in_degree, double rad)
a collection of functions related to file io
long int file_size(std::string &fname)
#define Int_vec_scan(A, B, C)
#define Int_vec_print(A, B, C)
the orbiter library for the classification of combinatorial objects