Changeset e20910 in git
- Timestamp:
- Sep 14, 2011, 7:00:07 PM (12 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '0604212ebb110535022efecad887940825b97c3f')
- Children:
- 8b87135f40450a46d90d5e08617044b9d4b56918
- Parents:
- a55ef037cdd445d3fc4149a3d95a4ebaecf3c2f5
- git-author:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2011-09-14 19:00:07+02:00
- git-committer:
- Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 16:12:49+01:00
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/ipshell.cc
ra55ef0 re20910 4932 4932 ring rInit(sleftv* pn, sleftv* rv, sleftv* ord) 4933 4933 { 4934 int ch;4935 4934 #ifdef HAVE_RINGS 4936 4935 unsigned int ringtype = 0; … … 4949 4948 int numberOfAllocatedBlocks; 4950 4949 4951 coeffs cf=NULL;4952 4950 // allocated ring 4953 4951 R = (ring) omAlloc0Bin(sip_sring_bin); 4954 4952 4953 coeffs cf = NULL; 4954 4955 assume( pn != NULL ); 4956 const int P = pn->listLength(); 4957 4955 4958 if (pn->Typ()==INT_CMD) 4956 4959 { 4957 ch=(int)(long)pn->Data(); 4958 if (pn->next==NULL) 4959 cf=nInitChar(ch==0 ? n_Q : n_Zp, (void*)(long)ch); 4960 const int ch = (int)(long)pn->Data(); 4961 4962 /* parameter? -------------------------------------------------------*/ 4963 pn = pn->next; 4964 4965 if (pn == NULL) // no params!? 4966 cf = nInitChar(ch==0 ? n_Q : n_Zp, (void*)(long)ch); 4960 4967 else 4961 4968 { 4962 if ((ch!=0) && (ch!=IsPrime(ch))) 4969 const int pars = pn->listLength(); 4970 4971 assume( pars > 0 ); 4972 4973 // predefined finite field: (p^k, a) 4974 if ((ch!=0) && (ch!=IsPrime(ch)) && (pars == 1)) 4963 4975 { 4964 4976 GFInfo param; 4965 4977 4966 4978 param.GFChar = ch; 4967 param.GFDegree = 1; 4968 4969 param.GFPar_name=pn->name; 4970 cf=nInitChar(n_GF,¶m); 4979 param.GFDegree = 1; 4980 param.GFPar_name = pn->name; 4971 4981 4972 if (cf==NULL) goto rInitError; 4973 else ffChar=TRUE; 4982 cf = nInitChar(n_GF, ¶m); 4983 } 4984 else // (0/p, a, b, ..., z) 4985 { 4986 assume( (ch == 0) || (ch==IsPrime(ch)) ); 4987 4988 // if ((pars > 1) && (ffChar)) 4989 // { 4990 // WerrorS("too many parameters"); 4991 // goto rInitError; 4992 // } 4974 4993 4975 } 4976 /* parameter -------------------------------------------------------*/ 4977 pn=pn->next; 4978 if (cf==NULL) cf=nInitChar(n_transExt,NULL); 4979 if (cf==NULL) goto rInitError; 4980 R->cf=cf; 4981 if (pn!=NULL) 4982 { 4983 int pars=pn->listLength(); 4984 if (!ffChar) R->cf->extRing->N=pars; 4985 if ((pars > 1) && (ffChar)) 4986 { 4987 WerrorS("too many parameters"); 4988 goto rInitError; 4989 } 4990 if (!ffChar) R->cf->extRing->names=(char**)omAlloc0(rPar(R)*sizeof(char_ptr)); 4991 if (rSleftvList2StringArray(pn, R->cf->extRing->names)) 4994 char ** names = (char**)omAlloc0(pars * sizeof(char_ptr)); 4995 4996 if (rSleftvList2StringArray(pn, names)) 4992 4997 { 4993 4998 WerrorS("parameter expected"); 4994 4999 goto rInitError; 4995 5000 } 4996 } 4997 } 5001 5002 TransExtInfo extParam; 5003 5004 extParam.r = rDefault( ch, pars, names); // Q/Zp [ p_1, ... p_pars ] 5005 5006 cf = nInitChar(n_transExt, &extParam); 5007 } 5008 } 5009 5010 // if (cf==NULL) goto rInitError; 5011 assume( cf != NULL ); 4998 5012 } 4999 5013 else if ((pn->name != NULL) … … 5001 5015 { 5002 5016 BOOLEAN complex_flag=(strcmp(pn->name,"complex")==0); 5003 c h=0;5017 const int ch=0; 5004 5018 if ((pn->next!=NULL) && (pn->next->Typ()==INT_CMD)) 5005 5019 { … … 5023 5037 WarnS("not implemented: name for i (complex)"); 5024 5038 cf=nInitChar(complex_flag ? n_long_C: n_long_R,NULL); 5039 5040 assume( cf != NULL ); 5025 5041 } 5026 5042 #ifdef HAVE_RINGS … … 5046 5062 else 5047 5063 cf=nInitChar(n_Z,NULL); 5064 5048 5065 if ((mpz_cmp_ui(modBase, 1) == 0) && (mpz_cmp_ui(modBase, 0) < 0)) 5049 5066 { … … 5060 5077 if (modExponent > 1) 5061 5078 { 5062 c h = modExponent;5079 const int ch = modExponent; 5063 5080 if ((mpz_cmp_ui(modBase, 2) == 0) && (modExponent <= 8*sizeof(NATNUMBER))) 5064 5081 { … … 5078 5095 { 5079 5096 ringtype = 2; 5080 ch = mpz_get_ui(modBase); 5081 cf=nInitChar(n_Zn,(void*)(long)modBase); 5082 } 5097 const int ch = mpz_get_ui(modBase); 5098 cf=nInitChar(n_Zn,(void*)(long)ch); 5099 } 5100 assume( cf != NULL ); 5083 5101 } 5084 5102 #endif 5103 // ring NEW = OLD, (), (); where OLD is a polynomial ring... 5104 else if ((pn->Typ()==RING_CMD) && (P == 1)) 5105 { 5106 TransExtInfo extParam; 5107 extParam.r = (ring)pn->Data(); 5108 cf = nInitChar(n_transExt, &extParam); 5109 } 5110 else if ((pn->Typ()==QRING_CMD) && (P == 1)) // same for qrings - which should be fields!? 5111 { 5112 AlgExtInfo extParam; 5113 extParam.r = (ring)pn->Data(); 5114 extParam.i = (extParam.r->qideal); 5115 5116 cf = nInitChar(n_algExt, &extParam); // Q[a]/<minideal> 5117 } 5085 5118 else 5086 5119 { 5087 Werror("Wrong ground field specification"); 5120 sleftv* p = pn; 5121 Werror("Wrong or unknown ground field specification"); 5122 #ifndef NDEBUG 5123 while (p != NULL) 5124 { 5125 Print( "pn[%p]: type: %d [%s]: %p, name: %s", p, p->Typ(), Tok2Cmdname(p->Typ()), p->Data(), (p->name == NULL? "NULL" : p->name) ); 5126 PrintLn(); 5127 p = p->next; 5128 } 5129 #endif 5088 5130 goto rInitError; 5089 5131 } 5090 pn=pn->next;5132 // pn=pn->next; 5091 5133 5092 5134 int l, last; … … 5108 5150 if (cf==NULL) 5109 5151 { 5110 Warn("%d is invalid characteristic of ground field. 32003 is used.", ch);5111 ch=32003;5152 const int ch=32003; 5153 Warn("Invalid ground field specification: using the default field: Z_{%d}", ch); 5112 5154 cf=nInitChar(n_Zp, (void*)(long)ch); 5113 5155 } 5114 R->cf=cf; 5156 5157 assume( R != NULL ); 5158 5159 R->cf = cf; 5160 5115 5161 #ifdef HAVE_RINGS 5116 R->cf->ringtype = ringtype; 5117 R->cf->modBase = modBase; 5118 R->cf->modExponent = modExponent; 5162 // the following should have beed set already into cf, right?! 5163 // R->cf->ringtype = ringtype; 5164 // R->cf->modBase = modBase; 5165 // R->cf->modExponent = modExponent; 5119 5166 #endif 5120 5167
Note: See TracChangeset
for help on using the changeset viewer.