Changeset 38cfbb in git
- Timestamp:
- Jan 12, 1998, 6:32:50 PM (26 years ago)
- Branches:
- (u'spielwiese', '5b153614cbc72bfa198d75b1e9e33dab2645d9fe')
- Children:
- 47faf56bd0bcff347db95df89b7ca4f50b53e9af
- Parents:
- 85734a4179c98e94173e3d6556a8c74b4b2c8d19
- Location:
- Singular
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/clapconv.cc
r85734a r38cfbb 3 3 * Computer Algebra System SINGULAR * 4 4 ****************************************/ 5 // $Id: clapconv.cc,v 1.1 2 1997-12-03 16:58:30 obachmanExp $5 // $Id: clapconv.cc,v 1.13 1998-01-12 17:32:44 Singular Exp $ 6 6 /* 7 7 * ABSTRACT: convert data between Singular and factory … … 280 280 mpz_clear(&z->n); 281 281 z->s=3; 282 if (mpz_size1(&z->z)<=MP_SMALL)283 {284 int ui=(int)mpz_get_si(&z->z);285 if ((((ui<<3)>>3)==ui)286 && (mpz_cmp_si(&z->z,(long)ui)==0))287 {288 mpz_clear(&z->z);289 Free((ADDRESS)z,sizeof(rnumber));290 z=INT_TO_SR(ui);291 }292 }293 282 } 294 283 else -
Singular/clapsing.cc
r85734a r38cfbb 3 3 * Computer Algebra System SINGULAR * 4 4 ****************************************/ 5 // $Id: clapsing.cc,v 1.2 0 1997-12-16 11:40:27Singular Exp $5 // $Id: clapsing.cc,v 1.21 1998-01-12 17:32:46 Singular Exp $ 6 6 /* 7 7 * ABSTRACT: interface between Singular and factory … … 28 28 poly res=NULL; 29 29 30 pCleardenom(f);31 pCleardenom(g);32 30 // for now there is only the possibility to handle polynomials over 33 31 // Q and Fp ... … … 61 59 else 62 60 WerrorS( "not implemented" ); 63 pDelete(&f);64 pDelete(&g);65 61 return res; 66 62 } 67 63 64 poly singclap_resultant ( poly f, poly g , poly x) 65 { 66 int i=pIsPurePower(x); 67 if (i==0) 68 { 69 WerrorS("3rd argument must be a ring variable"); 70 return NULL; 71 } 72 Variable X(i); 73 // for now there is only the possibility to handle polynomials over 74 // Q and Fp ... 75 if ( nGetChar() == 0 || nGetChar() > 1 ) 76 { 77 setCharacteristic( nGetChar() ); 78 CanonicalForm F( convSingPClapP( f ) ), G( convSingPClapP( g ) ); 79 poly res=convClapPSingP( resultant( F, G, X ) ); 80 Off(SW_RATIONAL); 81 return res; 82 } 83 // and over Q(a) / Fp(a) 84 else if (( nGetChar()==1 ) /* Q(a) */ 85 || (nGetChar() <-1)) /* Fp(a) */ 86 { 87 if (nGetChar()==1) setCharacteristic( 0 ); 88 else setCharacteristic( -nGetChar() ); 89 poly res; 90 if (currRing->minpoly!=NULL) 91 { 92 CanonicalForm mipo=convSingTrClapP(((lnumber)currRing->minpoly)->z); 93 Variable a=rootOf(mipo); 94 CanonicalForm F( convSingAPClapAP( f,a ) ), G( convSingAPClapAP( g,a ) ); 95 res= convClapAPSingAP( resultant( F, G, X ) ); 96 } 97 else 98 { 99 CanonicalForm F( convSingTrPClapP( f ) ), G( convSingTrPClapP( g ) ); 100 res= convClapPSingTrP( resultant( F, G, X ) ); 101 } 102 Off(SW_RATIONAL); 103 return res; 104 } 105 else 106 WerrorS( "not implemented" ); 107 return NULL; 108 } 68 109 //poly singclap_resultant ( poly f, poly g , poly x) 69 110 //{ 70 // int i=p IsPurePower(x);111 // int i=pVar(x); 71 112 // if (i==0) 72 113 // { 73 // WerrorS(" 3rd argument must be a ring variable");114 // WerrorS("ringvar expected"); 74 115 // return NULL; 75 116 // } 76 // Variable X(i); 77 // // for now there is only the possibility to handle polynomials over 78 // // Q and Fp ... 79 // if ( nGetChar() == 0 || nGetChar() > 1 ) 117 // ideal I=idInit(1,1); 118 // 119 // // get the coeffs von f wrt. x: 120 // I->m[0]=pCopy(f); 121 // matrix ffi=mpCoeffs(I,i); 122 // ffi->rank=1; 123 // ffi->ncols=ffi->nrows; 124 // ffi->nrows=1; 125 // ideal fi=(ideal)ffi; 126 // 127 // // get the coeffs von g wrt. x: 128 // I->m[0]=pCopy(g); 129 // matrix ggi=mpCoeffs(I,i); 130 // ggi->rank=1; 131 // ggi->ncols=ggi->nrows; 132 // ggi->nrows=1; 133 // ideal gi=(ideal)ggi; 134 // 135 // // contruct the matrix: 136 // int fn=IDELEMS(fi); //= deg(f,x)+1 137 // int gn=IDELEMS(gi); //= deg(g,x)+1 138 // matrix m=mpNew(fn+gn-2,fn+gn-2); 139 // if(m==NULL) 80 140 // { 81 // setCharacteristic( nGetChar() ); 82 // CanonicalForm F( convSingPClapP( f ) ), G( convSingPClapP( g ) ); 83 // poly res=convClapPSingP( resultant( F, G, X ) ); 84 // Off(SW_RATIONAL); 85 // return res; 141 // return NULL; 86 142 // } 87 // // and over Q(a) / Fp(a) 88 // else if (( nGetChar()==1 ) /* Q(a) */ 89 // || (nGetChar() <-1)) /* Fp(a) */ 143 // 144 // // enter the coeffs into m: 145 // int j; 146 // for(i=0;i<gn-1;i++) 90 147 // { 91 // if (nGetChar()==1) setCharacteristic( 0 ); 92 // else setCharacteristic( -nGetChar() ); 93 // poly res; 94 // if (currRing->minpoly!=NULL) 148 // for(j=0;j<fn;j++) 95 149 // { 96 // CanonicalForm mipo=convSingTrClapP(((lnumber)currRing->minpoly)->z); 97 // Variable a=rootOf(mipo); 98 // CanonicalForm F( convSingAPClapAP( f,a ) ), G( convSingAPClapAP( g,a ) ); 99 // res= convClapAPSingAP( resultant( F, G, X ) ); 150 // MATELEM(m,i+1,fn-j+i)=pCopy(fi->m[j]); 100 151 // } 101 // else 152 // } 153 // for(i=0;i<fn-1;i++) 154 // { 155 // for(j=0;j<gn;j++) 102 156 // { 103 // CanonicalForm F( convSingTrPClapP( f ) ), G( convSingTrPClapP( g ) ); 104 // res= convClapPSingTrP( resultant( F, G, X ) ); 157 // MATELEM(m,gn+i,gn-j+i)=pCopy(gi->m[j]); 105 158 // } 106 // Off(SW_RATIONAL);107 // return res;108 159 // } 109 // else 110 // WerrorS( "not implemented" ); 111 // return NULL; 160 // 161 // poly r=mpDet(m); 162 // 163 // idDelete(&fi); 164 // idDelete(&gi); 165 // idDelete((ideal *)&m); 166 // return r; 112 167 //} 113 poly singclap_resultant ( poly f, poly g , poly x)114 {115 int i=pVar(x);116 if (i==0)117 {118 WerrorS("ringvar expected");119 return NULL;120 }121 ideal I=idInit(1,1);122 123 // get the coeffs von f wrt. x:124 I->m[0]=pCopy(f);125 matrix ffi=mpCoeffs(I,i);126 ffi->rank=1;127 ffi->ncols=ffi->nrows;128 ffi->nrows=1;129 ideal fi=(ideal)ffi;130 131 // get the coeffs von g wrt. x:132 I->m[0]=pCopy(g);133 matrix ggi=mpCoeffs(I,i);134 ggi->rank=1;135 ggi->ncols=ggi->nrows;136 ggi->nrows=1;137 ideal gi=(ideal)ggi;138 139 // contruct the matrix:140 int fn=IDELEMS(fi); //= deg(f,x)+1141 int gn=IDELEMS(gi); //= deg(g,x)+1142 matrix m=mpNew(fn+gn-2,fn+gn-2);143 if(m==NULL)144 {145 return NULL;146 }147 148 // enter the coeffs into m:149 int j;150 for(i=0;i<gn-1;i++)151 {152 for(j=0;j<fn;j++)153 {154 MATELEM(m,i+1,fn-j+i)=pCopy(fi->m[j]);155 }156 }157 for(i=0;i<fn-1;i++)158 {159 for(j=0;j<gn;j++)160 {161 MATELEM(m,gn+i,gn-j+i)=pCopy(gi->m[j]);162 }163 }164 165 poly r=mpDet(m);166 167 idDelete(&fi);168 idDelete(&gi);169 idDelete((ideal *)&m);170 return r;171 }172 168 173 169 lists singclap_extgcd ( poly f, poly g ) … … 787 783 BOOLEAN jjGCD_P(leftv res, leftv u, leftv v) 788 784 { 789 res->data=(void *)singclap_gcd((poly)(u-> CopyD()),((poly)v->CopyD()));785 res->data=(void *)singclap_gcd((poly)(u->Data()),((poly)v->Data())); 790 786 return FALSE; 791 787 } -
Singular/extra.cc
r85734a r38cfbb 2 2 * Computer Algebra System SINGULAR * 3 3 *****************************************/ 4 /* $Id: extra.cc,v 1.2 5 1997-12-18 14:26:32Singular Exp $ */4 /* $Id: extra.cc,v 1.26 1998-01-12 17:32:46 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT: general interface to internals of Singular ("system" command) … … 169 169 #ifdef SRING 170 170 TEST_FOR("SRING") 171 #endif 172 #ifdef TEST_MAC_ORDER 173 TEST_FOR("MAC_ORDER"); 171 174 #endif 172 175 ; -
Singular/longrat.cc
r85734a r38cfbb 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: longrat.cc,v 1.1 4 1997-11-27 08:36:06Singular Exp $ */4 /* $Id: longrat.cc,v 1.15 1998-01-12 17:32:47 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT: computation with long rational numbers (Hubert Grassmann) … … 215 215 void nlNew (number * r) 216 216 { 217 //*r=INT_TO_SR(0);218 217 *r=NULL; 219 218 } … … 272 271 int nlSize(number a) 273 272 { 274 if ( (int)a==1)273 if (a==INT_TO_SR(0)) 275 274 return 0; /* rational 0*/ 276 if ( (((int)a)&3)==1)275 if (SR_HDL(a) & SR_INT) 277 276 return 1; /* immidiate int */ 278 277 #ifdef HAVE_LIBGMP2 … … 1152 1151 mpz_mul_ui(&u->z,&b->z,(unsigned long)-SR_TO_INT(a)); 1153 1152 mpz_neg(&u->z,&u->z); 1154 } 1153 } 1155 1154 } 1156 1155 nlGmpSimple(&u->z); … … 1944 1943 if ((SR_HDL(x) & SR_INT) ||(x==NULL)) 1945 1944 return; 1945 if (x->s==3) 1946 { 1947 if (mpz_cmp_ui(&x->z,(long)0)==0) 1948 { 1949 nlDelete(&x); 1950 x=nlInit(0); 1951 return; 1952 } 1953 if (mpz_size1(&x->z)<=MP_SMALL) 1954 { 1955 int ui=(int)mpz_get_si(&x->z); 1956 if ((((ui<<3)>>3)==ui) 1957 && (mpz_cmp_si(&x->z,(long)ui)==0)) 1958 { 1959 mpz_clear(&x->z); 1960 Free((ADDRESS)x,sizeof(rnumber)); 1961 x=INT_TO_SR(ui); 1962 return; 1963 } 1964 } 1965 } 1946 1966 if (x->s!=1) nlGmpSimple(&x->z); 1947 1967 if (x->s==0) -
Singular/matpol.cc
r85734a r38cfbb 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: matpol.cc,v 1. 7 1997-12-15 22:46:32 obachmanExp $ */4 /* $Id: matpol.cc,v 1.8 1998-01-12 17:32:48 Singular Exp $ */ 5 5 6 6 /* … … 447 447 ma[i]=mpMult(ma[i-1], ma[1]); 448 448 MATELEM(s,1,i) = mpTrace(ma[i]); 449 pTest(MATELEM(s,1,i)); 449 450 } 450 451 for (i=k+1; i<=n; i++) 452 { 451 453 MATELEM(s,1,i) = TraceOfProd(ma[i / 2], ma[(i+1) / 2], n); 454 pTest(MATELEM(s,1,i)); 455 } 452 456 for (i=1; i<=k; i++) 453 457 idDelete((ideal *)&(ma[i])); … … 459 463 { 460 464 p = pCopy(MATELEM(s,1,i)); 465 pTest(p); 461 466 for (j=i-1; j>=1; j--) 462 467 { 463 468 q = pMult(pCopy(MATELEM(s,1,j)), pCopy(MATELEM(a,1,i-j))); 469 pTest(q); 464 470 p = pAdd(p,q); 465 471 } … … 470 476 471 477 pMultN(p, c); 478 pTest(p); 472 479 MATELEM(a,1,i) = p; 473 480 nDelete(&c); -
Singular/misc.cc
r85734a r38cfbb 647 647 char * versionString() 648 648 { 649 StringSet(" ");649 StringSet("\t"); 650 650 #ifdef HAVE_FACTORY 651 StringAppend(" \tfactory (%s),\n", factoryVersion);651 StringAppend("factory (%s),", factoryVersion); 652 652 #endif 653 653 #ifdef HAVE_LIBFAC_P 654 StringAppend("\tlibfac(%s,%s),\n",libfac_version,libfac_date); 655 #endif 656 #ifdef SRING 657 StringAppend("\tsuper algebra,\n"); 658 #endif 659 #ifdef DRING 660 StringAppend("\tWeyl algebra,\n"); 654 StringAppend("libfac(%s,%s),\n\t",libfac_version,libfac_date); 661 655 #endif 662 656 #ifdef HAVE_GMP 663 657 #if defined (__GNU_MP_VERSION) && defined (__GNU_MP_VERSION_MINOR) 664 StringAppend(" \tGMP(%d.%d),\n",__GNU_MP_VERSION,__GNU_MP_VERSION_MINOR);658 StringAppend("GMP(%d.%d),",__GNU_MP_VERSION,__GNU_MP_VERSION_MINOR); 665 659 #elif defined (HAVE_SMALLGMP) 666 StringAppend ("\tSmallGMP(2.0.2.0),\n");660 StringAppendS("SmallGMP(2.0.2.0),"); 667 661 #else 668 StringAppend("\tGMP(1.3),\n"); 669 #endif 662 StringAppendS("GMP(1.3),"); 663 #endif 664 #endif 665 #ifdef HAVE_MPSR 666 StringAppend("MP(%s),\n\t",MP_VERSION); 667 #endif 668 #if defined(HAVE_READLINE) && !defined(FEREAD) 669 StringAppendS("libreadline,\n\t"); 670 #endif 671 #ifdef HAVE_FEREAD 672 StringAppendS("emulated libreadline,\n"); 673 #endif 674 #ifdef SRING 675 StringAppendS("super algebra,"); 676 #endif 677 #ifdef DRING 678 StringAppendS("Weyl algebra,"); 670 679 #endif 671 680 #ifdef HAVE_DBM 672 StringAppend("\tDBM,\n"); 673 #endif 674 #ifdef HAVE_MPSR 675 StringAppend("\tMP(%s),\n",MP_VERSION); 676 #endif 677 #if defined(HAVE_READLINE) && !defined(FEREAD) 678 StringAppend("\tlibreadline,\n"); 679 #endif 680 #ifdef HAVE_FEREAD 681 StringAppend("\temulated libreadline,\n"); 681 StringAppendS("DBM,"); 682 682 #endif 683 683 #ifdef HAVE_INFO 684 StringAppend("\tinfo,\n"); 685 #else 686 StringAppend("\twithout info,\n"); 684 StringAppendS("info,"); 687 685 #endif 688 686 #ifdef TEST 689 StringAppend ("\tTESTs,\n");687 StringAppendS("TESTs,"); 690 688 #endif 691 689 #if YYDEBUG 692 StringAppend ("\tYYDEBUG=1,\n");690 StringAppendS("YYDEBUG=1,"); 693 691 #endif 694 692 #ifdef MDEBUG 695 StringAppend("\tMDEBUG=%d,\n",MDEBUG); 693 StringAppend("MDEBUG=%d,",MDEBUG); 694 #endif 695 #ifdef TEST_MAC_ORDER 696 StringAppendS("mac_order,"); 696 697 #endif 697 698 #ifndef __OPTIMIZE__ 698 StringAppend(" \t-g,\n");699 #endif 700 StringAppend(" \trandom=%d\n",siRandomStart);699 StringAppend("-g,"); 700 #endif 701 StringAppend("random=%d\n",siRandomStart); 701 702 #ifdef MSDOS 702 703 char *p=getenv("SPATH"); -
Singular/subexpr.cc
r85734a r38cfbb 653 653 if (e==NULL) 654 654 { 655 switch (rtyp & 1023)655 switch (rtyp) 656 656 { 657 657 case IDHDL:
Note: See TracChangeset
for help on using the changeset viewer.