Changeset 609334 in git for kernel/ratgring.cc


Ignore:
Timestamp:
Feb 26, 2009, 12:14:16 PM (15 years ago)
Author:
Viktor Levandovskyy <levandov@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
3a852046e44ceaad99faf50863adfab42f049b2c
Parents:
61944d0a0689203f1f85c43b1610be266ec31371
Message:
*levandov: working on pContentRat


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

Legend:

Unmodified
Added
Removed
  • kernel/ratgring.cc

    r61944d0 r609334  
    77 *  Author:  levandov (Viktor Levandovsky)
    88 *  Created: 8/00 - 11/00
    9  *  Version: $Id: ratgring.cc,v 1.17 2009-02-25 17:01:00 Singular Exp $
     9 *  Version: $Id: ratgring.cc,v 1.18 2009-02-26 11:14:16 levandov Exp $
    1010 *******************************************************************/
    1111#include "mod2.h"
     
    100100}
    101101
    102 /* TO TEST!!! */
    103102/* returns x-coeff of p, i.e. a poly in x, s.t. corresponding xd-monomials
    104103have the same D-part
     
    110109  poly q   = pNext(p);
    111110  poly res; // = p_Head(p,r);
    112   res = p_GetExp_k_n(p, ishift+1, r->N, r);
     111  res = p_GetExp_k_n(p, ishift+1, r->N, r); // does pSetm internally
    113112  p_SetCoeff(res,n_Copy(p_GetCoeff(p,r),r),r);
    114113  poly s;
     
    129128  p_LmCheckPolyRing2(*p, r);
    130129  poly q = p_Head(*p,r);
    131   // in the next line ishift is correct
    132   while ( ( (*p)!=NULL ) && ( p_Comp_k_n(*p, q, ishift, r) ))
     130  while ( ( (*p)!=NULL ) && ( p_Comp_k_n(*p, q, ishift+1, r) ))
    133131  {
    134132    p_LmDelete(p,r);
     
    464462  id_Delete(&ncsyz,r);
    465463
    466   p_LmDeleteAndNextRat(&p1, is+1, r); // t_f
    467   p_LmDeleteAndNextRat(&HF, is+1, r); // r_f = h_f - lt_D(h_f)
    468 
    469   p_LmDeleteAndNextRat(&p2, is+1, r); // t_g
    470   p_LmDeleteAndNextRat(&HG, is+1, r); // r_g = h_g - lt_D(h_g)
     464  p_LmDeleteAndNextRat(&p1, is, r); // t_f
     465  p_LmDeleteAndNextRat(&HF, is, r); // r_f = h_f - lt_D(h_f)
     466
     467  p_LmDeleteAndNextRat(&p2, is, r); // t_g
     468  p_LmDeleteAndNextRat(&HG, is, r); // r_g = h_g - lt_D(h_g)
    471469
    472470
     
    506504#endif
    507505
    508   if ( out!=NULL ) pContent(out);
     506  //  if ( out!=NULL ) pContent(out); // postponed to enterS
    509507  return(out);
    510508}
     
    560558  // alt:
    561559  poly out = p_Copy(p1,r);
    562   p_LmDeleteAndNextRat(&out, is+1, r); // out == t_g
     560  p_LmDeleteAndNextRat(&out, is, r); // out == t_g
    563561
    564562  ideal ncsyz = ncGCD(P,K,r);
     
    572570#endif
    573571  id_Delete(&ncsyz,r);
    574   p_LmDeleteAndNextRat(&p2, is+1, r); // t_f
    575   p_LmDeleteAndNextRat(&H, is+1, r); // r_g = h_g - lt_D(h_g)
     572  p_LmDeleteAndNextRat(&p2, is, r); // t_f
     573  p_LmDeleteAndNextRat(&H, is, r); // r_g = h_g - lt_D(h_g)
    576574
    577575#ifdef PDEBUG
     
    608606#endif
    609607
    610   if ( out!=NULL ) pContent(out);
     608  //  if ( out!=NULL ) pContent(out); // postponed to enterS
    611609  return(out);
    612610}
     
    687685}
    688686
    689 poly pContentRat(poly ph)
    690 // destroys ph
     687void pContentRat(poly ph)
     688// changes ph
    691689// for rat coefficients in K(x1,..xN)
    692690{
     
    701699  int *L = (int *)omAlloc0((len+1)*sizeof(int));  //lengths of coeffs
    702700  int k = 0;
    703   poly p = ph;
     701  poly p = pCopy(ph); // ph will be needed below
    704702  int HasConstantCoef = 0;
    705703  int mintdeg = pTotaldegree(p);
    706704  int minlen = len;
     705  int is = currRing->real_var_start - 1;
    707706  while (p!=NULL)
    708707  {
    709     LM[k] = p_HeadRat(p, currRing->real_var_start, currRing);
    710     C[k] = p_GetCoeffRat(p, currRing->real_var_start, currRing);
     708    LM[k] = p_GetExp_k_n(p,1,is,currRing); // need LmRat istead of  p_HeadRat(p, is, currRing); !
     709    C[k] = p_GetCoeffRat(p, is, currRing);
    711710    D[k] =  pTotaldegree(C[k]);
    712711    mintdeg = si_min(mintdeg,D[k]);
     
    719718      // smth like goto cleanup and return(pContent(p));
    720719    }
    721     p_LmDeleteAndNextRat(&p, currRing->real_var_start, currRing);
     720    p_LmDeleteAndNextRat(&p, is, currRing);
    722721    k++;
    723722  }
     
    734733      if (L[i] < mindeglen)
    735734      {
    736         mindeglen=L[i];
     735        mindeglen=L[i];
    737736        pmindeglen = i;
    738737      }
     
    759758        pDelete(&LM[k]);
    760759      }
    761       p=pContent(ph);
     760      pContent(ph);
    762761      goto cleanup;
    763762    }
     
    774773  for(i=0; i<=k; i++)
    775774  {
    776    p=pAdd(p,pMult(C[i],LM[i]));
     775   p = pAdd(p, pMult(C[i],LM[i]) );
    777776   C[i]=NULL; LM[i]=NULL;
    778777  }
     778  pDelete(&ph); // do not need it anymore
     779  ph = p;
    779780  // aufraeumen, return
    780781cleanup:
     
    783784  omFree(D);
    784785  omFree(L);
    785   return p;
    786 }
    787 #endif
     786}
     787#endif
Note: See TracChangeset for help on using the changeset viewer.