Changeset 73460e in git


Ignore:
Timestamp:
Apr 26, 2016, 3:15:26 PM (8 years ago)
Author:
Andreas Steenpass <steenpass@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'b4f17ed1d25f93d46dbe29e4b499baecc2fd51bb')
Children:
99c74f3ed026dfaf783fdac2f85e2b6e18227089
Parents:
adc9531df1d439258c957d9547102094a1f33d31
git-author:
Andreas Steenpass <steenpass@mathematik.uni-kl.de>2016-04-26 15:15:26+02:00
git-committer:
Andreas Steenpass <steenpass@mathematik.uni-kl.de>2017-12-15 12:17:07+01:00
Message:
add: implement sorting of the M_i
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/GBEngine/syz4.cc

    radc953 r73460e  
    127127}
    128128
     129#define SORT_MI 1
     130
     131#if SORT_MI
     132static int compare_Mi(const void* a, const void *b)
     133{
     134    const ring r = currRing;
     135    poly p_a = *((poly *)a);
     136    poly p_b = *((poly *)b);
     137    int cmp;
     138    int deg_a = p_Deg(p_a, r);
     139    int deg_b = p_Deg(p_b, r);
     140    cmp = (deg_a > deg_b) - (deg_a < deg_b);
     141    if (cmp != 0) {
     142         return cmp;
     143    }
     144    int comp_a = p_GetComp(p_a, r);
     145    int comp_b = p_GetComp(p_b, r);
     146    cmp = (comp_a > comp_b) - (comp_a < comp_b);
     147    if (cmp != 0) {
     148         return cmp;
     149    }
     150    int exp_a[r->N+1];
     151    int exp_b[r->N+1];
     152    p_GetExpV(p_a, exp_a, r);
     153    p_GetExpV(p_b, exp_b, r);
     154    for (int i = r->N; i > 0; i--) {
     155        cmp = (exp_a[i] > exp_b[i]) - (exp_a[i] < exp_b[i]);
     156        if (cmp != 0) {
     157            return cmp;
     158        }
     159    }
     160    return 0;
     161}
     162#endif   // SORT_MI
     163
    129164static ideal computeFrame(const ideal G, const syzM_i_Function syzM_i,
    130165    const syzHeadFunction *syzHead)
     
    142177    }
    143178    omFree(M);
     179#if SORT_MI
     180    qsort(frame->m, IDELEMS(frame), sizeof(poly), compare_Mi);
     181#endif
    144182    return frame;
    145183}
Note: See TracChangeset for help on using the changeset viewer.