Ignore:
Timestamp:
Sep 30, 2011, 3:19:52 PM (13 years ago)
Author:
Burcin Erocal <burcin@…>
Branches:
(u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
Children:
a06b989486851e55685f4102903f531916e6773a
Parents:
5d5d7966c8304cc858a123c944ed894289e9facf
git-author:
Burcin Erocal <burcin@erocal.org>2011-09-30 15:19:52+02:00
git-committer:
Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 16:13:52+01:00
Message:
Adapt charstr to the new ring data structure.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libpolys/polys/monomials/ring.cc

    r5d5d79 r8476c2  
    609609  }
    610610#endif
    611   if (rParameter(r)==NULL)
    612   {
    613     i=r->cf->ch;
    614     if(i==-1)
    615       s=omStrDup("real");                    /* R */
    616     else
    617     {
    618       s=(char *)omAlloc(MAX_INT_LEN+1);
    619       sprintf(s,"%d",i);                   /* Q, Z/p */
    620     }
     611  if (rField_is_long_R(r))
     612  {
     613    i = MAX_INT_LEN*2+7; // 2 integers and real,,
     614    s=(char *)omAlloc(i);
     615    snprintf(s,i,"real,%d,%d",r->cf->float_len,r->cf->float_len2); /* long_R */
    621616    return s;
    622617  }
     618  if (rField_is_R(r))
     619  {
     620    return omStrDup("real"); /* short real */
     621  }
     622  char **params = rParameter(r);
     623  if (params==NULL)
     624  {
     625    s=(char *)omAlloc(MAX_INT_LEN+1);
     626    snprintf(s,MAX_INT_LEN+1,"%d",n_GetChar(r->cf));         /* Q, Z/p */
     627    return s;
     628  }
    623629  if (rField_is_long_C(r))
    624630  {
    625     s=(char *)omAlloc(21+strlen(rParameter(r)[0]));
    626     sprintf(s,"complex,%d,%s",r->float_len,rParameter(r)[0]);   /* C */
     631    i=strlen(params[0])+21;
     632    s=(char *)omAlloc(i);
     633    snprintf(s,i,"complex,%d,%s",r->cf->float_len,params[0]);   /* C */
     634    return s;
     635  }
     636  if (nCoeff_is_GF(r->cf))
     637  {
     638    i=strlen(params[0])+21;
     639    s=(char *)omAlloc(i);
     640    snprintf(s,i,"%d,%s",r->cf->m_nfCharQ,params[0]); /* GF(q)  */
    627641    return s;
    628642  }
     
    634648  s=(char *)omAlloc((long)(l+MAX_INT_LEN+1));
    635649  s[0]='\0';
    636   if (r->cf->ch<0)       sprintf(s,"%d",-r->cf->ch); /* Fp(a) */
    637   else if (r->cf->ch==1) sprintf(s,"0");         /* Q(a)  */
    638   else
    639   {
    640     sprintf(s,"%d,%s",r->cf->ch,rParameter(r)[0]); /* GF(q)  */
    641     return s;
    642   }
     650  snprintf(s,MAX_INT_LEN+1,"%d",r->cf->ch); /* Fp(a) or Q(a) */
    643651  char tt[2];
    644652  tt[0]=',';
Note: See TracChangeset for help on using the changeset viewer.