Changeset 446c2d in git


Ignore:
Timestamp:
Feb 14, 2005, 10:35:16 AM (18 years ago)
Author:
Michael Brickenstein <bricken@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '00e2e9c41af3fde1273eb3633f4c0c7c3db2579d')
Children:
c70e58e289e0fb70ec18f904a7b46f4640a32101
Parents:
e270ea75e00891407b10e3c04bcac50fc3e9ba21
Message:
*bricken: better support for block polynoms


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

Legend:

Unmodified
Added
Removed
  • kernel/fast_mult.cc

    re270ea r446c2d  
    11#include "fast_mult.h"
    22#include "kbuckets.h"
     3static const int pass_option=1;
    34static void degsplit(poly p,int n,poly &p1,poly&p2){
    45  poly erg1_i, erg2_i;
     
    6263  int pot=n/2;
    6364  assume(pot*2==n);
     65
     66
     67  //splitting
    6468  poly f1=NULL;
    65   //f/(x^(pot));
    6669  poly f0=NULL;//f-(x^(pot)*F1);
    6770  degsplit(pCopy(f),pot,f1,f0);
    6871  div_by_x_power_n(f1,pot);
    69   // poly G1=g/(x^(pot));
    70   //poly G0=g-(x^(pot)*G1);
     72
    7173  poly g1=NULL;
    7274  poly g0=NULL;
     
    7476  div_by_x_power_n(g1,pot);
    7577 
     78  //p00, p11
    7679  poly p00=unifastmult(f0,g0);
    77     poly p11=unifastmult(f1,g1);
    78  
    79   poly pbig=unifastmult(pAdd(f0,f1),pAdd(g0,g1));
    80  
    81   poly erg=NULL;//=p11;
    82  
     80  poly p11=unifastmult(f1,g1);
     81
     82  //construct erg, factor
     83  poly erg=NULL;
    8384  poly factor=pOne();
     85
    8486  pSetExp(factor,1,n);
    8587  erg=ppMult_mm(p11,factor);
    8688  erg=pAdd(erg,pCopy(p00));
    87  
     89
     90 
     91
     92
     93 
     94  //  if((f1!=NULL) &&(f0!=NULL) &&(g0!=NULL) && (g1!=NULL)){
     95  if(true){
     96//eat up f0,f1,g0,g1
     97  poly pbig=unifastmult(pAdd(f0,f1),pAdd(g0,g1));
     98 
     99
     100 
     101  //eat up pbig
    88102  poly sum=pbig;
    89103  pSetExp(factor,1,pot);
    90  
     104 
     105  //eat up p00
    91106  sum=pAdd(sum,pNeg(p00));
    92107 
    93 
     108  //eat up p11
    94109  sum=pAdd(sum,pNeg(p11));
    95110
    96  
     111  
    97112  sum=pMult_mm(sum,factor);
    98  
     113
     114
     115  //eat up sum
    99116  erg=pAdd(sum,erg);
    100   //  erg=pAdd(erg,p00);
     117  } else {
     118    //eat up f0,f1,g0,g1
     119    poly s1=unifastmult(f0,g1);
     120    poly s2=unifastmult(g0,f1);
     121    pSetExp(factor,1,pot);
     122    poly h=pMult_mm(((s1!=NULL)?s1:s2),factor);
     123    pDelete(&f1);
     124    pDelete(&f0);
     125    pDelete(&g0);
     126    pDelete(&g1);
     127    erg=pAdd(erg,h);
     128  }
     129 
    101130 
    102131  pDelete(&factor);
     132                 
     133                 
     134
    103135  return(erg);
    104136}
     
    107139   
    108140 
    109   // BOOLEAN corr=lenS_correct(strat);
     141
    110142
    111143  int n=1;
     
    131163  kBucket_pt erg_bucket= kBucketCreate(currRing);
    132164  kBucketInit(erg_bucket,NULL,0 /*pLength(P.p)*/);
    133   //poly erg_mult=pOne();
     165
    134166  int pot=n/2;
    135167  assume(pot*2==n);
     168
     169
     170  //splitting
    136171  poly f1=NULL;
    137   //f/(x^(pot));
    138172  poly f0=NULL;//f-(x^(pot)*F1);
    139173  degsplit(pCopy(f),pot,f1,f0);
    140174  div_by_x_power_n(f1,pot);
    141   // poly G1=g/(x^(pot));
    142   //poly G0=g-(x^(pot)*G1);
    143175  poly g1=NULL;
    144176  poly g0=NULL;
     
    146178  div_by_x_power_n(g1,pot);
    147179 
     180  //p00
     181  //p11
    148182  poly p00=unifastmult(f0,g0);
    149     poly p11=unifastmult(f1,g1);
    150  
    151   poly pbig=unifastmult(pAdd(f0,f1),pAdd(g0,g1));
    152  
    153   //poly erg=p11;
    154  
     183  poly p11=unifastmult(f1,g1);
     184 
     185
     186
     187
     188  //eat up f0,f1,g0,g1
     189  poly pbig=unifastmult(pAdd(f0,f1),pAdd(g0,g1)); 
    155190  poly factor=pOne();//pCopy(erg_mult);
    156191  pSetExp(factor,1,n);
     
    160195  kBucket_Add_q(erg_bucket,pCopy(p00),&pseudo_len);
    161196  pSetExp(factor,1,pot);
    162   //poly sum=pbig;
     197
     198  //eat up pbig
    163199  pseudo_len=0;
    164200  kBucket_Add_q(erg_bucket,pMult_mm(pbig,factor),&pseudo_len);
    165201  pseudo_len=0;
     202  //eat up p00
    166203  kBucket_Add_q(erg_bucket,pMult_mm(pNeg(p00),factor),&pseudo_len);
    167204  pseudo_len=0;
     205  //eat up p11
    168206  kBucket_Add_q(erg_bucket,pMult_mm(pNeg(p11),factor),&pseudo_len);
    169   //  pSetExp(factor,1,pot);
    170  
    171   // sum=pAdd(sum,pNeg(p00));
    172  
    173 
    174   //sum=pAdd(sum,pNeg(p11));
    175 
    176  
    177   //sum=pMult_mm(sum,factor);
    178  
    179   pseudo_len=0;
    180   //  kBucket_Add_q(erg_bucket,sum,&pseudo_len);
    181   //  erg=pAdd(erg,p00);
     207
     208 
     209  pseudo_len=0;
     210
    182211 
    183212  pDelete(&factor);
    184   //return(erg);
    185   //  pDelete(&erg_mult);
     213
    186214  int len=0;
    187215  poly erg=NULL;
    188216  kBucketClear(erg_bucket,&erg,&len);
    189217  kBucketDestroy(&erg_bucket);
    190   //pNormalize(P.p);
     218
    191219  return erg;
    192220}
Note: See TracChangeset for help on using the changeset viewer.