ginac.git
3 weeks agoRemove executable file attribute from last Python script. master
Richard Kreckel [Sat, 29 Aug 2020 18:22:49 +0000 (20:22 +0200)]
Remove executable file attribute from last Python script.

They are all invoked by ${PYTHON} and lack a shebang line since 8a4e28dc81.

3 weeks agobuild: use bundled CLN if available
Alexey Sheplyakov [Thu, 19 Dec 2019 14:17:41 +0000 (18:17 +0400)]
build: use bundled CLN if available

So one can unpack CLN tarball (or clone CLN git repository) and compile
both CLN and GiNaC in one pass:

git clone git://ginac.de/ginac.git
cd ginac
git clone git://www.ginac.de/cln.git
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo .. && make

3 weeks agoUse "modern" CMake facilities to manage includes and libs
Alexey Sheplyakov [Wed, 18 Dec 2019 10:52:17 +0000 (14:52 +0400)]
Use "modern" CMake facilities to manage includes and libs

* Use target_link_libraries to specify dependencies (include paths,
  compiler options, etc)

* Export targets and provide `ginac-config.cmake` so the following
  `CMakeLists.txt` is enough to build a program using GiNaC:

    cmake_minimum_required(VERSION 3.1)
    project(foo)
    find_package(ginac REQUIRED)
    add_executable(foo foo.cpp)
    target_link_libraries(foo PRIVATE ginac::ginac)

* GiNaC can be included as a (CMake) subproject. One can put GiNaC
  sources (either from git or a tarball) into a subdirectory (say,
  `ginac`) and use the following CMakeLists.txt to build everything:

    cmake_minimum_required(VERSION 3.1)
    project(foo)
    add_subdirectory(ginac)
    add_executable(foo foo.cpp)
    target_link_libraries(foo PRIVATE ginac::ginac)

3 weeks agobuild: windows: enable automatic imports by default
Alexey Sheplyakov [Thu, 26 Dec 2019 17:45:11 +0000 (21:45 +0400)]
build: windows: enable automatic imports by default

For now there are no dllexport/dllimport markings in GiNaC and CLN, so
export all symbols when building GiNaC DLL, and enable automatic imports
when linking with it. Note: this works with GNU linker only.

3 weeks agobuild: CMake: made it easier to run tests in parallel
Alexey Sheplyakov [Fri, 27 Dec 2019 13:34:05 +0000 (17:34 +0400)]
build: CMake: made it easier to run tests in parallel

As of now `make -jN check` executes test suite sequentially
(although it builds test executables in parallel). This takes
a bit too long, so it would be nice to run tests in parallel.
`ctest -jN` or `make test ARGS=-jN` runs tests concurrently,
however it does not build test executables, instead it fails
if any test binary is missing.

Also `test` target is a bit special and it's impossible to add
dependencies to it, see
https://gitlab.kitware.com/cmake/cmake/issues/8438

To work around the problem define `test_suite` target which
builds the tests suite without running it, so one can both
compile and run tests in parallel

make -j8 test_suite
make test ARGS=-j8

3 weeks agoMade it easier to run tests on windows
Alexey Sheplyakov [Wed, 25 Dec 2019 16:41:17 +0000 (20:41 +0400)]
Made it easier to run tests on windows

Put executables and DLLs into the `bin` subdirectory so the system
can locate GiNaC (and CLN) DLLs without extra configuration.

3 weeks agonumeric.cpp, archive.cpp: don't include config.h
Alexey Sheplyakov [Wed, 18 Dec 2019 12:39:12 +0000 (16:39 +0400)]
numeric.cpp, archive.cpp: don't include config.h

config.h is necessary for excompiler only, the rest of the library
is pretty portable. Not including dynamically generated headers
saves compilation time due to more (c)cache hits.

3 weeks agoBuild example programs to avoid breaking them on API changes
Alexey Sheplyakov [Mon, 6 Jan 2020 18:34:09 +0000 (22:34 +0400)]
Build example programs to avoid breaking them on API changes

3 weeks agobuild: fixed `ginac-excompiler` installation with CMake
Alexey Sheplyakov [Thu, 19 Dec 2019 14:16:53 +0000 (18:16 +0400)]
build: fixed `ginac-excompiler` installation with CMake

