Changeset a3432c in git


Ignore:
Timestamp:
Sep 24, 1998, 2:09:26 PM (26 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
2386d98357886538fbc1e8f5e3e458fcb811ff1f
Parents:
56c52a7879fbc6de62cefba1da86b2edf2aadd4c
Message:
minor optimizations


git-svn-id: file:///usr/local/Singular/svn/trunk@2519 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
Singular
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/primdec.lib

    r56c52a7 ra3432c  
    1 // $Id: primdec.lib,v 1.26 1998-09-24 09:59:51 Singular Exp $
     1// $Id: primdec.lib,v 1.27 1998-09-24 12:09:26 Singular Exp $
    22////////////////////////////////////////////////////////////////////////////////
    33// primdec.lib                                                                //
     
    1111////////////////////////////////////////////////////////////////////////////////
    1212
    13 version="$Id: primdec.lib,v 1.26 1998-09-24 09:59:51 Singular Exp $";
     13version="$Id: primdec.lib,v 1.27 1998-09-24 12:09:26 Singular Exp $";
    1414info="
    1515LIBRARY: primdec.lib: PROCEDURE FOR PRIMARY DECOMPOSITION
     
    383383   if(size(k1)==size(k2))
    384384   {
    385       for(j=size(k1);j>0;j--)
     385      for(j=ncols(k1);j>0;j--)
    386386      {
    387387         if(leadexp(k1[j])!=leadexp(k2[j]))
     
    401401   if(size(k1)==size(k2))
    402402   {
    403       for(j=size(k1);j>0;j--)
     403      for(j=ncols(k1);j>0;j--)
    404404      {
    405405         if(leadexp(k1[j])!=leadexp(k2[j]))
     
    431431
    432432  ideal i=maxideal(1);
    433   int k=size(i);
     433  int k=ncols(i);
    434434  i[k]=0;
    435   i=randomid(i,size(i),b);
     435  i=randomid(i,ncols(i),b);
    436436  ideal ires=maxideal(1);
    437437  ires[k]=i[1]+var(k);
     
    472472      else
    473473      {
    474          while (lead(i[m])/var(n-1)==0)
    475         {
    476             m=m+1;
    477          }
    478          m=m-1;
     474        while (lead(i[m])/var(n-1)==0)
     475        {
     476          m=m+1;
     477        }
     478        m=m-1;
    479479      }
    480480      //check whether i[m] =(c*var(n)+h)^e modulo prm for some
     
    482482      //if not (0) is returned, else var(n)+h is added to prm
    483483
    484          e=deg(lead(i[m]));
    485          t=leadcoef(i[m])*e*var(n)+(i[m]-lead(i[m]))/var(n)^(e-1);
    486 
    487          i[m]=poly(e)^e*leadcoef(i[m])^(e-1)*i[m];
    488 
    489          if (reduce(i[m]-t^e,prm,1) !=0)
    490          {
    491            return(ideal(0));
    492          }
    493          h=interred(t);
    494          t=h[1];
     484      e=deg(lead(i[m]));
     485      t=leadcoef(i[m])*e*var(n)+(i[m]-lead(i[m]))/var(n)^(e-1);
     486
     487      i[m]=poly(e)^e*leadcoef(i[m])^(e-1)*i[m];
     488
     489      if (reduce(i[m]-t^e,prm,1) !=0)
     490      {
     491        return(ideal(0));
     492      }
     493      h=interred(t);
     494      t=h[1];
    495495
    496496      prm = prm,t;
     
    530530         continue;
    531531      }
    532 
    533532
    534533      if(size(l[2*i])==0)
  • Singular/subexpr.cc

    r56c52a7 ra3432c  
    9494    if ((store!=NULL)&&(store!=this))
    9595      store->CleanUp();
    96    
     96
    9797    switch (t /*=Typ()*/)
    9898      {
     
    128128        case RESOLUTION_CMD:
    129129          syPrint((syStrategy)d);
    130           break; 
     130          break;
    131131        case STRING_CMD:
    132132          ::Print("%-*.*s%s",spaces,spaces," ",(char *)d);
     
    138138         {
    139139           procinfov pi=(procinfov)d;
    140            ::Print("%-*.*s// libname  : %s\n",spaces,spaces," ",
    141                    piProcinfo(pi, "libname"));
    142            ::Print("%-*.*s// procname : %s\n",spaces,spaces," ",
    143                    piProcinfo(pi, "procname"));
    144            ::Print("%-*.*s// type     : %s",spaces,spaces," ",
    145                    piProcinfo(pi, "type"));
    146            //      ::Print("%-*.*s// ref      : %s",spaces,spaces," ",
    147            //   piProcinfo(pi, "ref"));
    148            break;
     140           ::Print("%-*.*s// libname  : %s\n",spaces,spaces," ",
     141                   piProcinfo(pi, "libname"));
     142           ::Print("%-*.*s// procname : %s\n",spaces,spaces," ",
     143                   piProcinfo(pi, "procname"));
     144           ::Print("%-*.*s// type     : %s",spaces,spaces," ",
     145                   piProcinfo(pi, "type"));
     146           //           ::Print("%-*.*s// ref      : %s",spaces,spaces," ",
     147           //   piProcinfo(pi, "ref"));
     148           break;
    149149         }
    150150       case POINTER_CMD:
     
    213213  {
    214214    PrintLn();
    215   } 
     215  }
    216216#ifdef SIQ
    217217  if (rtyp!=COMMAND)
     
    278278        break;
    279279      case PROC_CMD:
    280         piKill((procinfov)data);
    281         break;
     280        piKill((procinfov)data);
     281        break;
    282282      case LINK_CMD:
    283283        slKill((si_link)data);
     
    313313#ifdef HAVE_RTIMER
    314314        case VRTIMER:
    315 #endif         
     315#endif
    316316      case VOICE:
    317317      case VMAXDEG:
     
    327327      default:
    328328        ::Print("CleanUp: unknown type %d\n",rtyp);  /* DEBUG */
    329 #endif         
     329#endif
    330330    } /* end switch: (rtyp) */
    331331    data=NULL;
     
    349349#ifdef HAVE_RTIMER
    350350      case VRTIMER:
    351 #endif         
     351#endif
    352352      case VOICE:
    353353      case VMAXDEG:
     
    515515          r->ref++;
    516516          data=d;
    517         } 
     517        }
    518518        else
    519519        {
    520520          WerrorS("invalid ring description");
    521         } 
     521        }
    522522        break;
    523523      }
     
    546546void * sleftv::CopyD(int t)
    547547{
    548   if (iiCheckRing(t))
    549      return NULL;
    550548  if ((rtyp!=IDHDL)&&(e==NULL))
    551549  {
     550    if (iiCheckRing(t)) return NULL;
    552551    void *x=data;
    553552    if (rtyp==VNOETHER) x=(void *)pCopy(ppNoether);
     
    559558    return x;
    560559  }
    561   void *d=Data();
    562   if (!errorreported) return slInternalCopy(this,t,d,e);
     560  void *d=Data(); // will also do a iiCheckRing
     561  if ((!errorreported) && (d!=NULL)) return slInternalCopy(this,t,d,e);
    563562  return NULL;
    564563}
     
    581580  if ((a!=NULL) && (*a!=NULL))
    582581    return (*a)->Copy();
    583   return NULL; 
     582  return NULL;
    584583}
    585584
     
    664663      {
    665664        return rString((ring)d);
    666       } 
     665      }
    667666      default:
    668667        #ifdef TEST
     
    694693#ifdef HAVE_RTIMER
    695694      case VRTIMER:
    696 #endif         
     695#endif
    697696      case VOICE:
    698697      case VMAXDEG:
     
    702701        return INT_CMD;
    703702      case LIB_CMD:
    704         return STRING_CMD; 
     703        return STRING_CMD;
    705704      case VMINPOLY:
    706705        return NUMBER_CMD;
     
    791790void * sleftv::Data()
    792791{
    793   if (iiCheckRing(rtyp))
     792  if (rtyp!=IDHDL && iiCheckRing(rtyp))
    794793     return NULL;
    795794  if (e==NULL)
     
    823822                         if(h==NULL) return (void *)sNoName;
    824823                         return IDSTRING(h);
    825                        } 
     824                       }
    826825      case IDHDL:
    827826        return IDDATA((idhdl)data);
Note: See TracChangeset for help on using the changeset viewer.