Changeset 9fb610 in git


Ignore:
Timestamp:
Mar 10, 2007, 4:41:49 PM (17 years ago)
Author:
Viktor Levandovskyy <levandov@…>
Branches:
(u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
Children:
88492ede6c4234be98e154a965829ff216366144
Parents:
68c1c44e5af6cb14e14acff3b217f125b4e15830
Message:
*levandov: updates rational ncGB


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

Legend:

Unmodified
Added
Removed
  • kernel/pInline1.h

    r68c1c4 r9fb610  
    77 *  Author:  obachman (Olaf Bachmann)
    88 *  Created: 8/00
    9  *  Version: $Id: pInline1.h,v 1.8 2007-01-15 17:12:57 Singular Exp $
     9 *  Version: $Id: pInline1.h,v 1.9 2007-03-10 15:41:49 levandov Exp $
    1010 *******************************************************************/
    1111#ifndef PINLINE1_H
     
    168168  for(i=l;i<=k;i++)
    169169  {
    170     np->exp[(r->VarOffset[i] & 0xffffff)] =0;
     170    //np->exp[(r->VarOffset[i] & 0xffffff)] =0;
     171    p_SetExp(np,i,0,r);
    171172  }
    172173  p_Setm(np,r);
  • kernel/pInline2.h

    r68c1c4 r9fb610  
    77 *  Author:  obachman (Olaf Bachmann)
    88 *  Created: 8/00
    9  *  Version: $Id: pInline2.h,v 1.11 2007-03-04 22:56:16 levandov Exp $
     9 *  Version: $Id: pInline2.h,v 1.12 2007-03-10 15:41:49 levandov Exp $
    1010 *******************************************************************/
    1111#ifndef PINLINE2_H
     
    159159  for(;i<=r->N;i++)
    160160  {
    161     if (a->exp[(r->VarOffset[i] & 0xffffff)] != b->exp[(r->VarOffset[i] & 0xffffff)]) return FALSE;
     161    if (p_GetExp(a,i,r) != p_GetExp(b,i,r)) return FALSE;
     162    //    if (a->exp[(r->VarOffset[i] & 0xffffff)] != b->exp[(r->VarOffset[i] & 0xffffff)]) return FALSE;
    162163  }
    163164  return TRUE;
  • kernel/ratgring.cc

    r68c1c4 r9fb610  
    77 *  Author:  levandov (Viktor Levandovsky)
    88 *  Created: 8/00 - 11/00
    9  *  Version: $Id: ratgring.cc,v 1.5 2007-03-10 13:17:15 Singular Exp $
     9 *  Version: $Id: ratgring.cc,v 1.6 2007-03-10 15:41:49 levandov Exp $
    1010 *******************************************************************/
    1111#include "mod2.h"
     
    6565  if (q == NULL) return p;
    6666  poly res = p_Head(p,r);
    67   while ( p_Comp_k_n(p, q, ishift, r) )
     67  while ( (q!=NULL) && (p_Comp_k_n(p, q, ishift+1, r)))
    6868  {
    6969    res = p_Add_q(res,p_Head(q,r),r);
    70     q   = pNext(p);
     70    q   = pNext(q);
    7171  }
    7272  return res;
    7373}
    7474
     75/* TO TEST!!! */
    7576/* returns x-coeff of p, i.e. a poly in x, s.t. corresponding xd-monomials
    7677have the same D-part */
     
    7980{
    8081  poly q   = pNext(p);
    81   poly res = p_Head(p,r);
     82  poly res; // = p_Head(p,r);
     83  res = p_GetExp_k_n(p, ishift+1, r->N, r);
     84  p_SetCoeff(res,n_Copy(p_GetCoeff(p,r),r),r);
    8285  poly s;
    83   while ( p_Comp_k_n(p, q, ishift, r) )
    84   {
    85     s   = p_GetExp_k_n(q, ishift, r->N, r);
     86  while ((q!= NULL) && (p_Comp_k_n(p, q, ishift+1, r)))
     87  {
     88    s   = p_GetExp_k_n(q, ishift+1, r->N, r);
     89    p_SetCoeff(s,n_Copy(p_GetCoeff(q,r),r),r);
    8690    res = p_Add_q(res,s,r);
    87     q   = pNext(p);
     91    q   = pNext(q);
    8892  }
    8993  return res;
    9094}
    9195
    92 void p_LmDeleteAndNextRat(poly p, int ishift, ring r)
     96void p_LmDeleteAndNextRat(poly *p, int ishift, ring r)
    9397{
    9498  /* modifies p*/
    95   p_LmCheckPolyRing2(p, r);
    96   while ( p_Comp_k_n(p, pNext(p), ishift, r) )
    97   {
    98     p_LmDelete(&p,r);
    99   }
    100 }
     99  Print("start: "); Print(" "); p_wrp(*p,r);
     100  p_LmCheckPolyRing2(*p, r);
     101  poly q = p_Head(*p,r);
     102  // in the next line ishift is correct
     103  while ( ( (*p)!=NULL ) && ( p_Comp_k_n(*p, q, ishift, r) ))
     104  {
     105    p_LmDelete(p,r);
     106    Print("while: ");p_wrp(*p,r);Print(" ");
     107  }
     108  p_wrp(*p,r);Print(" ");
     109  PrintS("end\n");
     110  p_LmDelete(&q,r);
     111}
     112
     113/* to test!!! */
     114/* ExpVector(pr) = ExpVector(p1) - ExpVector(p2) */
     115void p_ExpVectorDiffRat(poly pr, poly p1, poly p2, int ishift, ring r)
     116{
     117  p_LmCheckPolyRing1(p1, r);
     118  p_LmCheckPolyRing1(p2, r);
     119  p_LmCheckPolyRing1(pr, r);
     120  int i;
     121  poly t=pr;
     122  Exponent_t e1,e2;
     123  for (i=ishift+1 ; i<=r->N; i++)
     124  {
     125    e1 = p_GetExp(p1, i, r);
     126    e2 = p_GetExp(p2, i, r);
     127    //    pAssume1(p_GetExp(p1, i, r) >= p_GetExp(p2, i, r));
     128    if (e1 < e2)
     129    {
     130#ifdef PDEBUG
     131      Print("negative ExpVectorDiff\n");
     132#endif   
     133      p_Delete(&t,r);
     134      break;
     135    }
     136    else
     137    {
     138      p_SetExp(t,i, e1-e2,r);
     139    }
     140  }
     141  p_Setm(t,r);
     142}
     143
     144
     145
    101146
    102147/* returns ideal (u,v) s.t. up + vq = 0 */
     
    120165  K  = sh->m[0]; /* take just the first element - to be enhanced later */
    121166  K1 = pTakeOutComp(&K, 1); // 1st component is taken out from K
    122 //  K2 = pTakeOutComp(&K, 2);
    123   p_SetCompP(K1,0,r);
    124   pShift(&K,-2); // 2nd component to 0th comp.
    125 //  K2 = pTakeOutComp(&K, 2);
    126   p_SetCompP(K2,0,r);
    127   K2 = K;
     167//  pShift(&K,-2); // 2nd component to 0th comp.
     168  K2 = pTakeOutComp(&K, 1);
     169//  K2 = K;
     170
     171  Print("syz1: "); p_wrp(K1,r);
     172  Print("syz2: "); p_wrp(K2,r);
    128173
    129174  /* checking signs before multiplying */   
     
    134179  bck2 = n_GreaterZero(ck2,r);
    135180  /* K1 <0, K2 <0 (-K1,-K2)    */
    136   if ( !(bck1 && bck2) ) /* - , - */
    137   {
    138     K1 = p_Neg(K1,r);
    139     K2 = p_Neg(K2,r);
    140   }
    141   idDelete(&h);
     181//   if ( !(bck1 && bck2) ) /* - , - */
     182//   {
     183//     K1 = p_Neg(K1,r);
     184//     K2 = p_Neg(K2,r);
     185//   }
     186  id_Delete(&h,r);
    142187  h = idInit(2,1);
    143188  h->m[0] = p_Copy(K1,r);
    144189  h->m[1] = p_Copy(K2,r);
    145   idDelete(&sh);
     190  id_Delete(&sh,r);
    146191  return(h);
    147192}
     
    322367  int is = ishift; /* TODO */
    323368
    324   poly m  = pOne();
    325   p_ExpVectorDiff(m, p2, p1, r); // includes X and D parts
     369  poly m = pOne();
     370  p_ExpVectorDiffRat(m, p2, p1, ishift, r); // includes X and D parts
    326371  //p_Setm(m,r);
    327   m = p_GetExp_k_n(m,1,ishift-1,r); /* rat D-exp of m */
     372  //  m = p_GetExp_k_n(m,1,ishift,r); /* rat D-exp of m */
    328373#ifdef PDEBUG
    329374  p_Test(m,r);
     
    331376
    332377  /* pSetComp(m,r)=0? */
    333   poly HH, H;
     378  poly HH = NULL;
     379  poly H  = NULL;
    334380  HH = p_Copy(p_HeadRat(p1,is,r),r); // lm_D(g)
    335381  H  = r->nc->p_Procs.mm_Mult_p(m, p_Copy(HH, r), r); // d^aplha lm_D(g)
     
    338384  poly P  = p_Copy( p_GetCoeffRat(p2, is, r), r);
    339385
    340   HH = p_Neg(HH, r);
    341   poly out = p_Add_q(p_Copy(p1,r), HH, r); // out == t_g
     386  //  HH = p_Neg(HH, r);
     387  //  poly out = NULL;
     388  //  out = p_Add_q(p_Copy(p1,r), HH, r); // out == t_g
     389
     390  Print("f: "); p_wrp(p2,r); PrintS(" ");
     391  Print("g: "); p_wrp(p1,r); PrintS(" ");
    342392
    343393  // alt:
    344   // out = p_Copy(p1,r);
    345   // p_LmDeleteAndNextRat(out, is, r);
     394  poly out = p1; //p_Copy(p1,r);
     395  p_LmDeleteAndNextRat(&out, is+1, r); // out == t_g
     396
     397  Print("t_g: "); p_wrp(out,r);
    346398
    347399  ideal ncsyz = ncGCD(P,K,r);
     
    349401  poly PP = p_Copy(ncsyz->m[1],r); // p'
    350402 
    351   HH = p_Copy(p_HeadRat(p2,is,r),r);
    352   HH = p_Neg(HH, r);
    353   p2 = p_Add_q(p2, HH, r); // t_f
     403//    HH = p_Copy(p_HeadRat(p2,is,r),r);
     404//    HH = p_Neg(HH, r);
     405//    p2 = p_Add_q(p2, HH, r); // t_f
    354406
    355407  // alt:
    356   // p_LmDeleteAndNextRat(p2, is, r);
    357 
    358 
    359   HH = p_Copy(p_HeadRat(H,is,r),r);
    360   HH = p_Neg(HH, r);
    361   H  = p_Add_q(H, HH, r); // r_g
     408  p_LmDeleteAndNextRat(&p2, is+1, r); // t_f
     409
     410  Print("t_f: "); p_wrp(p2,r);
     411
     412//    HH = p_Copy(p_HeadRat(H,is,r),r);
     413//    HH = p_Neg(HH, r);
     414//    H  = p_Add_q(H, HH, r); // r_g
    362415
    363416  // alt:
    364   // p_LmDeleteAndNextRat(H, is, r);
    365 
    366 
    367   p2 = p_Mult_q(p2, KK, r); // p2 = k' t_f
     417  p_LmDeleteAndNextRat(&H, is+1, r); // r_g
     418
     419  Print("r_g: "); p_wrp(H,r);
     420
     421  p2 = p_Mult_q(KK, p2, r); // p2 = k' t_f
    368422  p_Test(p2,r);
    369423//  p_Delete(&KK,r);
    370424
     425  Print("k' t_f: "); p_wrp(p2,r);
     426
    371427  out = r->nc->p_Procs.mm_Mult_p(m, out, r); // d^aplha t_g
    372428  p_Delete(&m,r);
    373429
     430  Print("d^a t_g: "); p_wrp(out,r);
     431  PrintS(" end reduction");
    374432  out = p_Add_q(H, out, r);
    375433  p_Test(out,r);
     
    381439  return(out);
    382440}
    383 
    384 
    385441
    386442// return: FALSE, if there exists i in ishift..r->N,
     
    402458* arrays reducer and red_length are [0..(rl-1)]
    403459*/
    404 int redRat (poly* h,poly *reducer, int *red_length,int rl, int ishift, ring r)
     460int redRat (poly* h, poly *reducer, int *red_length, int rl, int ishift, ring r)
    405461{
    406462  if ((*h)==NULL) return 0;
     
    430486      p_wrp(reducer[j],r);
    431487    }
    432     poly hh=nc_rat_ReduceSpolyNew(*h, reducer[j], ishift, r);
    433     p_Delete(h,r); *h=hh;
     488    poly hh=nc_rat_ReduceSpolyNew(reducer[j], *h, ishift, r);
     489    //    p_Delete(h,r);
     490    *h=hh;
    434491    if (TEST_OPT_DEBUG)
    435492    {
  • kernel/ratgring.h

    r68c1c4 r9fb610  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: ratgring.h,v 1.3 2007-03-10 13:14:33 Singular Exp $ */
     6/* $Id: ratgring.h,v 1.4 2007-03-10 15:41:49 levandov Exp $ */
    77/*
    88* ABSTRACT additional defines etc for --with-plural
     
    2626poly p_HeadRat(poly p, int ishift, ring r);
    2727
    28 void p_LmDeleteAndNextRat(poly p, int ishift, ring r);
     28void p_LmDeleteAndNextRat(poly *p, int ishift, ring r);
     29
     30void p_ExpVectorDiffRat(poly pr, poly p1, poly p2, int ishift, ring r);
    2931
    3032ideal ncGCD(poly p, poly q, ring r);
Note: See TracChangeset for help on using the changeset viewer.