Changeset fda7090 in git for kernel/digitech.cc


Ignore:
Timestamp:
Nov 10, 2010, 5:07:34 PM (13 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
db31439b3d389e600b96258fcf1bd94de4d24d3f
Parents:
1446e7f6b858dd03816a2e1b9a0c6022428f8b67
Message:
code simplification


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

Legend:

Unmodified
Added
Removed
  • kernel/digitech.cc

    r1446e7 rfda7090  
    1010#include <kernel/ideals.h>
    1111static ideal zero_ideal;
    12 #if 1
     12
    1313void bit_reduce(poly & f,ring r)
    1414{
     
    4242  f=erg;
    4343}
    44 #else
    45 
    46 
    47 
    48 void do_bit_reduce(poly f, kBucket_pt bucket)
    49 {
    50     ring r=bucket->bucket_ring;
    51     int p=rChar(r);
    52     int max=rVar(r);
    53     while (f!=NULL)
    54         {
    55             // int len=0;
    56 //             poly erg;
    57 //             kBucketClear(bucket,&erg, &len);
    58 //             kBucketDestroy(&bucket);
    59 //             return erg;
    60             //return;
    61         //}
    62 
    63     BOOLEAN changed=FALSE;
    64     poly next=pNext(f);
    65     pNext(f)=NULL;
    66     int i;
    67     for(i=1;i<=max;i++)
    68     {
    69       unsigned long exp;
    70       while((exp=p_GetExp(f,i,r))>=p){
    71                p_SetExp(f,i,exp-p+1,r);
    72                changed=TRUE;
    73       }
    74     }
    75 
    76     if (changed)
    77     {
    78         p_Setm(f,r);
    79 
    80         int pseudo_len=0;
    81         kBucket_Add_q(bucket,f,&pseudo_len);
    82         //do_bit_reduce(next,bucket);
    83     }
    84     else
    85     {
    86         //do_bit_reduce(next,bucket);
    87         int pseudo_len=0;
    88         kBucket_Add_q(bucket,f,&pseudo_len);
    89 
    90     }
    91     f=next;
    92     }
    93 }
    94 poly do_bitreduce(poly f, ring r)
    95 {
    96   poly erg=NULL;
    97   poly *append_to=&erg;
    98   int p=rChar(r);
    99   int max=rVar(r);
    100   kBucket_pt bucket= kBucketCreate(r);
    101   kBucketInit(bucket,NULL,0 /*pLength(P.p)*/);
    102   while(f!=NULL)
    103   {
    104     BOOLEAN changed=FALSE;
    105     poly next=pNext(f);
    106     pNext(f)=NULL;
    107     assume(pNext(f)==NULL);
    108     int i;
    109     for(i=1;i<=max;i++)
    110     {
    111       unsigned long exp;
    112       while((exp=p_GetExp(f,i,r))>=p)
    113       {
    114                p_SetExp(f,i,exp-p+1,r);
    115                changed=TRUE;
    116       }
    117     }
    118     if (changed)
    119     {
    120         p_Setm(f,r);
    121         int pseudo_len=0;
    122         kBucket_Add_q(bucket,f,&pseudo_len);
    123     }
    124     else
    125     {
    126         (*append_to)=f;
    127         append_to=&(pNext(f));
    128     }
    129     f=next;
    130   }
    131   {
    132     int pseudo_len=0;
    133     kBucket_Add_q(bucket,erg,&pseudo_len);
    134     pseudo_len=0;
    135     kBucketClear(bucket,&erg,&pseudo_len);
    136   }
    137     return erg;
    138 }
    139 void bit_reduce2(poly & f,ring r)
    140 {
    141   if (f==NULL) return;
    142   if (pNext(f)==NULL){
    143     int p=rChar(r);
    144     int max=rVar(r);
    145     BOOLEAN changed=FALSE;
    146     poly next=pNext(f);
    147     assume(pNext(f)==NULL);
    148     int i;
    149     for(i=1;i<=max;i++)
    150     {
    151       unsigned long exp;
    152       while((exp=p_GetExp(f,i,r))>=p)
    153       {
    154                p_SetExp(f,i,exp-p+1,r);
    155                changed=TRUE;
    156       }
    157     }
    158     if (changed)
    159         p_Setm(f,r);
    160     return;
    161   }
    162   // kBucket_pt bucket= kBucketCreate(r);
    163 //   kBucketInit(bucket,NULL,0 /*pLength(P.p)*/);
    164 //   do_bit_reduce(f,bucket);
    165 //   int len=0;
    166 //   kBucketClear(bucket,&f, &len);
    167 //   kBucketDestroy(&bucket);
    168     f=do_bitreduce(f,r);
    169 
    170 }
    171 void bit_reduce1(poly & f,ring r)
    172 {
    173   if (f==NULL) return;
    174 
    175 
    176   if (pNext(f)==NULL)
    177   {
    178     int p=rChar(r);
    179     int max=rVar(r);
    180     BOOLEAN changed=FALSE;
    181     poly next=pNext(f);
    182     assume(pNext(f)==NULL);
    183     int i;
    184     for(i=1;i<=max;i++)
    185     {
    186       unsigned long exp;
    187       while((exp=p_GetExp(f,i,r))>=p)
    188       {
    189                p_SetExp(f,i,exp-p+1,r);
    190                changed=TRUE;
    191       }
    192     }
    193     if (changed)
    194         p_Setm(f,r);
    195     return;
    196   }
    197   kBucket_pt bucket= kBucketCreate(r);
    198   kBucketInit(bucket,NULL,0 /*pLength(P.p)*/);
    199   do_bit_reduce(f,bucket);
    200   int len=0;
    201   kBucketClear(bucket,&f, &len);
    202   kBucketDestroy(&bucket);
    203 
    204 }
    205 // void bit_reduce_arg(poly & f,ring r){
    206 //   kBucket_pt bucket= kBucketCreate(r);
    207 //   kBucketInit(bucket,NULL,0 /*pLength(P.p)*/);
    208 //   f=do_bit_reduce(f,bucket);
    209 // }
    210 #endif
    21144
    21245poly uni_subst_bits(poly outer_uni, poly inner_multi, ring r)
     
    23972  }
    24073
    241 
    242 
    243 
    24474  //free potences
    24575  for(i=0;i<=d_max;i++)
Note: See TracChangeset for help on using the changeset viewer.