Changeset ca086f in git


Ignore:
Timestamp:
Feb 17, 2006, 11:26:38 AM (17 years ago)
Author:
Michael Brickenstein <bricken@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a657104b677b4c461d018cbf3204d72d34ad66a9')
Children:
ad6ad248b17525d3c24a305a72c5bc48027f3a32
Parents:
03f3269a5d14c3b22852ee7da5f71f27c6e017fb
Message:
*bricken: bit reductions


git-svn-id: file:///usr/local/Singular/svn/trunk@8953 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
kernel
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • kernel/digitech.cc

    r03f3269 rca086f  
    33#include "ideals.h"
    44static ideal zero_ideal;
     5#if 1
    56void bit_reduce(poly & f,ring r){
    67  poly p=f;
     
    3132  f=erg;
    3233}
     34#else
     35
     36
     37
     38void do_bit_reduce(poly f, kBucket_pt bucket){
     39    ring r=bucket->bucket_ring;
     40    int p=rChar(r);
     41    int max=rVar(r);
     42    while (f!=NULL)
     43        {
     44            // int len=0;
     45//             poly erg;
     46//             kBucketClear(bucket,&erg, &len);
     47//             kBucketDestroy(&bucket);
     48//             return erg;
     49            //return;
     50        //}
     51   
     52    BOOLEAN changed=FALSE;
     53    poly next=pNext(f);
     54    pNext(f)=NULL;
     55    int i;
     56    for(i=1;i<=max;i++){
     57      unsigned long exp;
     58      while((exp=p_GetExp(f,i,r))>=p){
     59               p_SetExp(f,i,exp-p+1,r);
     60               changed=TRUE;
     61      }
     62    }
     63   
     64    if (changed) {
     65        p_Setm(f,r);
     66       
     67        int pseudo_len=0;
     68        kBucket_Add_q(bucket,f,&pseudo_len);
     69        //do_bit_reduce(next,bucket);
     70    } else {
     71        //do_bit_reduce(next,bucket);
     72        int pseudo_len=0;
     73        kBucket_Add_q(bucket,f,&pseudo_len);
     74       
     75    }
     76    f=next;
     77    }
     78}
     79poly do_bitreduce(poly f, ring r){
     80  poly erg=NULL;
     81  poly *append_to=&erg;
     82  int p=rChar(r);
     83  int max=rVar(r);
     84  kBucket_pt bucket= kBucketCreate(r);
     85  kBucketInit(bucket,NULL,0 /*pLength(P.p)*/);
     86  while(f!=NULL){
     87    BOOLEAN changed=FALSE;
     88    poly next=pNext(f);
     89    pNext(f)=NULL;
     90    assume(pNext(f)==NULL);
     91    int i;
     92    for(i=1;i<=max;i++){
     93      unsigned long exp;
     94      while((exp=p_GetExp(f,i,r))>=p){
     95               p_SetExp(f,i,exp-p+1,r);
     96               changed=TRUE;
     97      }
     98    }
     99    if (changed) {
     100        p_Setm(f,r);
     101        int pseudo_len=0;
     102        kBucket_Add_q(bucket,f,&pseudo_len);
     103    } else {
     104        (*append_to)=f;
     105        append_to=&(pNext(f));
     106    }
     107    f=next;
     108  }
     109  {
     110    int pseudo_len=0;
     111    kBucket_Add_q(bucket,erg,&pseudo_len);
     112    pseudo_len=0;
     113    kBucketClear(bucket,&erg,&pseudo_len);
     114  }
     115    return erg;
     116}
     117void bit_reduce2(poly & f,ring r){
     118  if (f==NULL) return;
     119  if (pNext(f)==NULL){
     120    int p=rChar(r);
     121    int max=rVar(r);
     122    BOOLEAN changed=FALSE;
     123    poly next=pNext(f);
     124    assume(pNext(f)==NULL);
     125    int i;
     126    for(i=1;i<=max;i++){
     127      unsigned long exp;
     128      while((exp=p_GetExp(f,i,r))>=p){
     129               p_SetExp(f,i,exp-p+1,r);
     130               changed=TRUE;
     131      }
     132    }
     133    if (changed)
     134        p_Setm(f,r);
     135    return;
     136  }
     137  // kBucket_pt bucket= kBucketCreate(r);
     138//   kBucketInit(bucket,NULL,0 /*pLength(P.p)*/);
     139//   do_bit_reduce(f,bucket);
     140//   int len=0;
     141//   kBucketClear(bucket,&f, &len);
     142//   kBucketDestroy(&bucket);
     143    f=do_bitreduce(f,r);
     144 
     145}
     146void bit_reduce1(poly & f,ring r){
     147  if (f==NULL) return;
     148
     149 
     150  if (pNext(f)==NULL){
     151    int p=rChar(r);
     152    int max=rVar(r);
     153    BOOLEAN changed=FALSE;
     154    poly next=pNext(f);
     155    assume(pNext(f)==NULL);
     156    int i;
     157    for(i=1;i<=max;i++){
     158      unsigned long exp;
     159      while((exp=p_GetExp(f,i,r))>=p){
     160               p_SetExp(f,i,exp-p+1,r);
     161               changed=TRUE;
     162      }
     163    }
     164    if (changed)
     165        p_Setm(f,r);
     166    return;
     167  }
     168  kBucket_pt bucket= kBucketCreate(r);
     169  kBucketInit(bucket,NULL,0 /*pLength(P.p)*/);
     170  do_bit_reduce(f,bucket);
     171  int len=0;
     172  kBucketClear(bucket,&f, &len);
     173  kBucketDestroy(&bucket);
     174 
     175}
     176// void bit_reduce_arg(poly & f,ring r){
     177//   kBucket_pt bucket= kBucketCreate(r);
     178//   kBucketInit(bucket,NULL,0 /*pLength(P.p)*/);
     179//   f=do_bit_reduce(f,bucket);
     180// }
     181#endif
     182
    33183poly uni_subst_bits(poly outer_uni, poly inner_multi, ring r){
    34184  zero_ideal=idInit(0,1);
  • kernel/digitech.h

    r03f3269 rca086f  
    33#include "mod2.h"
    44#include "polys.h"
     5void bit_reduce(poly & f,ring r);
    56poly uni_subst_bits(poly outer_uni, poly inner_multi, ring r);
    67#endif
  • kernel/tgb_internal.h

    r03f3269 rca086f  
    55*  Computer Algebra System SINGULAR     *
    66****************************************/
    7 /* $Id: tgb_internal.h,v 1.21 2005-12-08 09:00:20 bricken Exp $ */
     7/* $Id: tgb_internal.h,v 1.22 2006-02-17 10:26:35 bricken Exp $ */
    88/*
    99 * ABSTRACT: tgb internal .h file
     
    8888    virtual ~slimgb_alg();
    8989  char** states;
     90  ideal add_later;
    9091  ideal S;
    9192  ring r;
     
    185186static poly kBucketGcd(kBucket* b, ring r);
    186187static void multi_reduction(red_object* los, int & losl, slimgb_alg* c);
     188
    187189sorted_pair_node* quick_pop_pair(slimgb_alg* c);
    188190sorted_pair_node* top_pair(slimgb_alg* c);
Note: See TracChangeset for help on using the changeset viewer.