Orbiter 2022
Combinatorial Objects
statistics.h
Go to the documentation of this file.
1// statistics.h
2//
3// Anton Betten
4//
5// moved here from galois.h: July 27, 2018
6// started as orbiter: October 23, 2002
7// 2nd version started: December 7, 2003
8// galois started: August 12, 2005
9
10
11#ifndef ORBITER_SRC_LIB_FOUNDATIONS_STATISTICS_STATISTICS_H_
12#define ORBITER_SRC_LIB_FOUNDATIONS_STATISTICS_STATISTICS_H_
13
14
15namespace orbiter {
16namespace layer1_foundations {
17
18
19// #############################################################################
20// tally.cpp
21// #############################################################################
22
23
25
26
27
28class tally {
29
30public:
31
33
35 int *data;
38 // computed using int_vec_sorting_permutation
40 // perm_inv[i] is the index in data
41 // of the element in data_sorted[i]
45
53
54 tally();
55 ~tally();
56 void init(int *data, int data_length,
57 int f_second, int verbose_level);
58 void init_lint(long int *data, int data_length,
59 int f_second, int verbose_level);
60 void sort_and_classify();
62 int class_of(int pt_idx);
63 void print(int f_backwards);
64 void print_no_lf(int f_backwards);
65 void print_tex_no_lf(int f_backwards);
66 void print_first(int f_backwards);
67 void print_second(int f_backwards);
68 void print_first_tex(int f_backwards);
69 void print_second_tex(int f_backwards);
70 void print_file(std::ostream &ost, int f_backwards);
71 void print_file_tex(std::ostream &ost, int f_backwards);
72 void print_file_tex_we_are_in_math_mode(std::ostream &ost, int f_backwards);
73 void print_naked_stringstream(std::stringstream &sstr, int f_backwards);
74 void print_naked(int f_backwards);
75 void print_naked_tex(std::ostream &ost, int f_backwards);
76 void print_types_naked_tex(std::ostream &ost, int f_backwards,
77 int *the_vec_sorted,
78 int nb_types, int *type_first, int *type_len);
79 void print_array_tex(std::ostream &ost, int f_backwards);
80 double average();
82 void get_data_by_multiplicity(int *&Pts, int &nb_pts,
83 int multiplicity, int verbose_level);
85 long int *&Pts, int &nb_pts, int multiplicity, int verbose_level);
86 int determine_class_by_value(int value);
87 int get_value_of_class(int class_idx);
89 void get_class_by_value(int *&Pts, int &nb_pts, int value,
90 int verbose_level);
92 long int *&Pts, int &nb_pts, int value, int verbose_level);
94 int &nb_types, int verbose_level);
95 void save_classes_individually(std::string &fname);
96};
97
98
99// #############################################################################
100// tally_vector_data.cpp
101// #############################################################################
102
103
105
106
107
109
110public:
111
114
115 int *data; // [data_length * data_set_sz]
116
117 int *rep_idx; // [data_length], rep_idx[i] is the index into Rep of data[i * data_set_sz]
118 int *Reps; // [data_length * data_set_sz], used [nb_types * data_set_sz]
119 int *Frequency; // [data_length], used [nb_types]
121 // computed using int_vec_sorting_permutation
123 // perm_inv[i] is the index in data
124 // of the element in data_sorted[i]
125
126
127 std::multimap<uint32_t, int> Hashing;
128 // we store the pair (hash, idx)
129 // where hash is the hash value of the set and idx is the
130 // index in the table Sets where the set is stored.
131 //
132 // we use a multimap because the hash values are not unique
133 // it happens that two sets have the same hash value.
134 // map cannot handle that.
135
138 //int *type_len; same as Frequency[]
139
140 int **Reps_in_lex_order; // [nb_types]
141 int *Frequency_in_lex_order; // [nb_types]
142
143
146 void init(int *data, int data_length, int data_set_sz,
147 int verbose_level);
148 int hash_and_find(int *data,
149 int &idx, uint32_t &h, int verbose_level);
150 void print();
151 void save_classes_individually(std::string &fname, int verbose_level);
152 void get_transversal(
153 int *&transversal, int *&frequency, int &nb_types, int verbose_level);
154 void print_classes_bigger_than_one(int verbose_level);
155
156};
157
158
159}}
160
161#endif /* ORBITER_SRC_LIB_FOUNDATIONS_STATISTICS_STATISTICS_H_ */
162
163
a statistical analysis of data consisting of vectors of ints
Definition: statistics.h:108
int hash_and_find(int *data, int &idx, uint32_t &h, int verbose_level)
void save_classes_individually(std::string &fname, int verbose_level)
std::multimap< uint32_t, int > Hashing
Definition: statistics.h:127
void init(int *data, int data_length, int data_set_sz, int verbose_level)
void get_transversal(int *&transversal, int *&frequency, int &nb_types, int verbose_level)
a statistical analysis of data consisting of single integers
Definition: statistics.h:28
void get_class_by_value_lint(long int *&Pts, int &nb_pts, int value, int verbose_level)
Definition: tally.cpp:672
void print(int f_backwards)
Definition: tally.cpp:245
void print_naked(int f_backwards)
Definition: tally.cpp:396
void print_file_tex_we_are_in_math_mode(std::ostream &ost, int f_backwards)
Definition: tally.cpp:357
void print_first(int f_backwards)
Definition: tally.cpp:276
void print_first_tex(int f_backwards)
Definition: tally.cpp:297
void save_classes_individually(std::string &fname)
Definition: tally.cpp:732
void print_second(int f_backwards)
Definition: tally.cpp:285
void print_no_lf(int f_backwards)
Definition: tally.cpp:256
int get_value_of_class(int class_idx)
Definition: tally.cpp:625
void init(int *data, int data_length, int f_second, int verbose_level)
Definition: tally.cpp:71
void init_lint(long int *data, int data_length, int f_second, int verbose_level)
Definition: tally.cpp:122
void print_array_tex(std::ostream &ost, int f_backwards)
Definition: tally.cpp:470
int determine_class_by_value(int value)
Definition: tally.cpp:612
void print_file(std::ostream &ost, int f_backwards)
Definition: tally.cpp:321
void print_file_tex(std::ostream &ost, int f_backwards)
Definition: tally.cpp:337
void get_class_by_value(int *&Pts, int &nb_pts, int value, int verbose_level)
Definition: tally.cpp:643
void print_second_tex(int f_backwards)
Definition: tally.cpp:308
void get_data_by_multiplicity(int *&Pts, int &nb_pts, int multiplicity, int verbose_level)
Definition: tally.cpp:556
void print_tex_no_lf(int f_backwards)
Definition: tally.cpp:266
void print_types_naked_tex(std::ostream &ost, int f_backwards, int *the_vec_sorted, int nb_types, int *type_first, int *type_len)
Definition: tally.cpp:426
void print_naked_tex(std::ostream &ost, int f_backwards)
Definition: tally.cpp:412
void print_naked_stringstream(std::stringstream &sstr, int f_backwards)
Definition: tally.cpp:377
data_structures::set_of_sets * get_set_partition_and_types(int *&types, int &nb_types, int verbose_level)
Definition: tally.cpp:701
void get_data_by_multiplicity_as_lint(long int *&Pts, int &nb_pts, int multiplicity, int verbose_level)
Definition: tally.cpp:584
the orbiter library for the classification of combinatorial objects