1 //
2 //  permutation.h
3 //  Symmetry
4 //
5 //  Created by Marcus Johansson on 01/02/15.
6 //  Copyright (c) 2015 Marcus Johansson.
7 //
8 //  Distributed under the MIT License ( See LICENSE file or copy at http://opensource.org/licenses/MIT )
9 //
10 
11 #ifndef __MSYM__PERMUTATION_h
12 #define __MSYM__PERMUTATION_h
13 
14 #include <stdio.h>
15 #include "symop.h"
16 #include "msym_error.h"
17 
18 
19 //There are better ways of representing a permutation (lika a Lehmer code) but I'll leave that for later
20 typedef struct _msym_permutation_cycle_t {
21     int l;
22     int s;
23 } msym_permutation_cycle_t;
24 
25 typedef struct _msym_permutation {
26     int *p;
27     int p_length;
28     msym_permutation_cycle_t *c;
29     int c_length;
30 } msym_permutation_t;
31 
32 typedef struct _msym_permutation_morphism {
33     enum {BIJECTION, SURJECTION} type;
34     msym_permutation_t *domain;
35     msym_permutation_t *codomain;
36     int l;
37     union {
38         int *bijection;
39         msym_permutation_cycle_t *surjection;
40     } function;
41 
42 } msym_permutation_morphism_t;
43 
44 
45 msym_error_t findSymmetryOperationPermutations(int l, msym_symmetry_operation_t sops[l], msym_thresholds_t *t, msym_permutation_t **ret);
46 msym_error_t findPermutation(msym_symmetry_operation_t *sop, int l, double (*v[l])[3], msym_thresholds_t *t, msym_permutation_t *perm);
47 void freePermutationData(msym_permutation_t *perm);
48 void permutationMatrix(msym_permutation_t *perm, double m[perm->p_length][perm->p_length]);
49 msym_error_t findPermutationSubgroups(int l, msym_permutation_t perm[l], int sgmax, msym_symmetry_operation_t *sops, int *subgroupl, msym_subgroup_t **subgroup);
50 
51 #endif /* defined(__MSYM__PERMUTATION_h) */
52