Changeset 8251cc in git for kernel/polys.cc


Ignore:
Timestamp:
Apr 26, 2007, 11:22:34 AM (17 years ago)
Author:
Oliver Wienand <wienand@…>
Branches:
(u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
Children:
a2589fbeca8f1226cf84a107ae899a974fbe264b
Parents:
c6eecb9d3c2515ce9b40ef65205d28266ba90999
Message:
division of monomials in the case of coefficient rings


git-svn-id: file:///usr/local/Singular/svn/trunk@10003 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/polys.cc

    rc6eecb r8251cc  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: polys.cc,v 1.13 2006-12-15 17:16:07 Singular Exp $ */
     4/* $Id: polys.cc,v 1.14 2007-04-26 09:22:34 wienand Exp $ */
    55
    66/*
     
    110110}
    111111
     112#ifdef HAVE_RING2TOM
     113#define pDiv_nn(p, n)              p_Div_nn(p, n, currRing)
     114
     115poly p_Div_nn(poly p, const number n, const ring r)
     116{
     117  pAssume(!n_IsZero(n,r));
     118  p_Test(p, r);
     119
     120  poly q = p;
     121  while (p != NULL)
     122  {
     123    number nc = pGetCoeff(p);
     124    pSetCoeff0(p, n_Div(nc, n, r));
     125    n_Delete(&nc, r);
     126    pIter(p);
     127  }
     128  p_Test(q, r);
     129  return q;
     130}
     131#endif
     132
    112133/*2
    113134* divides a by the monomial b, ignores monomials which are not divisible
     
    120141  poly prev=NULL;
    121142  int i;
     143#ifdef HAVE_RING2TOM
     144  bool unit = true;
     145  number inv = pGetCoeff(b);
     146  if ((currRing->cring == 1) && ((long) pGetCoeff(b) % 2 == 0))
     147  {
     148    unit = false;
     149  }
     150  if (unit) inv=nInvers(inv);
     151#else
    122152  number inv=nInvers(pGetCoeff(b));
     153#endif
    123154
    124155  while (a!=NULL)
     
    147178    }
    148179  }
     180#ifdef HAVE_RING2TOM
     181  if (!unit)
     182  {
     183    pDiv_nn(result,inv);
     184  }
     185  else
     186#endif
    149187  pMult_nn(result,inv);
    150188  nDelete(&inv);
Note: See TracChangeset for help on using the changeset viewer.