Changeset dd8047 in git


Ignore:
Timestamp:
Apr 6, 2011, 12:51:16 PM (13 years ago)
Author:
Martin Lee <martinlee84@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '4188d308699580d975efd0f6cca8dcb41c396f70')
Children:
09cb44379e8060a8d2ac1b71d07ebab1fd9e46e6
Parents:
1b8e048f850c69dc6881f43dc67b980d46ee540b
Message:
fix in bivariate factorization


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

Legend:

Unmodified
Added
Removed
  • factory/facFqBivar.cc

    r1b8e048 rdd8047  
    946946  if (factorNums < (int) logarithm)
    947947    factorNums= (int) logarithm;
     948  int subCheck1= substituteCheck (A, x);
     949  int subCheck2= substituteCheck (A, y);
    948950  for (int i= 0; i < factorNums; i++)
    949951  {
     
    966968      if (!fail)
    967969      {
     970        int dummy= subCheck2;
     971        subCheck2= subCheck1;
     972        subCheck1= dummy;
    968973        A= buf;
    969974        swap2= true;
     
    10261031    if (i == 0)
    10271032    {
    1028       int subCheck= substituteCheck (bufUniFactors);
    1029 
    1030       if (subCheck > 1)
    1031       {
    1032         CanonicalForm bufA= A;
    1033         subst (bufA, bufA, subCheck, x);
    1034         factors= biFactorize (bufA, info);
    1035         reverseSubst (factors, subCheck, x);
    1036         appendSwapDecompress (factors, contentAxFactors, contentAyFactors,
    1037                               swap, swap2, N);
    1038         normalize (factors);
    1039         return factors;
    1040       }
    1041 
    1042       if (!derivXZero && !fail2)
    1043       {
    1044         subCheck= substituteCheck (bufUniFactors2);
    1045         if (subCheck > 1)
     1033      if (subCheck1 > 0)
     1034      {
     1035        int subCheck= substituteCheck (bufUniFactors);
     1036
     1037        if (subCheck > 1 && (subCheck1%subCheck == 0))
     1038        {
     1039          CanonicalForm bufA= A;
     1040          subst (bufA, bufA, subCheck, x);
     1041          factors= biFactorize (bufA, info);
     1042          reverseSubst (factors, subCheck, x);
     1043          appendSwapDecompress (factors, contentAxFactors, contentAyFactors,
     1044                                swap, swap2, N);
     1045          normalize (factors);
     1046          return factors;
     1047        }
     1048      }
     1049
     1050      if (!derivXZero && !fail2 && subCheck2 > 0)
     1051      {
     1052        int subCheck= substituteCheck (bufUniFactors2);
     1053
     1054        if (subCheck > 1 && (subCheck2%subCheck == 0))
    10461055        {
    10471056          CanonicalForm bufA= A;
  • factory/facFqBivarUtil.cc

    r1b8e048 rdd8047  
    389389}
    390390
     391int
     392substituteCheck (const CanonicalForm& F, const Variable& x)
     393{
     394  if (F.inCoeffDomain())
     395    return 0;
     396  if (degree (F, x) < 0)
     397    return 0;
     398  CanonicalForm f= swapvar (F, F.mvar(), x);
     399  int sizef= 0;
     400  for (CFIterator i= f; i.hasTerms(); i++, sizef++)
     401  {
     402    if (i.exp() == 1)
     403      return 0;
     404  }
     405  int * expf= new int [sizef];
     406  int j= 0;
     407  for (CFIterator i= f; i.hasTerms(); i++, j++)
     408    expf [j]= i.exp();
     409
     410  int indf= sizef - 1;
     411  if (expf[indf] == 0)
     412    indf--;
     413
     414  int result= expf[indf];
     415  for (int i= indf - 1; i >= 0; i--)
     416  {
     417    if (expf [i]%result != 0)
     418    {
     419      delete [] expf;
     420      return 0;
     421    }
     422  }
     423
     424  delete [] expf;
     425  return result;
     426}
     427
    391428static int
    392429substituteCheck (const CanonicalForm& F, const CanonicalForm& G)
  • factory/facFqBivarUtil.h

    r1b8e048 rdd8047  
    191191             );
    192192
     193/// check if a substitution x^n->x is possible
     194///
     195/// @return an integer n > 1, if a substitution described as above is possible
     196///         else n <= 1
     197int
     198substituteCheck (const CanonicalForm& F, ///<[in] a polynomial
     199                 const Variable& x       ///<[in] some variable
     200                );
     201
    193202#endif
    194203/* FAC_FQ_BIVAR_UTIL_H */
Note: See TracChangeset for help on using the changeset viewer.