Changeset 113a80 in git


Ignore:
Timestamp:
Jul 9, 2018, 2:40:55 PM (6 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
4b5b3658c8e1f3c4b2725057e56be417eb838a72
Parents:
43fa86cc32c42433e618d6c2978915bf8a580e66
Message:
nFindCoeffByName for polys over Z/n (n_Zn and n_Znm)
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • Singular/misc_ip.cc

    r43fa86 r113a80  
    3131#include "coeffs/flintcf_Q.h"
    3232#include "coeffs/flintcf_Zn.h"
     33#include "coeffs/rmodulon.h"
    3334
    3435#include "polys/ext_fields/algext.h"
     
    14091410    h=enterid("ZZ",0/*level*/, CRING_CMD,&(basePack->idroot),FALSE /*init*/,FALSE /*search*/);
    14101411    IDDATA(h)=(char*)nInitChar(n_Z,NULL);
     1412    nRegisterCfByName(nrnInitCfByName,n_Zn); // and n_Znm
    14111413    iiAddCproc("kernel","crossprod",FALSE,iiCrossProd);
    14121414    iiAddCproc("kernel","Float",FALSE,iiFloat);
  • libpolys/coeffs/rmodulon.cc

    r43fa86 r113a80  
    5555}
    5656
     57coeffs 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
    5784static char* nrnCoeffName_buff=NULL;
    5885static char* nrnCoeffName(const coeffs r)
     
    6087  if(nrnCoeffName_buff!=NULL) omFree(nrnCoeffName_buff);
    6188  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);
    6390  char* s = (char*) omAlloc(l);
    6491  s= mpz_get_str (s, 10, r->modBase);
    6592  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);
    6794  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);
    6996  omFreeSize((ADDRESS)s, l);
    7097  return nrnCoeffName_buff;
  • libpolys/coeffs/rmodulon.h

    r43fa86 r113a80  
    1616#include "coeffs/rintegers.h"
    1717
    18 typedef struct { mpz_ptr base;  unsigned long exp; } ZnmInfo;
     18typedef struct { mpz_ptr base;  int exp; } ZnmInfo;
    1919
    2020BOOLEAN nrnInitChar    (coeffs r, void*);
    2121number nrnMapGMP(number from, const coeffs /*src*/, const coeffs dst);/*for SAGE*/
    2222nMapFunc nrnSetMap(const coeffs src, const coeffs dst);/* for SAGE, better: n_setMap*/
    23 
     23coeffs nrnInitCfByName(char *name,n_coeffType n);
    2424
    2525#endif
Note: See TracChangeset for help on using the changeset viewer.