Changeset 113a80 in git
- Timestamp:
- Jul 9, 2018, 2:40:55 PM (5 years ago)
- Branches:
- (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
- Children:
- 4b5b3658c8e1f3c4b2725057e56be417eb838a72
- Parents:
- 43fa86cc32c42433e618d6c2978915bf8a580e66
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/misc_ip.cc
r43fa86 r113a80 31 31 #include "coeffs/flintcf_Q.h" 32 32 #include "coeffs/flintcf_Zn.h" 33 #include "coeffs/rmodulon.h" 33 34 34 35 #include "polys/ext_fields/algext.h" … … 1409 1410 h=enterid("ZZ",0/*level*/, CRING_CMD,&(basePack->idroot),FALSE /*init*/,FALSE /*search*/); 1410 1411 IDDATA(h)=(char*)nInitChar(n_Z,NULL); 1412 nRegisterCfByName(nrnInitCfByName,n_Zn); // and n_Znm 1411 1413 iiAddCproc("kernel","crossprod",FALSE,iiCrossProd); 1412 1414 iiAddCproc("kernel","Float",FALSE,iiFloat); -
libpolys/coeffs/rmodulon.cc
r43fa86 r113a80 55 55 } 56 56 57 coeffs nrnInitCfByName(char *s,n_coeffType n) 58 { 59 const int start_len=strlen("ZZ/bigint("); 60 if (strncmp(s,"ZZ/bigint(",start_len)==0) 61 { 62 s+=start_len; 63 mpz_t z; 64 mpz_init(z); 65 s=nEatLong(s,z); 66 ZnmInfo info; 67 info.base=z; 68 info.exp= 1; 69 while ((*s!='\0') && (*s!=')')) s++; 70 // expect ")" or ")^exp" 71 if (*s=='\0') { mpz_clear(z); return NULL; } 72 if (((*s)==')') && (*(s+1)=='^')) 73 { 74 s=s+2; 75 s=nEati(s,&(info.exp),0); 76 return nInitChar(n_Znm,(void*) &info); 77 } 78 else 79 return nInitChar(n_Zn,(void*) &info); 80 } 81 else return NULL; 82 } 83 57 84 static char* nrnCoeffName_buff=NULL; 58 85 static char* nrnCoeffName(const coeffs r) … … 60 87 if(nrnCoeffName_buff!=NULL) omFree(nrnCoeffName_buff); 61 88 size_t l = (size_t)mpz_sizeinbase(r->modBase, 10) + 2; 62 nrnCoeffName_buff=(char*)omAlloc(l+ 6);89 nrnCoeffName_buff=(char*)omAlloc(l+12); 63 90 char* s = (char*) omAlloc(l); 64 91 s= mpz_get_str (s, 10, r->modBase); 65 92 if (nCoeff_is_Ring_ModN(r)) 66 snprintf(nrnCoeffName_buff,l+6,"ZZ/ %s",s);93 snprintf(nrnCoeffName_buff,l+6,"ZZ/bigint(%s)",s); 67 94 else if (nCoeff_is_Ring_PtoM(r)) 68 snprintf(nrnCoeffName_buff,l+6,"ZZ/ %s^%lu",s,r->modExponent);95 snprintf(nrnCoeffName_buff,l+6,"ZZ/bigint(%s)^%lu",s,r->modExponent); 69 96 omFreeSize((ADDRESS)s, l); 70 97 return nrnCoeffName_buff; -
libpolys/coeffs/rmodulon.h
r43fa86 r113a80 16 16 #include "coeffs/rintegers.h" 17 17 18 typedef struct { mpz_ptr base; unsigned longexp; } ZnmInfo;18 typedef struct { mpz_ptr base; int exp; } ZnmInfo; 19 19 20 20 BOOLEAN nrnInitChar (coeffs r, void*); 21 21 number nrnMapGMP(number from, const coeffs /*src*/, const coeffs dst);/*for SAGE*/ 22 22 nMapFunc nrnSetMap(const coeffs src, const coeffs dst);/* for SAGE, better: n_setMap*/ 23 23 coeffs nrnInitCfByName(char *name,n_coeffType n); 24 24 25 25 #endif
Note: See TracChangeset
for help on using the changeset viewer.