Changeset 61e5dd in git


Ignore:
Timestamp:
Feb 28, 2001, 12:54:49 PM (23 years ago)
Author:
Viktor Levandovskyy <levandov@…>
Branches:
(u'spielwiese', '5b153614cbc72bfa198d75b1e9e33dab2645d9fe')
Children:
a7f4aeac5d0d530cdd6e09874d28a3251d1bb373
Parents:
962a8c4638085e709407994e99b9a6243f838410
Message:
Plural intergration, syzygies : added gring.cc gring.h


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

Legend:

Unmodified
Added
Removed
  • Singular/gring.cc

    r962a8c r61e5dd  
    77 *  Author:  levandov (Viktor Levandovsky)
    88 *  Created: 8/00 - 11/00
    9  *  Version: $Id: gring.cc,v 1.8 2001-02-26 15:08:43 levandov Exp $
     9 *  Version: $Id: gring.cc,v 1.9 2001-02-28 11:54:49 levandov Exp $
    1010 *******************************************************************/
    1111#include "mod2.h"
     
    697697  return(p_Copy(t,r));  /* as last computed element was cMT[a,b] */
    698698}
     699
     700
     701/* ----------------------------- Syzygies ---------------------- */
     702
     703/*2
     704* reduction of p2 with p1
     705* do not destroy p1, but p2
     706* p1 divides p2 -> for use in NF algorithm
     707*/
     708
     709poly nc_spGSpolyRed(poly p1, poly p2,poly spNoether, const ring r)
     710{
     711  int i=0;
     712  int nv=r->N;
     713  poly a1=p_Head(p1,r);
     714  poly a2=p_Head(p2,r);
     715  Exponent_t *A1=(Exponent_t *)omAlloc0((r->N+1)*sizeof(Exponent_t));
     716  Exponent_t *A2=(Exponent_t *)omAlloc0((r->N+1)*sizeof(Exponent_t));
     717
     718  p_GetExpV(a1,A1,r);
     719  p_GetExpV(a2,A2,r);
     720  number cF=n_Copy(p_GetCoeff(a2,r),r);
     721  p_Delete(&a1,r);p_Delete(&a2,r);
     722
     723  for (i=1;i<=nv;i++)
     724  {
     725    A2[i]= A2[i]-A1[i];
     726  }
     727//  A2[0]=0;  /* later pGetComp */
     728
     729  poly delta=pOne();
     730  p_SetExpV(delta,A2,r);
     731  freeT(A1,r->N);
     732  freeT(A2,r->N);
     733  poly pdelta=nc_mm_Mult_p(delta,p_Copy(p1,r),r);
     734  p_Delete(&delta,r);
     735  delta = pdelta;
     736  number cD=p_GetCoeff(delta,r);
     737  poly out=p_Mult_nn(p2,cD,r);
     738  cF=n_Neg(cF,r);
     739  delta=p_Mult_nn(delta,cF,r);
     740  out=p_Add_q(out,delta,r);
     741  n_Delete(&cF,r);
     742  return(out);
     743}
     744
     745
     746/*3
     747* reduction of p2 with p1
     748* do not destroy p1 and p2
     749* p1 divides p2 -> for use in NF algorithm
     750*/
     751poly nc_spGSpolyRedNew(poly p1, poly p2,poly spNoether, const ring r)
     752{
     753  return(nc_spGSpolyRed(p1,p_Copy(p2,r),spNoether,r));
     754}
     755
     756/*4
     757* creates the S-polynomial of p1 and p2
     758* do not destroy p1 and p2
     759*/
     760poly nc_spGSpolyCreate(poly p1, poly p2,poly spNoether, const ring r)
     761{
     762  int i=0;
     763  int nv=r->N;
     764 
     765  Exponent_t *A1=(Exponent_t *)omAlloc0((r->N+1)*sizeof(Exponent_t));
     766  Exponent_t *A2=(Exponent_t *)omAlloc0((r->N+1)*sizeof(Exponent_t));
     767  Exponent_t *G=(Exponent_t *)omAlloc0((r->N+1)*sizeof(Exponent_t));
     768
     769  p_GetExpV(p1,A1,r);
     770  p_GetExpV(p2,A2,r);
     771
     772  for (i=1;i<=nv;i++)
     773  {
     774    if (A2[i]>=A1[i])
     775    {
     776      G[i]=A2[i];
     777    }
     778    else { G[i]=A1[i]; }
     779
     780    A1[i]=G[i]-A1[i];
     781    A2[i]=G[i]-A2[i];
     782
     783  }
     784//  G[0]=0;  /* later pGetComp */
     785  poly m1=pOne();
     786  poly m2=pOne();
     787
     788  p_SetExpV(m1,A1,r);
     789  p_SetExpV(m2,A2,r);
     790  //HOW??????????????????????
     791  freeT(A1,r->N);
     792  freeT(A2,r->N);
     793  freeT(G,r->N);
     794  poly out=nc_mm_Mult_p(m1,p_Copy(p1,r),r);
     795  poly delta = nc_mm_Mult_p(m2,p_Copy(p2,r),r);
     796  number cOut=n_Copy(pGetCoeff(out),r);
     797  number cDelta=n_Copy(p_GetCoeff(delta,r),r);
     798  cOut=n_Neg(cOut,r);
     799  delta=p_Mult_nn(delta,cOut,r);
     800  out=p_Mult_nn(out,cDelta,r);
     801//  cOut=nDiv(cOut,cDelta);
     802//  cOut=nNeg(cOut);
     803//  delta=pSetCoeffP(delta,cOut);
     804  out=p_Add_q(out, delta,r);
     805
     806  p_Delete(&m1,r);
     807  p_Delete(&m2,r);
     808  n_Delete(&cOut,r);
     809  n_Delete(&cDelta,r);
     810
     811  return(out);
     812}
     813
     814/*5
     815* reduction of tail(q) with p1
     816* lead(p1) divides lead(pNext(q2)) and pNext(q2) is reduced
     817* do not destroy p1, but tail(q)
     818*/
     819void nc_spGSpolyRedTail(poly p1, poly q, poly q2, poly spNoether, const ring r)
     820{
     821  int i=0;
     822  int nv=r->N;
     823  poly a1=p_Head(p1,r);
     824  poly a2=p_Head(p_Next(q2,r),r);
     825  //HOW??????????????????
     826  Exponent_t *A1=(Exponent_t *)omAlloc0((r->N+1)*sizeof(Exponent_t));
     827  Exponent_t *A2=(Exponent_t *)omAlloc0((r->N+1)*sizeof(Exponent_t));
     828
     829  p_GetExpV(a1,A1,r);
     830  p_GetExpV(a2,A2,r);
     831  number cF=n_Copy(p_GetCoeff(a2,r),r);
     832  p_Delete(&a1,r);p_Delete(&a2,r);
     833
     834  for (i=1;i<=nv;i++)
     835  {
     836    A2[i]= A2[i]-A1[i];
     837  }
     838//  A2[0]=0;  /* later pGetComp */
     839
     840  poly delta=pOne();
     841  p_SetExpV(delta,A2,r);
     842  freeT(A1,r->N);
     843  freeT(A2,r->N);
     844  poly pdelta=nc_mm_Mult_p(delta,p_Copy(p1,r),r);
     845  p_Delete(&delta,r);
     846  number cD=p_GetCoeff(pdelta,r);
     847  q=p_Mult_nn(q,cD,r);
     848  cF=n_Neg(cF,r);
     849  pdelta=p_Mult_nn(pdelta,cF,r);
     850  q=p_Add_q(q, pdelta,r);
     851//  pDelete(&delta);
     852  n_Delete(&cF,r);
     853}
     854
     855/*6
     856* creates the commutative lcm(lm(p1),lm(p2))
     857* do not destroy p1 and p2
     858*/
     859poly nc_spShort(poly p1, poly p2, const ring r)
     860{
     861  int i=0;
     862  int nv=r->N;
     863  poly a1=p_Head(p1,r);
     864  poly a2=p_Head(p2,r);
     865  //HOW????????????????
     866  Exponent_t *A1=(Exponent_t *)omAlloc0((r->N+1)*sizeof(Exponent_t));
     867  Exponent_t *A2=(Exponent_t *)omAlloc0((r->N+1)*sizeof(Exponent_t));
     868  Exponent_t *G=(Exponent_t *)omAlloc0((r->N+1)*sizeof(Exponent_t));
     869
     870  p_GetExpV(a1,A1,r);
     871  p_GetExpV(a2,A2,r);
     872
     873  p_Delete(&a1,r);p_Delete(&a2,r);
     874
     875  for (i=1;i<=nv;i++)
     876  {
     877    if (A2[i]>=A1[i])
     878    {
     879      G[i]=A2[i];
     880    }
     881    else { G[i]=A1[i]; }
     882
     883  }
     884//  G[0]=0;  /* later pGetComp */
     885  poly out=pOne();
     886  p_SetExpV(out,G,r);
     887  //HOW?????????????????????
     888  freeT(G,r->N);
     889  freeT(A1,r->N);
     890  freeT(A2,r->N);
     891  return(out);
     892}
     893
    699894#endif
  • Singular/gring.h

    r962a8c r61e5dd  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: gring.h,v 1.6 2001-02-26 15:08:44 levandov Exp $ */
     6/* $Id: gring.h,v 1.7 2001-02-28 11:54:49 levandov Exp $ */
    77/*
    88* ABSTRACT additional defines etc for --with-plural
     
    2424poly nc_uu_Mult_ww (int i, int a, int j, int b, const ring r);
    2525poly _nc_p_Mult_q(poly p, poly q, const int copy, const ring r);
     26//syzygies :
     27poly nc_spGSpolyCreate(poly p1, poly p2,poly spNoether, const ring r);
     28poly nc_spGSpolyRed(poly p1, poly p2,poly spNoether, const ring r);
     29poly nc_spGSpolyRedNew(poly p1, poly p2,poly spNoether, const ring r);
     30void nc_spGSpolyRedTail(poly p1, poly q, poly q2, poly spNoether, const ring r);
     31poly nc_spShort(poly p1, poly p2, const ring r);
    2632
     33ideal gr_bba (ideal F, ideal Q,kStrategy strat);
    2734#endif /* HAVE_PLURAL */
    2835#endif
Note: See TracChangeset for help on using the changeset viewer.