3 weeks agobuild: accept both python 3 and python 2
Alexey Sheplyakov [Sun, 23 Aug 2020 07:28:07 +0000 (11:28 +0400)]
build: accept both python 3 and python 2

This makes building GiNaC a bit easier for users of "old" distributions
where python 3 is not installed by default (Ubuntu 16.04), or even not
available (CentOS 7).

Scripts themselves work just fine with python 2.7 and python 3.x, so
only minor changes to CMakeLists.txt are required (autotools scripts
already handle python2/3)

4 weeks ago[build] Fix Python detection in Autotools build.
Richard Kreckel [Sun, 23 Aug 2020 14:09:34 +0000 (16:09 +0200)]
[build] Fix Python detection in Autotools build.

This was a latent bug: the PYTHON variable was not set in Makefiles,
only PYTHON3 was, but scripts were still invoked with $(PYTHON).

While at it, let's also accept python2 >= 2.7.

4 weeks agoAvoid "catching polymorphic type by value" warnings.
Richard Kreckel [Fri, 21 Aug 2020 17:10:12 +0000 (19:10 +0200)]
Avoid "catching polymorphic type by value" warnings.

4 weeks agoAvoid unnecessary expansion in sqrfree_yun().
Richard Kreckel [Fri, 21 Aug 2020 15:47:19 +0000 (17:47 +0200)]
Avoid unnecessary expansion in sqrfree_yun().

Don't make the polynomial primitive inside Yun's algorithm. Computing the
primitive part will incur an extra expansion of the polynomial and this
may distroy a pre-factored structure in the other variables. In the multi-
variate case, working with primitive polynomials isn't sufficient anyways
to avoid a final division to discover lost factors.

4 weeks agoSegregate sqfree() tests into file of its own.
Richard Kreckel [Fri, 21 Aug 2020 15:45:08 +0000 (17:45 +0200)]
Segregate sqfree() tests into file of its own.

4 weeks ago[build] Use python3 command in CMake build, not python.
Richard Kreckel [Fri, 21 Aug 2020 15:09:36 +0000 (17:09 +0200)]
[build] Use python3 command in CMake build, not python.

6 weeks agoFinalize 1.7.11 release. release_1-7-11
Richard Kreckel [Mon, 3 Aug 2020 18:45:53 +0000 (20:45 +0200)]
Finalize 1.7.11 release.

6 weeks agoAdd m4/host-cpu-c-abi.m4.
Richard Kreckel [Mon, 3 Aug 2020 18:44:09 +0000 (20:44 +0200)]
Add m4/host-cpu-c-abi.m4.

This avoids warnings about gl_HOST_CPU_C_ABI_32BIT being m4_require'd
but not m4_defun'd.

6 weeks agoClean up check suite a little bit.
Richard Kreckel [Mon, 3 Aug 2020 18:01:13 +0000 (20:01 +0200)]
Clean up check suite a little bit.

Some tests in tiny test files are better moved elsewhere to reduce compile
and link time.

6 weeks agoRemove obsolete debug #include file from factor.cpp.
Richard Kreckel [Mon, 3 Aug 2020 17:20:56 +0000 (19:20 +0200)]
Remove obsolete debug #include file from factor.cpp.

6 weeks agoMake workarounds for sqrfree_yun() obsolete.
Richard Kreckel [Mon, 3 Aug 2020 16:20:27 +0000 (18:20 +0200)]
Make workarounds for sqrfree_yun() obsolete.

Since Yun's algorithm is based on polynomial GCD, it only finds factors
up to a unit. Callers shouldn't have to work around this, so sqrfree_yun()
now does a final polynomial long division to compute the lost factor and
fixes the result before returning.

6 weeks ago[BUGFIX] Fix factor_univariate(poly, x) for constant poly.
Richard Kreckel [Mon, 3 Aug 2020 16:09:30 +0000 (18:09 +0200)]
[BUGFIX] Fix factor_univariate(poly, x) for constant poly.

The modular factorization fails to find a prime in this case, leading to
an infinite loop. At least one caller (factor_sqrfree) happens to produce
such constant polys in some cases.

7 weeks ago[BUGFIX] factor_multivariate(): respect unit...
Richard Kreckel [Wed, 29 Jul 2020 22:20:22 +0000 (00:20 +0200)]
[BUGFIX] factor_multivariate(): respect unit...

