Changeset 68349d in git


Ignore:
Timestamp:
Mar 25, 2004, 10:19:12 PM (20 years ago)
Author:
Viktor Levandovskyy <levandov@…>
Branches:
(u'spielwiese', 'a719bcf0b8dbc648b128303a49777a094b57592c')
Children:
c47b0a37e9aaabd8518efe50efd4ab6a540b00b6
Parents:
3d9ed9730c6639ccd48654bab09d3ef24067f307
Message:
*levandov: Plural Subst fix


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

Legend:

Unmodified
Added
Removed
  • kernel/gring.cc

    r3d9ed9 r68349d  
    77 *  Author:  levandov (Viktor Levandovsky)
    88 *  Created: 8/00 - 11/00
    9  *  Version: $Id: gring.cc,v 1.4 2003-12-17 19:40:41 levandov Exp $
     9 *  Version: $Id: gring.cc,v 1.5 2004-03-25 21:19:12 levandov Exp $
    1010 *******************************************************************/
    1111#include "mod2.h"
     
    13931393            ares=p_Add_q(ares, bres,currRing);
    13941394            /* What to give free? */
     1395            /* Do we have to free PREFIX/SUFFIX? it seems so */
    13951396            pDelete(&prefix);
    13961397            pDelete(&suffix);
     
    19461947}
    19471948
    1948 #endif
     1949/* substitute the n-th variable by e in p
     1950* destroy p
     1951* e is not a constant
     1952*/
     1953poly nc_pSubst(poly p, int n, poly e)
     1954{
     1955  int rN=currRing->N;
     1956  int *PRE = (int *)omAlloc0((rN+1)*sizeof(int));
     1957  int *SUF = (int *)omAlloc0((rN+1)*sizeof(int));
     1958  int i,j,pow;
     1959  poly suf,pre;
     1960  poly res = NULL;
     1961  poly out = NULL;
     1962  while ( p!= NULL )
     1963  {
     1964    pGetExpV(p, PRE); /* faster splitting? */
     1965    pow = PRE[n]; PRE[n]=0;
     1966    res = NULL;
     1967    if (pow!=0)
     1968    {
     1969      for (i=n+1; i<=rN; i++)
     1970      {
     1971        SUF[i] = PRE[i];
     1972        PRE[i] = 0;
     1973      }
     1974      res =  pPower(pCopy(e),pow);
     1975      /* multiply with prefix */
     1976      pre = pOne();
     1977      pSetExpV(pre,PRE);
     1978      pSetm(pre);
     1979      pSetComp(pre,PRE[0]);
     1980      res = nc_mm_Mult_p(pre,res,currRing);
     1981      /* multiply with suffix */
     1982      suf = pOne();
     1983      pSetExpV(suf,SUF);
     1984      pSetm(suf);
     1985      pSetComp(suf,PRE[0]);
     1986      res = nc_p_Mult_mm(res,suf,currRing);
     1987    }
     1988    else /* pow==0 */
     1989    {
     1990      res = pHead(p);
     1991    }
     1992    p   = pLmDeleteAndNext(p);
     1993    out = pAdd(out,res);
     1994  }
     1995  freeT(PRE,rN);
     1996  freeT(SUF,rN);
     1997  return(out);
     1998}
     1999
     2000#endif
  • kernel/gring.h

    r3d9ed9 r68349d  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: gring.h,v 1.3 2003-12-16 18:30:31 levandov Exp $ */
     6/* $Id: gring.h,v 1.4 2004-03-25 21:18:57 levandov Exp $ */
    77/*
    88* ABSTRACT additional defines etc for --with-plural
     
    2323void ncCleanUp(ring r); /* smaller than kill */
    2424
    25 // poly functions defined in p_Procs :
     25/* poly functions defined in p_Procs : */
    2626poly nc_pp_Mult_mm(poly p, poly m, const ring r, poly &last);
    2727poly nc_p_Mult_mm(poly p, poly m, const ring r);
    2828poly nc_p_Minus_mm_Mult_qq(poly p, const poly m, poly q, const ring r);
    29 // other routines we need in addition :
     29/* other routines we need in addition : */
    3030poly nc_p_Mult_mm_Common(poly p, const poly m, int side, const ring r);
    3131poly nc_mm_Mult_p(const poly m, poly p, const ring r);
     
    4242poly _nc_p_Mult_q(poly p, poly q, const int copy, const ring r);
    4343
    44 //copy :
     44/* subst: */
     45poly nc_pSubst(poly p, int n, poly e);
     46
     47/* copy : */
    4548poly nc_p_CopyGet(poly a, ring r);
    4649poly nc_p_CopyPut(poly a, ring r);
    4750
    48 //syzygies :
    49 // former nc_spGSpolyCreate
     51/* syzygies : */
     52/* former nc_spGSpolyCreate */
    5053poly nc_CreateSpoly(poly p1, poly p2, poly spNoether, const ring r);
    51 // former nc_spGSpolyRed
     54/* former nc_spGSpolyRed */
    5255poly nc_ReduceSpoly(poly p1, poly p2, poly spNoether, const ring r);
    53 // former nc_spGSpolyRedNew
     56/* former nc_spGSpolyRedNew */
    5457poly nc_ReduceSpolyNew(poly p1, poly p2, poly spNoether, const ring r);
    55 // former nc_spGSpolyRedTail
     58/* former nc_spGSpolyRedTail */
    5659void nc_ReduceSpolyTail(poly p1, poly q, poly q2, poly spNoether, const ring r);
    57 // former nc_spShort
     60/* former nc_spShort */
    5861poly nc_CreateShortSpoly(poly p1, poly p2, const ring r=currRing);
    5962
    6063ideal gr_bba (ideal F, ideal Q,kStrategy strat);
    6164
    62 // brackets:
     65/* brackets: */
    6366poly nc_p_Bracket_qq(poly p, poly q);
    6467poly nc_mm_Bracket_nn(poly m1, poly m2);
    6568
    66 //twostd:
    67 
     69/* twostd: */
    6870ideal twostd(ideal I);
    6971
    70 // complete reduction routines
     72/* complete reduction routines */
    7173
    72 //void nc_kBucketPolyRed(kBucket_pt b, poly p);
     74/* void nc_kBucketPolyRed(kBucket_pt b, poly p); */
    7375void nc_kBucketPolyRed(kBucket_pt b, poly p, number *c);
    7476void nc_PolyPolyRed(poly &b, poly p, number *c);
     
    7981
    8082#else
    81 // dummy definition to make gcc happy
     83/* dummy definition to make gcc happy */
    8284#define nc_kBucketPolyRed(A,B,C) 0
    8385#define nc_PolyPolyRed(A,B,C) 0
  • kernel/polys.cc

    r3d9ed9 r68349d  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: polys.cc,v 1.1.1.1 2003-10-06 12:15:55 Singular Exp $ */
     4/* $Id: polys.cc,v 1.2 2004-03-25 21:16:15 levandov Exp $ */
    55
    66/*
     
    2020#include "ring.h"
    2121
     22#ifdef HAVE_PLURAL
     23#include "gring.h"
     24#endif
     25
    2226/* ----------- global variables, set by pSetGlobals --------------------- */
    2327/* computes length and maximal degree of a POLYnomial */
     
    835839    else return pSubst2(p, n, pGetCoeff(e));
    836840  }
     841
     842#ifdef HAVE_PLURAL
     843  if (rIsPluralRing(currRing))
     844  {
     845    return nc_pSubst(p,n,e);
     846  }
     847#endif
    837848
    838849  int exponent,i;
Note: See TracChangeset for help on using the changeset viewer.