check_inifcns
check_matrices
check_lsolve
- check_mul_info
heur_gcd_bug
exam_paranoia
exam_heur_gcd
exam_cra
exam_real_imag
bugme_chinrem_gcd
- factor_univariate_bug
pgcd_relatively_prime_bug
pgcd_infinite_loop)
exam_structure \
exam_misc \
exam_mod_gcd \
- check_mul_info \
bugme_chinrem_gcd \
- factor_univariate_bug \
pgcd_relatively_prime_bug \
pgcd_infinite_loop \
exam_cra \
check_lsolve_SOURCES = check_lsolve.cpp genex.cpp
check_lsolve_LDADD = ../ginac/libginac.la
-check_mul_info_SOURCES = check_mul_info.cpp
-check_mul_info_LDADD = ../ginac/libginac.la
-
exam_paranoia_SOURCES = exam_paranoia.cpp
exam_paranoia_LDADD = ../ginac/libginac.la
bugme_chinrem_gcd_SOURCES = bugme_chinrem_gcd.cpp
bugme_chinrem_gcd_LDADD = ../ginac/libginac.la
-factor_univariate_bug_SOURCES = factor_univariate_bug.cpp
-factor_univariate_bug_LDADD = ../ginac/libginac.la
-
pgcd_relatively_prime_bug_SOURCES = pgcd_relatively_prime_bug.cpp
pgcd_relatively_prime_bug_LDADD = ../ginac/libginac.la
+++ /dev/null
-#include "ginac.h"
-#include <iostream>
-using namespace GiNaC;
-
-int main(int argc, char** argv)
-{
- symbol x("x"), y("y");
- ex e = x*y;
- if (!e.info(info_flags::indefinite)) {
- std::cerr << "eek, product of two symbols is NOT indefinite";
- return 1;
- }
- return 0;
-}
ex e;
symbol x("x");
lst syms = {x};
-
+
+ e = 1;
+ result += check_factor(e);
+
e = ex("1+x-x^3", syms);
result += check_factor(e);
return 0;
}
+static unsigned exam_factor_content()
+{
+ unsigned result = 0;
+ ex e;
+ symbol x("x"), y("y");
+
+ // Fixed 2013-07-28 by Alexei Sheplyakov in factor_univariate().
+ e = ex("174247781*x^2-1989199947807987/200000000000000", lst{x});
+ result += check_factor(e);
+
+ // Fixed 2014-05-18 by Alexei Sheplyakov in factor_multivariate().
+ e = ex("(x+y+x*y)*(3*x+2*y)", lst{x, y});
+ result += check_factor(e);
+
+ return result;
+}
+
static unsigned exam_factor_wang()
{
// these 15 polynomials are from the appendix of P.S.Wang,
return result;
}
-static unsigned check_factorization(const exvector& factors)
-{
- ex e = dynallocate<mul>(factors);
- ex ef = factor(e.expand());
- if (ef.nops() != factors.size()) {
- clog << "wrong number of factors, expected " << factors.size() <<
- ", got " << ef.nops();
- return 1;
- }
- for (size_t i = 0; i < ef.nops(); ++i) {
- if (find(factors.begin(), factors.end(), ef.op(i)) == factors.end()) {
- clog << "wrong factorization: term not found: " << ef.op(i);
- return 1;
- }
- }
- return 0;
-}
-
-static unsigned factor_integer_content_bug()
-{
- parser reader;
- exvector factors;
- factors.push_back(reader("x+y+x*y"));
- factors.push_back(reader("3*x+2*y"));
- return check_factorization(factors);
-}
-
unsigned exam_factor()
{
unsigned result = 0;
result += exam_factor1(); cout << '.' << flush;
result += exam_factor2(); cout << '.' << flush;
result += exam_factor3(); cout << '.' << flush;
+ result += exam_factor_content(); cout << '.' << flush;
result += exam_factor_wang(); cout << '.' << flush;
- result += factor_integer_content_bug();
- cout << '.' << flush;
return result;
}
return result;
}
+static unsigned exam_mul_info()
+{
+ symbol x("x"), y("y");
+ ex e = x*y;
+ if (!e.info(info_flags::indefinite)) {
+ clog << "eek, product of two symbols is NOT indefinite\n";
+ return 1;
+ }
+ return 0;
+}
+
static unsigned is_polynomial_false_positive()
{
unsigned result = 0;
result += exam_paranoia18(); cout << '.' << flush;
result += exam_paranoia19(); cout << '.' << flush;
result += exam_paranoia20(); cout << '.' << flush;
+ result += exam_mul_info(); cout << '.' << flush;
result += is_polynomial_false_positive(); cout << '.' << flush;
result += exam_paranoia21(); cout << '.' << flush;
result += exam_paranoia22(); cout << '.' << flush;
+++ /dev/null
-/**
- * @file factor_upoly_q_bug.cpp Check for a bug in factor_univariate().
- *
- * factor_univariate() didn't check if the argument is an integer polynomial,
- * the result was a segfault.
- */
-#include "ginac.h"
-#include <iostream>
-using namespace GiNaC;
-using namespace std;
-
-int main(int argc, char** argv)
-{
- cout << "checking if factor() handles rational polynomials. ";
- parser p;
- ex e = p("174247781*x^2-1989199947807987/200000000000000*x");
- ex ef = factor(e);
- ex diff = (e - ef).expand();
- cout << "yes" << endl;
- return 0;
-}