...if the content of polynomial isn't a number and needs to be factored.
And while at it, reduce the scope of a local variable.

7 weeks agoFix bug in power::expand() with the overall coefficient.
Vladimir V. Kisil [Mon, 27 Jul 2020 19:03:42 +0000 (21:03 +0200)]
Fix bug in power::expand() with the overall coefficient.

The negative sign of overall coefficient had been lost if a
power base contained some sign-definite factors.

7 weeks agoFix of a bug in sqrfree_parfrac() related to Yun factorisation.
Vladimir V. Kisil [Mon, 27 Jul 2020 18:58:27 +0000 (20:58 +0200)]
Fix of a bug in sqrfree_parfrac() related to Yun factorisation.

Yun's algorithm does not account for constant factors, thus
sqrfree_parfrac() dropped such factors in partial fractions.

2 months agoFinalize 1.7.10 release. release_1-7-10
Richard Kreckel [Sun, 28 Jun 2020 17:33:38 +0000 (19:33 +0200)]
Finalize 1.7.10 release.

2 months agoAdd exam for exam_common_factors.
Richard Kreckel [Sun, 28 Jun 2020 15:21:33 +0000 (17:21 +0200)]
Add exam for exam_common_factors.

Including a case involving a hidden zero to catch errors like the one fixed
in 5f7f81ad35a, as suggested by Alexey Sheplyakov <asheplyakov@yandex.ru>.

2 months ago[build] Check for python3 command, not python.
Richard Kreckel [Sun, 28 Jun 2020 14:07:30 +0000 (16:07 +0200)]
[build] Check for python3 command, not python.

PEP 394 does not require the python command to be installed.

2 months ago[BUGFIX] Prevent crashes in find_common_factor()
Vladimir V. Kisil [Mon, 22 Jun 2020 07:49:00 +0000 (09:49 +0200)]
[BUGFIX] Prevent crashes in find_common_factor()

These happened if a non-normalised common factor was equal to zero.

Thanks to Feng Feng for reporting this bug.

3 months agoRevert "Improve diff(abs(x)) for real x."
Richard Kreckel [Fri, 19 Jun 2020 11:34:07 +0000 (13:34 +0200)]
Revert "Improve diff(abs(x)) for real x."

This reverts commit fa1ffcfdc9da97a6fb7cc2c9c36fe1fc45c808a9.

3 months agoImprove diff(abs(x)) for real x.
Pierangelo Masarati [Wed, 17 Jun 2020 17:52:49 +0000 (19:52 +0200)]
Improve diff(abs(x)) for real x.

4 months ago[C++20] Disambiguate std::integral concept and GiNaC::integral class.
Richard Kreckel [Mon, 18 May 2020 06:26:09 +0000 (08:26 +0200)]
[C++20] Disambiguate std::integral concept and GiNaC::integral class.

4 months ago[C++20] Clean up using-declarations.
Richard Kreckel [Mon, 18 May 2020 06:22:21 +0000 (08:22 +0200)]
[C++20] Clean up using-declarations.

Never write a using-declaration before #including another header file!

4 months ago[PATCH] Add default print function as the Python printing method.
Vladimir V. Kisil [Sat, 25 Apr 2020 21:26:07 +0000 (23:26 +0200)]
[PATCH] Add default print function as the Python printing method.

5 months agoFinalize 1.7.9 release. release_1-7-9
Richard Kreckel [Fri, 10 Apr 2020 23:20:22 +0000 (01:20 +0200)]
Finalize 1.7.9 release.

5 months agoMinor enhancements to tutorial.
Richard Kreckel [Fri, 10 Apr 2020 23:10:47 +0000 (01:10 +0200)]
Minor enhancements to tutorial.

5 months agoAdd .gitignore files.
Richard Kreckel [Fri, 10 Apr 2020 23:01:47 +0000 (01:01 +0200)]
Add .gitignore files.

5 months ago[PATCH] Fix zeta(x, s).evalf() when x and s aren't lists.
Stefan Weinzierl [Fri, 10 Apr 2020 16:01:28 +0000 (18:01 +0200)]
[PATCH] Fix zeta(x, s).evalf() when x and s aren't lists.

5 months agoMake C++ files in doc/examples/ compile again.
Richard Kreckel [Thu, 9 Apr 2020 19:23:25 +0000 (21:23 +0200)]
Make C++ files in doc/examples/ compile again.

