| 611 | } |
| 612 | |
| 613 | leftv iiMap(map theMap, const char * what) |
| 614 | { |
| 615 | idhdl w,r; |
| 616 | leftv v; |
| 617 | int i; |
| 618 | nMapFunc nMap; |
| 619 | |
| 620 | r=IDROOT->get(theMap->preimage,myynest); |
| 621 | if ((currPack!=basePack) |
| 622 | &&((r==NULL) || ((r->typ != RING_CMD) ))) |
| 623 | r=basePack->idroot->get(theMap->preimage,myynest); |
| 624 | if ((r==NULL) && (currRingHdl!=NULL) |
| 625 | && (strcmp(theMap->preimage,IDID(currRingHdl))==0)) |
| 626 | { |
| 627 | r=currRingHdl; |
| 628 | } |
| 629 | if ((r!=NULL) && (r->typ == RING_CMD)) |
| 630 | { |
| 631 | ring src_ring=IDRING(r); |
| 632 | if ((nMap=n_SetMap(src_ring->cf, currRing->cf))==NULL) |
| 633 | { |
| 634 | Werror("can not map from ground field of %s to current ground field", |
| 635 | theMap->preimage); |
| 636 | return NULL; |
| 637 | } |
| 638 | if (IDELEMS(theMap)<src_ring->N) |
| 639 | { |
| 640 | theMap->m=(polyset)omReallocSize((ADDRESS)theMap->m, |
| 641 | IDELEMS(theMap)*sizeof(poly), |
| 642 | (src_ring->N)*sizeof(poly)); |
| 643 | #ifdef HAVE_SHIFTBBA |
| 644 | if (rIsLPRing(src_ring)) |
| 645 | { |
| 646 | // src_ring [x,y,z,...] |
| 647 | // curr_ring [a,b,c,...] |
| 648 | // |
| 649 | // map=[a,b,c,d] -> [a,b,c,...] |
| 650 | // map=[a,b] -> [a,b,0,...] |
| 651 | |
| 652 | short src_lV = src_ring->isLPring; |
| 653 | short src_ncGenCount = src_ring->LPncGenCount; |
| 654 | short src_nVars = src_lV - src_ncGenCount; |
| 655 | int src_nblocks = src_ring->N / src_lV; |
| 656 | |
| 657 | short dest_nVars = currRing->isLPring - currRing->LPncGenCount; |
| 658 | short dest_ncGenCount = currRing->LPncGenCount; |
| 659 | |
| 660 | // add missing NULL generators |
| 661 | for(i=IDELEMS(theMap); i < src_lV - src_ncGenCount; i++) |
| 662 | { |
| 663 | theMap->m[i]=NULL; |
| 664 | } |
| 665 | |
| 666 | // remove superfluous generators |
| 667 | for(i = src_nVars; i < IDELEMS(theMap); i++) |
| 668 | { |
| 669 | if (theMap->m[i] != NULL) |
| 670 | { |
no test coverage detected