Macaulay2 Engine
Loading...
Searching...
No Matches

◆ sort_sign()

int sort_sign ( int a,
int * v1,
int b,
int * v2 )
static

Definition at line 19 of file skew.cpp.

20{
21 if (a == 0 || b == 0) return 1;
22 int result = 0; // number of sign switches
23 a--;
24 b--;
25 for (;;)
26 {
27 if (v1[a] < v2[b])
28 {
29 b--;
30 if (b < 0)
31 {
32 return (result % 2 == 0 ? 1 : -1);
33 }
34 }
35 else if (v1[a] > v2[b])
36 {
37 result += b + 1;
38 a--;
39 if (a < 0)
40 {
41 return (result % 2 == 0 ? 1 : -1);
42 }
43 }
44 else
45 return 0;
46 }
47}
VALGRIND_MAKE_MEM_DEFINED & result(result)

References result().

Referenced by SkewMultiplication::diff(), SkewMultiplication::mult_sign(), and SkewMultiplication::mult_sign().