5 months agoRemove obsolete CVSROOT directory.
Richard Kreckel [Thu, 9 Apr 2020 18:44:41 +0000 (20:44 +0200)]
Remove obsolete CVSROOT directory.

5 months ago[PATCH] Check number of parameters when reading function from archive.
Richard Kreckel [Tue, 7 Apr 2020 21:56:25 +0000 (23:56 +0200)]
[PATCH] Check number of parameters when reading function from archive.

Functions where looked up by their function name in archives. However,
some functions have overloads for different numbers of parameters
('zeta', 'G', 'psi'). Reading archives could pick the wrong overload.

Fixed by requiring that the actual number of function parameters in the
archive node must equal the function's declared number of parameters.

Thanks to Feng Feng for reporting this problem.

8 months agoUpdate some compiler versions.
Richard Kreckel [Tue, 7 Jan 2020 23:03:50 +0000 (00:03 +0100)]
Update some compiler versions.

8 months agoChange www.ginac.de urls to https.
Richard Kreckel [Tue, 7 Jan 2020 22:41:40 +0000 (23:41 +0100)]
Change www.ginac.de urls to https.

8 months agoHappy New Year!
Richard Kreckel [Wed, 1 Jan 2020 11:57:25 +0000 (12:57 +0100)]
Happy New Year!

9 months ago[PATCH] numeric, ex: added constructors taking `long long`. Fixes MinGW64 build.
Alexey Sheplyakov [Thu, 12 Dec 2019 07:38:18 +0000 (08:38 +0100)]
[PATCH] numeric, ex: added constructors taking `long long`. Fixes MinGW64 build.

On 64-bit windows std::size_t is `unsigned long long` (64 bit).
However there is no ex constructor taking (unsigned) long long.

This patch adds ex and numeric constructors taking `long long`
and `unsigned long long`.

11 months agoFinalize 1.7.8 release. release_1-7-8
Richard Kreckel [Mon, 7 Oct 2019 20:23:54 +0000 (22:23 +0200)]
Finalize 1.7.8 release.

11 months agoFix bug in H_evalf: Flag has_minus_one is now computed where it is needed.
Stefan Weinzierl [Mon, 7 Oct 2019 18:32:01 +0000 (20:32 +0200)]
Fix bug in H_evalf: Flag has_minus_one is now computed where it is needed.

This bug has been reported and fixed by Yannick Ulrich <yannick.ulrich@psi.ch>.

11 months agoTrivialize pseries::eval().
Richard Kreckel [Thu, 3 Oct 2019 21:08:24 +0000 (23:08 +0200)]
Trivialize pseries::eval().

Since 1.7.0, the elements are eval()'ed, so there's nothing to do any
more for pseries::eval().

11 months agoFix pseries::evalf() regression.
Vladimir V. Kisil [Tue, 1 Oct 2019 22:00:09 +0000 (00:00 +0200)]
Fix pseries::evalf() regression.

Since f8c2455fbb, rest was not evalf()'ed any more.

11 months agoReally finalize 1.7.7 release. release_1-7-7
Richard Kreckel [Sun, 22 Sep 2019 21:50:45 +0000 (23:50 +0200)]
Really finalize 1.7.7 release.

11 months agoFinalize 1.7.7 release.
Richard Kreckel [Sun, 22 Sep 2019 21:39:06 +0000 (23:39 +0200)]
Finalize 1.7.7 release.

11 months agoReplace some .push_back() with .emplace_back() where it's safe.
Richard Kreckel [Sun, 22 Sep 2019 21:32:14 +0000 (23:32 +0200)]
Replace some .push_back() with .emplace_back() where it's safe.

11 months agoFix unarchiving empty containers.
Richard Kreckel [Sun, 22 Sep 2019 17:18:19 +0000 (19:18 +0200)]
Fix unarchiving empty containers.

The bug was reported by Vladimir V. Kisil <kisilv@maths.leeds.ac.uk>, see
<https://www.ginac.de/pipermail/ginac-devel/2019-September/002399.html>.

11 months agoUpdate m4/ax_cxx_compile_stdcxx.m4 to current upstream version.
Richard Kreckel [Sun, 22 Sep 2019 17:02:31 +0000 (19:02 +0200)]
Update m4/ax_cxx_compile_stdcxx.m4 to current upstream version.

