Changeset 2de2a46 in git
- Timestamp:
- Jun 13, 2005, 6:26:03 PM (18 years ago)
- Branches:
- (u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
- Children:
- 046c0a3380938818035c6cb0f21c5867363369db
- Parents:
- a8d0266204146ab7540d16124586c7f957757ea7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/extra.cc
ra8d026 r2de2a46 2 2 * Computer Algebra System SINGULAR * 3 3 *****************************************/ 4 /* $Id: extra.cc,v 1.22 5 2005-05-09 15:54:54Singular Exp $ */4 /* $Id: extra.cc,v 1.226 2005-06-13 16:26:03 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT: general interface to internals of Singular ("system" command) … … 60 60 #include "walk.h" 61 61 #endif 62 62 63 #include "weight.h" 63 64 #include "fast_mult.h" 64 65 #include "digitech.h" 66 65 67 #ifdef HAVE_SPECTRUM 66 68 #include "spectrum.h" 69 #endif 70 71 #ifdef HAVE_BIFAC 72 #include <bifac.h> 67 73 #endif 68 74 … … 2551 2557 return(FALSE); 2552 2558 } 2559 else 2560 /*==================== bifac =================*/ 2561 #ifdef HAVE_BIFAC 2562 if (strcmp(sys_cmd, "bifac")==0) 2563 { 2564 if (h->Typ()!=POLY_CMD) 2565 { 2566 WerrorS("`system(\"bifac\",<poly>) expected"); 2567 return TRUE; 2568 } 2569 if (!rField_is_Q()) 2570 { 2571 WerrorS("coeff field must be Q"); 2572 return TRUE; 2573 } 2574 BIFAC B; 2575 CFFList C; 2576 int sw_rat=isOn(SW_RATIONAL); 2577 On(SW_RATIONAL); 2578 CanonicalForm F( convSingPClapP((poly)(h->Data()))); 2579 B.bifac(F, 1); 2580 CFFList L=B.getFactors(); 2581 PrintS("factors:\n"); 2582 cout << L <<"\n"; 2583 // construct the ring ============================================== 2584 int i; 2585 int lev=ExtensionLevel(); 2586 char **names=(char**)omAlloc0(lev*sizeof(char_ptr)); 2587 for(i=1;i<=lev; i++) 2588 { 2589 StringSetS(""); 2590 names[i-1]=omStrDup(StringAppend("a(%d)",i)); 2591 } 2592 ring alg_ring=rDefault(0,lev,names); 2593 ring new_ring=rCopy0(currRing); // all variable names, ordering etc. 2594 new_ring->P=lev; 2595 new_ring->parameter=names; 2596 new_ring->algring=alg_ring; 2597 new_ring->ch=1; 2598 rComplete(new_ring,TRUE); 2599 // set the mipo =============================================== 2600 ring save_currRing=currRing; idhdl save_currRingHdl=currRingHdl; 2601 rChangeCurrRing(alg_ring); 2602 ideal mipo_id=idInit(lev,1); 2603 for (i=lev; i>0;i--) 2604 { 2605 CanonicalForm Mipo=getMipo(Variable(-i),Variable(i)); 2606 mipo_id->m[i-1]=convClapPSingP(Mipo); 2607 } 2608 idShow(mipo_id); 2609 alg_ring->qideal=mipo_id; 2610 rChangeCurrRing(new_ring); 2611 for (i=lev-1; i>=0;i--) 2612 { 2613 poly p=pOne(); 2614 lnumber n=(lnumber)pGetCoeff(p); 2615 // no need to delete nac 1 2616 n->z=(napoly)mipo_id->m[i]; 2617 mipo_id->m[i]=p; 2618 } 2619 new_ring->minideal=id_Copy(alg_ring->qideal,new_ring); 2620 // convert factors ============================================= 2621 ideal fac_id=idInit(L.length(),1); 2622 CFFListIterator J=L; 2623 i=0; 2624 intvec *v = new intvec( L.length() ); 2625 for ( ; J.hasItem(); J++,i++ ) 2626 { 2627 fac_id->m[i]=convClapAPSingAP_R( J.getItem().factor(),pVariables,0 ); 2628 (*v)[i]=J.getItem().exp(); 2629 } 2630 idhdl hh=enterid("factors",0,LIST_CMD,&(currRing->idroot),FALSE); 2631 lists LL=(lists)omAllocBin( slists_bin); 2632 LL->Init(2); 2633 LL->m[0].rtyp=IDEAL_CMD; 2634 LL->m[0].data=(char *)fac_id; 2635 LL->m[1].rtyp=INTVEC_CMD; 2636 LL->m[1].data=(char *)v; 2637 IDDATA(hh)=(char *)LL; 2638 2639 rChangeCurrRing(save_currRing); 2640 currRingHdl=save_currRingHdl; 2641 if (!sw_rat) Off(SW_RATIONAL); 2642 2643 res->data=new_ring; 2644 res->rtyp=RING_CMD; 2645 return FALSE; 2646 } 2647 else 2648 #endif 2553 2649 /*==================== Error =================*/ 2554 2650 Werror( "system(\"%s\",...) %s", sys_cmd, feNotImplemented );
Note: See TracChangeset
for help on using the changeset viewer.