Changeset dd5534 in git


Ignore:
Timestamp:
Mar 15, 2011, 3:45:13 PM (13 years ago)
Author:
Frank Seelisch <seelisch@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'c1c65551e4b3a0de0b13ddf30446f6e9569681b5')
Children:
91b031a4e88cb480f4ba993bf5904694c62d9b34
Parents:
c4dab43d69dd36ed09ba07d4e771236f8a7bcc39
Message:
fixed dim of ideal and sum of ideals over rings (with Anne)

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

Legend:

Unmodified
Added
Removed
  • Singular/iparith.cc

    rc4dab4 rdd5534  
    2727#include <kernel/longtrans.h>
    2828#include <kernel/ideals.h>
     29#include <kernel/prCopy.h>
    2930#include <kernel/matpol.h>
    3031#include <kernel/kstd1.h>
     
    17591760{
    17601761  assumeStdFlag(v);
     1762#ifdef HAVE_RINGS
     1763  if (rField_is_Ring(currRing))
     1764  {
     1765    ring origR = currRing;
     1766    ring tempR = rCopy(origR);
     1767    tempR->ringtype = 0; tempR->ch = 0;
     1768    rComplete(tempR);
     1769    ideal vid = (ideal)v->Data();
     1770    int i = idPosConstant(vid);
     1771    if ((i != -1) && (nIsUnit(pGetCoeff(vid->m[i]))))
     1772    { /* ideal v contains unit; dim = -1 */
     1773      res->data = (char *)-1;
     1774      return FALSE;
     1775    }
     1776    rChangeCurrRing(tempR);
     1777    ideal vv = idrCopyR(vid, origR, currRing);
     1778    ideal ww = idrCopyR((ideal)w->Data(), origR, currRing);
     1779    /* drop degree zero generator from vv (if any) */
     1780    if (i != -1) pDelete(&vv->m[i]);
     1781    long d = (long)scDimInt(vv, ww);   
     1782    if (rField_is_Ring_Z(origR) && (i == -1)) d++;
     1783    res->data = (char *)d;
     1784    idDelete(&vv); idDelete(&ww);
     1785    rChangeCurrRing(origR);
     1786    rDelete(tempR);
     1787    return FALSE;
     1788  }
     1789#endif
    17611790  if(currQuotient==NULL)
    17621791    res->data = (char *)((long)scDimInt((ideal)(v->Data()),(ideal)w->Data()));
     
    35993628{
    36003629  assumeStdFlag(v);
     3630#ifdef HAVE_RINGS
     3631  if (rField_is_Ring(currRing))
     3632  {
     3633    ring origR = currRing;
     3634    ring tempR = rCopy(origR);
     3635    tempR->ringtype = 0; tempR->ch = 0;
     3636    rComplete(tempR);
     3637    ideal vid = (ideal)v->Data();
     3638    int i = idPosConstant(vid);
     3639    if ((i != -1) && (nIsUnit(pGetCoeff(vid->m[i]))))
     3640    { /* ideal v contains unit; dim = -1 */
     3641      res->data = (char *)-1;
     3642      return FALSE;
     3643    }
     3644    rChangeCurrRing(tempR); rComplete(tempR);
     3645    ideal vv = idrCopyR(vid, origR, currRing);
     3646    /* drop degree zero generator from vv (if any) */
     3647    if (i != -1) pDelete(&vv->m[i]);
     3648    long d = (long)scDimInt(vv, currQuotient);   
     3649    if (rField_is_Ring_Z(origR) && (i == -1)) d++;
     3650    res->data = (char *)d;
     3651    idDelete(&vv);
     3652    rChangeCurrRing(origR);
     3653    rDelete(tempR);
     3654    return FALSE;
     3655  }
     3656#endif
    36013657  res->data = (char *)(long)scDimInt((ideal)(v->Data()),currQuotient);
    36023658  return FALSE;
  • kernel/ideals.cc

    rc4dab4 rdd5534  
    9494#endif
    9595
     96/* index of generator with leading term in ground ring (if any);
     97   otherwise -1 */
     98int idPosConstant(ideal id)
     99{
     100  int k;
     101  for (k = IDELEMS(id)-1; k>=0; k--)
     102  {
     103    if (p_LmIsConstantComp(id->m[k], currRing) == TRUE)
     104      return k;
     105  }
     106  return -1;
     107}
     108
    96109/*2
    97110* initialise the maximal ideal (at 0)
     
    223236
    224237/*2
    225 * ideal id = (id[i]), c any number
     238* ideal id = (id[i]), c any unit
    226239* if id[i] = c*id[j] then id[j] is deleted for j > i
    227240*/
     
    236249      for (j=k; j>i; j--)
    237250      {
    238         if ((id->m[j]!=NULL)
    239         && (pComparePolys(id->m[i], id->m[j])))
     251        if (id->m[j]!=NULL)
    240252        {
    241           pDelete(&id->m[j]);
     253#ifdef HAVE_RINGS
     254          if (rField_is_Ring(currRing))
     255          {
     256            /* if id[j] = c*id[i] then delete id[j].
     257               In the below cases of a ground field, we
     258               check whether id[i] = c*id[j] and, if so,
     259               delete id[j] for historical reasons (so
     260               that previous output does not change) */
     261            if (pComparePolys(id->m[j], id->m[i])) pDelete(&id->m[j]);
     262          }
     263          else
     264          {
     265            if (pComparePolys(id->m[i], id->m[j])) pDelete(&id->m[j]);
     266          }
     267#else
     268          if (pComparePolys(id->m[i], id->m[j])) pDelete(&id->m[j]);
     269#endif         
    242270        }
    243271      }
  • kernel/ideals.h

    rc4dab4 rdd5534  
    6262  /*- initialise the maximal ideal (at 0) -*/
    6363void idSkipZeroes (ideal ide);
     64/* index of generator with leading term in ground ring (if any);
     65   otherwise -1 */
     66int idPosConstant (ideal id);
    6467  /*gives an ideal the minimal possible size*/
    6568void idNorm(ideal id);
  • kernel/pInline1.h

    rc4dab4 rdd5534  
    587587{
    588588  if (p == NULL) return FALSE;
     589#ifdef HAVE_RINGS
     590  if (rField_is_Ring(currRing))
     591    return (p_LmIsConstant(p, r) && nIsUnit(pGetCoeff(p)));
     592#endif
    589593  return p_LmIsConstant(p, r);
    590594}
  • kernel/polys1.cc

    rc4dab4 rdd5534  
    17171717  if (pLength(p1) != pLength(p2))
    17181718    return FALSE;
     1719#ifdef HAVE_RINGS
     1720  if (rField_is_Ring(currRing))
     1721  {
     1722    if ((pLength(p1) == 1) && (nEqual(pGetCoeff(p1), pGetCoeff(p2))))
     1723      return TRUE;
     1724    if (!nIsUnit(pGetCoeff(p2))) return FALSE;
     1725  }
     1726#endif
    17191727  n=nDiv(pGetCoeff(p1),pGetCoeff(p2));
    17201728  while ((p1 != NULL) /*&& (p2 != NULL)*/)
Note: See TracChangeset for help on using the changeset viewer.