11 months agoRemove exhashmap<T> class.
Richard Kreckel [Sun, 22 Sep 2019 11:19:00 +0000 (13:19 +0200)]
Remove exhashmap<T> class.

Class exhashmap<T> was a workaround for missing std::hash_map<Key, T>
in the original C++98 standard. It was put in GiNaC because map<Key, T>
was deemed too slow. Since C++11 there is std::unorderd_map<Key, T>,
which is hash-based. To be able to use it, add specializations of
std::hash<ex> and std:equal_to<ex>.

12 months agoComplete documentation regarding Python 3 requirement.
Richard Kreckel [Tue, 10 Sep 2019 21:40:22 +0000 (23:40 +0200)]
Complete documentation regarding Python 3 requirement.

This was missed in the last commit.

12 months agoConvert shebangs to python3.
Richard Kreckel [Tue, 10 Sep 2019 21:29:07 +0000 (23:29 +0200)]
Convert shebangs to python3.

PEP 394 does not require the python command to be installed.

15 months ago[DOC] Additional examples on number conversions.
Vladimir V. Kisil [Sun, 9 Jun 2019 16:40:58 +0000 (18:40 +0200)]
[DOC] Additional examples on number conversions.

Some aspects of these methods are not obvious for newbies.

Signed-off-by: Vladimir V. Kisil <kisilv@maths.leeds.ac.uk>
15 months ago[DOC] Suggest ios::binary flag for archiving files.
Vladimir V. Kisil [Sun, 9 Jun 2019 16:36:49 +0000 (18:36 +0200)]
[DOC] Suggest ios::binary flag for archiving files.

Without the flag locales setting of the OS tempers the file structure.

Signed-off-by: Vladimir V. Kisil <kisilv@maths.leeds.ac.uk>
15 months agoFix slow numerical computation of zeta({7,3}).
Stefan Weinzierl [Tue, 4 Jun 2019 08:21:10 +0000 (10:21 +0200)]
Fix slow numerical computation of zeta({7,3}).

The bug was reported by Vitaly Magerya <vmagerya@gmail.com>, see
<https://www.ginac.de/pipermail/ginac-list/2019-May/002265.html>.

15 months agoFix crash computing zeta({7,3}) numerically.
Stefan Weinzierl [Tue, 4 Jun 2019 08:11:14 +0000 (10:11 +0200)]
Fix crash computing zeta({7,3}) numerically.

The bug was reported by Vitaly Magerya <vmagerya@gmail.com>, see
<https://www.ginac.de/pipermail/ginac-list/2019-May/002265.html>.

16 months ago[DOC] Change library order in tutorial example.
Richard Kreckel [Fri, 3 May 2019 19:14:20 +0000 (21:14 +0200)]
[DOC] Change library order in tutorial example.

Some systems care about library ordering: Dependent libraries must be
linked last. Let's link with -lginac before -lcln in the example so it
will work on any system, even on Windows.

17 months agoFinalize 1.7.6 release. release_1-7-6
Richard Kreckel [Mon, 22 Apr 2019 18:14:52 +0000 (20:14 +0200)]
Finalize 1.7.6 release.

17 months agoFix bug in mul::series() about asymptotic order term.
Richard Kreckel [Sun, 21 Apr 2019 19:43:45 +0000 (21:43 +0200)]
Fix bug in mul::series() about asymptotic order term.

This reverts db81420a6195 and adds a test case.

Thanks to Feng Feng for reporting this.

17 months agoFix cl_N output of negative fixnums.
Richard Kreckel [Thu, 4 Apr 2019 18:21:41 +0000 (20:21 +0200)]
Fix cl_N output of negative fixnums.

Thanks to Feng Feng for reporting this.

18 months agoFix bug in inifcns_nstdsums.cpp...
Stefan Weinzierl [Fri, 22 Mar 2019 09:01:30 +0000 (10:01 +0100)]
Fix bug in inifcns_nstdsums.cpp...

...related to trailing zeros in combination with user-specified signs for small
imaginary parts.

When the trailing zeros are shuffled away, the information on the signs of the
small imaginary parts has to be kept.

This bug was reported by Dmitry Chicherin.

