Ian Jauslin
summaryrefslogtreecommitdiff
blob: 7b7a07a2e1db09dbf1f136ffb7dd7171a0b63d5c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/*
Copyright 2015-2022 Ian Jauslin

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

/* declaring fields */

#ifndef FIELDS_H
#define FIELDS_H

#include "types.h"


// Fields_Table

// init
int init_Fields_Table(Fields_Table* fields);
int free_Fields_Table(Fields_Table fields);

// determine field type
int field_type(int index, Fields_Table fields);
// check whether a field anticommutes
int is_fermion(int index, Fields_Table fields);
// check whether a field is non-commuting
int is_noncommuting(int index, Fields_Table fields);


// Identities

// init
int init_Identities(Identities* identities,int size);
int free_Identities(Identities identities);

// resize
int resize_identities(Identities* identities,int new_size);

// copy
int identities_cpy(Identities input, Identities* output);
int identities_cpy_noinit(Identities input, Identities* output);

// append an element to a identities
int identities_append(Int_Array lhs, Polynomial rhs, Identities* output);
int identities_append_noinit(Int_Array lhs, Polynomial rhs, Identities* output);

// concatenate two identitiess
int identities_concat(Identities input, Identities* output);

// resolve the identities
int resolve_ids(Polynomial* polynomial, Fields_Table fields);
// check whether an array is a sub-array of another, support for noncommuting elements
int int_array_is_subarray_noncommuting(Int_Array input, Int_Array test_array, Fields_Table fields);


// Virtual_fields

// init
int init_Virtual_fields(Virtual_fields* virtual_fields,int size);
int free_Virtual_fields(Virtual_fields virtual_fields);

// resize
int resize_virtual_fields(Virtual_fields* virtual_fields,int new_size);

// copy
int virtual_fields_cpy(Virtual_fields input, Virtual_fields* output);
int virtual_fields_cpy_noinit(Virtual_fields input, Virtual_fields* output);

// append an element to a virtual_fields
int virtual_fields_append(int index, Polynomial expr, Virtual_fields* output);
int virtual_fields_append_noinit(int index, Polynomial expr, Virtual_fields* output);

// concatenate two virtual_fields
int virtual_fields_concat(Virtual_fields input, Virtual_fields* output);


// Groups

// init
int init_Groups(Groups* groups,int size);
int free_Groups(Groups groups);

// resize
int resize_groups(Groups* groups,int new_size);

// copy
int groups_cpy(Groups input, Groups* output);
int groups_cpy_noinit(Groups input, Groups* output);

// append an element to a groups
int groups_append(Int_Array indices, Groups* output);
int groups_append_noinit(Int_Array indices, Groups* output);

// concatenate two groupss
int groups_concat(Groups input, Groups* output);

// find which group an index belongs to
int find_group(int index, Groups groups);


// Variables

// allocate memory
int init_Variables(Variables* variables,int size);
// free memory
int free_Variables(Variables variables);

// resize
int resize_variables(Variables* variables,int new_size);

// copy
int variables_cpy(Variables input, Variables* output);
int variables_cpy_noinit(Variables input, Variables* output);

// append an element to a variables collection
int variables_append(Char_Array var_name, Tree symbol_tree, Variables* output);
int variables_append_noinit(Char_Array var_name, Tree symbol_tree, Variables* output);

// concatenate two variables collections
int variables_concat(Variables input, Variables* output);

// find a variable matching a var_name
int variables_find_var(Char_Array name, Variables variables, Tree* output);

// add a polynomials as a new named variable
int add_polynomial_to_variables(char* name, Polynomial polynomial, Variables* variables);

#define FIELDS_H_DONE
#endif