Changeset 57e95ce in git


Ignore:
Timestamp:
Apr 19, 2000, 5:45:00 PM (23 years ago)
Author:
Wilfred Pohl <pohl@…>
Branches:
(u'spielwiese', 'f6c3dc58b0df4bd712574325fe76d0626174ad97')
Children:
13d076b1deb4bfd0d554b81f02cd622c8b6b5f6d
Parents:
c78e8bf1856fddae986219c7747c226eb90cb1c7
Message:
special division without negative exponent


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

Legend:

Unmodified
Added
Removed
  • Singular/sparsmat.cc

    rc78e8b r57e95ce  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: sparsmat.cc,v 1.25 2000-02-09 08:15:09 pohl Exp $ */
     4/* $Id: sparsmat.cc,v 1.26 2000-04-19 15:45:00 pohl Exp $ */
    55
    66/*
     
    4242static BOOLEAN smCheckLead(const poly, const poly);
    4343static poly smDMult(poly, const poly);
    44 static void smPolyDivN(poly a, const number);
     44static void smComplete(poly, const poly, const poly);
     45static void smPolyDivN(poly, const number);
    4546static BOOLEAN smSmaller(poly, poly);
    4647static void smCombineChain(poly *, poly);
     
    18601861      lead = smCheckLead(a, e);
    18611862      r = smDMult(a, e);
     1863      smComplete(r, b, c);
    18621864    }
    18631865    else
     
    18941896    {
    18951897      r = smDMult(a, e);
     1898      smComplete(r, b, c);
    18961899      if (smCheckLead(a, e))
    18971900        smCombineChain(&pa, r);
     
    19411944    pSetCoeff0(e,yn);
    19421945    if (smIsNegQuot(e, a, b))
     1946    {
    19431947      h = smDMult(tail, e);
     1948      smComplete(h, a, b);
     1949    }
    19441950    else
    19451951      h = smEMult(tail, e);
     
    19541960  int i;
    19551961
    1956   for (i=pVariables; i; i--)
    1957   {
    1958     pSetExp(a,i,pGetExp(b,i)-pGetExp(c,i));
    1959     if (pGetExp(a,i) < 0)
    1960     {
    1961       while(--i) pSetExp(a,i,pGetExp(b,i)-pGetExp(c,i));
    1962       return TRUE;
    1963     }
    1964   }
    1965   return FALSE;
     1962  i=pVariables;
     1963  while (i&&(pGetExp(b,i)<pGetExp(c,i))) i--;
     1964  if(i)
     1965  {
     1966    for (i=pVariables; i; i--)
     1967    {
     1968      if(pGetExp(b,i)<pGetExp(c,i))
     1969        pSetExp(a,i,pGetExp(c,i)-pGetExp(b,i));
     1970      else
     1971        pSetExp(a,i,0);
     1972    }
     1973    return TRUE;
     1974  }
     1975  else
     1976  {
     1977    for (i=pVariables; i; i--)
     1978    {
     1979      pSetExp(a,i,pGetExp(b,i)-pGetExp(c,i));
     1980    }
     1981    return FALSE;
     1982  }
    19661983}
    19671984
     
    19721989  int i;
    19731990
    1974   h = res = pInit();
     1991  h = res = pNew();
    19751992  loop
    19761993  {
    1977     //pSetComp(h,0);
     1994    pCopy2(h,t);
    19781995    for (i=pVariables; i; i--)
    1979       pSetExp(h,i,pGetExp(e,i)+pGetExp(t,i));
     1996      pAddExp(h,i,pGetExp(e,i));
    19801997    pSetm(h);
    19811998    pSetCoeff0(h,nMult(y,pGetCoeff(t)));
     
    19862003      return res;
    19872004    }
    1988     h = pNext(h) = pInit();
     2005    h = pNext(h) = pNew();
    19892006  }
    19902007}
     
    19922009static BOOLEAN smCheckLead(const poly t, const poly e)
    19932010{
    1994   int i;
    1995   for (i=pVariables; i; i--)
    1996   {
    1997     if ((pGetExp(e,i)+pGetExp(t,i)) < 0)
    1998       return FALSE;
    1999   }
    2000   return TRUE;
    2001 }
    2002 
    2003 static poly smDMult(poly t, const poly e)
    2004 {
    2005   const number y = pGetCoeff(e);
    2006   poly r = NULL;
    2007   poly res, h;
    20082011  int i;
    20092012  Exponent_t w;
    2010 
    2011   h = res = pInit();
     2013  for (i=pVariables; i; i--)
     2014  {
     2015    w = pGetExp(e,i);
     2016    if (w&&(w>pGetExp(t,i)))
     2017      return FALSE;
     2018  }
     2019  return TRUE;
     2020}
     2021
     2022static poly smDMult(poly t, const poly e)
     2023{
     2024  const number y = pGetCoeff(e);
     2025  poly res, h;
     2026
    20122027  loop
    20132028  {
    2014     i=pVariables;
     2029    if(smCheckLead(t,e)) break;
     2030    pIter(t);
     2031    if(t==NULL) return NULL;
     2032  }
     2033  h = res = pNew();
     2034  loop
     2035  {
     2036    pCopy2(h,t);
     2037    pSetCoeff0(h,nMult(y,pGetCoeff(t)));
    20152038    loop
    20162039    {
    2017       w = pGetExp(e,i)+pGetExp(t,i);
    2018       if (w < 0) break;
    2019       pSetExp(h,i,w);
    2020       i--;
    2021       if (i == 0)
    2022       {
    2023         pSetm(h);
    2024         pSetCoeff0(h,nMult(y,pGetCoeff(t)));
    2025         pIter(t);
    2026         if (t == NULL)
    2027         {
    2028           pNext(h) = NULL;
    2029           return res;
    2030         }
    2031         r = h;
    2032         h = pNext(h) = pInit();
    2033         i=pVariables;
    2034       }
     2040      pIter(t);
     2041      if(t==NULL)
     2042      {
     2043        pNext(h)=NULL;
     2044        return res;
     2045      }
     2046      if(smCheckLead(t,e)) break;
     2047    }
     2048    h=pNext(h)=pNew();
     2049  }
     2050}
     2051
     2052static void smComplete(poly t, const poly b, const poly c)
     2053{
     2054  int i;
     2055  while(t!=NULL)
     2056  {
     2057    for (i=pVariables; i; i--)
     2058    {
     2059      pAddExp(t,i,pGetExp(b,i));
     2060      pSubExp(t,i,pGetExp(c,i));
     2061      pSetm(t);
    20352062    }
    20362063    pIter(t);
    2037     if (t == NULL)
    2038     {
    2039       if (r != NULL)
    2040         pNext(r) = NULL;
    2041       else
    2042         res = NULL;
    2043       pFree1(h);
    2044       return res;
    2045     }
    20462064  }
    20472065}
  • Singular/sparsmat.h

    rc78e8b r57e95ce  
    88 *
    99 *******************************************************************/
    10 /* $Id: sparsmat.h,v 1.5 2000-02-09 08:45:16 pohl Exp $ */
     10/* $Id: sparsmat.h,v 1.6 2000-04-19 15:45:00 pohl Exp $ */
    1111
    1212
     
    1616void smSpecialPolyDiv(poly, poly);
    1717/* ----------------- macros ------------------ */
    18 #define OLD_DIV 1
     18/* #define OLD_DIV 1 */
    1919
    2020#ifdef OLD_DIV
Note: See TracChangeset for help on using the changeset viewer.