18 months agoRefactor matrix::determinant_minor() a bit.
Richard Kreckel [Sat, 9 Mar 2019 17:40:32 +0000 (18:40 +0100)]
Refactor matrix::determinant_minor() a bit.

Remove special cases for small matrices and for for last column
minor computation. Add early return for the case that all minors
relevant for one column turn out to be zero. Improve some comments.

18 months ago[DOC] Fix examples using deprecated lst initializers.
Richard Kreckel [Fri, 8 Mar 2019 21:33:44 +0000 (22:33 +0100)]
[DOC] Fix examples using deprecated lst initializers.

18 months agoRefactor module static helper functions to helper class.
Richard Kreckel [Thu, 7 Mar 2019 19:57:50 +0000 (20:57 +0100)]
Refactor module static helper functions to helper class.

Functions symbolset and insert_symbols in inifcns.cpp are better written
as a class, to improve readability.

19 months agoConvert YAPTU to Python3.
Richard Kreckel [Sun, 17 Feb 2019 19:43:28 +0000 (20:43 +0100)]
Convert YAPTU to Python3.

It should now work with python2 and python3.

19 months agoFinalize 1.7.5 release. release_1-7-5
Richard Kreckel [Sun, 17 Feb 2019 11:13:10 +0000 (12:13 +0100)]
Finalize 1.7.5 release.

19 months agoFix elusive bug in expairseq ctor.
Richard Kreckel [Sat, 16 Feb 2019 11:58:38 +0000 (12:58 +0100)]
Fix elusive bug in expairseq ctor.

When an expair turns out to represent a number, that should go into
the expairseq's overall_coeff. This was accomplished by class mul,
thanks to the override of expair_needs_further_processing(), but not
always for class add.

This patch fixes the base class' expair_needs_further_processing()
with similar logic as that already in place for class mul.

Thanks to Mario Prausa for reporting this.

19 months agoHappy New Year!
Richard Kreckel [Tue, 1 Jan 2019 16:42:15 +0000 (17:42 +0100)]
Happy New Year!

21 months agoG_do_hoelder: fix case with real x values which are not of type cl_R.
Stefan Weinzierl [Wed, 12 Dec 2018 21:53:12 +0000 (22:53 +0100)]
G_do_hoelder: fix case with real x values which are not of type cl_R.

In CLN, a complex number of type cl_N with vanishing imaginary part is not
necessarily a real number of type cl_R.

This bug has been reported by T. Huber.

23 months agoHandle un-normal zeros properly in the division-free elimination.
Vitaly Magerya [Fri, 12 Oct 2018 18:45:27 +0000 (20:45 +0200)]
Handle un-normal zeros properly in the division-free elimination.

Call .normal() instead of just .expand(), such that matrix::pivot() finds
the pivot.

Note that this problem also affects matrix::solve() with 'algo'
set to solve_algo::automatic.

Of course, using .normal() makes division_free_elimination only
truly "division-free" if the input matrix didn't have fractions.
In other cases, GCDs will be computed.

23 months agoUpdate m4/ax_cxx_compile_stdcxx.m4 to current upstream version.
Richard Kreckel [Thu, 4 Oct 2018 19:32:21 +0000 (21:32 +0200)]
Update m4/ax_cxx_compile_stdcxx.m4 to current upstream version.

23 months ago[DOC] Explaining in tutorial sign ambiguity for numer() and denom().
Richard Kreckel [Thu, 4 Oct 2018 19:28:42 +0000 (21:28 +0200)]
[DOC] Explaining in tutorial sign ambiguity for numer() and denom().

Based on a patch provided by Vladimir V. Kisil <kisilv@maths.leeds.ac.uk>.

2 years agoConsider solve_algo::markowitz in automatic elimination algorithm selection.
Vitaly Magerya [Tue, 19 Jun 2018 23:13:07 +0000 (01:13 +0200)]
Consider solve_algo::markowitz in automatic elimination algorithm selection.

Cf. <https://www.ginac.de/pipermail/ginac-list/2018-June/002211.html>.

2 years agoAdd optional matrix::rank() algorighm selection.
Vitaly Magerya [Wed, 13 Jun 2018 21:07:45 +0000 (23:07 +0200)]
Add optional matrix::rank() algorighm selection.

