Changeset cb7578 in git
- Timestamp:
- Jan 19, 2002, 1:29:32 PM (22 years ago)
- Branches:
- (u'spielwiese', 'd1b01e9d51ade4b46b745d3bada5c5f3696be3a8')
- Children:
- 92dfcf05070f45f75af8cd2d1cc3467b7a0a8e16
- Parents:
- 7164b4073058f2dcb68506a829cdbbe9a28d3ee4
- Location:
- Singular
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/fast_maps.cc
r7164b40 rcb7578 7 7 * Author: obachman (Olaf Bachmann) 8 8 * Created: 02/01 9 * Version: $Id: fast_maps.cc,v 1. 6 2002-01-19 12:26:02 bricken Exp $9 * Version: $Id: fast_maps.cc,v 1.7 2002-01-19 12:29:32 obachman Exp $ 10 10 *******************************************************************/ 11 11 #include "mod2.h" … … 18 18 #include "fast_maps.h" 19 19 20 #if 0 21 // paste into extra.cc 22 if(strcmp(sys_cmd,"map")==0) 23 { 24 ring image_r = currRing; 25 map theMap = (map)h->Data(); 26 ideal image_id = (ideal) theMap; 27 ring map_r = IDRING(idroot->get(theMap->preimage, myynest)); 28 ideal map_id = IDIDEAL(map_r->idroot->get(h->Next()->Name(), myynest)); 29 30 ring src_r, dest_r; 31 maMap_CreateRings(map_id, map_r, image_id, image_r, src_r, dest_r); 32 mapoly mp; 33 maideal mideal; 34 35 maMap_CreatePolyIdeal(map_id, map_r, src_r, dest_r, mp, mideal); 36 maPoly_Out(mp, src_r); 37 return FALSE; 38 } 39 40 // use as Singular source template 41 ring map_r = 32003, (a, b, c), Dp; 42 ideal map_id = a, ab, c3 + ab, a2b + ab; 43 44 45 ring image_r; 46 ideal image_id = x2y3, y, z+x6; 47 48 map Phi = map_r, image_id; 49 50 51 system("map", Phi, map_id); 52 53 #endif 20 54 /******************************************************************************* 21 55 ** … … 109 143 110 144 Top: 111 p_LmCmpAction(iter->src, what->src, src_r, goto Greater, goto Smaller, goto Equal); 112 145 p_LmCmpAction(iter->src, what->src, src_r, goto Equal, goto Greater, goto Smaller); 146 147 113 148 Greater: 149 if (iter->next == NULL) 150 { 151 iter->next = what; 152 return into; 153 } 114 154 prev = iter; 115 155 iter = iter->next; 116 if (iter == NULL) goto Smaller;117 156 goto Top; 118 157 119 158 Smaller: 159 if (prev == NULL) 160 { 161 what->next = iter; 162 return what; 163 } 164 prev->next = what; 120 165 what->next = iter; 121 if (prev != NULL) 122 prev->next = what; 123 return what; 166 return into; 124 167 125 168 Equal: … … 131 174 coeff->next = iter->coeff; 132 175 iter->coeff = what->coeff; 133 }134 p_LmFree(what->src, src_r);135 omFreeBinAddr(what);136 return i ter;176 what->coeff = NULL; 177 } 178 maMonomial_Free(what, src_r); 179 return into; 137 180 } 138 181 … … 155 198 } 156 199 157 static void maMap_InitMpoly(ideal map_id, ring map_r, ring src_r, ring dest_r,158 mapoly &mp, maideal &mideal)200 void maMap_CreatePolyIdeal(ideal map_id, ring map_r, ring src_r, ring dest_r, 201 mapoly &mp, maideal &mideal) 159 202 { 160 203 mideal = (maideal) omAlloc0(sizeof(maideal_s)); … … 169 212 { 170 213 mideal->buckets[i] = sBucketCreate(dest_r); 171 maPoly_InsertMonomial(mp, 172 prShallowCopyR_NoSort(map_id->m[i], map_r, src_r), 173 src_r, 174 mideal->buckets[i]); 175 } 176 } 177 } 214 mp = maPoly_InsertPoly(mp, 215 prShallowCopyR_NoSort(map_id->m[i], map_r, src_r), 216 src_r, 217 mideal->buckets[i]); 218 } 219 } 220 } 221 222 void maMap_CreateRings(ideal map_id, ring map_r, 223 ideal image_id, ring image_r, 224 ring &src_r, ring &dest_r) 225 { 226 src_r = map_r; 227 dest_r = image_r; 228 } 229 178 230 179 231 #if 0 … … 290 342 // return NULL if deg(ggt(m1, m2)) < 2 291 343 // else return m = ggT(m1, m2) and q1, q2 such that m1 = q1*m m2 = q2*m 292 293 344 static poly maEggT(const poly m1, const poly m2, poly &q1, poly &q2,const ring r) 294 345 { 295 296 346 int i; 297 347 int dg = 0; 298 348 poly ggt = NULL; 299 q1 = p_Init(r); 300 q2 = p_Init(r); 301 ggt=p_Init(r); 302 303 for (i=1;i<=r->N;i++) { 349 for (i=1; i<=r->N; i++) 350 { 304 351 Exponent_t e1 = p_GetExp(m1, i, r); 305 352 Exponent_t e2 = p_GetExp(m2, i, r); 306 if (e1 > 0 && e2 > 0){ 353 if (e1 > 0 && e2 > 0) 354 { 307 355 Exponent_t em = (e1 > e2 ? e2 : e1); 356 if (dg < 2) 357 { 358 ggt = p_Init(r); 359 q1 = p_Init(r); 360 q2 = p_Init(r); 361 } 308 362 dg += em; 309 363 p_SetExp(ggt, i, em, r); … … 311 365 p_SetExp(q2, i, e2 - em, r); 312 366 } 313 else { 314 p_SetExp(q1, i, e1, r); 315 p_SetExp(q2, i, e2, r); 316 } 317 } 318 if (dg>1) 367 } 368 if (ggt != NULL) 319 369 { 320 370 p_Setm(ggt, r); 321 371 p_Setm(q1, r); 322 372 p_Setm(q2, r); 323 324 325 }326 else {327 p_LmFree(ggt, r);328 p_LmFree(q1, r);329 p_LmFree(q2, r);330 ggt = NULL;331 373 } 332 374 return ggt; 333 375 } 334 335 336 376 337 377 /******************************************************************************* … … 504 544 #endif 505 545 506 void map_main(ideal map_id, ring map_r, ideal image_id, ring image_r)507 {508 509 }510 546 511 547 -
Singular/fast_maps.h
r7164b40 rcb7578 8 8 * bricken (Michael Brickenstein) 9 9 * Created: 01/02 10 * Version: $Id: fast_maps.h,v 1. 6 2002-01-19 11:22:52 SingularExp $10 * Version: $Id: fast_maps.h,v 1.7 2002-01-19 12:29:32 obachman Exp $ 11 11 *******************************************************************/ 12 12 … … 76 76 mapoly maPoly_InsertMonomial(mapoly into, poly p, ring src_r, sBucket_pt bucket = NULL); 77 77 78 79 78 // optimizes mpoly for later evaluation 80 79 mapoly maPoly_Optimize(mapoly mpoly, ring src_r); … … 83 82 mapoly maPoly_Eval(mapoly mpoly, ring src_r, poly* dest_id, ring dest_r); 84 83 84 // creates mpoly and mideal 85 void maMap_CreatePolyIdeal(ideal map_id, ring map_r, 86 ring src_r, ring dest_r, 87 mapoly &mp, maideal &mideal); 88 89 void maMap_CreateRings(ideal map_id, ring map_r, 90 ideal image_id, ring image_r, 91 ring &src_r, ring &dest_r); 85 92 86 93 87 94 95
Note: See TracChangeset
for help on using the changeset viewer.