Changeset 609334 in git


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


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

Legend:

Unmodified
Added
Removed
  • kernel/polys1.cc

    r61944d0 r609334  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: polys1.cc,v 1.32 2008-07-25 14:37:55 Singular Exp $ */
     4/* $Id: polys1.cc,v 1.33 2009-02-26 11:14:16 levandov Exp $ */
    55
    66/*
     
    2626#ifdef HAVE_FACTORY
    2727#include "clapsing.h"
     28#endif
     29
     30#ifdef HAVE_RATGRING
     31#include "ratgring.h"
    2832#endif
    2933
     
    10481052    }
    10491053    if (h!=NULL) nDelete(&h);
    1050     pContent(ph);
     1054 
     1055#ifdef HAVE_RATGRING
     1056    if (rIsRatGRing(currRing))
     1057    {
     1058      pContentRat(ph);
     1059    }
     1060    else
     1061#endif
     1062      pContent(ph);
    10511063  }
    10521064}
  • 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
  • kernel/ratgring.h

    r61944d0 r609334  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: ratgring.h,v 1.9 2009-02-25 16:37:34 levandov Exp $ */
     6/* $Id: ratgring.h,v 1.10 2009-02-26 11:14:16 levandov Exp $ */
    77/*
    88* ABSTRACT additional defines etc for --with-plural
     
    1212#ifdef HAVE_RATGRING
    1313#include "structs.h"
     14#include "gring.h"
    1415
    1516/* MACROS */
     
    114115// Content stuff
    115116
    116 poly pInitContentRat_a(poly ph);
    117117void pContentRat(poly ph);
    118118
Note: See TracChangeset for help on using the changeset viewer.