Changeset aaeb98 in git


Ignore:
Timestamp:
Oct 8, 2009, 10:38:31 AM (15 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '45e267b9942dec9429fe249ce3e5e44ab80a6a3a')
Children:
967a9d48cc1d702f106bf47d327d87adbaf6833c
Parents:
bedecea1bbe3e8a1d0e5a820d4d446733ede75b9
Message:
*hannes: code simplification


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

Legend:

Unmodified
Added
Removed
  • kernel/longalg.cc

    rbedece raaeb98  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: longalg.cc,v 1.54 2009-10-08 08:30:14 Singular Exp $ */
     4/* $Id: longalg.cc,v 1.55 2009-10-08 08:38:31 Singular Exp $ */
    55/*
    66* ABSTRACT:   algebraic numbers
     
    3131napoly naMinimalPoly;
    3232#define naParNames (currRing->parameter)
    33 #define napNormalize(p) p_Normalize(p,nacRing)
    3433static int naIsChar0;
    3534static ring naMapRing;
     
    219218  qq = (napoly)p_Init(nacRing);
    220219  pNext(qq) = NULL;
    221   napNormalize(g);
    222   napNormalize(f);
     220  p_Normalize(g, nacRing);
     221  p_Normalize(f, nacRing);
    223222  a = f;
    224223  do
     
    231230    h = napCopy(g);
    232231    napMultT(h, qq);
    233     napNormalize(h);
     232    p_Normalize(h,nacRing);
    234233    nacDelete(&pGetCoeff(qq),nacRing);
    235234    a = napAdd(a, h);
     
    249248  qq = (napoly)p_Init(nacRing);
    250249  pNext(qq) = b = NULL;
    251   napNormalize(g);
    252   napNormalize(f);
     250  p_Normalize(g,nacRing);
     251  p_Normalize(f,nacRing);
    253252  a = f;
    254253  do
     
    262261    h = napCopy(g);
    263262    napMultT(h, qq);
    264     napNormalize(h);
     263    p_Normalize(h,nacRing);
    265264    nacDelete(&pGetCoeff(qq),nacRing);
    266265    a = napAdd(a, h);
     
    312311    napMultN(qa, t);
    313312    nacDelete(&t,nacRing);
    314     napNormalize(qa);
     313    p_Normalize(qa,nacRing);
    315314    p_Delete(&x,nacRing);
    316315    p_Delete(&r,nacRing);
     
    331330    t = nacInvers(pGetCoeff(r));
    332331    napMultN(q, t);
    333     napNormalize(q);
     332    p_Normalize(q,nacRing);
    334333    nacDelete(&t,nacRing);
    335334    p_Delete(&x,nacRing);
     
    360359      //nacNormalize(t);
    361360      napMultN(q, t);
    362       napNormalize(q);
     361      p_Normalize(q,nacRing);
    363362      nacDelete(&t,nacRing);
    364363      p_Delete(&x,nacRing);
     
    16621661  {
    16631662    if (pNext(x->z)!=NULL)
    1664       result->z = napCopy(x->z);
     1663      result->z = p_Copy(x->z, r->algring);
    16651664    else
    16661665      result->z = napGcd0(x->z, y->z);
     
    16771676    napoly rz=napGcd(x->z, y->z);
    16781677    CanonicalForm F, G, R;
    1679     R=convSingPFactoryP(rz,nacRing);
    1680     napNormalize(x->z);
    1681     F=convSingPFactoryP(x->z,nacRing)/R;
    1682     napNormalize(y->z);
    1683     G=convSingPFactoryP(y->z,nacRing)/R;
     1678    R=convSingPFactoryP(rz,r->algring);
     1679    p_Normalize(x->z,nacRing);
     1680    F=convSingPFactoryP(x->z,r->algring)/R;
     1681    p_Normalize(y->z,nacRing);
     1682    G=convSingPFactoryP(y->z,r->algring)/R;
    16841683    F = gcd( F, G );
    16851684    if (F.isOne())
     
    16871686    else
    16881687    {
    1689       p_Delete(&rz,nacRing);
    1690       result->z=convFactoryPSingP( F*R,nacRing );
    1691       napNormalize(result->z);
     1688      p_Delete(&rz,r->algring);
     1689      result->z=convFactoryPSingP( F*R,r->algring );
     1690      p_Normalize(result->z,nacRing);
    16921691    }
    16931692  }
     
    19791978  naTest(la);
    19801979  naTest(lb);
    1981   napoly x = napCopy(a->z);
     1980  napoly x = p_Copy(a->z, r->algring);
    19821981  number t = napLcm(b->z); // get all denom of b->z
    19831982  if (!nacIsOne(t))
    19841983  {
    1985     number bt, r;
     1984    number bt, rr;
    19861985    napoly xx=x;
    19871986    while (xx!=NULL)
    19881987    {
    1989       bt = nacGcd(t, pGetCoeff(xx), nacRing);
    1990       r = nacMult(t, pGetCoeff(xx));
    1991       nacDelete(&pGetCoeff(xx),nacRing);
    1992       pGetCoeff(xx) = nacDiv(r, bt);
     1988      bt = nacGcd(t, pGetCoeff(xx), r->algring);
     1989      rr = nacMult(t, pGetCoeff(xx));
     1990      nacDelete(&pGetCoeff(xx),r->algring);
     1991      pGetCoeff(xx) = nacDiv(rr, bt);
    19931992      nacNormalize(pGetCoeff(xx));
    1994       nacDelete(&bt,nacRing);
    1995       nacDelete(&r,nacRing);
     1993      nacDelete(&bt,r->algring);
     1994      nacDelete(&rr,r->algring);
    19961995      pIter(xx);
    19971996    }
    19981997  }
    1999   nacDelete(&t,nacRing);
     1998  nacDelete(&t,r->algring);
    20001999  result->z = x;
    20012000#ifdef HAVE_FACTORY
     
    20032002  {
    20042003    result->z=singclap_alglcm(result->z,b->n);
    2005     p_Delete(&x,nacRing);
     2004    p_Delete(&x,r->algring);
    20062005  }
    20072006#endif
Note: See TracChangeset for help on using the changeset viewer.