Changeset 3373e32 in git


Ignore:
Timestamp:
Aug 12, 2011, 8:14:45 PM (12 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
Children:
3da9f4eecf506fa238a5377a07d73051db6ceb9b
Parents:
8c6ae50ebf0a50c5c19b2b5b0dad7b35be193f9b
git-author:
Hans Schoenemann <hannes@mathematik.uni-kl.de>2011-08-12 20:14:45+02:00
git-committer:
Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 13:30:46+01:00
Message:
rewrite rInit
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/ipshell.cc

    r8c6ae50 r3373e32  
    20982098       
    20992099      if (
    2100           ((ch!=0) && (ch<2) && (is_gf_char=-1)) // TODO for Hans!: negative characteristic?
     2100          ((ch!=0) && (ch<2) && (is_gf_char=-1)) // TODO for Hans!: negative characteristic?
    21012101      #ifndef NV_OPS
    21022102      || (ch > 32003)
     
    21272127      {
    21282128        ch = (int)(long)LL->m[0].Data();
    2129        
    2130         // TODO: check that ch is a supported (by our GF impl.) power of a prime
     2129       
     2130        // TODO: check that ch is a supported (by our GF impl.) power of a prime
    21312131        while ((ch != fftable[is_gf_char]) && (fftable[is_gf_char])) is_gf_char++;
    2132        
     2132       
    21332133        if (fftable[is_gf_char]==0) is_gf_char=-1;
    21342134      }
     
    21372137      {
    21382138        ring extRing = rCompose((lists)L->m[0].Data());
    2139        
     2139       
    21402140        if (extRing==NULL)
    21412141        {
     
    21472147        else
    21482148          ch = 1; // WTF?
    2149        
     2149       
    21502150//        extRing->names = (char**)omAlloc0(rPar(R)*sizeof(char_ptr)); // obsolete?
    2151        
     2151       
    21522152        int i;
    2153        
     2153       
    21542154//        for( i = rPar(R) - 1; i >= 0; i--) extRing->names[i] = omStrDup(extRing->names[i]);
    2155 /*     
     2155/*       
    21562156        // Obsolete?
    21572157        if (extRing->qideal!=NULL)
     
    21652165            R->cf->extRing->qideal->m[0]=NULL;
    21662166            idDelete(&(R->cf->extRing->qideal));
    2167              
     2167             
    21682168            redefineFunctionPointers();
    21692169          }
     
    23082308      if (R->block1[j]>R->N)
    23092309      {
    2310         R->block1[j]=R->N;
    2311         iv_len=R->block1[j]-R->block0[j]+1;
     2310        R->block1[j]=R->N;
     2311        iv_len=R->block1[j]-R->block0[j]+1;
    23122312      }
    23132313      //Print("block %d from %d to %d\n",j,R->block0[j], R->block1[j]);
     
    23332333           R->block1[j]=si_max(R->block0[j],R->block0[j]+(int)sqrt((double)(iv->length()-1)));
    23342334           if (R->block1[j]>R->N)
    2335            {
    2336              WerrorS("ordering matrix too big");
    2337              goto rCompose_err;
    2338            }
     2335           {
     2336             WerrorS("ordering matrix too big");
     2337             goto rCompose_err;
     2338           }
    23392339           break;
    23402340         case ringorder_ls:
     
    28212821{
    28222822  res->data=singclap_resultant((poly)u->CopyD(),(poly)v->CopyD(),
    2823                   (poly)w->CopyD(), currRing);
     2823                  (poly)w->CopyD(), currRing);
    28242824  return errorreported;
    28252825}
     
    32763276               ( fast==1 ? computeWC( nph,(Rational)rVar(currRing), currRing ) :
    32773277              /* fast==2 */computeWC( nph,
    3278                       ((Rational)rVar(currRing))/(Rational)2, currRing ) ) );
     3278                      ((Rational)rVar(currRing))/(Rational)2, currRing ) ) );
    32793279
    32803280  #ifdef SPECTRUM_DEBUG
     
    41764176
    41774177  if ( !(rField_is_R(currRing) || rField_is_long_R(currRing) || \
    4178                           rField_is_long_C(currRing)) )
     4178                          rField_is_long_C(currRing)) )
    41794179  {
    41804180    unsigned long int ii = (unsigned long int)arg2->Data();
     
    41894189
    41904190  int ldummy;
    4191   int deg= pLDeg( gls, &ldummy, currRing );
     4191  int deg= currRing->pLDeg( gls, &ldummy, currRing );
    41924192  //  int deg= pDeg( gls );
    41934193  int len= pLength( gls );
     
    44374437    return TRUE;
    44384438  else if ( !(rField_is_R(currRing) || rField_is_long_R(currRing) || \
    4439                           rField_is_long_C(currRing)) )
     4439                          rField_is_long_C(currRing)) )
    44404440  {
    44414441    unsigned long int ii=(unsigned long int)v->Data();
     
    45734573          onepoint->m[j].rtyp=STRING_CMD;
    45744574          onepoint->m[j].data=(void *)complexToStr((*roots[j])[i],oprec,
    4575                           currRing->cf);
     4575                          currRing->cf);
    45764576        }
    45774577        else
     
    49494949  // get ch of ground field
    49504950  int numberOfAllocatedBlocks;
     4951 
     4952  coeffs cf=NULL;
    49514953
    49524954  if (pn->Typ()==INT_CMD)
    49534955  {
    49544956    ch=(int)(long)pn->Data();
     4957    if (pn->next==NULL)
     4958      cf=nInitChar(ch==0 ? n_Q : n_Zp, (void*)(long)ch);
     4959    else
     4960    {
     4961      if ((ch!=0) && (ch!=IsPrime(ch)))
     4962      {
     4963        cf=nInitChar(n_GF,(void*)(long)ch);
     4964        if (cf==NULL) goto rInitError;
     4965        else ffChar=TRUE;
     4966      }
     4967      /* parameter -------------------------------------------------------*/
     4968      pn=pn->next;
     4969      if (cf==NULL) cf=nInitChar(n_transExt,NULL);
     4970      R->cf=cf;
     4971      if (pn!=NULL)
     4972      {
     4973        int pars=pn->listLength();
     4974        if (!ffChar) R->cf->extRing->N=pars;
     4975        if ((pars > 1) && (ffChar))
     4976        {
     4977          WerrorS("too many parameters");
     4978          goto rInitError;
     4979        }
     4980        if (!ffChar) R->cf->extRing->names=(char**)omAlloc0(rPar(R)*sizeof(char_ptr));
     4981        if (rSleftvList2StringArray(pn, R->cf->extRing->names))
     4982        {
     4983          WerrorS("parameter expected");
     4984          goto rInitError;
     4985        }
     4986      }
     4987    }
    49554988  }
    49564989  else if ((pn->name != NULL)
     
    49584991  {
    49594992    BOOLEAN complex_flag=(strcmp(pn->name,"complex")==0);
    4960     ch=-1;
     4993    ch=0;
    49614994    if ((pn->next!=NULL) && (pn->next->Typ()==INT_CMD))
    49624995    {
     4996      WarnS("not implemented: size for real/complex");
    49634997      float_len=(int)(long)pn->next->Data();
    49644998      float_len2=float_len;
     
    49675001      {
    49685002        float_len2=(int)(long)pn->next->Data();
     5003        WarnS("not implemented: size for real/complex");
    49695004        pn=pn->next;
    49705005      }
     
    49755010      pn->next->name=omStrDup("i");
    49765011    }
     5012    else
     5013      WarnS("not implemented: name for i (complex)");
     5014    cf=nInitChar(complex_flag ? n_long_C: n_long_R,NULL);
    49775015  }
    49785016#ifdef HAVE_RINGS
     
    49965034      }
    49975035    }
     5036    else
     5037      cf=nInitChar(n_Z,NULL);
    49985038    if ((mpz_cmp_ui(modBase, 1) == 0) && (mpz_cmp_ui(modBase, 0) < 0))
    49995039    {
     
    50065046      goto rInitError;
    50075047    }
    5008     // module is 0 ---> integers
    5009     if (mpz_cmp_ui(modBase, 0) == 0)
    5010     {
    5011       ch = 0;
    5012       ringtype = 4;
    5013     }
     5048    // module is 0 ---> integers ringtype = 4;
    50145049    // we have an exponent
    5015     else if (modExponent > 1)
     5050    if (modExponent > 1)
    50165051    {
    50175052      ch = modExponent;
     
    50215056           depending on the size of a long on the respective platform */
    50225057        ringtype = 1;       // Use Z/2^ch
     5058        cf=nInitChar(n_Z2m,(void*)(long)modExponent);
    50235059      }
    50245060      else
    50255061      {
    50265062        ringtype = 3;
     5063        cf=nInitChar(n_Zn,(void*)(long)modBase);
    50275064      }
    50285065    }
     
    50325069      ringtype = 2;
    50335070      ch = mpz_get_ui(modBase);
     5071      cf=nInitChar(n_Zn,(void*)(long)modBase);
    50345072    }
    50355073  }
     
    50565094   *         q    q : GF(q=p^n)       *names         TRUE
    50575095  */
    5058   if ((ch!=-1)
    5059 #ifdef HAVE_RINGS
    5060        && (ringtype == 0)
    5061 #endif
    5062      )
    5063   {
    5064     int l = 0;
    5065 
    5066     if (((ch!=0) && (ch<2))
    5067     #ifndef NV_OPS
    5068     || (ch > 32003)
    5069     #endif
    5070     )
    5071     {
    5072       Warn("%d is invalid characteristic of ground field. 32003 is used.", ch);
    5073       ch=32003;
    5074     }
    5075     // load fftable, if necessary
    5076     if (pn!=NULL)
    5077     {
    5078       while ((ch!=fftable[l]) && (fftable[l])) l++;
    5079       if (fftable[l]==0) ch = IsPrime(ch);
    5080       else
    5081       {
    5082         char *m[1]={(char *)sNoName};
    5083         nfSetChar(ch,m);
    5084         if (errorreported) goto rInitError;
    5085         else ffChar=TRUE;
    5086       }
    5087     }
    5088     else
    5089     {
    5090       ch = IsPrime(ch);
    5091     }
     5096  l = 0;
     5097
     5098  if (cf==NULL)
     5099  {
     5100    Warn("%d is invalid characteristic of ground field. 32003 is used.", ch);
     5101    ch=32003;
     5102    cf=nInitChar(n_Zp, (void*)(long)ch);
    50925103  }
    50935104  // allocated ring and set ch
    50945105  R = (ring) omAlloc0Bin(sip_sring_bin);
    5095   R->cf->ch = ch;
     5106  R->cf=cf;
    50965107#ifdef HAVE_RINGS
    50975108  R->cf->ringtype = ringtype;
     
    50995110  R->cf->modExponent = modExponent;
    51005111#endif
    5101   if (ch == -1)
    5102   {
    5103     R->float_len= si_min(float_len,32767);
    5104     R->float_len2= si_min(float_len2,32767);
    5105   }
    5106 
    5107   /* parameter -------------------------------------------------------*/
    5108   if (pn!=NULL)
    5109   {
    5110     R->cf->extRing->N=pn->listLength();
    5111     //if ((ffChar|| (ch == 1)) && (rPar(R) > 1))
    5112     if ((rPar(R) > 1) && (ffChar || (ch == -1)))
    5113     {
    5114       WerrorS("too many parameters");
    5115       goto rInitError;
    5116     }
    5117     R->cf->extRing->names=(char**)omAlloc0(rPar(R)*sizeof(char_ptr));
    5118     if (rSleftvList2StringArray(pn, R->cf->extRing->names))
    5119     {
    5120       WerrorS("parameter expected");
    5121       goto rInitError;
    5122     }
    5123     if (ch>1 && !ffChar) R->cf->ch=-ch;
    5124     else if (ch==0) R->cf->ch=1;
    5125   }
    5126   else if (ffChar)
    5127   {
    5128     WerrorS("need one parameter");
    5129     goto rInitError;
    5130   }
    5131   /* post-processing of field description */
    5132   // we have short reals, but no short complex
    5133   if ((R->cf->ch == - 1)
    5134   && (rParameter(R) !=NULL)
    5135   && (R->float_len < SHORT_REAL_LENGTH))
    5136   {
    5137     R->float_len = SHORT_REAL_LENGTH;
    5138     R->float_len2 = SHORT_REAL_LENGTH;
    5139   }
    51405112
    51415113  /* names and number of variables-------------------------------------*/
Note: See TracChangeset for help on using the changeset viewer.