Changeset 8336c9 in git for factory/facFqFactorize.cc


Ignore:
Timestamp:
Aug 15, 2012, 4:47:03 PM (10 years ago)
Author:
Martin Lee <martinlee84@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '2234726c50d679d6664181a5c72f75a6fd64a787')
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
File:
1 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
Note: See TracChangeset for help on using the changeset viewer.