Before, matrix::rank() was hardcoded to use Bareiss elimination,
which for some matrices is way too slow (and I had to work around
this limitation in my own code). I propose adding an argument that
will allow users to select which elimination scheme to use. The
argument is the same as matrix::solve() takes (so, solve_algo::*).

I've tried to mimic how a similar argument was added to
matrix::inverse() by keeping the current set of rank() functions
and defining separate ones with the 'algo' argument, with the
old ones calling the new ones with solve_algo::automatic. This
is instead of using default argument values.

I've also put the code that makes the automatic selection of
the elimination method into a separate function so that both
matrix::solve() and matrix::rank() could share it. There's a bit
of similar code in matrix::determinant(), but since the self
of determinant algorithms is different from the elimination
algorithms, it's not clear if these two could be unified.

2 years agoCorrect wording in tutorial regarding degree(), ldegree().
Richard Kreckel [Sun, 10 Jun 2018 11:46:39 +0000 (13:46 +0200)]
Correct wording in tutorial regarding degree(), ldegree().

2 years agoAllow expreseq in the arguments of lsolve(eqns, vars).
Vitaly Magerya [Thu, 31 May 2018 16:39:08 +0000 (18:39 +0200)]
Allow expreseq in the arguments of lsolve(eqns, vars).

See <http://www.cebix.net/pipermail/ginac-list/2018-May/002201.html>.

2 years agoAdd Markowitz-ordered Gaussian elimination algorithm.
Vitaly Magerya [Thu, 31 May 2018 15:43:56 +0000 (17:43 +0200)]
Add Markowitz-ordered Gaussian elimination algorithm.

This algorithm avoids the 'fill-in' problem of Gaussian elimination
and significantly improves the times for solving large sparse systems.
See: <https://www.ginac.de/pipermail/ginac-list/2018-May/002202.html>.

2 years agoRemove MSVC-specific definition of __func__ and __alignof__.
Jan Rheinländer [Tue, 1 May 2018 18:43:04 +0000 (20:43 +0200)]
Remove MSVC-specific definition of __func__ and __alignof__.

They are not required any more in C++11.

2 years agoAvoid multiple filling of partitions in ::get() member functions.
Richard Kreckel [Mon, 5 Mar 2018 08:15:18 +0000 (09:15 +0100)]
Avoid multiple filling of partitions in ::get() member functions.

2 years agoFinalize 1.7.4 release. release_1-7-4
Richard Kreckel [Mon, 19 Feb 2018 22:32:51 +0000 (23:32 +0100)]
Finalize 1.7.4 release.

2 years agoFix ABI compatibility with so-version 6.
Richard Kreckel [Mon, 19 Feb 2018 22:10:32 +0000 (23:10 +0100)]
Fix ABI compatibility with so-version 6.

Commit 1be7026a unintentionally broke the ABI since g++ doesn't appear
to generate symbols for inline methods. Ugh.

Cf. https://bugzilla.redhat.com/show_bug.cgi?id=1541187

2 years agoFinalize 1.7.3 release. release_1-7-3
Richard Kreckel [Thu, 1 Feb 2018 21:59:46 +0000 (22:59 +0100)]
Finalize 1.7.3 release.

2 years agoPrepare for release 1.7.3 (yeah, again).
Richard Kreckel [Wed, 31 Jan 2018 22:07:35 +0000 (23:07 +0100)]
Prepare for release 1.7.3 (yeah, again).

2 years agoFix two comments in ginac/normal.cpp.
Richard Kreckel [Wed, 31 Jan 2018 22:00:08 +0000 (23:00 +0100)]
Fix two comments in ginac/normal.cpp.

And, while at it, make some disabled debugging output code compile when
it is enabled.

2 years agoFix out-of-bounds error in multivar_diophant().
Richard Kreckel [Wed, 31 Jan 2018 21:55:02 +0000 (22:55 +0100)]
Fix out-of-bounds error in multivar_diophant().

This could trigger an assertion in the factorization exams introduced
in afb0ccaa49 if the library was compiled with -DDO_GINAC_ASSERT.

2 years agoShortcut conversion ex->numeric->ex in expairseq::make_flat().
Richard Kreckel [Wed, 31 Jan 2018 11:18:37 +0000 (12:18 +0100)]
Shortcut conversion ex->numeric->ex in expairseq::make_flat().

Of course, passing an ex by reference is always faster than converting
it to a numeric first (even if it is a numeric).

