Changeset 40b31de in git for kernel/ratgring.cc


Ignore:
Timestamp:
Feb 21, 2009, 4:25:43 PM (15 years ago)
Author:
Viktor Levandovskyy <levandov@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
28734edefa255520d20d13c4c0f3ba4f92590a2a
Parents:
9e9dbcc8d214c3ffadd3d652094fe70a53aa1302
Message:
*levandov: rational Groebner bases updated


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

Legend:

Unmodified
Added
Removed
  • kernel/ratgring.cc

    r9e9dbc r40b31de  
    77 *  Author:  levandov (Viktor Levandovsky)
    88 *  Created: 8/00 - 11/00
    9  *  Version: $Id: ratgring.cc,v 1.11 2008-08-07 21:15:56 levandov Exp $
     9 *  Version: $Id: ratgring.cc,v 1.12 2009-02-21 15:25:43 levandov Exp $
    1010 *******************************************************************/
    1111#include "mod2.h"
     
    9797{
    9898  /* modifies p*/
    99   Print("start: "); Print(" "); p_wrp(*p,r);
     99  //  Print("start: "); Print(" "); p_wrp(*p,r);
    100100  p_LmCheckPolyRing2(*p, r);
    101101  poly q = p_Head(*p,r);
     
    104104  {
    105105    p_LmDelete(p,r);
    106     Print("while: ");p_wrp(*p,r);Print(" ");
    107   }
    108   p_wrp(*p,r);Print(" ");
    109   PrintS("end\n");
     106    //    Print("while: ");p_wrp(*p,r);Print(" ");
     107  }
     108  //  p_wrp(*p,r);Print(" ");
     109  //  PrintS("end\n");
    110110  p_LmDelete(&q,r);
    111111}
     
    146146ideal ncGCD2(poly p, poly q, const ring r)
    147147{
     148  // todo: must destroy p,q
    148149  intvec *w = NULL;
    149150  ideal h = idInit(2,1);
     
    193194ideal ncGCD(poly p, poly q, const ring r)
    194195{
     196  // destroys p and q
    195197  // assume: p,q are in the comm. ring
    196198  // to be used in the coeff business
    197199#ifdef PDEBUG
    198   Print("G_start:");
     200  PrintS(" GCD_start:");
    199201#endif
    200202  poly g = singclap_gcd(p_Copy(p,r),p_Copy(q,r));
    201203#ifdef PDEBUG
    202204  p_wrp(g,r);
    203   Print("G_end;");
     205  PrintS(" GCD_end;\n");
    204206#endif
    205207  poly u = singclap_pdivide(q,g); //q/g
    206208  poly v = singclap_pdivide(p,g); //p/g
     209  p_Delete(&p,r);
     210  p_Delete(&q,r);
    207211  ideal h = idInit(2,1);
    208212  h->m[0] = u; // p_Copy(u,r);
     
    385389
    386390  poly m = pOne();
    387   p_ExpVectorDiffRat(m, p1, p2, ishift, r); // includes X and D parts
     391  p_ExpVectorDiffRat(m, p2, p1, ishift, r); // includes X and D parts
    388392  //p_Setm(m,r);
    389393  //  m = p_GetExp_k_n(m,1,ishift,r); /* rat D-exp of m */
    390394#ifdef PDEBUG
    391395  p_Test(m,r);
     396  PrintS("d^alpha = "); p_wrp(m,r); PrintLn();
    392397#endif
    393398
     
    395400  poly HH = NULL;
    396401  poly H  = NULL;
    397   HH = p_Copy(p_HeadRat(p1,is,r),r); // lm_D(g)
     402  HH = p_HeadRat(p1,is,r); //p_Copy(p_HeadRat(p1,is,r),r); // lm_D(g)
    398403//  H  = r->nc->p_Procs.mm_Mult_p(m, p_Copy(HH, r), r); // d^aplha lm_D(g)
    399   H  = nc_mm_Mult_pp(m, HH, r); // d^aplha lm_D(g) == h_g in the paper
    400 
    401   poly K  = p_Copy( p_GetCoeffRat(H,  is, r), r); // k in the paper
    402   Print("k: "); p_wrp(K,r); PrintS("\n");
    403   poly P  = p_Copy( p_GetCoeffRat(p2, is, r), r); // lc_D(p_2) == lc_D(f)
    404   Print("p: "); p_wrp(P,r); PrintS("\n");
    405 
    406   //  HH = p_Neg(HH, r);
    407   //  poly out = NULL;
    408   //  out = p_Add_q(p_Copy(p1,r), HH, r); // out == t_g
    409 
    410   Print("f: "); p_wrp(p2,r); PrintS("\n");
    411   Print("g: "); p_wrp(p1,r); PrintS("\n");
    412 
     404  H  = nc_mm_Mult_p(m, HH, r); // d^aplha lm_D(g) == h_g in the paper
     405
     406  poly K  = p_GetCoeffRat(H,  is, r); //p_Copy( p_GetCoeffRat(H,  is, r), r); // k in the paper
     407  poly P  = p_GetCoeffRat(p2, is, r); //p_Copy( p_GetCoeffRat(p2, is, r), r); // lc_D(p_2) == lc_D(f)
     408
     409#ifdef PDEBUG
     410  PrintS("k: "); p_wrp(K,r); PrintS("\n");
     411  PrintS("p: "); p_wrp(P,r); PrintS("\n");
     412  PrintS("f: "); p_wrp(p2,r); PrintS("\n");
     413  PrintS("g: "); p_wrp(p1,r); PrintS("\n");
     414#endif
    413415  // alt:
    414   poly out = p1; //p_Copy(p1,r);
     416  poly out = p_Copy(p1,r);
    415417  p_LmDeleteAndNextRat(&out, is+1, r); // out == t_g
    416418
    417   Print("t_g: "); p_wrp(out,r);
    418 
    419419  ideal ncsyz = ncGCD(P,K,r);
    420   poly KK = p_Copy(ncsyz->m[0],r); // k'
    421   poly PP = p_Copy(ncsyz->m[1],r); // p'
    422  
    423 //    HH = p_Copy(p_HeadRat(p2,is,r),r);
    424 //    HH = p_Neg(HH, r);
    425 //    p2 = p_Add_q(p2, HH, r); // t_f
    426 
    427   // alt:
     420  poly KK = ncsyz->m[0]; ncsyz->m[0]=NULL; //p_Copy(ncsyz->m[0],r); // k'
     421  poly PP = ncsyz->m[1]; ncsyz->m[1]= NULL; //p_Copy(ncsyz->m[1],r); // p'
     422
     423#ifdef PDEBUG
     424  PrintS("t_g: "); p_wrp(out,r);
     425  PrintS("k': "); p_wrp(KK,r); PrintS("\n"); 
     426  PrintS("p': "); p_wrp(PP,r); PrintS("\n"); 
     427#endif
     428  id_Delete(&ncsyz,r);
    428429  p_LmDeleteAndNextRat(&p2, is+1, r); // t_f
    429 
    430   Print("t_f: "); p_wrp(p2,r);
    431 
    432 //    HH = p_Copy(p_HeadRat(H,is,r),r);
    433 //    HH = p_Neg(HH, r);
    434 //    H  = p_Add_q(H, HH, r); // r_g
    435 
    436   // alt:
    437   p_LmDeleteAndNextRat(&H, is+1, r); // r_g
    438 
    439   Print("r_g: "); p_wrp(H,r);
     430  p_LmDeleteAndNextRat(&H, is+1, r); // r_g = h_g - lt_D(h_g)
     431
     432#ifdef PDEBUG
     433  PrintS(" t_f: "); p_wrp(p2,r);
     434  PrintS(" r_g: "); p_wrp(H,r);
     435#endif
    440436
    441437  p2 = p_Mult_q(KK, p2, r); // p2 = k' t_f
     438
     439#ifdef PDEBUG
    442440  p_Test(p2,r);
    443 //  p_Delete(&KK,r);
    444 
    445   Print("k' t_f: "); p_wrp(p2,r);
     441  PrintS(" k' t_f: "); p_wrp(p2,r);
     442#endif
    446443
    447444//  out = r->nc->p_Procs.mm_Mult_p(m, out, r); // d^aplha t_g
    448445  out = nc_mm_Mult_p(m, out, r); // d^aplha t_g 
    449  
    450446  p_Delete(&m,r);
    451447
    452   Print("d^a t_g: "); p_wrp(out,r);
    453   Print(" end reduction\n");
     448#ifdef PDEBUG
     449  PrintS(" d^a t_g: "); p_wrp(out,r);
     450  PrintS(" end reduction\n");
     451#endif
     452
    454453  out = p_Add_q(H, out, r); // r_g + d^a t_g
     454
     455#ifdef PDEBUG
    455456  p_Test(out,r);
    456   out  = p_Mult_q(PP, out, r); // c' (r_g + d^a t_g)
    457 
     457#endif
     458  out = p_Mult_q(PP, out, r); // p' (r_g + d^a t_g)
    458459  out = p_Add_q(p2,out,r); // delete out, p2; // the sum
     460
     461#ifdef PDEBUG
    459462  p_Test(out,r);
     463#endif
     464
    460465  if ( out!=NULL ) pContent(out);
    461466  return(out);
     
    468473BOOLEAN p_DivisibleByRat(poly a, poly b, int ishift, const ring r)
    469474{
     475#ifdef PDEBUG
     476  PrintS("invoke p_DivByRat with a = ");
     477  p_wrp(p_Head(a,r),r);
     478  PrintS(" and b= ");
     479  p_wrp(p_Head(b,r),r);
     480  PrintLn();
     481#endif
    470482  int i;
    471   for(i=r->N;i>ishift;i--)
    472   {
     483  for(i=r->N; i>ishift; i--)
     484  {
     485#ifdef PDEBUG
     486    PrintS("i=%d,",i);
     487#endif
    473488    if (p_GetExp(a,i,r) > p_GetExp(b,i,r)) return FALSE;
    474489  }
     
    491506    for(i=rl-1;i>=0;i--)
    492507    {
     508      //      Print("test %d, l=%d (curr=%d, l=%d\n",i,red_length[i],j,l);
    493509      if ((l>red_length[i]) && (p_DivisibleByRat(reducer[i],*h,ishift,r)))
    494510      {
    495511        j=i; l=red_length[i];
     512        //        PrintS(" yes\n");
    496513      }
     514      //      else PrintS(" no\n");
    497515    }
    498516    if (j >=rl)
Note: See TracChangeset for help on using the changeset viewer.