Relying on aligned functions is non-portable.
Reported by Diego Conti <diego.conti@unipi.it>.
-Contacing the developers
-------------------------
+Contacting the developers
+-------------------------
If you have found a bug, have a patch or a question, or would like to
make a suggestion please send email to one of our public mailing lists
cmake/modules/FindGiNaC.cmake \
cmake/modules/FindLibDL.cmake
-BUILD_HELPERS = scripts/yaptu.py scripts/fixupind.py
+BUILD_HELPERS = scripts/yaptu.py
# All the rest of the distributed files
EXTRA_DIST = ginac.pc GiNaC.spec $(BUILD_HELPERS) $(CMAKE_FILES)
This file records noteworthy changes.
+1.8.7 (12 August 2023)
+* Fix series expansion of polynomial(x)^n for small and large n.
+* Fix bugs in internal parser from strings.
+* Make ginsh evaluate line-by-line in non-interactive mode.
+* Several build fixes.
+
+1.8.6 (8 February 2023)
+* Fix wrong numeric info on transcendental functions.
+* Fix crash of evaluation of binomial(n, k) with negative integer n, k.
+
+1.8.5 (1 January 2023)
+* Speed up multivariate polynomial factorization; fix it in some rare
+ corner cases where it didn't previously terminate.
+
1.8.4 (19 September 2022)
* Add support for sqrfree_parfrac().
* Add info methods for transcendental functions.
* Test of Chinese remainder algorithm. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* functions. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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 underlying symbolic manipulations. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* manipulations. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* tests on these numbers like is_integer() etc... */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
*/
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Here we test GiNaC's archiving system. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* A small program exposing historical bug in poly_cra function. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Here we test GiNaC's Clifford algebra objects. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
*/
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Here we test GiNaC's color objects (su(3) Lie algebra). */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Tests for symbolic differentiation, including various functions. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Factorization test suite. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* endless loop or (even worse) wrong result. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Here we test manipulations on GiNaC's indexed objects. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* functions. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* functions. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* functions. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Comparison data for the test of polylogarithms. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* These exams test solving small linear systems of symbolic equations. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* https://www.ginac.de/pipermail/ginac-devel/2006-April/000942.html */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Here we examine manipulations on GiNaC's symbolic matrices. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
*/
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
*/
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Rational function normalization test suite. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* tests on these numbers like is_integer() etc... */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* these oopses for good, so we run those stupid tests... */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Check for some silly bugs in the parser. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
}
}
+// Check that two strings parse to equal expressions.
+static int check_eq(ostream &err_str, parser &reader, const char *expr1, const char *expr2)
+{
+ const string srep1(expr1);
+ const string srep2(expr2);
+ ex e1, e2;
+ try{ e1 = reader(srep1); } catch (const exception &e) {
+ err_str << "\"" << srep1 << "\" failed to parse: "
+ << e.what() << endl;
+ return 1;
+ }
+ try{ e2 = reader(srep2); } catch (const exception &e) {
+ err_str << "\"" << srep2 << "\" failed to parse: "
+ << e.what() << endl;
+ return 1;
+ }
+ if (!(e1-e2).expand().is_zero()) {
+ err_str << "\"" << srep1 << "\" was misparsed as \""
+ << e1 << "\"" << endl;
+ return 1;
+ }
+ return 0;
+}
+
+// Tests for the interaction of the '^' operator with
+// the unary '+' and the unary '-' operators
+static int check5(ostream& err_str)
+{
+ parser reader;
+ return
+ +check_eq(err_str, reader, "3^2+1", "10")
+ +check_eq(err_str, reader, "3^+2-1", "8")
+ +check_eq(err_str, reader, "3^-2+1", "10/9")
+ +check_eq(err_str, reader, "3^-2/5", "1/45")
+ +check_eq(err_str, reader, "3^-2*5", "5/9")
+ +check_eq(err_str, reader, "3^-2-5", "-44/9")
+ +check_eq(err_str, reader, "3^(-2)+1", "10/9")
+ +check_eq(err_str, reader, "(3)^(-2)+1", "10/9")
+ +check_eq(err_str, reader, "+3^2+1", "10")
+ +check_eq(err_str, reader, "+3^+2+1", "10")
+ +check_eq(err_str, reader, "+3^-2+1", "10/9")
+ +check_eq(err_str, reader, "+3^-2/5", "1/45")
+ +check_eq(err_str, reader, "+3^-2*5", "5/9")
+ +check_eq(err_str, reader, "+3^-2-5", "-44/9")
+ +check_eq(err_str, reader, "-3^2+1", "-8")
+ +check_eq(err_str, reader, "-3^+2+1", "-8")
+ +check_eq(err_str, reader, "-3^-2+1", "8/9")
+ +check_eq(err_str, reader, "-3^-2/3", "-1/27")
+ +check_eq(err_str, reader, "1+2^3^4", "1+(2^81)")
+ +check_eq(err_str, reader, "2^3^4+1", "1+(2^81)")
+ +check_eq(err_str, reader, "2^+3^4+1", "1+(2^81)")
+ +check_eq(err_str, reader, "2^3^+4+1", "1+(2^81)");
+}
+
+// Tests for the interaction of the '*' operator with
+// the unary '+' and the unary '-' operators
+static int check6(ostream& err_str)
+{
+ parser reader;
+ return
+ +check_eq(err_str, reader, "3*+2-1", "5")
+ +check_eq(err_str, reader, "3*2+1", "7")
+ +check_eq(err_str, reader, "3*+2+1", "7")
+ +check_eq(err_str, reader, "3*-2+1", "-5")
+ +check_eq(err_str, reader, "3*-2/5", "-6/5")
+ +check_eq(err_str, reader, "3*-2*5", "-30")
+ +check_eq(err_str, reader, "3*-2-5", "-11")
+ +check_eq(err_str, reader, "3*(-2)+1", "-5")
+ +check_eq(err_str, reader, "(3)*(-2)+1", "-5")
+ +check_eq(err_str, reader, "+3*2+1", "7")
+ +check_eq(err_str, reader, "+3*+2+1", "7")
+ +check_eq(err_str, reader, "+3*-2+1", "-5")
+ +check_eq(err_str, reader, "+3*-2/5", "-6/5")
+ +check_eq(err_str, reader, "+3*-2*5", "-30")
+ +check_eq(err_str, reader, "+3*-2-5", "-11")
+ +check_eq(err_str, reader, "-3*2+1", "-5")
+ +check_eq(err_str, reader, "-3*+2+1", "-5")
+ +check_eq(err_str, reader, "-3*-2+1", "7")
+ +check_eq(err_str, reader, "-3*-2/3", "2")
+ +check_eq(err_str, reader, "1+2*3*4", "25")
+ +check_eq(err_str, reader, "2*3*4+1", "25")
+ +check_eq(err_str, reader, "2*+3*4+1", "25")
+ +check_eq(err_str, reader, "2*3*+4+1", "25");
+}
+
+// Tests for nested unary + and unary -
+static int check7(ostream& err_str)
+{
+ parser reader;
+ return
+ +check_eq(err_str, reader, "+1", "1")
+ +check_eq(err_str, reader, "++1", "1")
+ +check_eq(err_str, reader, "+-+1", "-1")
+ +check_eq(err_str, reader, "+-+-1", "1")
+ +check_eq(err_str, reader, "+-+-+1", "1")
+ +check_eq(err_str, reader, "100++--+1+10", "111");
+}
+
int main(int argc, char** argv)
{
cout << "examining old parser bugs" << flush;
errors += check2(err_str); cout << '.' << flush;
errors += check3(err_str); cout << '.' << flush;
errors += check4(err_str); cout << '.' << flush;
+ errors += check5(err_str); cout << '.' << flush;
+ errors += check6(err_str); cout << '.' << flush;
+ errors += check7(err_str); cout << '.' << flush;
if (errors) {
cout << "Yes, unfortunately:" << endl;
cout << err_str.str();
* rational function normalization in normalization.cpp. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* this code, it is a sanity check rather deeply rooted in GiNaC's classes. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Series expansion test (Laurent and Taylor series). */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
return result;
}
+// Test expansion of powers of polynomials.
+static unsigned exam_series15()
+{
+ unsigned result = 0;
+
+ ex e = pow(x + pow(x,2), 2);
+
+ result += check_series(e, 0, Order(1), 0);
+ result += check_series(e, 0, Order(x), 1);
+ result += check_series(e, 0, Order(pow(x,2)), 2);
+ result += check_series(e, 0, pow(x,2) + Order(pow(x,3)), 3);
+ result += check_series(e, 0, pow(x,2) + 2*pow(x,3) + Order(pow(x,4)), 4);
+ result += check_series(e, 0, pow(x,2) + 2*pow(x,3) + pow(x,4), 5);
+ result += check_series(e, 0, pow(x,2) + 2*pow(x,3) + pow(x,4), 6);
+
+ return result;
+}
+
unsigned exam_pseries()
{
unsigned result = 0;
result += exam_series12(); cout << '.' << flush;
result += exam_series13(); cout << '.' << flush;
result += exam_series14(); cout << '.' << flush;
+ result += exam_series15(); cout << '.' << flush;
return result;
}
*/
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Small test for the relational objects and their conversion to bool. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
*/
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Small test for the structure<> template. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* input in the consistency checks. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
*/
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Utility functions for benchmarking. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
*/
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* after which e should be just a1^2. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
*/
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Some timings on series expansion of the Gamma function around a pole. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Lewis and Michael Wester. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Lewis and Michael Wester. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Lewis and Michael Wester. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Lewis and Michael Wester. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Lewis and Michael Wester. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Lewis and Michael Wester. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Lewis and Michael Wester. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Lewis and Michael Wester. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* by Robert H. Lewis and Michael Wester. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Lewis and Michael Wester. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Lewis and Michael Wester. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Fermat-test). */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Lewis and Michael Wester. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Lewis and Michael Wester. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Lewis and Michael Wester. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Lewis and Michael Wester. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Lewis and Michael Wester. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Time the parser. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
*/
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Time the different GCD algorithms. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
*/
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* A simple stop watch class. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* A simple stop watch class. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
# Output a system dependent set of variables, describing how to set the
# run time search path of shared libraries in an executable.
#
-# Copyright 1996-2015 Free Software Foundation, Inc.
+# Copyright 1996-2023 Free Software Foundation, Inc.
# Taken from GNU libtool, 2001
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
#
hardcode_direct=yes
hardcode_minus_L=yes
;;
- freebsd* | dragonfly*)
+ freebsd* | dragonfly* | midnightbsd*)
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
;;
freebsd[23].*)
library_names_spec='$libname$shrext$versuffix'
;;
- freebsd* | dragonfly*)
+ freebsd* | dragonfly* | midnightbsd*)
library_names_spec='$libname$shrext'
;;
gnu*)
AC_PATH_PROG(MAKEINDEX, makeindex, "")
AC_PATH_PROG(MAKEINFO, makeinfo, "")
AC_PATH_PROG(DVIPS, dvips, "")
-AM_CONDITIONAL(CONFIG_TEX, [test ! \( -z "$LATEX" -o -z $"PDFLATEX" -o -z "$MAKEINDEX" -o -z "$DVIPS" \)])
+AM_CONDITIONAL(CONFIG_TEX, [test ! \( -z "$LATEX" -o -z "$PDFLATEX" -o -z "$MAKEINDEX" -o -z "$DVIPS" \)])
AC_PATH_PROG(FIG2DEV, fig2dev, "")
AM_CONDITIONAL(CONFIG_FIG2DEV, [test ! -z "$FIG2DEV"])
AS_IF([test -z "$FIG2DEV" -o -z "$MAKEINFO"],
set(_idx ${_dirname}/${_basename}.idx)
set(_ind ${_dirname}/${_basename}.ind)
set(_pdf ${_dirname}/${_basename}.pdf)
- set(_fixupind ${CMAKE_SOURCE_DIR}/scripts/fixupind.py)
add_custom_command(
OUTPUT ${_idx}
COMMAND ${PDFLATEX_COMPILER} ${texfile}
add_custom_command(
OUTPUT ${_ind}
COMMAND ${MAKEINDEX_COMPILER} ${_idx}
- COMMAND ${PYTHON} ${_fixupind} ${_idx}
WORKING_DIRECTORY ${_dirname}
DEPENDS ${texfile} ${_idx}
COMMENT "MAKEINDEX ${_basename}.idx")
cd pdflatex; \
${PDFLATEX} reference.tex ;\
${MAKEINDEX} reference.idx ;\
- ${PYTHON} $(abs_top_srcdir)/scripts/fixupind.py reference.ind; \
${PDFLATEX} reference.tex
reference.dvi: latex latex/reference.dvi
This is a tutorial that documents GiNaC @value{VERSION}, an open
framework for symbolic computation within the C++ programming language.
-Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+Copyright (C) 1999-2024 Johannes Gutenberg University Mainz, Germany
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@page
@vskip 0pt plus 1filll
-Copyright @copyright{} 1999-2023 Johannes Gutenberg University Mainz, Germany
+Copyright @copyright{} 1999-2024 Johannes Gutenberg University Mainz, Germany
@sp 2
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@section License
The GiNaC framework for symbolic computation within the C++ programming
-language is Copyright @copyright{} 1999-2023 Johannes Gutenberg
+language is Copyright @copyright{} 1999-2024 Johannes Gutenberg
University Mainz, Germany.
This program is free software; you can redistribute it and/or
The @code{dirac_trace()} function is a linear functional that is equal to the
ordinary matrix trace only in @math{D = 4} dimensions. In particular, the
functional is not cyclic in
-@tex $D \ne 4$
+@tex
+$D \ne 4$
@end tex
@ifnottex
@math{D != 4}
@cite{The Role of gamma5 in Dimensional Regularization} (@ref{Bibliography}).
The value of the trace itself is also usually different in 4 and in
-@tex $D \ne 4$
+@tex
+$D \ne 4$
@end tex
@ifnottex
@math{D != 4}
@subsubsection A generic Clifford algebra
A generic Clifford algebra, i.e. a
-@tex $2^n$
+@tex
+$2^n$
@end tex
@ifnottex
2^n
@end ifnottex
-dimensional algebra with
-generators
-@tex $e_k$
-@end tex
+dimensional algebra with generators
+@tex
+$e_k$
+@end tex
@ifnottex
e_k
@end ifnottex
* Implementation of GiNaC's sums of expressions. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Interface to GiNaC's sums of expressions. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Archiving of GiNaC expressions. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Archiving of GiNaC expressions. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Assertion macro definition. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Implementation of GiNaC's ABC. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Interface to GiNaC's ABC. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Helper templates to provide per-class information for class hierarchies. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Implementation of GiNaC's clifford algebra (Dirac gamma) objects. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Interface to GiNaC's clifford algebra (Dirac gamma) objects. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* if e contains at least one, otherwise returns -1
*
* @param e Expression to be processed
- * @ignore_ONE defines if clifford_ONE should be ignored in the search*/
+ * @param ignore_ONE defines if clifford_ONE should be ignored in the search */
int clifford_max_label(const ex & e, bool ignore_ONE = false);
/** Calculation of the norm in the Clifford algebra. */
* @param mu Index (must be of class varidx or a derived class)
* @param metr Metric (should be indexed, tensmetric or a derived class, or a matrix)
* @param rl Representation label
- * @param e Clifford unit object
* @return Clifford vector with given components */
ex lst_to_clifford(const ex & v, const ex & mu, const ex & metr, unsigned char rl = 0);
+
+/** List or vector conversion into the Clifford vector.
+ *
+ * @param v List or vector of coordinates
+ * @param e Clifford unit object
+ * @return Clifford vector with given components */
ex lst_to_clifford(const ex & v, const ex & e);
/** An inverse function to lst_to_clifford(). For given Clifford vector extracts
* Implementation of GiNaC's color (SU(3) Lie algebra) objects. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Interface to GiNaC's color (SU(3) Lie algebra) objects. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Definition of optimizing macros. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Implementation of GiNaC's constant types and some special constants. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Interface to GiNaC's constant types and some special constants. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Wrapper template for making GiNaC classes out of STL containers. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Implementation of GiNaC's light-weight expression handles. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
bp->dbgprinttree();
}
+/** Expand an expression.
+ * @param options see GiNaC::expand_options */
ex ex::expand(unsigned options) const
{
if (options == 0 && (bp->flags & status_flags::expanded)) // The "expanded" flag only covers the standard options; someone might want to re-expand with different options
* Interface to GiNaC's light-weight expression handles. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
*/
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* fast numerical integration. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* C code equivalent in double precision. The function pointer has type FUNCP_2P.
*
* @param expr Expression to be compiled
- * @param sym Symbol from the expression to become the function parameter
+ * @param sym1 Symbol from the expression to become the first function parameter
+ * @param sym2 Symbol from the expression to become the second function parameter
* @param fp Returned function pointer
* @param filename Name of the intermediate source code and so-file. If
* supplied, these intermediate files will not be deleted
* Takes an expression and produces a function pointer to the compiled and linked
* C code equivalent in double precision. The function pointer has type FUNCP_CUBA.
*
- * @param expr Expression to be compiled
- * @param sym Symbol from the expression to become the function parameter
+ * @param exprs List of expression to be compiled
+ * @param syms Symbols from the expression to become the function parameters
* @param fp Returned function pointer
* @param filename Name of the intermediate source code and so-file. If
* supplied, these intermediate files will not be deleted
* Implementation of expression pairs (building blocks of expairseq). */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Definition of expression pairs (building blocks of expairseq). */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Implementation of sequences of expression pairs. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Interface to sequences of expression pairs. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Implementation of GiNaC's exprseq. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Definition of GiNaC's exprseq. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
*/
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
copy_if(syms.begin(), syms.end(),
inserter(syms_wox, syms_wox.end()), [x](const ex& y){ return y != x; });
- factorization_ctx ctx = {.poly = poly, .x = x,
- .syms_wox = syms_wox};
+ factorization_ctx ctx{poly, x, syms_wox};
// make polynomial primitive
poly.unitcontprim(x, ctx.unit, ctx.cont, ctx.pp);
ctx.vn = ctx.pp.collect(x).lcoeff(x);
ctx.vnlst = put_factors_into_vec(factor(ctx.vn));
- ctx.modulus = (ctx.vnlst.size() > 3) ? ctx.vnlst.size() : 3;
+ ctx.modulus = (ctx.vnlst.size() > 3) ? ctx.vnlst.size() : numeric(3);
ctx_in_x.push_back(ctx);
}
* Polynomial factorization. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* functions or polynomials inside function arguments.
*
* @param[in] poly expression to factorize
- * @param[in] option options to influence the factorization
+ * @param[in] options see GiNaC::factor_options
* @return factorized expression
*/
extern ex factor(const ex& poly, unsigned options = 0);
* somewhat obsolete (most of this can be replaced by exceptions). */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* somewhat obsolete (most of this can be replaced by exceptions). */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Implementation of abstract derivatives of functions. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Interface to abstract derivatives of functions. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Collection of all flags used through the GiNaC framework. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Please do not modify it directly, edit function.cppy instead!
* function.py options: maxargs=@maxargs@
*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* This file was generated automatically from function.hppy.
* Please do not modify it directly, edit function.hppy instead!
*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* This include file includes all other public GiNaC headers. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Replacement for map<> using hash tables. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Implementation of GiNaC's indices. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Interface to GiNaC's indices. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
/** Construct index with given value and dimension.
*
* @param v Value of index (numeric or symbolic)
- * @param dim Dimension of index space (numeric or symbolic)
- * @return newly constructed index */
+ * @param dim Dimension of index space (numeric or symbolic) */
explicit idx(const ex & v, const ex & dim);
// functions overriding virtual functions from base classes
*
* @param v Value of index (numeric or symbolic)
* @param dim Dimension of index space (numeric or symbolic)
- * @param covariant Make covariant index (default is contravariant)
- * @return newly constructed index */
+ * @param covariant Make covariant index (default is contravariant) */
varidx(const ex & v, const ex & dim, bool covariant = false);
// functions overriding virtual functions from base classes
* @param v Value of index (numeric or symbolic)
* @param dim Dimension of index space (numeric or symbolic)
* @param covariant Make covariant index (default is contravariant)
- * @param dotted Make covariant dotted (default is undotted)
- * @return newly constructed index */
+ * @param dotted Make covariant dotted (default is undotted) */
spinidx(const ex & v, const ex & dim = 2, bool covariant = false, bool dotted = false);
// functions overriding virtual functions from base classes
* Implementation of GiNaC's indexed expressions. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Interface to GiNaC's indexed expressions. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
public:
/** Construct indexed object with no index.
*
- * @param b Base expression
- * @return newly constructed indexed object */
+ * @param b Base expression */
indexed(const ex & b);
/** Construct indexed object with one index. The index must be of class idx.
*
* @param b Base expression
- * @param i1 The index
- * @return newly constructed indexed object */
+ * @param i1 The index */
indexed(const ex & b, const ex & i1);
/** Construct indexed object with two indices. The indices must be of class idx.
*
* @param b Base expression
* @param i1 First index
- * @param i2 Second index
- * @return newly constructed indexed object */
+ * @param i2 Second index */
indexed(const ex & b, const ex & i1, const ex & i2);
/** Construct indexed object with three indices. The indices must be of class idx.
* @param b Base expression
* @param i1 First index
* @param i2 Second index
- * @param i3 Third index
- * @return newly constructed indexed object */
+ * @param i3 Third index */
indexed(const ex & b, const ex & i1, const ex & i2, const ex & i3);
/** Construct indexed object with four indices. The indices must be of class idx.
* @param i1 First index
* @param i2 Second index
* @param i3 Third index
- * @param i4 Fourth index
- * @return newly constructed indexed object */
+ * @param i4 Fourth index */
indexed(const ex & b, const ex & i1, const ex & i2, const ex & i3, const ex & i4);
/** Construct indexed object with two indices and a specified symmetry. The
* @param b Base expression
* @param symm Symmetry of indices
* @param i1 First index
- * @param i2 Second index
- * @return newly constructed indexed object */
+ * @param i2 Second index */
indexed(const ex & b, const symmetry & symm, const ex & i1, const ex & i2);
/** Construct indexed object with three indices and a specified symmetry.
* @param symm Symmetry of indices
* @param i1 First index
* @param i2 Second index
- * @param i3 Third index
- * @return newly constructed indexed object */
+ * @param i3 Third index */
indexed(const ex & b, const symmetry & symm, const ex & i1, const ex & i2, const ex & i3);
/** Construct indexed object with four indices and a specified symmetry. The
* @param i1 First index
* @param i2 Second index
* @param i3 Third index
- * @param i4 Fourth index
- * @return newly constructed indexed object */
+ * @param i4 Fourth index */
indexed(const ex & b, const symmetry & symm, const ex & i1, const ex & i2, const ex & i3, const ex & i4);
/** Construct indexed object with a specified vector of indices. The indices
* must be of class idx.
*
* @param b Base expression
- * @param iv Vector of indices
- * @return newly constructed indexed object */
+ * @param iv Vector of indices */
indexed(const ex & b, const exvector & iv);
/** Construct indexed object with a specified vector of indices and
*
* @param b Base expression
* @param symm Symmetry of indices
- * @param iv Vector of indices
- * @return newly constructed indexed object */
+ * @param iv Vector of indices */
indexed(const ex & b, const symmetry & symm, const exvector & iv);
// internal constructors
* Implementation of GiNaC's initially known functions. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
return Order(x).hold();
}
+static ex Order_power(const ex & x, const ex & e)
+{
+ // Order(x)^e -> Order(x^e) for positive integer e
+ if (is_exactly_a<numeric>(e) && e.info(info_flags::posint))
+ return Order(pow(x, e));
+ // NB: For negative exponents, the above could be wrong.
+ // This is because series() produces Order(x^n) to denote the order where
+ // it gave up. So, Order(x^n) can also be an x^(n+1) term if the x^n term
+ // vanishes. In this situation, 1/Order(x^n) can also be a x^(-n-1) term.
+ // Transforming it to Order(x^-n) would miss that.
+
+ return power(Order(x), e).hold();
+}
+
static ex Order_expl_derivative(const ex & arg, const symbol & s)
{
return Order(arg.diff(s));
expl_derivative_func(Order_expl_derivative).
conjugate_func(Order_conjugate).
real_part_func(Order_real_part).
- imag_part_func(Order_imag_part));
+ imag_part_func(Order_imag_part).
+ power_func(Order_power));
//////////
// Solve linear system
* Interface to GiNaC's initially known functions. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
*/
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* some related stuff. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
*/
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* functions. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
static bool exp_info(const ex & x, unsigned inf)
{
switch (inf) {
- case info_flags::numeric:
case info_flags::expanded:
case info_flags::real:
return x.info(inf);
static bool log_info(const ex & x, unsigned inf)
{
switch (inf) {
- case info_flags::numeric:
case info_flags::expanded:
return x.info(inf);
case info_flags::real:
static bool trig_info(const ex & x, unsigned inf)
{
switch (inf) {
- case info_flags::numeric:
case info_flags::expanded:
case info_flags::real:
return x.info(inf);
static bool asin_info(const ex & x, unsigned inf)
{
switch (inf) {
- case info_flags::numeric:
case info_flags::expanded:
return x.info(inf);
default:
static bool atan_info(const ex & x, unsigned inf)
{
switch (inf) {
- case info_flags::numeric:
case info_flags::expanded:
case info_flags::real:
return x.info(inf);
static bool atan2_info(const ex & y, const ex & x, unsigned inf)
{
switch (inf) {
- case info_flags::numeric:
case info_flags::expanded:
case info_flags::real:
return y.info(inf) && x.info(inf);
* Implementation of GiNaC's symbolic integral. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Interface to GiNaC's symbolic integral. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Implementation of GiNaC's integration kernels for iterated integrals. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Interface to GiNaC's integration kernels for iterated integrals. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Implementation of GiNaC's lst. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Definition of GiNaC's lst. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Implementation of symbolic matrices */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Interface to symbolic matrices */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Implementation of GiNaC's products of expressions. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Interface to GiNaC's products of expressions. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Implementation of GiNaC's non-commutative products of expressions. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Interface to GiNaC's non-commutative products of expressions. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* computation, square-free factorization and rational function normalization. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* @param cb pointer to expression that will receive the cofactor of b, or nullptr
* @param check_args check whether a and b are polynomials with rational
* coefficients (defaults to "true")
+ * @param options see GiNaC::gcd_options
* @return the GCD as a new expression */
ex gcd(const ex &a, const ex &b, ex *ca, ex *cb, bool check_args, unsigned options)
{
* computation, square-free factorization and rational function normalization. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* of special functions or implement the interface to the bignum package. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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 Binomial coefficients. It computes the binomial coefficients. For
* integer n and k and positive n this is the number of ways of choosing k
- * objects from n distinct objects. If n is negative, the formula
- * binomial(n,k) == (-1)^k*binomial(k-n-1,k) is used to compute the result. */
+ * objects from n distinct objects. If n is a negative integer, the formula
+ * binomial(n,k) == (-1)^k*binomial(k-n-1,k) (if k>=0)
+ * binomial(n,k) == (-1)^(n-k)*binomial(-k-1,n-k) (otherwise)
+ * is used to compute the result. */
const numeric binomial(const numeric &n, const numeric &k)
{
if (n.is_integer() && k.is_integer()) {
else
return *_num0_p;
} else {
- return _num_1_p->power(k)*binomial(k-n-(*_num1_p),k);
+ if (k.is_nonneg_integer())
+ return _num_1_p->power(k)*binomial(k-n-(*_num1_p), k);
+ else
+ return _num_1_p->power(n-k)*binomial(-k-(*_num1_p), n-k);
}
}
* Makes the interface to the underlying bignum package available. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Implementation of GiNaC's overloaded operators. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Interface to GiNaC's overloaded operators. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Debugging facilities for parser. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
**/
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
registered_functions_hack& operator=(const registered_functions_hack&);
};
-// Encode an integer into a pointer to a function. Since functions
-// are aligned (the minimal alignment depends on CPU architecture)
-// we can distinguish between pointers and integers.
-static reader_func encode_serial_as_reader_func(unsigned serial)
-{
- uintptr_t u = (uintptr_t)serial;
- u = (u << 1) | (uintptr_t)1;
- reader_func ptr = (reader_func)((void *)u);
- return ptr;
-}
-
const prototype_table& get_default_reader()
{
- using std::make_pair;
static bool initialized = false;
static prototype_table reader;
if (!initialized) {
-
- reader[make_pair("sqrt", 1)] = sqrt_reader;
- reader[make_pair("pow", 2)] = pow_reader;
- reader[make_pair("power", 2)] = power_reader;
- reader[make_pair("lst", 0)] = lst_reader;
+
+ reader.insert({{"sqrt", 1}, reader_func(sqrt_reader)});
+ reader.insert({{"pow", 2}, reader_func(pow_reader)});
+ reader.insert({{"power", 2}, reader_func(power_reader)});
+ reader.insert({{"lst", 0}, reader_func(lst_reader)});
unsigned serial = 0;
for (auto & it : registered_functions_hack::get_registered_functions()) {
- prototype proto = make_pair(it.get_name(), it.get_nparams());
- reader[proto] = encode_serial_as_reader_func(serial);
+ reader.insert({{it.get_name(), it.get_nparams()},
+ reader_func(serial)});
++serial;
}
initialized = true;
const prototype_table& get_builtin_reader()
{
- using std::make_pair;
static bool initialized = false;
static prototype_table reader;
if (!initialized) {
-
- reader[make_pair("sqrt", 1)] = sqrt_reader;
- reader[make_pair("pow", 2)] = pow_reader;
- reader[make_pair("power", 2)] = power_reader;
- reader[make_pair("lst", 0)] = lst_reader;
+
+ reader.insert({{"sqrt", 1}, reader_func(sqrt_reader)});
+ reader.insert({{"pow", 2}, reader_func(pow_reader)});
+ reader.insert({{"power", 2}, reader_func(power_reader)});
+ reader.insert({{"lst", 0}, reader_func(lst_reader)});
enum {
log,
exp,
auto it = registered_functions_hack::get_registered_functions().begin();
unsigned serial = 0;
for ( ; serial<NFUNCTIONS; ++it, ++serial ) {
- prototype proto = make_pair(it->get_name(), it->get_nparams());
- reader[proto] = encode_serial_as_reader_func(serial);
+ reader.insert({{it->get_name(), it->get_nparams()},
+ reader_func(serial)});
}
initialized = true;
}
* Implementation of GiNaC's lexer. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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 lexer. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Code to deal with binary operators. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
}
}
+/// unary_expr: [+-] expression
+ex parser::parse_unary_expr()
+{
+ // Parse a binary expression with the priority of exponentiation
+ // or higher. Ignore the overall sign, because parse_primary()
+ // handles it for us.
+ get_next_tok(); // Skip [+-]
+ ex lhs = parse_primary();
+ ex e = parse_binop_rhs(get_tok_prec('^'), lhs);
+ return e;
+}
+
extern const numeric* _num_1_p;
static ex make_minus_expr(const exvector& args)
return dynallocate<mul>(args[0], rest);
}
+static ex make_power_expr(const exvector& args)
+{
+ size_t n = args.size();
+ ex p = pow(args[n - 2], args[n - 1]);
+ for (size_t i = n - 2; i > 0; i--) {
+ p = pow(args[i - 1], p);
+ }
+ return p;
+}
+
static ex make_binop_expr(const int binop, const exvector& args)
{
switch (binop) {
case '/':
return make_divide_expr(args);
case '^':
- if (args.size() != 2)
- throw std::invalid_argument(
- std::string(__func__)
- + ": power should have exactly 2 operands");
- return pow(args[0], args[1]);
+ return make_power_expr(args);
default:
throw std::invalid_argument(
std::string(__func__)
* Implementation of the parser context. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Interface to parser context. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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 parser uses (an associative array of) such functions to construct
* (GiNaC) classes and functions from a sequence of characters.
*/
-typedef ex (*reader_func)(const exvector& args);
+class reader_func {
+ enum { FUNCTION_PTR, GINAC_FUNCTION };
+public:
+ reader_func(ex (*func_)(const exvector& args))
+ : type(FUNCTION_PTR), serial(0), func(func_) {}
+ reader_func(unsigned serial_)
+ : type(GINAC_FUNCTION), serial(serial_), func(nullptr) {}
+ ex operator()(const exvector& args) const;
+private:
+ unsigned type;
+ unsigned serial;
+ ex (*func)(const exvector& args);
+};
+
+
/**
* Prototype table.
* Implementation of GiNaC's parser. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
#include "mul.h"
#include "constant.h"
#include "function.h"
+#include "operators.h"
#include <cstdint> // for uintptr_t
#include <sstream>
namespace GiNaC {
-// <KLUDGE>
-// Find out if ptr is a pointer to a function or a specially crafted integer.
-// It's possible to distinguish between these because functions are aligned.
-// Returns true if ptr is a pointer and false otherwise.
-static bool decode_serial(unsigned& serial, const reader_func ptr)
+ex reader_func::operator()(const exvector& args) const
{
- uintptr_t u = (uintptr_t)(void *)ptr;
- if (u & 1) {
- u >>= 1;
- serial = (unsigned)u;
- return false;
- }
- return true;
-}
-
-// Figures out if ptr is a pointer to function or a serial of GiNaC function.
-// In the former case calls that function, in the latter case constructs
-// GiNaC function with corresponding serial and arguments.
-static ex dispatch_reader_fcn(const reader_func ptr, const exvector& args)
-{
- unsigned serial = 0; // dear gcc, could you please shut up?
- bool is_ptr = decode_serial(serial, ptr);
- if (is_ptr)
- return ptr(args);
- else
+ switch (type) {
+ case FUNCTION_PTR:
+ return func(args);
+ case GINAC_FUNCTION:
return function(serial, args);
+ default:
+ abort();
+ }
}
-// </KLUDGE>
-
/// identifier_expr: identifier | identifier '(' expression* ')'
ex parser::parse_identifier_expr()
}
// Eat the ')'.
get_next_tok();
- prototype the_prototype = make_pair(name, args.size());
- auto reader = funcs.find(the_prototype);
+ auto reader = funcs.find({name, args.size()});
if (reader == funcs.end()) {
Parse_error_("no function \"" << name << "\" with " <<
args.size() << " arguments");
}
// reader->second might be a pointer to a C++ function or a specially
// crafted serial of a GiNaC::function.
- ex ret = dispatch_reader_fcn(reader->second, args);
- return ret;
+ return reader->second(args);
}
/// paren_expr: '(' expression ')'
return list;
}
-extern const ex _ex0;
-
-/// unary_expr: [+-] expression
-ex parser::parse_unary_expr()
-{
- // Unlike most other parse_* method this one does NOT consume
- // current token so parse_binop_rhs() knows what kind of operator
- // is being parsed.
-
- // There are different kinds of expressions which need to be handled:
- // -a+b
- // -(a)
- // +a
- // +(a)
- // Delegate the work to parse_binop_rhs(), otherwise we end up
- // duplicating it here.
- ex lhs = _ex0; // silly trick
- ex e = parse_binop_rhs(0, lhs);
- return e;
-}
-
/// primary: identifier_expr | number_expr | paren_expr | unary_expr
ex parser::parse_primary()
{
case '{':
return parse_lst_expr();
case '-':
+ return -parse_unary_expr();
case '+':
return parse_unary_expr();
case lexer::token_type::literal:
get_next_tok();
ex ret = parse_expression();
// parse_expression() stops if it encounters an unknown token.
- // This is not a bug: since the parser is recursive checking
+ // This is not a bug: since the parser is recursive, checking
// whether the next token is valid is responsibility of the caller.
// Hence make sure nothing is left in the stream:
if (token != lexer::token_type::eof)
* Interface to the parser. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Parser interface compatible with the old (bison/flex based) parser. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Chinese remainder algorithm. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Interface to GCD functions using Chinese remainder algorithm. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Utility functions. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Interface to utility functions. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Garner's algorithm. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Interface to Garner's algorithm. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Utility macros and functions for debugging. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Implementation of polynomial division in Z/Zp. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Interface to polynomial division in Z/Zp. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Euclidean GCD and supporting functions. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Functions for finding an evaluation point. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Numerical evaluation of univariate polynomials. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* GCD using Euclidean algorithm. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Several GCD algorithms. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Heuristic GCD code. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Utility function for interpolation. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Chinese remainder algorithm. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Implementation of modular GCD. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Interface to modular GCD. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Functions for Newton interpolation. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Functions to normalize polynomials in a field. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Functions to normalize polynomials in a field. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Functions to optimize the choice of variable for multivariate GCD. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* computations. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* GCD for polynomials in prime field. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Interface to GCD functions for polynomials over prime fields. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Chinese remainder algorithm. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Function to calculate the pseudo-remainder. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Factory for prime numbers. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Function to find primitive part of a multivariate polynomial. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Functions calculating remainders. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Functions calculating remainders. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Functions for polynomial ring arithmetic. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Utility functions for modular arithmetic. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* GCD function for univariate polynomials using PRS method. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Interface to polynomials with integer and modular coefficients. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Input/Output function for univariate polynomials. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Output operators for polynomials. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Implementation of GiNaC's symbolic exponentiation (basis^exponent). */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Interface to GiNaC's symbolic exponentiation (basis^exponent). */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Implementation of helper classes for expression output. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Definition of helper classes for expression output. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* methods for series expansion. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* non-terminating series.
*
* @param rel_ expansion variable and point (must hold a relational)
- * @param ops_ vector of {coefficient, power} pairs (coefficient must not be zero)
- * @return newly constructed pseries */
+ * @param ops_ vector of {coefficient, power} pairs (coefficient must not be zero) */
pseries::pseries(const ex &rel_, const epvector &ops_)
: seq(ops_)
{
// which can easily be solved given the starting value c_0 = (a_0)^p.
// For the more general case where the leading coefficient of A(x) is not
// a constant, just consider A2(x) = A(x)*x^m, with some integer m and
- // repeat the above derivation. The leading power of C2(x) = A2(x)^2 is
- // then of course x^(p*m) but the recurrence formula still holds.
+ // repeat the above derivation. The leading power of C2(x) = A2(x)^p is
+ // then of course a_0^p*x^(p*m) but the recurrence formula still holds.
if (seq.empty()) {
// as a special case, handle the empty (zero) series honoring the
else
return *this;
}
-
- const int ldeg = ldegree(var);
- if (!(p*ldeg).is_integer())
+
+ const int base_ldeg = ldegree(var);
+ if (!(p*base_ldeg).is_integer())
throw std::runtime_error("pseries::power_const(): trying to assemble a Puiseux series");
+ int new_ldeg = (p*base_ldeg).to_int();
+
+ const int base_deg = degree(var);
+ int new_deg = deg;
+ if (p.is_pos_integer()) {
+ // No need to compute beyond p*base_deg.
+ new_deg = std::min((p*base_deg).to_int(), deg);
+ }
// adjust number of coefficients
- int numcoeff = deg - (p*ldeg).to_int();
+ int numcoeff = new_deg - new_ldeg;
+ if (new_deg < deg)
+ numcoeff += 1;
+
if (numcoeff <= 0) {
- epvector epv { expair(Order(_ex1), deg) };
- return dynallocate<pseries>(relational(var,point), std::move(epv));
+ return dynallocate<pseries>(relational(var, point),
+ epvector{{Order(_ex1), deg}});
}
// O(x^n)^(-m) is undefined
// Compute coefficients of the powered series
exvector co;
co.reserve(numcoeff);
- co.push_back(pow(coeff(var, ldeg), p));
+ co.push_back(pow(coeff(var, base_ldeg), p));
for (int i=1; i<numcoeff; ++i) {
ex sum = _ex0;
for (int j=1; j<=i; ++j) {
- ex c = coeff(var, j + ldeg);
+ ex c = coeff(var, j + base_ldeg);
if (is_order_function(c)) {
co.push_back(Order(_ex1));
break;
} else
sum += (p * j - (i - j)) * co[i - j] * c;
}
- co.push_back(sum / coeff(var, ldeg) / i);
+ co.push_back(sum / coeff(var, base_ldeg) / i);
}
// Construct new series (of non-zero coefficients)
epvector new_seq;
bool higher_order = false;
for (int i=0; i<numcoeff; ++i) {
- if (!co[i].is_zero())
- new_seq.emplace_back(expair(co[i], p * ldeg + i));
+ if (!co[i].is_zero()) {
+ new_seq.emplace_back(expair(co[i], new_ldeg + i));
+ }
if (is_order_function(co[i])) {
higher_order = true;
break;
}
}
- if (!higher_order)
- new_seq.emplace_back(expair(Order(_ex1), p * ldeg + numcoeff));
+ if (!higher_order && new_deg == deg) {
+ new_seq.emplace_back(expair{Order(_ex1), new_deg});
+ }
return pseries(relational(var,point), std::move(new_seq));
}
if (!(real_ldegree*numexp).is_integer())
throw std::runtime_error("pseries::power_const(): trying to assemble a Puiseux series");
- ex e = basis.series(r, (order + real_ldegree*(1-numexp)).to_int(), options);
+ int extra_terms = (real_ldegree*(1-numexp)).to_int();
+ ex e = basis.series(r, order + std::max(0, extra_terms), options);
ex result;
try {
* Interface to class for extended truncated power series. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Reference-counted pointer template. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* GiNaC's class registrar (for class basic and all classes derived from it). */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* GiNaC's class registrar (for class basic and all classes derived from it). */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Implementation of relations between expressions */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Interface to relations between expressions. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* in GiNaC functions */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* in GiNaC functions */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Wrapper template for making GiNaC classes out of C++ structures. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Implementation of GiNaC's symbolic objects. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Interface to GiNaC's symbolic objects. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Implementation of GiNaC's symmetry definitions. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Interface to GiNaC's symmetry definitions. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Implementation of GiNaC's special tensors. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Interface to GiNaC's special tensors. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* but not of any interest to the user of the library. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* of any interest to the user of the library. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Utilities for summing over multiple indices */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* GiNaC library version information. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
#define GINACLIB_MINOR_VERSION 8
/* Micro version of GiNaC */
-#define GINACLIB_MICRO_VERSION 4
+#define GINACLIB_MICRO_VERSION 7
// GiNaC library version information. It has very little to do with GiNaC
// version number. In particular, library version is OS dependent.
// * change matrix inverse to use default argument (twice)
// * check for interfaces marked as deprecated
#define GINAC_LT_CURRENT 12
-#define GINAC_LT_REVISION 3
+#define GINAC_LT_REVISION 6
#define GINAC_LT_AGE 1
/*
* Implementation of GiNaC's wildcard objects. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* Interface to GiNaC's wildcard objects. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
.PP
CLN \- A Class Library for Numbers, Bruno Haible
.SH COPYRIGHT
-Copyright \(co 1999-2023 Johannes Gutenberg Universit\(:at Mainz, Germany
+Copyright \(co 1999-2024 Johannes Gutenberg Universit\(:at 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
*
* Global definitions for ginsh.
*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* functions. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
* This file must be processed with flex. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
YY_FATAL_ERROR("input in flex scanner failed");
result = n;
#endif
- } else if (((result = fread(buf, 1, max_size, yyin)) == 0) && ferror(yyin))
- YY_FATAL_ERROR("input in flex scanner failed");
+ } else {
+ int c = '*', n;
+ for (n = 0; n < max_size && (c = getc(yyin)) != EOF && c != '\n'; ++n)
+ buf[n] = (char)c;
+ if (c == '\n')
+ buf[n++] = (char)c;
+ if (c == EOF && ferror(yyin))
+ YY_FATAL_ERROR("input in flex scanner failed");
+ result = n;
+ }
return result;
}
* This file must be processed with yacc/bison. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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
void greeting(void)
{
cout << "ginsh - GiNaC Interactive Shell (GiNaC V" << GINACLIB_VERSION << ")" << endl;
- cout << " __, _______ Copyright (C) 1999-2023 Johannes Gutenberg University Mainz,\n"
+ cout << " __, _______ Copyright (C) 1999-2024 Johannes Gutenberg University Mainz,\n"
<< " (__) * | Germany. This is free software with ABSOLUTELY NO WARRANTY.\n"
<< " ._) i N a C | You are welcome to redistribute it under certain conditions.\n"
<< "<-------------' For details type `warranty;'.\n" << endl;
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 15
+#serial 18
dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro
dnl (serial version number 13).
dnl HP's aCC needs +std=c++11 according to:
dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf
dnl Cray's crayCC needs "-h std=c++11"
+ dnl MSVC needs -std:c++NN for C++17 and later (default is C++14)
for alternative in ${ax_cxx_compile_alternatives}; do
- for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do
- cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch])
+ for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}" MSVC; do
+ if test x"$switch" = xMSVC; then
+ dnl AS_TR_SH maps both `:` and `=` to `_` so -std:c++17 would collide
+ dnl with -std=c++17. We suffix the cache variable name with _MSVC to
+ dnl avoid this.
+ switch=-std:c++${alternative}
+ cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_${switch}_MSVC])
+ else
+ cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch])
+ fi
AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch,
$cachevar,
[ac_save_CXX="$CXX"
# host-cpu-c-abi.m4 serial 15
-dnl Copyright (C) 2002-2022 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
# lib-ld.m4 serial 10
-dnl Copyright (C) 1996-2003, 2009-2022 Free Software Foundation, Inc.
+dnl Copyright (C) 1996-2003, 2009-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
# lib-link.m4 serial 33
-dnl Copyright (C) 2001-2022 Free Software Foundation, Inc.
+dnl Copyright (C) 2001-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
additional_libdir3=
fi
dnl Search the library and its dependencies in $additional_libdir and
- dnl $LDFLAGS. Using breadth-first-seach.
+ dnl $LDFLAGS. Use breadth-first search.
LIB[]NAME=
LTLIB[]NAME=
INC[]NAME=
# lib-prefix.m4 serial 20
-dnl Copyright (C) 2001-2005, 2008-2022 Free Software Foundation, Inc.
+dnl Copyright (C) 2001-2005, 2008-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
+++ /dev/null
-
-# encoding: utf-8
-# TeX Live 2012 seems to dislike files produces by doxygen (1.8.x.y)
-# In particular, makeindex(1) program creates invalid index entries like
-# \hyperpage{NNN_}
-# (note the trailing underscore in the page number). This breaks automatic
-# builds and is very annoying. Hence this script. It replaces (broken)
-# \hyperpage{NNN_} with \hyperpage{NNN}.
-# Note: this is an ugly work around, a proper fix is welcome.
-import sys, os, re
-
-def fixupind(fname):
- """ Fix \\hyperpage{NNN_} entries in the ind file @var{fname} """
- tmpout = fname + '.tmp'
- inp = open(fname)
- out = open(tmpout, 'wt')
- rx = re.compile('(hyperpage)[{]([0-9]+)[_][}]')
- for line in inp:
- out.write(re.sub(rx, '\\1{\\2}', line))
- out.flush()
- out.close()
- inp.close()
- os.rename(tmpout, fname)
-
-if __name__ == '__main__':
- if len(sys.argv) <= 1:
- sys.exit(1)
- fixupind(sys.argv[1])
- sys.exit(0)
-
GiNaC Tutorial \- An open framework for symbolic computation within the
C++ programming language
.SH COPYRIGHT
-Copyright \(co 1999-2023 Johannes Gutenberg Universit\(:at Mainz, Germany
+Copyright \(co 1999-2024 Johannes Gutenberg Universit\(:at 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
* GiNaC archive file viewer. */
/*
- * GiNaC Copyright (C) 1999-2023 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2024 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