Changeset 9a6e9f in git for kernel/f5gb.cc


Ignore:
Timestamp:
Jun 1, 2008, 2:49:42 PM (15 years ago)
Author:
Christian Eder
Branches:
(u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
Children:
d0f98e2b6e781c62af72431742193116d71b7f19
Parents:
434e4154dbfea91da1283c2a039af70b75a4e85e
Message:
quicksort, label poly class


git-svn-id: file:///usr/local/Singular/svn/trunk@10734 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/f5gb.cc

    r434e415 r9a6e9f  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: f5gb.cc,v 1.4 2008-05-24 07:39:22 ederc Exp $ */
     4/* $Id: f5gb.cc,v 1.5 2008-06-01 12:49:42 ederc Exp $ */
    55/*
    66* ABSTRACT: f5gb interface
    77*/
     8
    89#include "mod2.h"
    910#include "kutil.h"
     
    2021#include "intvec.h"
    2122#include "pInline1.h"
     23#include "f5gb.h"
     24#include "lpoly.h"
     25#ifdef HAVE_F5
    2226
    23 #include "f5gb.h"
    2427
    25 #ifdef HAVE_F5
     28
     29
     30/*2
     31* sorting ideals by decreasing total degree
     32* "left" and "right" are the pointer of the first
     33* and last polynomial in the considered ideal
     34*/
     35void qsort_degree(poly* left, poly* right)
     36{
     37        poly* ptr1 = left;
     38        poly* ptr2 = right;
     39        poly p1,p2;
     40
     41        p2 = *(left + (right - left >> 1));
     42        do{
     43                while(pTotaldegree(*ptr1, currRing) < pTotaldegree(p2, currRing)){
     44                        ptr1++;
     45                }
     46                while(pTotaldegree(*ptr2, currRing) > pTotaldegree(p2,currRing)){
     47                        ptr2--;
     48                }
     49                if(ptr1 > ptr2){
     50                        break;
     51                }
     52                p1    = *ptr1;
     53                *ptr1 = *ptr2;
     54                *ptr2 = p1;
     55        } while(++ptr1 <= --ptr2);
     56
     57        if(left < ptr2){
     58                qsort_degree(left,ptr2);
     59        }
     60        if(ptr1 < right){
     61                qsort_degree(ptr1,right);
     62        }
     63}
     64
     65
     66/*2
     67* computes a gb of the ideal i in the ring r with our f5
     68* implementation
     69*/
    2670ideal F5main(ideal i, ring r)
    2771{
    28   ideal iTmp, g;
    29   int j;     
    30   iTmp = idInit(IDELEMS(i),i->rank);
     72      ideal iTmp, g;
     73      int j;     
     74      lpoly* lp;
     75      intvec* sort;
     76      iTmp = idInit(IDELEMS(i),i->rank);
    3177 
    32   for(j=0; j<IDELEMS(i); j++)
    33   {
    34     if(NULL != i->m[j])
    35     {
    36       iTmp->m[j] = i->m[j];
    37     }
    38   }
    39    
    40   iTmp = kInterRed(i,0); 
    41   idShow(i);
    42   idShow(iTmp);
    43   idShow(iTmp);
    44   return iTmp;
     78      for(j=0; j<IDELEMS(i); j++)
     79      {
     80              if(NULL != i->m[j])
     81              {
     82                      iTmp->m[j] = i->m[j];
     83              }
     84      }
     85
     86      iTmp = kInterRed(i,0); 
     87      qsort_degree(&iTmp->m[0],&iTmp->m[IDELEMS(iTmp)-1]);
     88      idShow(iTmp);
     89     
     90      lp = new lpoly[IDELEMS(iTmp)];
     91      for(j=0; j <IDELEMS(iTmp); j++){
     92                lp[j].setPoly(&iTmp->m[j]);
     93                pWrite(*(lp[j].getPoly()));
     94      }
     95               
     96
     97           
     98
     99
     100        return iTmp;
    45101}
     102
     103
    46104#endif
Note: See TracChangeset for help on using the changeset viewer.