aboutsummaryrefslogtreecommitdiff
path: root/old/utils.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--old/utils.h59
1 files changed, 0 insertions, 59 deletions
diff --git a/old/utils.h b/old/utils.h
deleted file mode 100644
index ee8ac6e..0000000
--- a/old/utils.h
+++ /dev/null
@@ -1,59 +0,0 @@
1#ifndef UTILS_H
2#define UTILS_H
3
4#include <stdbool.h>
5#include <stdlib.h>
6
7/* Constants and macros *****************************************************/
8
9#define pow2to11 2048
10#define pow2to12 4096
11#define pow3to7 2187
12#define pow3to8 6561
13#define pow12to4 20736
14#define factorial4 24
15#define factorial6 720
16#define factorial8 40320
17#define factorial12 479001600
18#define binom12on4 495
19#define binom8on4 70
20
21#define min(a,b) (((a) < (b)) ? (a) : (b))
22#define max(a,b) (((a) > (b)) ? (a) : (b))
23
24/* Generic utility functions *************************************************/
25
26void apply_permutation(int *perm, int *set, int n);
27void intarrcopy(int *src, int *dst, int n);
28bool is_perm(int *a, int n);
29bool is_subset(int *a, int n, int k);
30int sum(int *a, int n);
31void sum_arrays_mod(int *src, int *dst, int n, int m);
32void swap(int *a, int *b);
33
34/* Standard mathematical functions *******************************************/
35
36int binomial(int n, int k);
37int factorial(int n);
38int perm_sign(int a[], int n);
39int powint(int a, int b);
40
41/* Conversions to and from int (base b digits, permutations...) **************/
42
43int digit_array_to_int(int *a, int n, int b);
44void int_to_digit_array(int a, int b, int n, int *r);
45void int_to_sum_zero_array(int x, int b, int n, int *a);
46int invert_digits(int a, int b, int n);
47
48void index_to_perm(int p, int n, int *r);
49int perm_to_index(int *a, int n);
50
51void index_to_subset(int s, int n, int k, int *r);
52int subset_to_index(int *a, int n, int k);
53
54/* Am I not using these two?
55void index_to_ordered_subset(int s, int n, int k, int *r);
56int ordered_subset_to_index(int *a, int n, int k);
57*/
58
59#endif

Generated with cgit - Back to sebastiano.tronto.net