Changeset 446c2d in git
- Timestamp:
- Feb 14, 2005, 10:35:16 AM (18 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '00e2e9c41af3fde1273eb3633f4c0c7c3db2579d')
- Children:
- c70e58e289e0fb70ec18f904a7b46f4640a32101
- Parents:
- e270ea75e00891407b10e3c04bcac50fc3e9ba21
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/fast_mult.cc
re270ea r446c2d 1 1 #include "fast_mult.h" 2 2 #include "kbuckets.h" 3 static const int pass_option=1; 3 4 static void degsplit(poly p,int n,poly &p1,poly&p2){ 4 5 poly erg1_i, erg2_i; … … 62 63 int pot=n/2; 63 64 assume(pot*2==n); 65 66 67 //splitting 64 68 poly f1=NULL; 65 //f/(x^(pot));66 69 poly f0=NULL;//f-(x^(pot)*F1); 67 70 degsplit(pCopy(f),pot,f1,f0); 68 71 div_by_x_power_n(f1,pot); 69 // poly G1=g/(x^(pot)); 70 //poly G0=g-(x^(pot)*G1); 72 71 73 poly g1=NULL; 72 74 poly g0=NULL; … … 74 76 div_by_x_power_n(g1,pot); 75 77 78 //p00, p11 76 79 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; 83 84 poly factor=pOne(); 85 84 86 pSetExp(factor,1,n); 85 87 erg=ppMult_mm(p11,factor); 86 88 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 88 102 poly sum=pbig; 89 103 pSetExp(factor,1,pot); 90 104 105 //eat up p00 91 106 sum=pAdd(sum,pNeg(p00)); 92 107 93 108 //eat up p11 94 109 sum=pAdd(sum,pNeg(p11)); 95 110 96 111 97 112 sum=pMult_mm(sum,factor); 98 113 114 115 //eat up sum 99 116 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 101 130 102 131 pDelete(&factor); 132 133 134 103 135 return(erg); 104 136 } … … 107 139 108 140 109 // BOOLEAN corr=lenS_correct(strat); 141 110 142 111 143 int n=1; … … 131 163 kBucket_pt erg_bucket= kBucketCreate(currRing); 132 164 kBucketInit(erg_bucket,NULL,0 /*pLength(P.p)*/); 133 //poly erg_mult=pOne(); 165 134 166 int pot=n/2; 135 167 assume(pot*2==n); 168 169 170 //splitting 136 171 poly f1=NULL; 137 //f/(x^(pot));138 172 poly f0=NULL;//f-(x^(pot)*F1); 139 173 degsplit(pCopy(f),pot,f1,f0); 140 174 div_by_x_power_n(f1,pot); 141 // poly G1=g/(x^(pot));142 //poly G0=g-(x^(pot)*G1);143 175 poly g1=NULL; 144 176 poly g0=NULL; … … 146 178 div_by_x_power_n(g1,pot); 147 179 180 //p00 181 //p11 148 182 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)); 155 190 poly factor=pOne();//pCopy(erg_mult); 156 191 pSetExp(factor,1,n); … … 160 195 kBucket_Add_q(erg_bucket,pCopy(p00),&pseudo_len); 161 196 pSetExp(factor,1,pot); 162 //poly sum=pbig; 197 198 //eat up pbig 163 199 pseudo_len=0; 164 200 kBucket_Add_q(erg_bucket,pMult_mm(pbig,factor),&pseudo_len); 165 201 pseudo_len=0; 202 //eat up p00 166 203 kBucket_Add_q(erg_bucket,pMult_mm(pNeg(p00),factor),&pseudo_len); 167 204 pseudo_len=0; 205 //eat up p11 168 206 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 182 211 183 212 pDelete(&factor); 184 //return(erg); 185 // pDelete(&erg_mult); 213 186 214 int len=0; 187 215 poly erg=NULL; 188 216 kBucketClear(erg_bucket,&erg,&len); 189 217 kBucketDestroy(&erg_bucket); 190 //pNormalize(P.p); 218 191 219 return erg; 192 220 }
Note: See TracChangeset
for help on using the changeset viewer.