Changeset f99917f in git


Ignore:
Timestamp:
Mar 11, 1999, 4:58:09 PM (25 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
Children:
00f47bba032424d132ee7ddb27980fee77618bc3
Parents:
52c2fbd6f734a6e530dac2589becda5a013ced56
Message:
* hannes: added "highcorner" for modules (iparith, ipshell)
          fixed rWrite (ring.cc)
	  fixed mpCoef (matpol.cc)


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

Legend:

Unmodified
Added
Removed
  • Singular/iparith.cc

    r52c2fb rf99917f  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: iparith.cc,v 1.133 1999-03-09 14:23:07 Singular Exp $ */
     4/* $Id: iparith.cc,v 1.134 1999-03-11 15:58:05 Singular Exp $ */
    55
    66/*
     
    14951495        // Allow imap to be make an exception only for:
    14961496        if ( (rField_is_Q_a(r) &&  // Q(a..) -> Q(a..) || Q || Zp || Zp(a)
    1497               (rField_is_Q() || rField_is_Q_a() || 
     1497              (rField_is_Q() || rField_is_Q_a() ||
    14981498               (rField_is_Zp() || rField_is_Zp_a())))
    14991499             ||
    15001500             (rField_is_Zp_a(r) &&  // Zp(a..) -> Zp(a..) || Zp
    1501               (rField_is_Zp(currRing, rInternalChar(r)) || 
     1501              (rField_is_Zp(currRing, rInternalChar(r)) ||
    15021502               rField_is_Zp_a(currRing, rInternalChar(r)))) )
    15031503        {
     
    19751975
    19761976/*=================== operations with 2 args.: table =================*/
     1977
    19771978struct sValCmd2 dArith2[]=
    19781979{
     
    25082509  assumeStdFlag(v);
    25092510  ideal I=(ideal)v->Data();
    2510   BOOLEAN *UsedAxis=(BOOLEAN *)Alloc0(pVariables*sizeof(BOOLEAN));
    2511   int i,n;
    2512   poly po;
    2513   for(i=IDELEMS(I)-1;i>=0;i--)
    2514   {
    2515     po=I->m[i];
    2516     if ((po!=NULL) &&((n=pIsPurePower(po))!=0)) UsedAxis[n-1]=TRUE;
    2517   }
    2518   for(i=pVariables-1;i>=0;i--)
    2519   {
    2520     if(UsedAxis[i]==FALSE) return FALSE; // not zero-dim.
    2521   }
    2522   if (currRing->OrdSgn==1)
    2523   {
    2524     res->data=pOne();
    2525     return FALSE;
    2526   }
    2527   po=NULL;
    2528   scComputeHC(I,0,po);
    2529   if (po!=NULL)
    2530   {
    2531     pGetCoeff(po)=nInit(1);
    2532     for (i=pVariables; i>0; i--)
    2533     {
    2534       if (pGetExp(po, i) > 0) pDecrExp(po,i);
    2535     }
    2536     pSetm(po);
    2537   }
     2511  res->data=(void *)iiHighCorner(I,0);
     2512  return FALSE;
     2513}
     2514static BOOLEAN jjHIGHCORNER_M(leftv res, leftv v)
     2515{
     2516  assumeStdFlag(v);
     2517  intvec *module_w=new intvec(*(intvec*)atGet(v,"isHomog"));
     2518  ideal I=(ideal)v->Data();
     2519  int i;
     2520  poly p=NULL,po=NULL;
     2521  int rk=idRankFreeModule(I);
     2522  if (module_w==NULL)
     2523    module_w = new intvec(rk);
     2524  for(i=rk;i>0;i--)
     2525  {
     2526    p=iiHighCorner(I,i);
     2527    if (p==NULL)
     2528    {
     2529      Werror("module must be zero-dimensional");
     2530      delete module_w;
     2531      return TRUE;
     2532    }
     2533    if (po==NULL)
     2534      po=p;
     2535    else
     2536    {
     2537      // now po!=NULL, p!=NULL
     2538      int d=(pFDeg(po)+(*module_w)[pGetComp(po)] - pFDeg(p)+ (*module_w)[i]);
     2539      if (d==0)
     2540        d=pComp0(po,p);
     2541      if (d < 0)
     2542      {
     2543        pDelete(&po); po=p;
     2544      }
     2545      else // (d > 0)
     2546      {
     2547        pDelete(&p);
     2548      }
     2549    }
     2550  }
     2551  delete module_w;
    25382552  res->data=(void *)po;
    25392553  return FALSE;
     
    34013415,{jjGETDUMP,    GETDUMP_CMD,     NONE,           LINK_CMD }
    34023416,{jjHIGHCORNER, HIGHCORNER_CMD,  POLY_CMD,       IDEAL_CMD }
     3417,{jjHIGHCORNER_M, HIGHCORNER_CMD,VECTOR_CMD,     MODUL_CMD }
    34033418,{jjHILBERT,    HILBERT_CMD,     NONE,           IDEAL_CMD }
    34043419,{jjHILBERT,    HILBERT_CMD,     NONE,           MODUL_CMD }
  • Singular/ipshell.cc

    r52c2fb rf99917f  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: ipshell.cc,v 1.36 1999-03-09 12:28:48 obachman Exp $ */
     4/* $Id: ipshell.cc,v 1.37 1999-03-11 15:58:06 Singular Exp $ */
    55/*
    66* ABSTRACT:
     
    3131#include "ipconv.h"
    3232#include "silink.h"
     33#include "stairc.h"
    3334#include "ipshell.h"
    3435
     
    10651066  return FALSE;
    10661067}
     1068
     1069poly    iiHighCorner(ideal I, int ak)
     1070{
     1071  BOOLEAN *UsedAxis=(BOOLEAN *)Alloc0(pVariables*sizeof(BOOLEAN));
     1072  int i,n;
     1073  poly po;
     1074  for(i=IDELEMS(I)-1;i>=0;i--)
     1075  {
     1076    po=I->m[i];
     1077    if ((po!=NULL) &&((n=pIsPurePower(po))!=0)) UsedAxis[n-1]=TRUE;
     1078  }
     1079  for(i=pVariables-1;i>=0;i--)
     1080  {
     1081    if(UsedAxis[i]==FALSE) return NULL; // not zero-dim.
     1082  }
     1083  if (currRing->OrdSgn== -1)
     1084  {
     1085    po=NULL;
     1086    scComputeHC(I,ak,po);
     1087    if (po!=NULL)
     1088    {
     1089      pGetCoeff(po)=nInit(1);
     1090      for (i=pVariables; i>0; i--)
     1091      {
     1092        if (pGetExp(po, i) > 0) pDecrExp(po,i);
     1093      }
     1094    }
     1095  }
     1096  if (po!=NULL)
     1097  {
     1098    pSetComp(po,ak);
     1099    pSetm(po);
     1100  }
     1101  return po;
     1102}
  • Singular/ipshell.h

    r52c2fb rf99917f  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: ipshell.h,v 1.15 1998-10-22 12:26:11 krueger Exp $ */
     6/* $Id: ipshell.h,v 1.16 1999-03-11 15:58:07 Singular Exp $ */
    77/*
    88* ABSTRACT
     
    7171void    iiDebug();
    7272BOOLEAN iiCheckRing(int i);
     73poly    iiHighCorner(ideal i, int ak);
    7374/* ================================================================== */
    7475/* Expressions : */
  • Singular/matpol.cc

    r52c2fb rf99917f  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: matpol.cc,v 1.21 1999-03-08 17:30:42 Singular Exp $ */
     4/* $Id: matpol.cc,v 1.22 1999-03-11 15:58:08 Singular Exp $ */
    55
    66/*
     
    780780  poly sel, h;
    781781  int l, i;
     782  int pos_of_1 = -1;
    782783  matrix co;
     784
    783785  if (f==NULL)
    784786  {
     
    795797    for (i=l; i>=1; i--)
    796798    {
    797       h = pHead(sel);
     799      h = sel;
     800      pIter(sel);
     801      pNext(h)=NULL;
    798802      MATELEM(co,1,i) = h;
    799803      MATELEM(co,2,i) = NULL;
    800       sel = sel->next;
     804      if (pIsConstant(h)) pos_of_1 = i;
    801805    }
    802806  }
     
    805809    for (i=1; i<=l; i++)
    806810    {
    807       h = pHead(sel);
     811      h = sel;
     812      pIter(sel);
     813      pNext(h)=NULL;
    808814      MATELEM(co,1,i) = h;
    809815      MATELEM(co,2,i) = NULL;
    810       sel = sel->next;
     816      if (pIsConstant(h)) pos_of_1 = i;
    811817    }
    812818  }
     
    816822    loop
    817823    {
    818       h = mpExdiv(f, MATELEM(co,1,i));
    819       if (h!=NULL)
    820       {
    821         MATELEM(co,2,i) = pAdd(MATELEM(co,2,i), h);
     824      if (i!=pos_of_1)
     825      {
     826        h = mpExdiv(f, MATELEM(co,1,i));
     827        if (h!=NULL)
     828        {
     829          MATELEM(co,2,i) = pAdd(MATELEM(co,2,i), h);
     830          break;
     831        }
     832      }
     833      if (i == l)
     834      {
     835        // check monom 1 last:
     836        h = mpExdiv(f, MATELEM(co,1,pos_of_1));
     837        if (h!=NULL)
     838        {
     839          MATELEM(co,2,pos_of_1) = pAdd(MATELEM(co,2,pos_of_1), h);
     840          break;
     841        }
    822842        break;
    823       }
    824       if (i < l)
    825         i++;
    826       else
    827         break;
     843      }
     844      i ++;
    828845    }
    829846    pIter(f);
  • Singular/ring.cc

    r52c2fb rf99917f  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: ring.cc,v 1.44 1999-03-08 18:11:50 Singular Exp $ */
     4/* $Id: ring.cc,v 1.45 1999-03-11 15:58:09 Singular Exp $ */
    55
    66/*
     
    673673{
    674674  int VarCompIndex, VarLowIndex, VarHighIndex;
    675  
     675
    676676  r->VarOffset = (int*) Alloc((r->N + 1)*sizeof(int));
    677   pGetVarIndicies(r, r->VarOffset, VarCompIndex, 
     677  pGetVarIndicies(r, r->VarOffset, VarCompIndex,
    678678                  VarLowIndex, VarHighIndex);
    679679  r->VarCompIndex = VarCompIndex;
     
    732732
    733733  if (rField_is_GF(r))
    734     PrintS("//   # ground field : ");
     734  {
     735    Print("//   # ground field : %d\n",rInternalChar(r));
     736    Print("//   primitive element : %s\n", r->parameter[0]);
     737    if (r==currRing)
     738    {
     739      StringSetS("//   minpoly        : ");
     740      nfShowMipo();PrintS(StringAppend("\n"));
     741    }
     742  }
    735743  else
     744  {
    736745    PrintS("//   characteristic : ");
    737   if ( rField_is_R(r) )        PrintS("0 (real)\n");  /* R */
    738   else Print ("%d\n",rChar(r)); /* Fp(a) */
    739   if (r->parameter!=NULL)
    740   {
    741     if (r->ch<2)
     746    if ( rField_is_R(r) )        PrintS("0 (real)\n");  /* R */
     747    else Print ("%d\n",rChar(r)); /* Fp(a) */
     748    if (r->parameter!=NULL)
    742749    {
    743750      Print ("//   %d parameter    : ",rPar(r));
     
    762769      {
    763770        PrintS("...\n");
    764       }
    765     }
    766     else
    767     {
    768       Print("//   primitive element : %s\n", r->parameter[0]);
    769       if (r==currRing)
    770       {
    771         StringSetS("//   minpoly        : ");
    772         nfShowMipo();PrintS(StringAppend("\n"));
    773771      }
    774772    }
     
    13461344            tmpR.P=1;
    13471345            nSetChar(rInternalChar(currRing),TRUE,currRing->parameter,
    1348               rPar(currRing));
     1346              rPar(currRing));
    13491347          }
    13501348          else
    13511349          {
    13521350            nSetChar(rInternalChar(currRing),TRUE,currRing->parameter,
    1353               rPar(currRing));
     1351              rPar(currRing));
    13541352            WerrorS("different minpolys");
    13551353            return -1;
     
    13671365            tmpR.minpoly=naCopy(r1->minpoly);
    13681366            nSetChar(rInternalChar(currRing),TRUE,currRing->parameter,
    1369               rPar(currRing));
     1367              rPar(currRing));
    13701368          }
    13711369          else
     
    13891387            tmpR.minpoly=naCopy(r2->minpoly);
    13901388            nSetChar(rInternalChar(currRing),TRUE,currRing->parameter,
    1391               rPar(currRing));
     1389              rPar(currRing));
    13921390          }
    13931391          else
     
    14441442          tmpR.minpoly=naCopy(r1->minpoly);
    14451443          nSetChar(rInternalChar(currRing),TRUE,currRing->parameter,
    1446             rPar(currRing));
     1444            rPar(currRing));
    14471445        }
    14481446      }
     
    14711469          tmpR.minpoly=naCopy(r2->minpoly);
    14721470          nSetChar(rInternalChar(currRing),TRUE,currRing->parameter,
    1473             rPar(currRing));
     1471            rPar(currRing));
    14741472        }
    14751473      }
     
    15071505          tmpR.minpoly=naCopy(r1->minpoly);
    15081506          nSetChar(rInternalChar(currRing),TRUE,currRing->parameter,
    1509             rPar(currRing));
     1507            rPar(currRing));
    15101508        }
    15111509      }
     
    15371535          tmpR.minpoly=naCopy(r2->minpoly);
    15381536          nSetChar(rInternalChar(currRing),TRUE,currRing->parameter,
    1539             rPar(currRing));
     1537            rPar(currRing));
    15401538        }
    15411539      }
     
    19201918
    19211919  if (r->N == 0) return true;
    1922  
     1920
    19231921  if (r->VarOffset == NULL)
    19241922  {
     
    19271925    return false;
    19281926  }
    1929  
    1930   int 
    1931     VarCompIndex = r->VarCompIndex, 
    1932     VarLowIndex  = r->VarLowIndex, 
     1927
     1928  int
     1929    VarCompIndex = r->VarCompIndex,
     1930    VarLowIndex  = r->VarLowIndex,
    19331931    VarHighIndex = r->VarHighIndex,
    19341932    i;
    19351933  BOOLEAN ok = false;
    19361934  int* VarOffset = r->VarOffset;
    1937  
     1935
    19381936  rComplete(r);
    1939  
     1937
    19401938  if (   VarCompIndex != r->VarCompIndex ||
    19411939         VarLowIndex  != r->VarLowIndex ||
     
    19461944    ok = FALSE;
    19471945  }
    1948  
     1946
    19491947  for (i=0; i<=r->N; i++)
    19501948  {
Note: See TracChangeset for help on using the changeset viewer.