Changeset 8336c9 in git


Ignore:
Timestamp:
Aug 15, 2012, 4:47:03 PM (10 years ago)
Author:
Martin Lee <martinlee84@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '96ce329119711a2b80858c8365abd29f8460bbfa')
Children:
5b390eae2a5015d099e164e415bf9de0df375fd5
Parents:
c7b56e2b570482a60737ec1d6e4bf209156c36fa
git-author:
Martin Lee <martinlee84@web.de>2012-08-15 16:47:03+02:00
git-committer:
Martin Lee <martinlee84@web.de>2012-09-04 18:01:18+02:00
Message:
chg: moved some helper functions to utilities
Location:
factory
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • factory/facFqFactorize.cc

    rc7b56e2 r8336c9  
    12781278}
    12791279
    1280 CFList evaluateAtZero (const CanonicalForm& F)
    1281 {
    1282   CFList result;
    1283   CanonicalForm buf= F;
    1284   result.insert (buf);
    1285   for (int i= F.level(); i > 2; i--)
    1286   {
    1287     buf= buf (0, i);
    1288     result.insert (buf);
    1289   }
    1290   return result;
    1291 }
    1292 
    1293 CFList evaluateAtEval (const CanonicalForm& F, const CFArray& eval)
    1294 {
    1295   CFList result;
    1296   CanonicalForm buf= F;
    1297   result.insert (buf);
    1298   int k= eval.size();
    1299   for (int i= 1; i < k; i++)
    1300   {
    1301     buf= buf (eval[i], i + 2);
    1302     result.insert (buf);
    1303   }
    1304   return result;
    1305 }
    1306 
    1307 CFList evaluateAtEval (const CanonicalForm& F, const CFList& evaluation, int l)
    1308 {
    1309   CFList result;
    1310   CanonicalForm buf= F;
    1311   result.insert (buf);
    1312   int k= evaluation.length() + l - 1;
    1313   CFListIterator j= evaluation;
    1314   for (int i= k; j.hasItem() && i > l; i--, j++)
    1315   {
    1316     if (F.level() < i)
    1317       continue;
    1318     buf= buf (j.getItem(), i);
    1319     result.insert (buf);
    1320   }
    1321   return result;
    1322 }
    1323 
    13241280int
    13251281testFactors (const CanonicalForm& G, const CFList& uniFactors,
     
    20722028      j.getItem() *= ii.getItem();
    20732029  }
    2074 }
    2075 
    2076 CFList recoverFactors (const CanonicalForm& F, const CFList& factors)
    2077 {
    2078   CFList result;
    2079   CanonicalForm tmp, tmp2;
    2080   CanonicalForm G= F;
    2081   for (CFListIterator i= factors; i.hasItem(); i++)
    2082   {
    2083     tmp= i.getItem()/content (i.getItem(), 1);
    2084     if (fdivides (tmp, G, tmp2))
    2085     {
    2086       G= tmp2;
    2087       result.append (tmp);
    2088     }
    2089   }
    2090   return result;
    2091 }
    2092 
    2093 CFList recoverFactors (const CanonicalForm& F, const CFList& factors,
    2094                        const CFList& evaluation)
    2095 {
    2096   CFList result;
    2097   CanonicalForm tmp, tmp2;
    2098   CanonicalForm G= F;
    2099   for (CFListIterator i= factors; i.hasItem(); i++)
    2100   {
    2101     tmp= reverseShift (i.getItem(), evaluation);
    2102     tmp /= content (tmp, 1);
    2103     if (fdivides (tmp, G, tmp2))
    2104     {
    2105       G= tmp2;
    2106       result.append (tmp);
    2107     }
    2108   }
    2109   return result;
    2110 }
    2111 
    2112 CFList recoverFactors (CanonicalForm& F, const CFList& factors, int* index)
    2113 {
    2114   CFList result;
    2115   CanonicalForm tmp, tmp2;
    2116   CanonicalForm G= F;
    2117   int j= 0;
    2118   for (CFListIterator i= factors; i.hasItem(); i++, j++)
    2119   {
    2120     if (i.getItem().isZero())
    2121     {
    2122       index[j]= 0;
    2123       continue;
    2124     }
    2125     tmp= i.getItem();
    2126     if (fdivides (tmp, G, tmp2))
    2127     {
    2128       G= tmp2;
    2129       tmp /=content (tmp, 1);
    2130       result.append (tmp);
    2131       index[j]= 1;
    2132     }
    2133     else
    2134       index[j]= 0;
    2135   }
    2136   F= G;
    2137   return result;
    21382030}
    21392031
  • factory/facFqFactorize.h

    rc7b56e2 r8336c9  
    547547                                 );
    548548
    549 /// evaluate F successively n-2 at 0
    550 ///
    551 /// @return returns a list of successive evaluations of F, ending with F
    552 CFList evaluateAtZero (const CanonicalForm& F ///< [in] some poly
    553                       );
    554 
    555 /// divides factors by their content wrt. Variable(1) and checks if these polys
    556 /// divide F
    557 ///
    558 /// @return returns factors of F
    559 CFList recoverFactors (const CanonicalForm& F, ///< [in] some poly F
    560                        const CFList& factors   ///< [in] some list of
    561                                                ///< factor candidates
    562                       );
    563 
    564 /// divides factors shifted by evaluation by their content wrt. Variable(1) and
    565 /// checks if these polys divide F
    566 ///
    567 /// @return returns factors of F
    568 CFList recoverFactors (const CanonicalForm& F,  ///< [in] some poly F
    569                        const CFList& factors,   ///< [in] some list of
    570                                                 ///< factor candidates
    571                        const CFList& evaluation ///< [in] evaluation point
    572                       );
    573 
    574 /// checks if factors divide F, if so F is divided by this factor and the factor
    575 /// is divided by its content wrt. Variable(1) and the entry in index at the
    576 /// position of the factor is set to 1, otherwise the entry in index is set to 0
    577 ///
    578 /// @return returns factors of F
    579 CFList recoverFactors (CanonicalForm& F,     ///< [in,out] some poly F
    580                        const CFList& factors,///< [in] some list of
    581                                              ///< factor candidates
    582                        int* index            ///< [in] position of real factors
    583                       );
    584 
    585549/// refine a bivariate factorization of A with l factors to one with
    586550/// minFactorsLength
     
    676640             );
    677641
    678 /// evaluate @a F at @a evaluation
    679 ///
    680 /// @return @a evaluateAtEval returns a list containing the successive
    681 /// evaluations of @a F, last entry is @a F again
    682 CFList
    683 evaluateAtEval (const CanonicalForm& F,   ///<[in] some poly
    684                 const CFArray& evaluation ///<[in] some evaluation point
    685                );
    686 
    687 /// evaluate @a F at @a evaluation
    688 ///
    689 /// @return @a evaluateAtEval returns a list containing the successive
    690 /// evaluations of @a F starting at level @a l, last entry is @a F again
    691 CFList
    692 evaluateAtEval (const CanonicalForm& F,  ///<[in] some poly
    693                 const CFList& evaluation,///<[in] some evaluation point
    694                 int l                    ///<[in] level to start at
    695                );
    696 
    697642#endif
    698643/* FAC_FQ_FACTORIZE_H */
  • factory/facFqFactorizeUtil.cc

    rc7b56e2 r8336c9  
    1515#include "canonicalform.h"
    1616#include "cf_map.h"
     17#include "cf_algorithm.h"
    1718
    1819static inline
     
    188189}
    189190
    190 
     191CFList evaluateAtZero (const CanonicalForm& F)
     192{
     193  CFList result;
     194  CanonicalForm buf= F;
     195  result.insert (buf);
     196  for (int i= F.level(); i > 2; i--)
     197  {
     198    buf= buf (0, i);
     199    result.insert (buf);
     200  }
     201  return result;
     202}
     203
     204CFList evaluateAtEval (const CanonicalForm& F, const CFArray& eval)
     205{
     206  CFList result;
     207  CanonicalForm buf= F;
     208  result.insert (buf);
     209  int k= eval.size();
     210  for (int i= 1; i < k; i++)
     211  {
     212    buf= buf (eval[i], i + 2);
     213    result.insert (buf);
     214  }
     215  return result;
     216}
     217
     218CFList evaluateAtEval (const CanonicalForm& F, const CFList& evaluation, int l)
     219{
     220  CFList result;
     221  CanonicalForm buf= F;
     222  result.insert (buf);
     223  int k= evaluation.length() + l - 1;
     224  CFListIterator j= evaluation;
     225  for (int i= k; j.hasItem() && i > l; i--, j++)
     226  {
     227    if (F.level() < i)
     228      continue;
     229    buf= buf (j.getItem(), i);
     230    result.insert (buf);
     231  }
     232  return result;
     233}
     234
     235
     236CFList recoverFactors (const CanonicalForm& F, const CFList& factors)
     237{
     238  CFList result;
     239  CanonicalForm tmp, tmp2;
     240  CanonicalForm G= F;
     241  for (CFListIterator i= factors; i.hasItem(); i++)
     242  {
     243    tmp= i.getItem()/content (i.getItem(), 1);
     244    if (fdivides (tmp, G, tmp2))
     245    {
     246      G= tmp2;
     247      result.append (tmp);
     248    }
     249  }
     250  return result;
     251}
     252
     253CFList recoverFactors (const CanonicalForm& F, const CFList& factors,
     254                       const CFList& evaluation)
     255{
     256  CFList result;
     257  CanonicalForm tmp, tmp2;
     258  CanonicalForm G= F;
     259  for (CFListIterator i= factors; i.hasItem(); i++)
     260  {
     261    tmp= reverseShift (i.getItem(), evaluation, 2);
     262    tmp /= content (tmp, 1);
     263    if (fdivides (tmp, G, tmp2))
     264    {
     265      G= tmp2;
     266      result.append (tmp);
     267    }
     268  }
     269  return result;
     270}
     271
     272CFList recoverFactors (CanonicalForm& F, const CFList& factors, int* index)
     273{
     274  CFList result;
     275  CanonicalForm tmp, tmp2;
     276  CanonicalForm G= F;
     277  int j= 0;
     278  for (CFListIterator i= factors; i.hasItem(); i++, j++)
     279  {
     280    if (i.getItem().isZero())
     281    {
     282      index[j]= 0;
     283      continue;
     284    }
     285    tmp= i.getItem();
     286    if (fdivides (tmp, G, tmp2))
     287    {
     288      G= tmp2;
     289      tmp /=content (tmp, 1);
     290      result.append (tmp);
     291      index[j]= 1;
     292    }
     293    else
     294      index[j]= 0;
     295  }
     296  F= G;
     297  return result;
     298}
  • factory/facFqFactorizeUtil.h

    rc7b56e2 r8336c9  
    135135                        );
    136136
     137/// evaluate @a F at @a evaluation
     138///
     139/// @return @a evaluateAtEval returns a list containing the successive
     140/// evaluations of @a F, last entry is @a F again
     141CFList
     142evaluateAtEval (const CanonicalForm& F,   ///<[in] some poly
     143                const CFArray& evaluation ///<[in] some evaluation point
     144               );
     145
     146/// evaluate @a F at @a evaluation
     147///
     148/// @return @a evaluateAtEval returns a list containing the successive
     149/// evaluations of @a F starting at level @a l, last entry is @a F again
     150CFList
     151evaluateAtEval (const CanonicalForm& F,  ///<[in] some poly
     152                const CFList& evaluation,///<[in] some evaluation point
     153                int l                    ///<[in] level to start at
     154               );
     155
     156/// evaluate F successively n-2 at 0
     157///
     158/// @return returns a list of successive evaluations of F, ending with F
     159CFList evaluateAtZero (const CanonicalForm& F ///< [in] some poly
     160                      );
     161
     162/// divides factors by their content wrt. Variable(1) and checks if these polys
     163/// divide F
     164///
     165/// @return returns factors of F
     166CFList recoverFactors (const CanonicalForm& F, ///< [in] some poly F
     167                       const CFList& factors   ///< [in] some list of
     168                                               ///< factor candidates
     169                      );
     170
     171/// divides factors shifted by evaluation by their content wrt. Variable(1) and
     172/// checks if these polys divide F
     173///
     174/// @return returns factors of F
     175CFList recoverFactors (const CanonicalForm& F,  ///< [in] some poly F
     176                       const CFList& factors,   ///< [in] some list of
     177                                                ///< factor candidates
     178                       const CFList& evaluation ///< [in] evaluation point
     179                      );
     180
     181/// checks if factors divide F, if so F is divided by this factor and the factor
     182/// is divided by its content wrt. Variable(1) and the entry in index at the
     183/// position of the factor is set to 1, otherwise the entry in index is set to 0
     184///
     185/// @return returns factors of F
     186CFList recoverFactors (CanonicalForm& F,     ///< [in,out] some poly F
     187                       const CFList& factors,///< [in] some list of
     188                                             ///< factor candidates
     189                       int* index            ///< [in] position of real factors
     190                      );
     191
    137192#endif
    138193/* FAC_FQ_FACTORIZE_UTIL_H */
Note: See TracChangeset for help on using the changeset viewer.