2 years agoImprove gcd(a, b) where one argument is a power of a symbol.
Richard Kreckel [Wed, 31 Jan 2018 09:04:25 +0000 (10:04 +0100)]
Improve gcd(a, b) where one argument is a power of a symbol.

The already implemented recursion
  gcd(x^n, x*p(x)) -> x*gcd(x^(n-1), p(x))
is not ambitious enough: If p(x) has a factor of x, it just goes through
the same step again, and if p(x) has a factor which is a power of x, this
is reapeted many times.

Example:
  gcd(x^n, expand(x^n*(1+x)))
used to go recurse through the gcd routine n times, which could
easily lead to a stack overflow for n about 10^5.

To improve the situation, introduce a special case for gcd where one
argument is a power of a symbol and just cancel the common factor.

This turned out to be the root cause of segfaults in matrix elimination
algorithms, as reported by Patrick Schulz and Vitaly Magerya:
Cf. <https://www.ginac.de/pipermail/ginac-list/2018-January/thread.html>

2 years agoMake matrix::solve() work with non-normal zeros.
Richard Kreckel [Sun, 28 Jan 2018 23:07:17 +0000 (00:07 +0100)]
Make matrix::solve() work with non-normal zeros.

Normalize elements of augmented matrix before checking if they are zero.
This ensures that we don't divide by a non-normal zero. Also added a test.

This bug was reported by Vitaly Magerya <vmagerya@gmail.com>.

2 years ago[CHECK] Add some more factorization exams.
Richard Kreckel [Sun, 28 Jan 2018 18:59:54 +0000 (19:59 +0100)]
[CHECK] Add some more factorization exams.

Add the 15 multivariate polynomials from P. S. Wang's paper "An
Improved Multivariate Polynomial Factoring Algorithm" as exams.

Don't add them as benchmarks since timings vary considerably
depending on internal choice of variables. In any case, this should
never take hours. (But before 630db9a0b0 it did, occasionally.)

2 years agoAdd optional algorithm selection to matrix::inverse().
Richard Kreckel [Sun, 28 Jan 2018 18:23:50 +0000 (19:23 +0100)]
Add optional algorithm selection to matrix::inverse().

Following a proposal by Vitaly Magerya, a signature with a solve_algo
is added to class matrix. (Not using a default argument in order to
not break the ABI.)

2 years agoFix previous commit 'Speed up special cases of square-free...'.
Richard Kreckel [Thu, 25 Jan 2018 18:59:00 +0000 (19:59 +0100)]
Fix previous commit 'Speed up special cases of square-free...'.

Huh, I swear 4ffb3cbb3 worked for me! Sorry for that.

2 years agoSpeed up special cases of square-free factorization.
Richard Kreckel [Wed, 24 Jan 2018 21:37:24 +0000 (22:37 +0100)]
Speed up special cases of square-free factorization.

Square-free factorization of polynomials containing a factor which is
a high power P of a symbol x did scale like O(P) in space and time.
This patch introduces a shortcut in Yun's algorithm, such that the
computation is only O(1) in space and time.

This makes it possible to compute, say sqrfree(x^P + x^(P+1)) =>
(1+x)*x^P with P=123456789.

Found this to be a bottleneck while debugging one of Vitaly Magerya's
examples.

2 years agoPrepare for release 1.7.3.
Richard Kreckel [Mon, 1 Jan 2018 20:21:41 +0000 (21:21 +0100)]
Prepare for release 1.7.3.

2 years agoHappy New Year!
Richard Kreckel [Mon, 1 Jan 2018 19:47:26 +0000 (20:47 +0100)]
Happy New Year!

2 years ago[BUGFIX] Speed up some cases of polynomial factorization.
Richard Kreckel [Fri, 29 Dec 2017 21:16:54 +0000 (22:16 +0100)]
[BUGFIX] Speed up some cases of polynomial factorization.

Speed up a naive O(N) modulus operation in multivar_diophant().
This loop caused some polynomials to seemingly hang forever.

2 years agoDo not expand pre-factored polynomials.
Vitaly Magerya [Mon, 18 Dec 2017 18:28:01 +0000 (19:28 +0100)]
Do not expand pre-factored polynomials.

See <https://www.ginac.de/pipermail/ginac-list/2017-December/002155.html>.