.libs/
*.log
*.trs
-bugme_chinrem_gcd
-check_inifcns
-check_lsolve
-check_matrices
-check_numeric
exam.gar
exam_archive
exam_clifford
exam_color
-exam_cra
exam_differentiation
exam_factor
exam_heur_gcd
exam_indexed
exam_inifcns
exam_inifcns_nstdsums
+exam_inifcns_elliptic
exam_lsolve
exam_matrices
exam_misc
+exam_pgcd
exam_mod_gcd
exam_normalization
exam_sqrfree
exam_numeric
-exam_numeric_archive
exam_paranoia
exam_polygcd
+exam_collect_common_factors
exam_powerlaws
exam_pseries
+exam_chinrem_gcd
exam_real_imag
exam_structure
-match_bug
-parser_bugs
-pgcd_infinite_loop
-pgcd_relatively_prime_bug
+exam_match
+exam_parser
+check_inifcns
+check_lsolve
+check_matrices
+check_numeric
+check_cra
time_antipode
time_dennyfliegner
time_fateman_expand
check_inifcns
check_matrices
check_lsolve
- heur_gcd_bug
+ check_cra
exam_paranoia
exam_heur_gcd
- match_bug
- parser_bugs
- exam_numeric_archive
+ exam_match
+ exam_parser
exam_numeric
exam_powerlaws
exam_inifcns
exam_archive
exam_structure
exam_misc
+ exam_pgcd
exam_mod_gcd
- exam_cra
exam_real_imag
- bugme_chinrem_gcd
- pgcd_relatively_prime_bug
- pgcd_infinite_loop)
+ exam_chinrem_gcd)
set(ginac_timings
time_dennyfliegner
set(check_matrices_extra_src genex.cpp)
set(check_lsolve_extra_src genex.cpp)
-set(exam_heur_gcd_sources heur_gcd_bug.cpp)
-set(exam_numeric_archive_sources numeric_archive.cpp)
foreach(tst ${ginac_tests})
add_ginac_test(${tst})
CHECKS = check_numeric \
check_inifcns \
check_matrices \
- check_lsolve
+ check_lsolve \
+ check_cra
EXAMS = exam_paranoia \
exam_heur_gcd \
- match_bug \
- parser_bugs \
- exam_numeric_archive \
+ exam_match \
+ exam_parser \
exam_numeric \
- exam_powerlaws \
+ exam_powerlaws \
exam_inifcns \
exam_inifcns_nstdsums \
exam_inifcns_elliptic \
exam_differentiation \
- exam_polygcd \
+ exam_polygcd \
exam_collect_common_factors \
- exam_normalization \
+ exam_normalization \
exam_sqrfree \
exam_factor \
exam_pseries \
exam_matrices \
exam_lsolve \
exam_indexed \
- exam_color \
+ exam_color \
exam_clifford \
exam_archive \
exam_structure \
exam_misc \
+ exam_pgcd \
exam_mod_gcd \
- bugme_chinrem_gcd \
- pgcd_relatively_prime_bug \
- pgcd_infinite_loop \
- exam_cra \
+ exam_chinrem_gcd \
exam_real_imag
TIMES = time_dennyfliegner \
check_lsolve_SOURCES = check_lsolve.cpp genex.cpp
check_lsolve_LDADD = ../ginac/libginac.la
+check_cra_SOURCES = check_cra.cpp
+check_cra_LDADD = ../ginac/libginac.la
+
exam_paranoia_SOURCES = exam_paranoia.cpp
exam_paranoia_LDADD = ../ginac/libginac.la
-exam_heur_gcd_SOURCES = heur_gcd_bug.cpp
+exam_heur_gcd_SOURCES = exam_heur_gcd.cpp
exam_heur_gcd_LDADD = ../ginac/libginac.la
-match_bug_SOURCES = match_bug.cpp error_report.h
-match_bug_LDADD = ../ginac/libginac.la
-
-parser_bugs_SOURCES = parser_bugs.cpp
-parser_bugs_LDADD = ../ginac/libginac.la
+exam_match_SOURCES = exam_match.cpp error_report.h
+exam_match_LDADD = ../ginac/libginac.la
-exam_numeric_archive_SOURCES = numeric_archive.cpp
-exam_numeric_archive_LDADD = ../ginac/libginac.la
+exam_parser_SOURCES = exam_parser.cpp
+exam_parser_LDADD = ../ginac/libginac.la
exam_numeric_SOURCES = exam_numeric.cpp
exam_numeric_LDADD = ../ginac/libginac.la
exam_misc_SOURCES = exam_misc.cpp
exam_misc_LDADD = ../ginac/libginac.la
+exam_pgcd_SOURCES = exam_pgcd.cpp
+exam_pgcd_LDADD = ../ginac/libginac.la
+
exam_mod_gcd_SOURCES = exam_mod_gcd.cpp
exam_mod_gcd_LDADD = ../ginac/libginac.la
-exam_cra_SOURCES = exam_cra.cpp
-exam_cra_LDADD = ../ginac/libginac.la
-
exam_real_imag_SOURCES = exam_real_imag.cpp
exam_real_imag_LDADD = ../ginac/libginac.la
+exam_chinrem_gcd_SOURCES = exam_chinrem_gcd.cpp
+exam_chinrem_gcd_LDADD = ../ginac/libginac.la
+
time_dennyfliegner_SOURCES = time_dennyfliegner.cpp \
randomize_serials.cpp timer.cpp timer.h
time_dennyfliegner_LDADD = ../ginac/libginac.la
randomize_serials.cpp timer.cpp timer.h
time_parser_LDADD = ../ginac/libginac.la
-bugme_chinrem_gcd_SOURCES = bugme_chinrem_gcd.cpp
-bugme_chinrem_gcd_LDADD = ../ginac/libginac.la
-
-pgcd_relatively_prime_bug_SOURCES = pgcd_relatively_prime_bug.cpp
-pgcd_relatively_prime_bug_LDADD = ../ginac/libginac.la
-
-pgcd_infinite_loop_SOURCES = pgcd_infinite_loop.cpp
-pgcd_infinite_loop_LDADD = ../ginac/libginac.la
-
AM_CPPFLAGS = -I$(srcdir)/../ginac -I../ginac -DIN_GINAC
CLEANFILES = exam.gar
#include <iostream>
using namespace std;
+#include <cln/cln.h>
+
+
unsigned exam_archive()
{
unsigned result = 0;
- cout << "examining archiving system" << flush;
-
symbol x("x"), y("y"), mu("mu"), dim("dim", "\\Delta");
ex e, f;
return result;
}
+/** numeric::archive used to fail if the real part of a complex number
+ * is a rational number and the imaginary part is a floating point one. */
+unsigned numeric_complex_bug()
+{
+ using namespace cln;
+ struct archive_unarchive_check
+ {
+ unsigned operator()(const cl_N& n) const
+ {
+ ex e = numeric(n);
+ archive ar;
+ ar.archive_ex(e, "test");
+ ex check = ar.unarchive_ex(lst{}, "test");
+ if (!check.is_equal(e)) {
+ clog << __FILE__ << ':' << __LINE__ << ": expected: " << e << ", got " << check << endl;
+ return 1;
+ }
+ return 0;
+ }
+ } checker;
+ unsigned result = 0;
+ const cl_I one(1);
+ const cl_R three_fp = cl_float(3.0);
+ std::vector<cl_N> numbers = {
+ complex(one, one),
+ complex(one, three_fp),
+ complex(three_fp, one),
+ complex(three_fp, three_fp)
+ };
+ for (auto & n : numbers) {
+ result += checker(n);
+ }
+ return result;
+}
+
int main(int argc, char** argv)
{
- return exam_archive();
+ unsigned result = 0;
+
+ cout << "examining archiving system" << flush;
+
+ result += exam_archive(); cout << '.' << flush;
+ result += numeric_complex_bug(); cout << '.' << flush;
+
+ return result;
}
-/** @file bugme_chinrem_gcd.cpp
+/** @file exam_chinrem_gcd.cpp
*
* A small program exposing historical bug in poly_cra function. */
int main(int argc, char** argv)
{
- cout << "checking for bugs in poly_cra() and friends " << flush;
+ cout << "examining in poly_cra() and friends " << flush;
check_poly_cra();
check_extract_integer_content();
integer_coeff_braindamage();
/** @file heur_gcd_bug.cpp
*
- * heur_gcd_oops.cpp Check for a bug in heur_gcd().
+ * exam_heur_gcd.cpp Check for a bug in heur_gcd().
*
* heur_gcd() did not check if the arguments are integer polynomials
* (and did not convert them to integer polynomials), which lead to
int main(int argc, char** argv)
{
- cout << "checking if heur_gcd() can cope with rational polynomials. ";
+ cout << "examining if heur_gcd() can cope with rational polynomials. ";
const symbol x("x");
const ex _ex1(1);
ex a1 = x + numeric(5, 4);
-/** @file match_bug.cpp
+/** @file exam_match.cpp
*
* Check for bug in GiNaC::ex::match() described here:
* https://www.ginac.de/pipermail/ginac-devel/2006-April/000942.html */
int main(int argc, char** argv)
{
const int repetitions = 100;
- std::cout << "checking for historical bugs in match()... " << std::flush;
+ std::cout << "examining historical bugs in match()... " << std::flush;
failed_match_have_side_effects();
match_false_negative();
expairseq_failed_match_no_side_effect(repetitions);
#include <stdexcept>
#include <string>
+using namespace std;
+
// - a - b was misparsed as -a + b due to a bug in parser::parse_unary_expr()
-static int check1(std::ostream& err_str)
+static int check1(ostream& err_str)
{
- const std::string srep("-a-b");
+ const string srep("-a-b");
parser reader;
ex e = reader(srep);
ex a = reader.get_syms()["a"];
ex d = (e - g).expand();
if (!d.is_zero()) {
err_str << "\"" << srep << "\" was misparsed as \""
- << e << "\"" << std::endl;
+ << e << "\"" << endl;
return 1;
}
return 0;
}
/// Parser was rejecting the valid expression '5 - (3*x)/10'.
-static int check2(std::ostream& err_str)
+static int check2(ostream& err_str)
{
- const std::string srep("5-(3*x)/10");
+ const string srep("5-(3*x)/10");
parser reader;
ex e = reader(srep);
ex x = reader.get_syms()["x"];
ex d = (e - g).expand();
if (!d.is_zero()) {
err_str << "\"" << srep << "\" was misparsed as \""
- << e << "\"" << std::endl;
+ << e << "\"" << endl;
return 1;
}
return 0;
/// parse_literal_expr forget to consume the token, so parser get
/// very confused.
-static int check3(std::ostream& err_str)
+static int check3(ostream& err_str)
{
- const std::string srep("5-(2*I)/3");
+ const string srep("5-(2*I)/3");
parser reader;
ex e = reader(srep);
ex g = numeric(5) - (numeric(2)*I)/3;
ex d = (e - g).expand();
if (!d.is_zero()) {
err_str << "\"" << srep << "\" was misparsed as \""
- << e << "\"" << std::endl;
+ << e << "\"" << endl;
return 1;
}
return 0;
}
/// parser happily accepted various junk like 'x^2()+1'
-static int check4(std::ostream& err_str)
+static int check4(ostream& err_str)
{
- const std::string junk("x^2()+1");
+ const string junk("x^2()+1");
parser reader;
ex e;
try {
e = reader(junk);
- err_str << "parser accepts junk: \"" << junk << "\"" << std::endl;
+ err_str << "parser accepts junk: \"" << junk << "\"" << endl;
return 1;
} catch (parse_error& err) {
// Ok, parser rejects the nonsense.
int main(int argc, char** argv)
{
- std::cout << "checking for parser bugs. " << std::flush;
- std::ostringstream err_str;
+ cout << "examining old parser bugs" << flush;
+ ostringstream err_str;
int errors = 0;
- errors += check1(err_str);
- errors += check2(err_str);
- errors += check3(err_str);
- errors += check4(err_str);
+ errors += check1(err_str); cout << '.' << flush;
+ errors += check2(err_str); cout << '.' << flush;
+ errors += check3(err_str); cout << '.' << flush;
+ errors += check4(err_str); cout << '.' << flush;
if (errors) {
- std::cout << "Yes, unfortunately:" << std::endl;
- std::cout << err_str.str();
+ cout << "Yes, unfortunately:" << endl;
+ cout << err_str.str();
} else {
- std::cout << "Not found. ";
+ cout << "Not found. ";
}
return errors;
}
--- /dev/null
+/** @file exam_pgcd.cpp
+ *
+ * Exam GCD over prime fields computations.
+ */
+#include <string>
+#include <iostream>
+#include <utility>
+#include "ginac.h"
+using namespace std;
+using namespace GiNaC;
+
+// Check for an infite loop in PGCD, fixed 2010-02-23.
+static unsigned pgcd_relatively_prime_bug()
+{
+ const symbol q("q");
+ parser reader;
+ reader.get_syms().insert(make_pair(string("q"), q));
+
+ ex t = reader("-E20^16*E4^8*E5^8*E1^16*q^4"
+ "-(E10^24-E20^8*E5^16)*E4^16*E1^8"
+ "+E2^24*E20^16*E5^8*q^4");
+ ex g = gcd(t.expand(), t.diff(q).expand()) - 1;
+ if (!g.is_zero()) {
+ clog << " oops!" << endl <<
+ "** Error: should be 0, got " << g << endl;
+ return 1;
+ }
+ return 0;
+}
+
+// Check for an infinite loop in PGCD, fixed 2010-03-18.
+static unsigned pgcd_infinite_loop()
+{
+ parser the_parser;
+ ex e = the_parser(string(R"ex(792*z^8*w^4*x^3*y^4*u^7
++ 24*z^4*w^4*x^2*y^3*u^4 + 264*z^8*w^3*x^2*y^7*u^5 + 198*z^4*w^5*x^5*y*u^6
++ 110*z^2*w^3*x^5*y^4*u^6 - 120*z^8*w*x^4*u^6 - 480*z^5*w*x^4*y^6*u^8
+- 720*z^7*x^3*y^3*u^7 + 165*z^4*w^2*x^4*y*u^5 + 450*z^8*w^6*x^2*y*u^8
++ 40*z^2*w^3*x^3*y^3*u^6 - 288*z^7*w^2*x^3*y^6*u^6 + 250*z^6*w^4*x^2*y^4*u^8
++ 576*z^7*w^7*x^2*y^4*u^8 - 80*z^6*w^2*x^5*y^3*u^7 - 144*z^8*w^4*x^5*u^7
++ 120*z^4*w*x^2*y^6*u^6 + 320*z^5*w^5*x^2*y^7*u^8 + 192*z^7*w^6*x*y^7*u^6
+- 12*z^4*w^3*x^3*y^5*u^6 - 36*z^4*w^4*x^4*y^2*u^8 + 72*z^4*w^5*x^3*u^6
+- 20*z^2*w^2*x^4*y^5*u^8 + 660*z^8*w*x^2*y^4*u^6 + 66*z^4*w^4*x^4*y^4*u^4
++ 440*z^6*w^2*x^3*y^7*u^7 - 30*z^4*w*x^3*y^2*u^7 - 48*z^8*w^3*x^4*y^3*u^5
++ 72*z^6*w^2*x*y^6*u^4 - 864*z^7*w^3*x^4*y^3*u^8 + 480*z^7*w^4*x*y^4*u^7
++ 60*z^4*w^2*x^2*u^5 + 375*z^8*w^3*x*y*u^7 + 150*z^8*w^5*x*y^4*u^6
++ 180*z^6*x*y^3*u^5 + 216*z^6*w^3*x^2*y^3*u^6)ex"));
+ const symbol x = ex_to<symbol>(the_parser.get_syms()["x"]);
+ ex g = gcd(e, e.diff(x));
+ ex should_be = the_parser(string("u^4*z^2"));
+ if (!(g-should_be).expand().is_zero()) {
+ clog << "GCD was miscomputed. " << endl;
+ return 1;
+ }
+ return 0;
+}
+
+int main()
+{
+ unsigned result = 0;
+
+ cout << "Examining pgcd() bugs (infinite loop, miscalculation)" << flush;
+
+ result += pgcd_relatively_prime_bug(); cout << '.' << flush;
+ result += pgcd_infinite_loop(); cout << '.' << flush;
+
+ return result;
+}
+++ /dev/null
-/** @file mul_eval_memleak.cpp
- *
- * mul_eval_memleak.cpp Test for memory leak in {mul,power}::eval
- *
- * The bug was introduced by
- *
- * commit f418c6ee4d558c852e1fb95533af07a3ae43f409
- * Author: Alexei Sheplyakov <varg@theor.jinr.ru>
- * Date: Wed Jul 11 14:34:42 2007 +0400
- * (it was commited into the official branch as
- * commit a602d34c225dceb3e53742a7b3e19a4b5e280485
- * Author: Jens Vollinga <vollinga@thep.physik.uni-mainz.de>
- * Date: Wed Jul 11 21:07:40 2007 +0000)
- */
-
-/*
- * GiNaC Copyright (C) 1999-2020 Johannes Gutenberg University Mainz, Germany
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <ginac/ginac.h>
-using namespace GiNaC;
-
-#include <iostream>
-#include <stdexcept>
-#include <string>
-using namespace std;
-
-const unsigned check_mul_eval_memleak(const unsigned N)
-{
- // Expanding this expression into a Laurent series triggers the bug.
- static const string e_str("\
-1/605927415293858601*tgamma(3-eps)^(-1)*tgamma(2-eps)*(5013234896802\
-*(-1+2*eps)*((-2539001/2)*eps^(-2)+(-7617003/2+1692800*log(920*scale\
-^(-1))+3385202*log(1301*scale^(-1)))*eps^(-1)+F)+(846400+2539001*eps\
-)*(2539001*(-1+2*eps)*((-2539001/2)*eps^(-2)+(-7617003/2+1692800*log\
-(920*scale^(-1))+3385202*log(1301*scale^(-1)))*eps^(-1)+F)+286523497\
-2800*(-1+eps)^(-1)*eps^(-2)*(920*scale^(-1))^(-2*eps)*(1301*scale^(-\
-1))^(-2*eps)*tgamma(1+eps)^2)+6061411748045832000*(-1+eps)^(-1)*eps^\
-(-2)*(920*scale^(-1))^(-2*eps)*(1301*scale^(-1))^(-2*eps)*tgamma(1+e\
-ps)^2+716056132401*((-2539001/2)*eps^(-2)+(-7617003/2+1692800*log(92\
-0*scale^(-1))+3385202*log(1301*scale^(-1)))*eps^(-1)+F))+71656139360\
-0/716056132401*tgamma(1-eps)*tgamma(2*eps)^(-1)*tgamma(eps)^2*tgamma\
-(3-eps)^(-1)*(920*scale^(-1))^(-4*eps)*tgamma(-1+2*eps)-2/6059274152\
-93858601*tgamma(3-eps)^(-1)*(2149010446400*(-1+2*eps)*((-2539001/2)*\
-eps^(-2)+(-7617003/2+1692800*log(920*scale^(-1))+3385202*log(1301*sc\
-ale^(-1)))*eps^(-1)+F)+2425134880977920000*(-1+eps)^(-1)*eps^(-2)*(9\
-20*scale^(-1))^(-2*eps)*(1301*scale^(-1))^(-2*eps)*tgamma(1+eps)^2-7\
-16056132401*((-2539001/2)*eps^(-2)+(-7617003/2+1692800*log(920*scale\
-^(-1))+3385202*log(1301*scale^(-1)))*eps^(-1)+F)+1692601*(-1+2*eps)*\
-(2539001*(-1+2*eps)*((-2539001/2)*eps^(-2)+(-7617003/2+1692800*log(9\
-20*scale^(-1))+3385202*log(1301*scale^(-1)))*eps^(-1)+F)+28652349728\
-00*(-1+eps)^(-1)*eps^(-2)*(920*scale^(-1))^(-2*eps)*(1301*scale^(-1)\
-)^(-2*eps)*tgamma(1+eps)^2))*tgamma(2-eps)+(1/716056132401*I)*tgamma\
-(-1+eps)*mb^2*(mb*scale^(-1))^(-2*eps)*((716392960000*I)*mb^(-2)*(92\
-0*scale^(-1))^(-2*eps)*tgamma(-2+eps)-(2864898145201*I)*mb^(-2)*(130\
-1*scale^(-1))^(-2*eps)*tgamma(-2+eps)-(716224526400*I)*tgamma(-1+eps\
-)*mb^(-2)*(920*scale^(-1))^(-2*eps))-3385202/605927415293858601*tgam\
-ma(3-eps)^(-1)*tgamma(2-eps)*(2539001*(-1+2*eps)*((-2539001/2)*eps^(\
--2)+(-7617003/2+1692800*log(920*scale^(-1))+3385202*log(1301*scale^(\
--1)))*eps^(-1)+F)+2865234972800*(-1+eps)^(-1)*eps^(-2)*(920*scale^(-\
-1))^(-2*eps)*(1301*scale^(-1))^(-2*eps)*tgamma(1+eps)^2+846201*((-25\
-39001/2)*eps^(-2)+(-7617003/2+1692800*log(920*scale^(-1))+3385202*lo\
-g(1301*scale^(-1)))*eps^(-1)+F))\
-");
- const symbol eps("eps"), scale("scale"), mb("mb"), F("F");
- const lst syms(eps, scale, mb, F);
- const ex e0(e_str, syms);
-
- unsigned i = 0;
- unsigned n_failures = 0;
-
- ex e;
- try {
- for (; i < N; i++)
- e = e0.series(eps, 1).subs(Euler==0).expand();
- } catch (std::bad_alloc) {
- return i;
- }
- return 0;
-}
-
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-
-static void set_VM_limit(const unsigned long MB) {
- const unsigned mem_lim_kb = MB*1024*1024;
- struct rlimit lim;
- lim.rlim_cur = mem_lim_kb;
- lim.rlim_max = mem_lim_kb;
- setrlimit(RLIMIT_AS, &lim);
-}
-
-int main(int argc, char** argv) {
- static const unsigned max_mem = 32; // megabytes
- // otherwise one need wait for a long[er] time.
- set_VM_limit(max_mem);
- static const unsigned n_of_tests = 10000;
- const unsigned n_loops = check_mul_eval_memleak(n_of_tests);
- if (n_loops) {
- cerr << "memory exhausted after " << n_loops << " loops" << endl;
- return 1;
- }
- return 0;
-}
+++ /dev/null
-/** @file numeric_archive.cpp
- *
- * Check for a bug in numeric::archive
- *
- * numeric::archive used to fail if the real part of a complex number
- * is a rational number and the imaginary part is a floating point one. */
-
-/*
- * GiNaC Copyright (C) 1999-2020 Johannes Gutenberg University Mainz, Germany
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "ginac.h"
-using namespace GiNaC;
-
-#include <algorithm>
-#include <cln/cln.h>
-#include <iostream>
-#include <iterator>
-#include <sstream>
-#include <stdexcept>
-#include <vector>
-using namespace cln;
-
-struct archive_unarchive_check
-{
- cl_N operator()(const cl_N& n) const
- {
- ex e = numeric(n);
- archive ar;
- ar.archive_ex(e, "test");
- lst l;
- ex check = ar.unarchive_ex(l, "test");
- if (!check.is_equal(e)) {
- std::ostringstream s;
- s << __FILE__ << ':' << __LINE__ << ": expected: " << e << ", got " << check;
- throw std::logic_error(s.str());
- }
- return n;
- }
-};
-
-int main(int argc, char** argv)
-{
- const cl_I one(1);
- std::cout << "checking if numeric::archive handles complex numbers properly" << std::endl;
- const cl_R three_fp = cl_float(3.0, default_float_format);
- std::vector<cl_N> numbers;
- numbers.push_back(complex(one, three_fp));
- numbers.push_back(complex(three_fp, one));
- numbers.push_back(complex(three_fp, three_fp));
- numbers.push_back(complex(one, one));
- std::for_each(numbers.begin(), numbers.end(), archive_unarchive_check());
- return 0;
-}
+++ /dev/null
-/** @file parser_memleak.cpp
- *
- * This small program exhibits the memory leak in the ginac_yylex().
- * Run it as
- *
- * valgrind --leak-check=yes ./parser_memleak
- *
- * or simply
- *
- * ulimit -v `expr 64 \* 1024` ./parser_memleak
- */
-
-/*
- * GiNaC Copyright (C) 1999-2020 Johannes Gutenberg University Mainz, Germany
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <ginac/ginac.h>
-using namespace GiNaC;
-
-#include <iostream>
-#include <stdexcept>
-using namespace std;
-
-int main(int argc, char** argv) {
- const symbol x("x"), y("y");
- const lst syms(x, y);
- // parser-generated symbol => memory leak.
- static const char* str[] = { "x^2+2*x*y + cos(x)", "Li2(x/y) + log(y/x)" };
-
- // depends on the amount of the available VM, compiler options, etc.
- const unsigned N_max = 500000;
- unsigned N=0;
- ex e;
- try {
- for (; N < N_max; N++) {
- e = ex(str[N & 1], syms);
- }
- } catch (std::bad_alloc) {
- cerr << "N = " << N << endl;
- return 1;
- }
- return 0;
-}
+++ /dev/null
-#include <iostream>
-#include <string>
-#include "ginac.h"
-using namespace GiNaC;
-using namespace std;
-
-static const string srep("\
-792*z^8*w^4*x^3*y^4*u^7 + 24*z^4*w^4*x^2*y^3*u^4 \
-+ 264*z^8*w^3*x^2*y^7*u^5 + 198*z^4*w^5*x^5*y*u^6 \
-+ 110*z^2*w^3*x^5*y^4*u^6 - 120*z^8*w*x^4*u^6 \
-- 480*z^5*w*x^4*y^6*u^8 - 720*z^7*x^3*y^3*u^7 \
-+ 165*z^4*w^2*x^4*y*u^5 + 450*z^8*w^6*x^2*y*u^8 \
-+ 40*z^2*w^3*x^3*y^3*u^6 - 288*z^7*w^2*x^3*y^6*u^6 \
-+ 250*z^6*w^4*x^2*y^4*u^8 + 576*z^7*w^7*x^2*y^4*u^8 \
-- 80*z^6*w^2*x^5*y^3*u^7 - 144*z^8*w^4*x^5*u^7 \
-+ 120*z^4*w*x^2*y^6*u^6 + 320*z^5*w^5*x^2*y^7*u^8 \
-+ 192*z^7*w^6*x*y^7*u^6 - 12*z^4*w^3*x^3*y^5*u^6 \
-- 36*z^4*w^4*x^4*y^2*u^8 + 72*z^4*w^5*x^3*u^6 \
-- 20*z^2*w^2*x^4*y^5*u^8 + 660*z^8*w*x^2*y^4*u^6 \
-+ 66*z^4*w^4*x^4*y^4*u^4 + 440*z^6*w^2*x^3*y^7*u^7 \
-- 30*z^4*w*x^3*y^2*u^7 - 48*z^8*w^3*x^4*y^3*u^5 \
-+ 72*z^6*w^2*x*y^6*u^4 - 864*z^7*w^3*x^4*y^3*u^8 \
-+ 480*z^7*w^4*x*y^4*u^7 + 60*z^4*w^2*x^2*u^5 \
-+ 375*z^8*w^3*x*y*u^7 + 150*z^8*w^5*x*y^4*u^6 \
-+ 180*z^6*x*y^3*u^5 + 216*z^6*w^3*x^2*y^3*u^6");
-
-int main(int argc, char** argv)
-{
- cout << "Checking for more pgcd() bugs (infinite loop, miscalculation) ... " << flush;
- parser the_parser;
- ex e = the_parser(srep);
- const symbol x = ex_to<symbol>(the_parser.get_syms()["x"]);
- ex g = gcd(e, e.diff(x));
- ex should_be = the_parser(string("u^4*z^2"));
- if (!(g-should_be).expand().is_zero()) {
- cout << "GCD was miscomputed. " << flush;
- return 1;
- }
- cout << "not found. " << flush;
- return 0;
-}
+++ /dev/null
-/** @file pgcd_relatively_prime_bug.cpp
- *
- * A program exposing historical bug in the pgcd() function.
- */
-#include <string>
-#include <iostream>
-#include <utility>
-#include "ginac.h"
-using namespace std;
-using namespace GiNaC;
-
-int main(int argc, char** argv)
-{
- cout << "Checking for pgcd() bug regarding relatively prime polynomials: " << flush;
- const symbol q("q");
- parser reader;
- reader.get_syms().insert(make_pair(string("q"), q));
-
- ex t = reader("-E20^16*E4^8*E5^8*E1^16*q^4"
- "-(E10^24-E20^8*E5^16)*E4^16*E1^8"
- "+E2^24*E20^16*E5^8*q^4");
- ex g = gcd(t.expand(), t.diff(q).expand()) - 1;
- if (!g.is_zero()) {
- cout << " oops!" << endl <<
- "** Error: should be 0, got " << g << endl << flush;
- throw std::logic_error("gcd was miscalculated");
- }
- cout << "not found" << endl << flush;
- return 0;
-}
-