CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

| Download

GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it

Views: 418346
1
/****************************************************************************
2
**
3
*A expand_commutator.c ANUPQ source Eamonn O'Brien
4
**
5
*Y Copyright 1995-2001, Lehrstuhl D fuer Mathematik, RWTH Aachen, Germany
6
*Y Copyright 1995-2001, School of Mathematical Sciences, ANU, Australia
7
**
8
*/
9
10
#include "constants.h"
11
12
/* routines for handling expansion of commutator relations */
13
14
void add(int *x, int *y);
15
void invert_symbols(int *x);
16
17
/* expand the commutator of s and t */
18
19
void expand_commutator(int *s, int t)
20
{
21
int a[MAXWORD];
22
register int i;
23
24
for (i = 0; i < MAXWORD; ++i)
25
a[i] = s[i];
26
27
invert_symbols(s);
28
s[length(s)] = -t;
29
add(s, a);
30
s[length(s)] = t;
31
}
32
33
/* find the number of non-zero entries in s */
34
35
int length(int *s)
36
{
37
register int i = 0;
38
39
while (i < MAXWORD && s[i] != 0)
40
++i;
41
42
return i;
43
}
44
45
/* concatenate y with x */
46
47
void add(int *x, int *y)
48
{
49
register int j;
50
int i = length(x);
51
52
for (j = 0; j < MAXWORD && y[j] != 0; ++j)
53
x[i + j] = y[j];
54
}
55
56
/* construct the group-theoretic inverse of the symbols in x */
57
58
void invert_symbols(int *x)
59
{
60
register int i = length(x) - 1;
61
register int j;
62
int temp, mid;
63
64
mid = i / 2;
65
66
for (j = 0; j <= mid; ++j) {
67
temp = x[j];
68
x[j] = -x[i - j];
69
x[i - j] = -temp;
70
}
71
}
72
73