[SCM] an open source computer algebra system branch, cleanedupstream, updated. 6125e540ca6d66c307958938a9d53b245507c323
Bernhard R. Link
brlink at debian.org
Tue Apr 24 15:54:43 UTC 2012
The following commit has been merged in the cleanedupstream branch:
commit 878ac4a503a3a11aa06f449753039647075c87f1
Author: Martin Lee <martinlee84 at web.de>
Date: Thu Jan 5 17:52:39 2012 +0100
chg: more changes to replace polynomial factorization over integer with new algorithm
diff --git a/factory/cf_factor.cc b/factory/cf_factor.cc
index b1350aa..17b64c5 100644
--- a/factory/cf_factor.cc
+++ b/factory/cf_factor.cc
@@ -641,12 +641,12 @@ CFFList factorize ( const CanonicalForm & f, bool issqrfree )
if (issqrfree)
{
CFList factors;
- factors= ratSqrfFactorize (fz, Variable (1));
+ factors= ratSqrfFactorize (fz);
for (CFListIterator i= factors; i.hasItem(); i++)
F.append (CFFactor (i.getItem(), 1));
}
else
- F = ratFactorize (fz, Variable (1));
+ F = ratFactorize (fz);
Off (SW_RATIONAL);
}
diff --git a/factory/facBivar.h b/factory/facBivar.h
index 63c5092..54bf145 100644
--- a/factory/facBivar.h
+++ b/factory/facBivar.h
@@ -39,8 +39,8 @@ biFactorize (const CanonicalForm& F, ///< [in] a bivariate poly
/// element is the leading coefficient.
inline
CFList
-ratBiSqrfFactorize (const CanonicalForm & G, ///< [in] a bivariate poly
- const Variable& v ///< [in] algebraic variable
+ratBiSqrfFactorize (const CanonicalForm & G, ///< [in] a bivariate poly
+ const Variable& v= Variable (1) ///< [in] algebraic variable
)
{
CFMap N;
@@ -49,8 +49,16 @@ ratBiSqrfFactorize (const CanonicalForm & G, ///< [in] a bivariate poly
CanonicalForm contentY= content (F, 2);
F /= (contentX*contentY);
CFFList contentXFactors, contentYFactors;
- contentXFactors= factorize (contentX, v);
- contentYFactors= factorize (contentY, v);
+ if (v.level() != 1)
+ {
+ contentXFactors= factorize (contentX, v);
+ contentYFactors= factorize (contentY, v);
+ }
+ else
+ {
+ contentXFactors= factorize (contentX);
+ contentYFactors= factorize (contentY);
+ }
if (contentXFactors.getFirst().factor().inCoeffDomain())
contentXFactors.removeFirst();
if (contentYFactors.getFirst().factor().inCoeffDomain())
@@ -93,9 +101,9 @@ ratBiSqrfFactorize (const CanonicalForm & G, ///< [in] a bivariate poly
/// multiplicity, the first element is the leading coefficient.
inline
CFFList
-ratBiFactorize (const CanonicalForm & G, ///< [in] a bivariate poly
- const Variable& v, ///< [in] algebraic variable
- bool substCheck= true ///< [in] enables substitute check
+ratBiFactorize (const CanonicalForm & G, ///< [in] a bivariate poly
+ const Variable& v= Variable (1), ///< [in] algebraic variable
+ bool substCheck= true ///< [in] enables substitute check
)
{
CFMap N;
@@ -147,8 +155,16 @@ ratBiFactorize (const CanonicalForm & G, ///< [in] a bivariate poly
CanonicalForm contentY= content (F, 2);
F /= (contentX*contentY);
CFFList contentXFactors, contentYFactors;
- contentXFactors= factorize (contentX, v);
- contentYFactors= factorize (contentY, v);
+ if (v.level() != 1)
+ {
+ contentXFactors= factorize (contentX, v);
+ contentYFactors= factorize (contentY, v);
+ }
+ else
+ {
+ contentXFactors= factorize (contentX);
+ contentYFactors= factorize (contentY);
+ }
if (contentXFactors.getFirst().factor().inCoeffDomain())
contentXFactors.removeFirst();
if (contentYFactors.getFirst().factor().inCoeffDomain())
diff --git a/factory/facFactorize.h b/factory/facFactorize.h
index 1d48ac1..31ffe48 100644
--- a/factory/facFactorize.h
+++ b/factory/facFactorize.h
@@ -33,8 +33,8 @@ multiFactorize (const CanonicalForm& F, ///< [in] poly to be factored
/// element is the leading coefficient.
inline
CFList
-ratSqrfFactorize (const CanonicalForm & G, ///<[in] a multivariate poly
- const Variable& v ///<[in] algebraic variable
+ratSqrfFactorize (const CanonicalForm & G, ///<[in] a multivariate poly
+ const Variable& v= Variable (1) ///<[in] algebraic variable
)
{
if (getNumVars (G) == 2)
@@ -57,9 +57,9 @@ ratSqrfFactorize (const CanonicalForm & G, ///<[in] a multivariate poly
/// multiplicity, the first element is the leading coefficient.
inline
CFFList
-ratFactorize (const CanonicalForm& G, ///<[in] a multivariate poly
- const Variable& v, ///<[in] algebraic variable
- bool substCheck= true ///<[in] enables substitute check
+ratFactorize (const CanonicalForm& G, ///<[in] a multivariate poly
+ const Variable& v= Variable (1), ///<[in] algebraic variable
+ bool substCheck= true ///<[in] enables substitute check
)
{
if (getNumVars (G) == 2)
--
an open source computer algebra system
More information about the debian-science-commits
mailing list