Changeset 074fe7 in git


Ignore:
Timestamp:
Jan 10, 2013, 4:23:31 PM (11 years ago)
Author:
Martin Lee <martinlee84@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'd08f5f0bb3329b8ca19f23b74cb1473686415c3a')
Children:
bbcc98f3a145ea12750c79cdc791d485911ab3e3
Parents:
e8880a0b01758b6b968ac3c91e6538157a2cb836
git-author:
Martin Lee <martinlee84@web.de>2013-01-10 16:23:31+01:00
git-committer:
Martin Lee <martinlee84@web.de>2013-02-18 15:01:39+01:00
Message:
chg: some editing
chg: more updates to docu

Conflicts:

	factory/facFqFactorize.h
Location:
factory
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • factory/facFactorize.cc

    re8880a r074fe7  
    413413
    414414  if (w.level() != 1)
    415     changeSecondVariable (A, biFactors, evaluation, oldAeval, lengthAeval2, uniFactors, w);
     415    changeSecondVariable (A, biFactors, evaluation, oldAeval, lengthAeval2,
     416                          uniFactors, w);
    416417
    417418  CanonicalForm oldA= A;
     
    507508      CFList contents, LCs;
    508509      bool foundTrueMultiplier= false;
    509       LCHeuristic3 (LCmultiplier, factors, leadingCoeffs2[lengthAeval2-1], contents, LCs, foundTrueMultiplier);
     510      LCHeuristic2 (LCmultiplier, factors, leadingCoeffs2[lengthAeval2-1],
     511                    contents, LCs, foundTrueMultiplier);
    510512      if (foundTrueMultiplier)
    511513      {
     
    520522      {
    521523        bool foundMultiplier= false;
    522         LCHeuristic4 (LCmultiplier, factors, oldBiFactors, contents, oldAeval, A, leadingCoeffs2, lengthAeval2, foundMultiplier);
     524        LCHeuristic3 (LCmultiplier, factors, oldBiFactors, contents, oldAeval,
     525                      A, leadingCoeffs2, lengthAeval2, foundMultiplier);
    523526        // coming from above: divide out more LCmultiplier if possible
    524527        if (foundMultiplier)
    525528        {
    526529          foundMultiplier= false;
    527           LCHeuristic5 (oldBiFactors, oldAeval, contents, factors, testVars, lengthAeval2, leadingCoeffs2, A, LCmultiplier, foundMultiplier);
     530          LCHeuristic4 (oldBiFactors, oldAeval, contents, factors, testVars,
     531                        lengthAeval2, leadingCoeffs2, A, LCmultiplier,
     532                        foundMultiplier);
    528533        }
    529534        else
    530535        {
    531           LCHeuristic2 (LCs, contents, A, oldA, leadingCoeffs2[lengthAeval2-1],
    532                         foundMultiplier);
     536          LCHeuristicCheck (LCs, contents, A, oldA,
     537                            leadingCoeffs2[lengthAeval2-1], foundMultiplier);
    533538          if (!foundMultiplier && fdivides (getVars (LCmultiplier), testVars))
    534539          {
  • factory/facFqFactorize.cc

    re8880a r074fe7  
    25572557
    25582558void
    2559 LCHeuristic2 (const CFList& LCs, const CFList& contents, CanonicalForm& A,
    2560               const CanonicalForm& oldA, CFList& leadingCoeffs,
    2561               bool& foundTrueMultiplier)
     2559LCHeuristicCheck (const CFList& LCs, const CFList& contents, CanonicalForm& A,
     2560                  const CanonicalForm& oldA, CFList& leadingCoeffs,
     2561                  bool& foundTrueMultiplier)
    25622562{
    25632563  CanonicalForm pLCs= prod (LCs);
     
    25732573
    25742574void
    2575 LCHeuristic3 (const CanonicalForm& LCmultiplier, const CFList& factors, CFList& leadingCoeffs, CFList& contents, CFList& LCs, bool& foundTrueMultiplier)
     2575LCHeuristic2 (const CanonicalForm& LCmultiplier, const CFList& factors,
     2576              CFList& leadingCoeffs, CFList& contents, CFList& LCs,
     2577              bool& foundTrueMultiplier)
    25762578{
    25772579  CanonicalForm cont;
     
    26012603
    26022604void
    2603 LCHeuristic4 (const CanonicalForm& LCmultiplier, const CFList& factors, const CFList& oldBiFactors,
    2604               const CFList& contents, const CFList* oldAeval, CanonicalForm& A, CFList*& leadingCoeffs, int lengthAeval, bool& foundMultiplier)
    2605 {
    2606         int index= 1;
    2607         CFListIterator iter, iter2= factors;
    2608         for (iter= contents; iter.hasItem(); iter++, iter2++, index++)
    2609         {
    2610           if (fdivides (iter.getItem(), LCmultiplier))
     2605LCHeuristic3 (const CanonicalForm& LCmultiplier, const CFList& factors,
     2606              const CFList& oldBiFactors, const CFList& contents,
     2607              const CFList* oldAeval, CanonicalForm& A, CFList*& leadingCoeffs,
     2608              int lengthAeval, bool& foundMultiplier)
     2609{
     2610  int index= 1;
     2611  CFListIterator iter, iter2= factors;
     2612  for (iter= contents; iter.hasItem(); iter++, iter2++, index++)
     2613  {
     2614    if (fdivides (iter.getItem(), LCmultiplier))
     2615    {
     2616      if ((LCmultiplier/iter.getItem()).inCoeffDomain() &&
     2617          !isOnlyLeadingCoeff(iter2.getItem())) //content divides LCmultiplier completely and factor consists of more terms than just the leading coeff
     2618      {
     2619        Variable xx= Variable (2);
     2620        CanonicalForm vars;
     2621        vars= power (xx, degree (LC (getItem(oldBiFactors, index),1),
     2622                                  xx));
     2623        for (int i= 0; i < lengthAeval; i++)
     2624        {
     2625          if (oldAeval[i].isEmpty())
     2626            continue;
     2627          xx= oldAeval[i].getFirst().mvar();
     2628          vars *= power (xx, degree (LC (getItem(oldAeval[i], index),1),
     2629                                      xx));
     2630        }
     2631        if (vars.level() <= 2)
     2632        {
     2633          int index2= 1;
     2634          for (CFListIterator iter3= leadingCoeffs[lengthAeval-1];
     2635                iter3.hasItem(); iter3++, index2++)
    26112636          {
    2612             if ((LCmultiplier/iter.getItem()).inCoeffDomain() &&
    2613                 !isOnlyLeadingCoeff(iter2.getItem())) //content divides LCmultiplier completely and factor consists of more terms than just the leading coeff
     2637            if (index2 == index)
    26142638            {
    2615               Variable xx= Variable (2);
    2616               CanonicalForm vars;
    2617               vars= power (xx, degree (LC (getItem(oldBiFactors, index),1),
    2618                                         xx));
    2619               for (int i= 0; i < lengthAeval; i++)
    2620               {
    2621                 if (oldAeval[i].isEmpty())
    2622                   continue;
    2623                 xx= oldAeval[i].getFirst().mvar();
    2624                 vars *= power (xx, degree (LC (getItem(oldAeval[i], index),1),
    2625                                            xx));
    2626               }
    2627               if (vars.level() <= 2)
    2628               {
    2629                 int index2= 1;
    2630                 for (CFListIterator iter3= leadingCoeffs[lengthAeval-1];
    2631                      iter3.hasItem(); iter3++, index2++)
    2632                 {
    2633                   if (index2 == index)
    2634                   {
    2635                     iter3.getItem() /= LCmultiplier;
    2636                     break;
    2637                   }
    2638                 }
    2639                 A /= LCmultiplier;
    2640                 foundMultiplier= true;
    2641                 iter.getItem()= 1;
    2642               }
     2639              iter3.getItem() /= LCmultiplier;
     2640              break;
    26432641            }
    26442642          }
    2645         }
     2643          A /= LCmultiplier;
     2644          foundMultiplier= true;
     2645          iter.getItem()= 1;
     2646        }
     2647      }
     2648    }
     2649  }
    26462650}
    26472651
    26482652void
    2649 LCHeuristic5 (const CFList& oldBiFactors, const CFList* oldAeval, const CFList& contents, const CFList& factors, const CanonicalForm& testVars, int lengthAeval, CFList*& leadingCoeffs, CanonicalForm& A, CanonicalForm& LCmultiplier, bool& foundMultiplier)
    2650 {
    2651           int index=1;
    2652           CFListIterator iter, iter2= factors;
    2653           for (iter= contents; iter.hasItem(); iter++, iter2++, index++)
     2653LCHeuristic4 (const CFList& oldBiFactors, const CFList* oldAeval,
     2654              const CFList& contents, const CFList& factors,
     2655              const CanonicalForm& testVars, int lengthAeval,
     2656              CFList*& leadingCoeffs, CanonicalForm& A,
     2657              CanonicalForm& LCmultiplier, bool& foundMultiplier)
     2658{
     2659  int index=1;
     2660  CFListIterator iter, iter2= factors;
     2661  for (iter= contents; iter.hasItem(); iter++, iter2++, index++)
     2662  {
     2663    if (!iter.getItem().isOne() &&
     2664        fdivides (iter.getItem(), LCmultiplier))
     2665    {
     2666      if (!isOnlyLeadingCoeff (iter2.getItem())) // factor is more than just leading coeff
     2667      {
     2668        int index2= 1;
     2669        for (iter2= leadingCoeffs[lengthAeval-1]; iter2.hasItem();
     2670              iter2++, index2++)
     2671        {
     2672          if (index2 == index)
    26542673          {
    2655             if (!iter.getItem().isOne() &&
    2656                 fdivides (iter.getItem(), LCmultiplier))
     2674            iter2.getItem() /= iter.getItem();
     2675            foundMultiplier= true;
     2676            break;
     2677          }
     2678        }
     2679        A /= iter.getItem();
     2680        LCmultiplier /= iter.getItem();
     2681        iter.getItem()= 1;
     2682      }
     2683      else if (fdivides (getVars (LCmultiplier), testVars))//factor consists of just leading coeff
     2684      {
     2685        Variable xx= Variable (2);
     2686        CanonicalForm vars;
     2687        vars= power (xx, degree (LC (getItem(oldBiFactors, index),1),
     2688                                  xx));
     2689        for (int i= 0; i < lengthAeval; i++)
     2690        {
     2691          if (oldAeval[i].isEmpty())
     2692            continue;
     2693          xx= oldAeval[i].getFirst().mvar();
     2694          vars *= power (xx, degree (LC (getItem(oldAeval[i], index),1),
     2695                                      xx));
     2696        }
     2697        if (myGetVars(content(getItem(leadingCoeffs[lengthAeval-1],index),1))
     2698            /myGetVars (LCmultiplier) == vars)
     2699        {
     2700          int index2= 1;
     2701          for (iter2= leadingCoeffs[lengthAeval-1]; iter2.hasItem();
     2702                iter2++, index2++)
     2703          {
     2704            if (index2 == index)
    26572705            {
    2658               if (!isOnlyLeadingCoeff (iter2.getItem())) // factor is more than just leading coeff
    2659               {
    2660                 int index2= 1;
    2661                 for (iter2= leadingCoeffs[lengthAeval-1]; iter2.hasItem();
    2662                      iter2++, index2++)
    2663                 {
    2664                   if (index2 == index)
    2665                   {
    2666                     iter2.getItem() /= iter.getItem();
    2667                     foundMultiplier= true;
    2668                     break;
    2669                   }
    2670                 }
    2671                 A /= iter.getItem();
    2672                 LCmultiplier /= iter.getItem();
    2673                 iter.getItem()= 1;
    2674               }
    2675               else if (fdivides (getVars (LCmultiplier), testVars))//factor consists of just leading coeff
    2676               {
    2677                 Variable xx= Variable (2);
    2678                 CanonicalForm vars;
    2679                 vars= power (xx, degree (LC (getItem(oldBiFactors, index),1),
    2680                                           xx));
    2681                 for (int i= 0; i < lengthAeval; i++)
    2682                 {
    2683                   if (oldAeval[i].isEmpty())
    2684                     continue;
    2685                   xx= oldAeval[i].getFirst().mvar();
    2686                   vars *= power (xx, degree (LC (getItem(oldAeval[i], index),1),
    2687                                              xx));
    2688                 }
    2689                 if (myGetVars(content(getItem(leadingCoeffs[lengthAeval-1],index),1))
    2690                     /myGetVars (LCmultiplier) == vars)
    2691                 {
    2692                   int index2= 1;
    2693                   for (iter2= leadingCoeffs[lengthAeval-1]; iter2.hasItem();
    2694                        iter2++, index2++)
    2695                   {
    2696                     if (index2 == index)
    2697                     {
    2698                       iter2.getItem() /= LCmultiplier;
    2699                       foundMultiplier= true;
    2700                       break;
    2701                     }
    2702                   }
    2703                   A /= LCmultiplier;
    2704                   iter.getItem()= 1;
    2705                 }
    2706               }
     2706              iter2.getItem() /= LCmultiplier;
     2707              foundMultiplier= true;
     2708              break;
    27072709            }
    27082710          }
     2711          A /= LCmultiplier;
     2712          iter.getItem()= 1;
     2713        }
     2714      }
     2715    }
     2716  }
    27092717}
    27102718
     
    30833091
    30843092  if (v.level() != 1)
    3085     changeSecondVariable (A, biFactors, evaluation, oldAeval, lengthAeval2, uniFactors, v);
     3093    changeSecondVariable (A, biFactors, evaluation, oldAeval, lengthAeval2,
     3094                          uniFactors, v);
    30863095
    30873096  CanonicalForm oldA= A;
     
    30973106  //prepare leading coefficients
    30983107  CFList* leadingCoeffs2= new CFList [lengthAeval2];
    3099   prepareLeadingCoeffs (leadingCoeffs2, A, Aeval, A.level(), leadingCoeffs, biFactors,
    3100                         evaluation);
     3108  prepareLeadingCoeffs (leadingCoeffs2, A, Aeval, A.level(), leadingCoeffs,
     3109                        biFactors, evaluation);
    31013110
    31023111  CFListIterator iter;
     
    31823191      CFList contents, LCs;
    31833192      bool foundTrueMultiplier= false;
    3184       LCHeuristic3 (LCmultiplier, factors, leadingCoeffs2[lengthAeval2-1], contents, LCs, foundTrueMultiplier);
     3193      LCHeuristic2 (LCmultiplier, factors, leadingCoeffs2[lengthAeval2-1],
     3194                    contents, LCs, foundTrueMultiplier);
    31853195      if (foundTrueMultiplier)
    31863196      {
     
    31953205      {
    31963206        bool foundMultiplier= false;
    3197         LCHeuristic4 (LCmultiplier, factors, oldBiFactors, contents, oldAeval, A, leadingCoeffs2, lengthAeval2, foundMultiplier);
     3207        LCHeuristic3 (LCmultiplier, factors, oldBiFactors, contents, oldAeval,
     3208                      A, leadingCoeffs2, lengthAeval2, foundMultiplier);
    31983209
    31993210        // coming from above: divide out more LCmultiplier if possible
     
    32013212        {
    32023213          foundMultiplier= false;
    3203           LCHeuristic5 (oldBiFactors, oldAeval, contents, factors, testVars, lengthAeval2, leadingCoeffs2, A, LCmultiplier, foundMultiplier);
     3214          LCHeuristic4 (oldBiFactors, oldAeval, contents, factors, testVars,
     3215                        lengthAeval2, leadingCoeffs2, A, LCmultiplier,
     3216                        foundMultiplier);
    32043217        }
    32053218        else
    32063219        {
    3207           LCHeuristic2 (LCs, contents, A, oldA, leadingCoeffs2[lengthAeval2-1],
    3208                         foundMultiplier);
     3220          LCHeuristicCheck (LCs, contents, A, oldA,
     3221                            leadingCoeffs2[lengthAeval2-1], foundMultiplier);
    32093222          if (!foundMultiplier && fdivides (getVars (LCmultiplier), testVars))
    32103223          {
  • factory/facFqFactorize.h

    re8880a r074fe7  
    710710                       );
    711711
    712 void
    713 LCHeuristic (CanonicalForm& A, const CanonicalForm& LCmultiplier,
    714              CFList& biFactors, CFList*& leadingCoeffs, const CFList* oldAeval,
    715              int lengthAeval, const CFList& evaluation,
    716              const CFList& oldBiFactors);
    717 
    718 void
    719 LCHeuristic2 (const CFList& LCs, const CFList& contents, CanonicalForm& A,
    720               const CanonicalForm& oldA, CFList& leadingCoeffs,
    721               bool& foundTrueMultiplier);
    722 
    723 void
    724 LCHeuristic3 (const CanonicalForm& LCmultiplier, const CFList& factors, CFList& leadingCoeffs, CFList& contents, CFList& LCs, bool& foundTrueMultiplier);
    725 
    726 void
    727 LCHeuristic4 (const CanonicalForm& LCmultiplier, const CFList& factors, const CFList& oldBiFactors,
    728               const CFList& contents, const CFList* oldAeval, CanonicalForm& A, CFList*& leadingCoeffs, int lengthAeval, bool& foundMultiplier);
    729 
    730 void
    731 LCHeuristic5 (const CFList& oldBiFactors, const CFList* oldAeval, const CFList& contents, const CFList& factors, const CanonicalForm& testVars, int lengthAeval, CFList*& leadingCoeffs, CanonicalForm& A, CanonicalForm& LCmultiplier, bool& foundMultiplier);
     712/// heuristic to distribute @a LCmultiplier onto factors based on the variables
     713/// that occur in @a LCmultiplier and in the leading coeffs of bivariate factors
     714void
     715LCHeuristic (CanonicalForm& A,                 ///<[in,out] a poly
     716             const CanonicalForm& LCmultiplier,///<[in,out] divisor of LC (A,1)
     717             CFList& biFactors,                ///<[in,out] bivariate factors
     718             CFList*& leadingCoeffs,           ///<[in,out] leading coeffs
     719             const CFList* oldAeval,           ///<[in] bivariate factors wrt.
     720                                               ///< different second vars
     721             int lengthAeval,                  ///<[in] length of oldAeval
     722             const CFList& evaluation,         ///<[in] evaluation point
     723             const CFList& oldBiFactors        ///<[in] bivariate factors
     724                                               ///< without LCmultiplier
     725                                               ///< distributed on them
     726            );
     727
     728/// checks if prod(LCs)==LC (oldA,1) and if so divides elements of leadingCoeffs
     729/// by elements in contents, sets A to oldA and sets foundTrueMultiplier to true
     730void
     731LCHeuristicCheck (const CFList& LCs,        ///<[in] leading coeffs computed
     732                  const CFList& contents,   ///<[in] content of factors
     733                  CanonicalForm& A,         ///<[in,out] oldA*LCmultiplier^m
     734                  const CanonicalForm& oldA,///<[in] some poly
     735                  CFList& leadingCoeffs,    ///<[in,out] leading coefficients
     736                  bool& foundTrueMultiplier ///<[in,out] success?
     737                 );
     738
     739void
     740LCHeuristic2 (const CanonicalForm& LCmultiplier,
     741              const CFList& factors,
     742              CFList& leadingCoeffs,
     743              CFList& contents,
     744              CFList& LCs,
     745              bool& foundTrueMultiplier
     746             );
     747
     748void
     749LCHeuristic3 (const CanonicalForm& LCmultiplier,
     750              const CFList& factors,
     751              const CFList& oldBiFactors,
     752              const CFList& contents,
     753              const CFList* oldAeval,
     754              CanonicalForm& A,
     755              CFList*& leadingCoeffs,
     756              int lengthAeval,
     757              bool& foundMultiplier
     758             );
     759
     760void
     761LCHeuristic4 (const CFList& oldBiFactors,
     762              const CFList* oldAeval,
     763              const CFList& contents,
     764              const CFList& factors,
     765              const CanonicalForm& testVars,
     766              int lengthAeval,
     767              CFList*& leadingCoeffs,
     768              CanonicalForm& A,
     769              CanonicalForm& LCmultiplier,
     770              bool& foundMultiplier
     771             );
    732772
    733773#endif
Note: See TracChangeset for help on using the changeset viewer.