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 calculate_jacobi.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 "pq_defs.h"
11
#include "pcp_vars.h"
12
#include "constants.h"
13
14
/* calculate an individual jacobi */
15
16
void calculate_jacobi(struct pcp_vars *pcp)
17
{
18
register int *y = y_address;
19
20
Logical invalid = FALSE;
21
int bound = pcp->ccbeg;
22
int output;
23
int a, b, c;
24
25
#include "access.h"
26
27
printf("Input the three components for the consistency calculation: ");
28
read_value(FALSE, "", &c, 1);
29
read_value(FALSE, "", &b, 1);
30
read_value(TRUE, "", &a, 1);
31
32
/* check the validity of the components */
33
invalid =
34
outside(a, bound) || outside(b, bound) || outside(c, bound) ||
35
pcp->cc <= 2 || c < b || b < a ||
36
(a != b && b != c &&
37
WT(y[pcp->structure + c]) + WT(y[pcp->structure + b]) +
38
WT(y[pcp->structure + a]) >
39
pcp->cc) ||
40
((a == b || b == c) &&
41
WT(y[pcp->structure + a]) + WT(y[pcp->structure + c]) + 1 > pcp->cc);
42
43
/* if valid, calculate the jacobi */
44
if (!invalid) {
45
output = pcp->fullop;
46
pcp->fullop = TRUE;
47
jacobi(c, b, a, 0, pcp);
48
pcp->fullop = output;
49
} else {
50
PRINT("Incorrect values %d, %d, %d for Jacobi calculation\n", c, b, a);
51
pcp->redgen = 0;
52
}
53
}
54
55
/* check if x lies outside permitted range from 1 to y */
56
int outside(int x, int y)
57
{
58
return (x <= 0) || (x > y);
59
}
60
61