Changeset 36914e in git


Ignore:
Timestamp:
Mar 7, 2014, 2:11:05 PM (10 years ago)
Author:
Martin Lee <martinlee84@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
48686414f84cb721633f002b70fc8550f00a41d5
Parents:
40227ae7c2daf35e8c370108cbc9726d208d6ba8
git-author:
Martin Lee <martinlee84@web.de>2014-03-07 14:11:05+01:00
git-committer:
Hans Schoenemann <hannes@mathematik.uni-kl.de>2014-03-17 18:31:54+01:00
Message:
chg: added QuasiInverse over alg. function field
File:
1 edited

Legend:

Unmodified
Added
Removed
  • factory/libfac/charset/alg_factor.cc

    r40227a r36914e  
    464464      r= swapvar (r, x, X);
    465465    }
     466}
     467
     468CanonicalForm
     469QuasiInverse (const CanonicalForm& f, const CanonicalForm& g,
     470      CanonicalForm& numt, const Variable& x)
     471{
     472  CanonicalForm pi, pi1, q, t0, t1, Hi, bi, pi2;
     473  bool isRat= isOn (SW_RATIONAL);
     474  CanonicalForm m,tmp;
     475  if (isRat)
     476    Off (SW_RATIONAL);
     477  pi= f/content (f,x);
     478  pi1= g/content (g,x);
     479
     480  t0= 0;
     481  t1= 1;
     482  bi= 1;
     483
     484  On (SW_RATIONAL);
     485
     486  int delta= degree (f, x) - degree (g, x);
     487  Hi= power (LC (pi1, x), delta);
     488  if ( (delta+1) % 2 )
     489      bi = 1;
     490  else
     491      bi = -1;
     492
     493  while (degree (pi1,x) > 0)
     494  {
     495    On (SW_RATIONAL);
     496    psqr( pi, pi1, q, pi2, m, x);
     497    pi2 /= bi;
     498
     499    tmp= t1;
     500    t1= t0*m - t1*q;
     501    t0= tmp;
     502    t1 /= bi;
     503    pi = pi1; pi1 = pi2;
     504    if ( degree ( pi1, x ) > 0 )
     505    {
     506      delta = degree( pi, x ) - degree( pi1, x );
     507      if ( (delta+1) % 2 )
     508        bi = LC( pi, x ) * power( Hi, delta );
     509      else
     510        bi = -LC( pi, x ) * power( Hi, delta );
     511      Hi = power( LC( pi1, x ), delta ) / power( Hi, delta-1 );
     512    }
     513  }
     514  t1 /= gcd (pi1, t1);
     515  if (!isRat)
     516    Off (SW_RATIONAL);
     517  numt= t1;
     518  return pi;
    466519}
    467520
Note: See TracChangeset for help on using the changeset viewer.