Changeset 4732f8 in git


Ignore:
Timestamp:
Feb 21, 2009, 8:30:56 PM (14 years ago)
Author:
Viktor Levandovskyy <levandov@…>
Branches:
(u'spielwiese', '828514cf6e480e4bafc26df99217bf2a1ed1ef45')
Children:
cce4a2f69a8341c6b8fbb3f1e78b41bf26ed7970
Parents:
28f16452ba2351e155e944280a5d83ffdfd1ffc8
Message:
*levandov: ncratCreateSpoly added


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

Legend:

Unmodified
Added
Removed
  • Singular/extra.cc

    r28f164 r4732f8  
    22*  Computer Algebra System SINGULAR      *
    33*****************************************/
    4 /* $Id: extra.cc,v 1.295 2009-02-21 15:25:43 levandov Exp $ */
     4/* $Id: extra.cc,v 1.296 2009-02-21 19:30:56 levandov Exp $ */
    55/*
    66* ABSTRACT: general interface to internals of Singular ("system" command)
     
    27052705    }
    27062706    else
     2707/*==================== RatSpoly, noncomm rational coeffs =================*/
     2708    if (strcmp(sys_cmd, "ratSpoly") == 0)
     2709    {
     2710      poly p,q;
     2711      int is;
     2712      if ((h!=NULL) && (h->Typ()==POLY_CMD))
     2713      {
     2714        p=(poly)h->CopyD();
     2715        h=h->next;
     2716      }
     2717      else return TRUE;
     2718      if ((h!=NULL) && (h->Typ()==POLY_CMD))
     2719      {
     2720        q=(poly)h->CopyD();
     2721        h=h->next;
     2722      }
     2723      else return TRUE;
     2724      if ((h!=NULL) && (h->Typ()==INT_CMD))
     2725      {
     2726        is=(int)((long)(h->Data()));
     2727        res->rtyp=POLY_CMD;
     2728        //      res->rtyp=IDEAL_CMD;
     2729        if (rIsPluralRing(currRing))
     2730        {
     2731          res->data = nc_rat_CreateSpoly(p,q,is,currRing);
     2732          //    res->data = ncGCD(p,q,currRing);       
     2733        }
     2734        else res->data=p;
     2735      }
     2736      else return TRUE;
     2737      return FALSE;
     2738    }
     2739    else
    27072740#endif // HAVE_RATGRING
    27082741/*==================== Rat def =================*/
  • kernel/ratgring.cc

    r28f164 r4732f8  
    77 *  Author:  levandov (Viktor Levandovsky)
    88 *  Created: 8/00 - 11/00
    9  *  Version: $Id: ratgring.cc,v 1.13 2009-02-21 16:01:05 Singular Exp $
     9 *  Version: $Id: ratgring.cc,v 1.14 2009-02-21 19:30:56 levandov Exp $
    1010 *******************************************************************/
    1111#include "mod2.h"
     
    7575/* TO TEST!!! */
    7676/* returns x-coeff of p, i.e. a poly in x, s.t. corresponding xd-monomials
    77 have the same D-part */
     77have the same D-part
     78does not destroy p
     79*/
    7880
    7981poly p_GetCoeffRat(poly p, int ishift, ring r)
     
    207209  poly u = singclap_pdivide(q,g); //q/g
    208210  poly v = singclap_pdivide(p,g); //p/g
     211  v = p_Neg(v,r);
    209212  p_Delete(&p,r);
    210213  p_Delete(&q,r);
     
    366369// }
    367370
     371
     372/*4 - follow the numbering of gring.cc
     373* creates the S-polynomial of p1 and p2
     374* do not destroy p1 and p2
     375*/
     376poly nc_rat_CreateSpoly(poly pp1, poly pp2, int ishift, const ring r)
     377{
     378
     379  poly p1 = p_Copy(pp1,r);
     380  poly p2 = p_Copy(pp2,r);
     381
     382  const long lCompP1 = p_GetComp(p1,r);
     383  const long lCompP2 = p_GetComp(p2,r);
     384
     385  if ((lCompP1!=lCompP2) && (lCompP1!=0) && (lCompP2!=0))
     386  {
     387#ifdef PDEBUG
     388    Werror("nc_rat_CreateSpoly: different non-zero components!");
     389#endif
     390    return(NULL);
     391  }
     392
     393/* note: prod. crit does not apply! */
     394  poly pL=pOne();
     395  poly m1=pOne();
     396  poly m2=pOne();
     397  int is = ishift; /* TODO */
     398  pLcmRat(p1,p2,pL,is);
     399  p_Setm(pL,r);
     400#ifdef PDEBUG
     401  p_Test(pL,r);
     402#endif
     403  poly pr1 = p_GetExp_k_n(p1,1,ishift,r); /* rat D-exp of p1 */
     404  poly pr2 = p_GetExp_k_n(p2,1,ishift,r); /* rat D-exp of p2 */
     405  p_ExpVectorDiff(m1,pL,pr1,r); /* purely in D part by construction */
     406  p_ExpVectorDiff(m2,pL,pr2,r); /* purely in D part by construction */
     407  p_Delete(&pr1,r);
     408  p_Delete(&pr2,r);
     409  p_Delete(&pL,r);
     410#ifdef PDEBUG
     411  p_Test(m1,r);
     412  PrintS("d^{gamma-alpha} = "); p_wrp(m1,r); PrintLn();
     413  p_Test(m2,r);
     414  PrintS("d^{gamma-beta} = "); p_wrp(m2,r); PrintLn();
     415#endif
     416
     417  poly HF = NULL;
     418  HF = p_HeadRat(p1,is,r); // lm_D(f)
     419  HF  = nc_mm_Mult_p(m1, HF, r); // // d^{gamma-alpha} lm_D(f)
     420  poly C  = p_GetCoeffRat(HF,  is, r); // c = lc_D(h_f) in the paper
     421
     422  poly HG = NULL;
     423  HG = p_HeadRat(p2,is,r); // lm_D(g)
     424  HG  = nc_mm_Mult_p(m2, HG, r); // // d^{gamma-beta} lm_D(g)
     425  poly K  = p_GetCoeffRat(HG,  is, r); // k = lc_D(h_g) in the paper
     426
     427#ifdef PDEBUG
     428  PrintS("f: "); p_wrp(p1,r); PrintS("\n");
     429  PrintS("c: "); p_wrp(C,r); PrintS("\n");
     430  PrintS("g: "); p_wrp(p2,r); PrintS("\n");
     431  PrintS("k: "); p_wrp(K,r); PrintS("\n");
     432#endif
     433 
     434  ideal ncsyz = ncGCD(C,K,r);
     435  poly KK = ncsyz->m[0]; ncsyz->m[0]=NULL; //p_Copy(ncsyz->m[0],r); // k'
     436  poly CC = ncsyz->m[1]; ncsyz->m[1]= NULL; //p_Copy(ncsyz->m[1],r); // c'
     437  id_Delete(&ncsyz,r);
     438
     439  p_LmDeleteAndNextRat(&p1, is+1, r); // t_f
     440  p_LmDeleteAndNextRat(&HF, is+1, r); // r_f = h_f - lt_D(h_f)
     441
     442  p_LmDeleteAndNextRat(&p2, is+1, r); // t_g
     443  p_LmDeleteAndNextRat(&HG, is+1, r); // r_g = h_g - lt_D(h_g)
     444
     445
     446#ifdef PDEBUG
     447  PrintS(" t_f: "); p_wrp(p1,r); PrintS("\n"); 
     448  PrintS(" t_g: "); p_wrp(p2,r); PrintS("\n"); 
     449  PrintS(" r_f: "); p_wrp(HF,r); PrintS("\n"); 
     450  PrintS(" r_g: "); p_wrp(HG,r); PrintS("\n"); 
     451  PrintS(" c': "); p_wrp(CC,r); PrintS("\n"); 
     452  PrintS(" k': "); p_wrp(KK,r); PrintS("\n"); 
     453
     454#endif
     455
     456  // k'(r_f + d^{gamma-alpha} t_f)
     457
     458  p1 = p_Mult_q(m1, p1, r); // p1 = d^{gamma-alpha} t_f
     459  p1 = p_Add_q(p1,HF,r); // p1 = r_f + d^{gamma-alpha} t_f
     460  p1 = p_Mult_q(KK,p1,r); // p1 = k'(r_f + d^{gamma-alpha} t_f)
     461
     462  // c'(r_f + d^{gamma-beta} t_g)
     463
     464  p2 = p_Mult_q(m2, p2, r); // p2 = d^{gamma-beta} t_g
     465  p2 = p_Add_q(p2,HG,r); // p2 = r_g + d^{gamma-beta} t_g
     466  p2 = p_Mult_q(CC,p2,r); // p2 = c'(r_g + d^{gamma-beta} t_g)
     467
     468#ifdef PDEBUG
     469  p_Test(p1,r);
     470  p_Test(p2,r);
     471  PrintS(" k'(r_f + d^{gamma-alpha} t_f): "); p_wrp(p1,r);
     472  PrintS(" c'(r_g + d^{gamma-beta} t_g): "); p_wrp(p2,r);
     473#endif
     474
     475  poly out = p_Add_q(p1,p2,r); // delete p1, p2; // the sum
     476
     477#ifdef PDEBUG
     478  p_Test(out,r);
     479#endif
     480
     481  if ( out!=NULL ) pContent(out);
     482  return(out);
     483}
     484
     485
    368486/*2
    369487* reduction of p2 with p1
  • kernel/ratgring.h

    r28f164 r4732f8  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: ratgring.h,v 1.6 2008-08-07 21:15:56 levandov Exp $ */
     6/* $Id: ratgring.h,v 1.7 2009-02-21 19:30:56 levandov Exp $ */
    77/*
    88* ABSTRACT additional defines etc for --with-plural
     
    3535ideal ncGCD(poly p, poly q, ring r); // for p,q from a commutative ring
    3636
    37 //poly nc_rat_CreateSpoly(poly p1, poly p2, poly spNoether, int ishift, ring r);
     37poly nc_rat_CreateSpoly(poly p1, poly p2, int ishift, ring r);
    3838
    3939poly nc_rat_ReduceSpolyNew(poly p1, poly p2, int ishift, ring r);
Note: See TracChangeset for help on using the changeset viewer.