Changeset 6f30b8f in git for factory


Ignore:
Timestamp:
Jun 22, 2011, 2:06:03 PM (13 years ago)
Author:
Martin Lee <martinlee84@…>
Branches:
(u'spielwiese', '6e5adcba05493683b94648c659a729c189812c77')
Children:
368602a55ed4fcad6d7f470cbbaa9e51c309b4ea
Parents:
64e7cb73f028e3866617e41d55fd0265168a395d
Message:
added computation of squarefree part


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

Legend:

Unmodified
Added
Removed
  • factory/fac_sqrfree.cc

    r64e7cb r6f30b8f  
    88#include "cf_defs.h"
    99#include "canonicalform.h"
     10#include "cf_map.h"
    1011
    1112static int divexp = 1;
     
    180181    return F;
    181182}
     183
     184CanonicalForm
     185sqrfPart (const CanonicalForm& F)
     186{
     187  if (F.inCoeffDomain())
     188    return F;
     189  CFMap M;
     190  CanonicalForm A= compress (F, M);
     191  CanonicalForm w, v, b;
     192  CanonicalForm result;
     193  int i= 1;
     194  for (; i <= A.level(); i++)
     195  {
     196    if (!deriv (A, Variable (i)).isZero())
     197      break;
     198  }
     199
     200  w= gcd (A, deriv (A, Variable (i)));
     201  b= A/w;
     202  result= b;
     203  if (degree (w) < 1)
     204    return M (result);
     205  i++;
     206  for (; i <= A.level(); i++)
     207  {
     208    if (!deriv (w, Variable (i)).isZero())
     209    {
     210      b= w;
     211      w= gcd (w, deriv (w, Variable (i)));
     212      b /= w;
     213      if (degree (b) < 1)
     214        break;
     215      CanonicalForm g= gcd (b, result);
     216      if (degree (g) > 0)
     217        result *= b/g;
     218      if (degree (g) <= 0)
     219        result *= b;
     220    }
     221  }
     222  result= M (result);
     223  return result;
     224}
     225
  • factory/fac_sqrfree.h

    r64e7cb r6f30b8f  
    1919bool isSqrFreeZ ( const CanonicalForm & f );
    2020
     21/// squarefree part of a poly
     22CanonicalForm sqrfPart (const CanonicalForm& F ///<[in] some poly
     23                       );
     24
    2125#endif /* ! INCL_FAC_SQRFREE_H */
Note: See TracChangeset for help on using the changeset viewer.