Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sagesmc
Path: blob/master/src/sage/groups/perm_gps/partn_ref2/refinement_generic.h
8815 views
1
/*******************************************************************************
2
# Copyright (C) 2012 Thomas Feulner <[email protected]>
3
#
4
# Distributed under the terms of the GNU General Public License (GPL)
5
# as published by the Free Software Foundation; either version 2 of
6
# the License, or (at your option) any later version.
7
# http://www.gnu.org/licenses/
8
#******************************************************************************/
9
10
#include <stdio.h>
11
#include <stdlib.h>
12
13
#ifndef BACKTRACK_WITHLATEX_DEBUG
14
#define BACKTRACK_WITHLATEX_DEBUG 0 // set to 1 if you have to debug
15
#endif
16
17
static long *global_refine_vals_array = 0;
18
19
static int my_comp_func(const void *a, const void *b)
20
{
21
long val_a = global_refine_vals_array[*((int *) a)];
22
long val_b = global_refine_vals_array[*((int *) b)];
23
24
if(val_a == val_b)
25
return 0;
26
if(val_a < val_b)
27
return -1;
28
return 1;
29
}
30
31
int in_array(int *list, int length, int el){
32
int i=0;
33
for(; i < length; i++ )
34
{
35
if ( el == list[i] )
36
{
37
return 1;
38
}
39
}
40
return 0;
41
}
42
43
44