Changeset e7e815 in git


Ignore:
Timestamp:
Aug 12, 2011, 8:35:56 PM (13 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'b4f17ed1d25f93d46dbe29e4b499baecc2fd51bb')
Children:
f5bef2f630405aa4f809d8c3e3d981f72f87a74d
Parents:
2b7f4e1c2533023f1826c2b3ff11a6470249af65
git-author:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2011-08-12 20:35:56+02:00
git-committer:
Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 16:12:16+01:00
Message:
FIX: rCompose uses nInitChar now!
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/ipshell.cc

    r2b7f4e re7e815  
    6161
    6262#include <math.h>
     63
     64#include <polys/ext_fields/algext.h>
     65#include <polys/ext_fields/transext.h>
    6366
    6467// define this if you want to use the fast_map routine for mapping ideals
     
    20782081  // 4: C
    20792082  // 5: D
    2080   ring R = (ring) omAlloc0Bin(sip_sring_bin);
     2083 
     2084  ring R = (ring) omAlloc0Bin(sip_sring_bin); // why
    20812085   
    20822086   
    2083   assume( R->cf == NULL );   
    2084   int ch;
    2085   int is_gf_char = 0;
    2086    
     2087  assume( R->cf == NULL );
     2088 
    20872089  // ------------------------------------------------------------------
    20882090  // 0: char:
    20892091  if (L->m[0].Typ()==INT_CMD)
    20902092  {
    2091     ch = (int)(long)L->m[0].Data();
     2093    int ch = (int)(long)L->m[0].Data();
    20922094    assume( ch >= 0 );
    2093      
    2094      
    2095     if (ch != -1) // WTF?
    2096     {
    2097       int l=0;
    2098        
    2099       if (
    2100           ((ch!=0) && (ch<2) && (is_gf_char=-1)) // TODO for Hans!: negative characteristic?
    2101       #ifndef NV_OPS
    2102       || (ch > 32003)
    2103       #endif
    2104       || ((l=IsPrime(ch))!=ch)
    2105       )
    2106       {
    2107         Warn("%d is invalid characteristic of ground field. %d is used.", ch,l);
     2095
     2096    if (ch == 0) // Q?
     2097      R->cf = nInitChar(n_Q, NULL);
     2098    else
     2099    {
     2100      int l = IsPrime(ch); // Zp?
     2101      if( l != ch )
     2102      {
     2103        Warn("%d is invalid characteristic of ground field. %d is used.", ch, l);
    21082104        ch = l;
    2109       }
    2110     }
    2111   }
    2112   else if (L->m[0].Typ()==LIST_CMD)
     2105      }     
     2106      R->cf = nInitChar(n_Zp, (void*)ch);       
     2107    }
     2108  }
     2109  else if (L->m[0].Typ()==LIST_CMD) // something complicated...
    21132110  {
    21142111    lists LL=(lists)L->m[0].Data();
     2112   
    21152113#ifdef HAVE_RINGS
    2116     if (LL->m[0].Typ() == STRING_CMD)
    2117     {
    2118       rComposeRing(LL,R); /* Ring */
     2114    if (LL->m[0].Typ() == STRING_CMD) // 1st comes a string?
     2115    {
     2116      rComposeRing(LL, R); // Ring!?
    21192117    }
    21202118    else
    21212119#endif
    2122     if (LL->nr<3)
    2123       rComposeC(LL,R); /* R, long_R, long_C */
     2120    if (LL->nr < 3)
     2121      rComposeC(LL,R); // R, long_R, long_C
    21242122    else
    2125     {
     2123    {     
    21262124      if (LL->m[0].Typ()==INT_CMD)
    2127       {
     2125      {       
    21282126        ch = (int)(long)LL->m[0].Data();
    2129          
    2130         // TODO: check that ch is a supported (by our GF impl.) power of a prime
    2131         while ((ch != fftable[is_gf_char]) && (fftable[is_gf_char])) is_gf_char++;
    2132          
    2133         if (fftable[is_gf_char]==0) is_gf_char=-1;
    2134       }
    2135        
    2136       if (is_gf_char==-1)
     2127
     2128        if( ch != 0 ) // TODO: GF-Test ch!
     2129        {
     2130          GFInfo param;
     2131       
     2132          param.GFChar = ch;
     2133          param.GFDegree = 1;
     2134          param.GFPar_name = (const char*)(((lists)(LL->m[1].Data()))->m[0].Data());
     2135
     2136          // nfInitChar should be able to handle the case when ch is in fftables!
     2137          R->cf = nInitChar(n_GF, (void*)&param);
     2138        }
     2139      }
     2140
     2141      if( R->cf == NULL )
    21372142      {
    21382143        ring extRing = rCompose((lists)L->m[0].Data());
     
    21402145        if (extRing==NULL)
    21412146        {
    2142           WerrorS("could not create rational function coefficient field");
     2147          WerrorS("could not create the specified coefficient field");
    21432148          goto rCompose_err;
    21442149        }
    2145         if (extRing->cf->ch > 0)
    2146           ch = - extRing->cf->ch; // TODO: this is obsolete!
    2147         else
    2148           ch = 1; // WTF?
    2149          
    2150 //        extRing->names = (char**)omAlloc0(rPar(R)*sizeof(char_ptr)); // obsolete?
    2151          
    2152         int i;
    2153          
    2154 //        for( i = rPar(R) - 1; i >= 0; i--) extRing->names[i] = omStrDup(extRing->names[i]);
    2155 /*       
    2156         // Obsolete?
    2157         if (extRing->qideal!=NULL)
     2150
     2151        if( extRing->qideal != NULL ) // Algebraic extension
    21582152        {
    2159           if (IDELEMS(extRing->qideal) == 1)
    2160           {
    2161             extRing->qideal->m[0] = naInit(1,R);
    2162             lnumber n=(lnumber)R->minpoly;
    2163             n->z = extRing->qideal->m[0];
    2164 //            naMinimalPoly = n->z;
    2165             R->cf->extRing->qideal->m[0]=NULL;
    2166             idDelete(&(R->cf->extRing->qideal));
    2167              
    2168             redefineFunctionPointers();
    2169           }
    2170           else
    2171           {
    2172             WerrorS("not implemented yet.");
    2173           }
     2153          AlgExtInfo extParam;
     2154         
     2155          extParam.i = extRing->qideal;
     2156          extParam.r = extRing;
     2157
     2158          extRing->qideal = NULL; // ???
     2159
     2160          R->cf = nInitChar(type, (void*)&extParam);
     2161        } else // Transcendental extension
     2162        {
     2163          TransExtInfo extParam;
     2164          extParam.r = r;
     2165
     2166          R->cf = nInitChar(n_transExt, &extParam);
    21742167        }
    2175 */
    2176       }
    2177       else
    2178       { // gf-char
    2179 //        ch = fftable[is_gf_char];
    2180         extRing->N=1;
    2181         extRing->names=(char**)omAlloc0(1*sizeof(char_ptr));
    2182         extRing->names[0]=omStrDup((char*)((lists)(LL->m[1].Data()))->m[0].Data());
    2183       }
     2168       
     2169      }     
    21842170    }
    21852171  }
     
    21892175    goto rCompose_err;
    21902176  }
    2191   rRenameVars(R);
    2192   rComplete(R);
    2193    
    2194 #ifdef HAVE_RINGS
    2195   // This was a BUG IN SINGULAR: There is no HABE_RINGS!!!
    2196    
    2197 // currently, coefficients which are ring elements require a global ordering:
    2198   if (rField_is_Ring(R) && (R->pOrdSgn==-1))
    2199   {
    2200     WerrorS("global ordering required for these coefficients");
     2177
     2178  if( R->cf == NULL )
     2179  {
     2180    WerrorS("could not create coefficient field described by the input!");
    22012181    goto rCompose_err;
    22022182  }
    2203 #endif
    2204    
    2205    
    2206    
    2207    
    2208    
    2209    
    2210    
    2211    
    2212    
     2183
    22132184  // ------------------------- VARS ---------------------------
    22142185  if (L->m[1].Typ()==LIST_CMD)
     
    24072378    goto rCompose_err;
    24082379  }
     2380
     2381  // ------------------------ ??????? --------------------
     2382
     2383  rRenameVars(R);
     2384  rComplete(R);
     2385
     2386#ifdef HAVE_RINGS
     2387  // This was a BUG IN SINGULAR: There is no HABE_RINGS!!!
     2388
     2389// currently, coefficients which are ring elements require a global ordering:
     2390  if (rField_is_Ring(R) && (R->pOrdSgn==-1))
     2391  {
     2392    WerrorS("global ordering required for these coefficients");
     2393    goto rCompose_err;
     2394  }
     2395#endif
     2396
     2397
    24092398  // ------------------------ Q-IDEAL ------------------------
    24102399
Note: See TracChangeset for help on using the changeset viewer.