Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

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

563603 views
1
#include"typedef.h"
2
/**************************************************************************\
3
@---------------------------------------------------------------------------
4
@---------------------------------------------------------------------------
5
@ FILE: reduction_sort.c
6
@---------------------------------------------------------------------------
7
@---------------------------------------------------------------------------
8
@
9
\**************************************************************************/
10
11
12
/**************************************************************************\
13
@---------------------------------------------------------------------------
14
@ void reduction_sort(G,T,n)
15
@ int **G, **T, n;
16
@
17
@ make simultaneous row and colum permutations on the twodimensional
18
@ array G of size n x n such that G[i][i] <= G[j][j] for 0<=i<=j<n.
19
@ Simultaneously the row operations are applied to T, that
20
@ has to be an array of the same size or NULL
21
@---------------------------------------------------------------------------
22
@
23
\**************************************************************************/
24
void reduction_sort(G,T,n)
25
int **G, **T, n;
26
{
27
int i,j,k;
28
int minpos, min;
29
int *tmp;
30
int merk;
31
for(i=0;i<n;i++)
32
{
33
min = G[i][i];
34
minpos = i;
35
for(j=i+1;j<n;j++)
36
{
37
if(G[j][j] < min)
38
{ min = G[j][j]; minpos = j;}
39
}
40
if(minpos != i)
41
{
42
tmp = G[i]; G[i] = G[minpos]; G[minpos] = tmp;
43
if(T != NULL)
44
{ tmp = T[i]; T[i] = T[minpos]; T[minpos] = tmp;}
45
for(j=0;j<n;j++)
46
{ merk = G[j][i]; G[j][i] = G[j][minpos]; G[j][minpos] = merk;}
47
}
48
}
49
}
50
51