]> www.ginac.de Git - ginac.git/log
13 years agoncmul::eval(): don't write beyond the end of the vector.
Alexei Sheplyakov [Sat, 8 Aug 2009 10:03:38 +0000 (13:03 +0300)]
ncmul::eval(): don't write beyond the end of the vector.

13 years agoMake sure add::eval() collects all numeric terms.
Richard Kreckel [Wed, 22 Sep 2010 22:40:38 +0000 (00:40 +0200)]
Make sure add::eval() collects all numeric terms.

Apparently, add::eval() assumed that none of the elements of its epvector
has a numeric rest. However, nothing guarantees that -- in particular
evalchildren() doesn't (and actually cannot) do so. Since there are many
places where a new add is constructed directly from an epvector, enforcing
this doesn't make sense either. One example where it did fail was found by
Burgin Erocal: real_part(1+2*(sqrt(2)+1)*(sqrt(2)-1)) returned 1+2*1, not 3.

Thanks to Burcin Erocal for reporting this bug.

13 years agoBe more careful about final top-level substitution.
Richard Kreckel [Wed, 15 Sep 2010 07:11:57 +0000 (09:11 +0200)]
Be more careful about final top-level substitution.

Substituting x==log(x) in exp(x) erroneously returned log(x) because of a
final subst(x==log(x)) after having eval'ed exp(log(x)) -> x. This final
substitution is wrong in the general case. On the other hand, the intent
is to syntactically substitute functions of a given kind etc. This patch
suppresses the final top-level substitution unless the intermediate result
is a container.

Thanks to Burcin Erocal for reporting this bug (originally described by
Kees van Schaik on sage-support@googlegroops.com).

13 years agoFix autoconf warning about AC_INIT use.
Richard Kreckel [Mon, 13 Sep 2010 20:39:05 +0000 (22:39 +0200)]
Fix autoconf warning about AC_INIT use.

Apparently, autoconf doesn't like the angle brackets in the bug-report
argument any more. It comlains "not a literal: <ginac-list@ginac.de>".
So let's remove it. And while at it, also provide tarname and url

13 years agopower::eval(): fix several memory leaks
Alexei Sheplyakov [Sun, 22 Aug 2010 20:09:18 +0000 (23:09 +0300)]
power::eval(): fix several memory leaks

While working on fsolve bug I've noticed the following in valgrind log:

==17455== 136 (56 direct, 80 indirect) bytes in 1 blocks are definitely lost in loss record 16 of 19
==17455==    at 0x4C249C7: operator new(unsigned long) (vg_replace_malloc.c:220)
==17455==    by 0x516CA70: GiNaC::power::eval(int) const (power.cpp:540)
==17455==    by 0x4FC1E39: GiNaC::ex::construct_from_basic(GiNaC::basic const&) (ex.cpp:310)
==17455==    by 0x406FBF: main (ex.h:255)

Heap allocated objects definitely need the status_flags::dyncallocated flag.

13 years agofsolve: avoid useless numerical evaluation of the function
Alexei Sheplyakov [Sat, 21 Aug 2010 16:13:29 +0000 (19:13 +0300)]
fsolve: avoid useless numerical evaluation of the function

Don't compute f(x) if new x is outside of the interval. We don't need that
value anyway, and the function might be difficult to compute numerically or
even ill defined outside the interval.

As a result fsolve is able to find root(s) of some weird functions.
For example

fsolve((1/(sqrt(2*Pi)))*integral(t, 0, x, exp(-1/2*t^2)) == 0.5, x, 0, 100)

actually works now.

13 years agointegral::evalf(): don't attempt to ignore problems.
Alexei Sheplyakov [Thu, 19 Aug 2010 08:10:25 +0000 (11:10 +0300)]
integral::evalf(): don't attempt to ignore problems.

Don't ignore exceptions thrown by numerical integration routine.
In general, the code like this

try {
// blah-blah
} catch (std::exception& err) { }

is just plain evil. Case in the point:


13 years agofsolve: check if evalf() return value is actually a number.
Alexei Sheplyakov [Wed, 18 Aug 2010 21:07:13 +0000 (00:07 +0300)]
fsolve: check if evalf() return value is actually a number.

Fixes the segfault triggered by


In general, ex_to is unsafe, and should be used only after proper checks.
evalf() may return non-numeric expression for various reasons (bad
convergence, floating point over- or underflow, out of memory, etc).
So let's add missing checks.

Thanks to Ernst Moritz Hahn for a bug report.

13 years agoRemoved trailing spaces.
Jens Vollinga [Tue, 6 Jul 2010 12:38:36 +0000 (14:38 +0200)]
Removed trailing spaces.

13 years agoTexinfo interprets @strong{Note...} as a cross reference and gives a
Jens Vollinga [Tue, 6 Jul 2010 09:23:21 +0000 (11:23 +0200)]
Texinfo interprets @strong{Note...} as a cross reference and gives a
warning about it. Changed the text to avoid this.

13 years agoParser: handle abbreviations as advertized in the manual.
Alexei Sheplyakov [Mon, 5 Jul 2010 07:15:20 +0000 (09:15 +0200)]
Parser: handle abbreviations as advertized in the manual.

The following example from the tutorial

GiNaC::symbol x, y;
GiNaC::symtab table;
table["x"] = x+log(y)+1;
GiNaC::parser reader(table);
GiNaC::ex e = reader("5*x3 - x2");

fails with the following exception:

terminate called after throwing an instance of 'std::invalid_argument'
what(): find_or_insert_symbol: name "x" does not correspond to a symbol

Remove silly checks from find_or_insert_symbol, and fix its return value
(should be ex, not symbol).

13 years agoBe more careful with conjugate(f(x)) -> f(conjugate(x)).
Richard Kreckel [Sat, 22 May 2010 20:34:42 +0000 (22:34 +0200)]
Be more careful with conjugate(f(x)) -> f(conjugate(x)).

That identity is correct for holomorphic functions, but we have to be
careful with some functions not being holomorphic everywhere. On branch
cuts, it is wrong. For a discussion, see:

This patch changes the default behavior of user-defined functions. From
now on, a user-defined conjugate_func must be registered, in order to
evaluate conjugate(f(x)) -> f(conjugate(x)). This patch also adds such
functions for most initially known functions.

13 years agoFix dangerous iterator use.
Richard Kreckel [Tue, 18 May 2010 22:18:35 +0000 (00:18 +0200)]
Fix dangerous iterator use.

This was detected by cppcheck and reported by Martin Ettl <ettl.martin@gmx.de>.

13 years agopgcd(), chinrem_gcd(): use appropriate definition of the degree.
Alexei Sheplyakov [Mon, 17 May 2010 22:23:03 +0000 (00:23 +0200)]
pgcd(), chinrem_gcd(): use appropriate definition of the degree.

Effect: fixes (rare) GCD miscalculation.

pgcd() treats polynomials Z_p[x_0, ..., x_n] as R[x_0, ..., x_{n - 1}], where
R = Z_p[x_n]. Therefore one should use correct definition of the degree
(i.e. compute it w.r.t. x_0, ..., x_{n-1}, but NOT w.r.t. x_n!).

One should use appropriate definition of degree (that is, w.r.t.  x_0, ..., x_n)
in chinrem_gcd() too.

Thanks to Aless Lasaruk for a bug report.

13 years agoAdded `degree_vector' utility function.
Alexei Sheplyakov [Mon, 17 May 2010 22:21:53 +0000 (00:21 +0200)]
Added `degree_vector' utility function.

It's a generalization of degree(expr, var) for multivariate polynomials.

13 years agoprimpart_content: correctly handle monomials.
Alexei Sheplyakov [Mon, 17 May 2010 22:20:08 +0000 (00:20 +0200)]
primpart_content: correctly handle monomials.

Impact: fixes (rare) incorrect gcd calculation and (potential) segfault.

Thanks to Aless Lasaruk for a bug report.

13 years agopgcd(): avoid infinite loop if the first GCD candidate coincides with GCD
Alexei Sheplyakov [Mon, 17 May 2010 22:17:26 +0000 (00:17 +0200)]
pgcd(): avoid infinite loop if the first GCD candidate coincides with GCD

136 if (H_lcoeff.is_equal(lc_gcd)) {
137 if ((Hprev-H).expand().smod(pn).is_zero()) // (*)
138 continue;

The check (*) can result in infinite loop if the (very) first GCD candidate
gives the correct GCD: any subsequent iterations give the same result, so
Hprev and H will be equal (hence the infinite loop). That check is not very
useful (AFAIR I was trying to avoid extra division checks), so let's remove it.

13 years agoFix URL of CODA.
Richard Kreckel [Mon, 17 May 2010 06:37:08 +0000 (08:37 +0200)]
Fix URL of CODA.

13 years agoFix memory leak in excompiler due to use of wrong operator delete.
Richard Kreckel [Thu, 13 May 2010 20:54:52 +0000 (22:54 +0200)]
Fix memory leak in excompiler due to use of wrong operator delete.

This was reported by Martin Ettl <ettl.martin@gmx.de>.

13 years agoExplicit function disambiguation.
Richard Kreckel [Thu, 13 May 2010 16:30:40 +0000 (18:30 +0200)]
Explicit function disambiguation.

This is necessary for compilers where the hyperbolic and the tgamma function
templates are pulled in from <cmath> and compete with GiNaC's function
templates. GCC 4.4 and 4.5 need this, when compiling with -std=cxx0x.

13 years agoFix weird ctor invocation syntax.
Richard Kreckel [Tue, 27 Apr 2010 20:44:35 +0000 (22:44 +0200)]
Fix weird ctor invocation syntax.

This patch is required for GCC-4.5.

13 years agoProducts (class mul) now answer correctly to info_flags::negative and
Jens Vollinga [Sun, 28 Mar 2010 22:21:18 +0000 (00:21 +0200)]
Products (class mul) now answer correctly to info_flags::negative and

13 years agoReally fixed the atan2(-Pi, 0) bug.
Richard Kreckel [Thu, 25 Mar 2010 22:08:54 +0000 (23:08 +0100)]
Really fixed the atan2(-Pi, 0) bug.

The problem was that atan2_eval assumed that if y is real and not
positive, it must be negative. But this neglects the fact that in
symbolic compution it may just not be possible to determine the
sign. Now, the expression is returned as it is. Ugly, but correct.

13 years agoMerge branch 'master' of ssh://www.ginac.de/srv/git/ginac
Richard Kreckel [Thu, 25 Mar 2010 21:23:13 +0000 (22:23 +0100)]
Merge branch 'master' of ssh://www.ginac.de/srv/git/ginac

13 years agoFixed a bug in atan2. It gave a division by zero error for calls like
Jens Vollinga [Thu, 25 Mar 2010 09:36:41 +0000 (10:36 +0100)]
Fixed a bug in atan2. It gave a division by zero error for calls like
atan2(-Pi,0), because arguments like -Pi were not recognized (via
info_flags) as negative but as real nevertheless.

13 years agoCopyright goes 2010.
Jens Vollinga [Fri, 5 Mar 2010 20:37:19 +0000 (21:37 +0100)]
Copyright goes 2010.

13 years agoUpdate copyright notice.
Richard Kreckel [Sat, 27 Feb 2010 14:00:22 +0000 (15:00 +0100)]
Update copyright notice.

13 years agopgcd(): detect relatively prime polynomials properly...
Alexei Sheplyakov [Tue, 23 Feb 2010 10:01:23 +0000 (12:01 +0200)]
pgcd(): detect relatively prime polynomials properly...

... so pgcd() doesn't loop forever any more. Division test does not handle
relatively prime polynomials (because C = 1 divides any polynomial). So we
should stop interpolation (and return gcd of contents) if we got relatively
prime images (we should do that for efficiency reasons too).

Thanks to Jörg Arndt for a bug report.

13 years agoInstall the ginac-excompiler script iff excompiler is supported and enabled.
Alexei Sheplyakov [Wed, 6 Jan 2010 17:56:04 +0000 (19:56 +0200)]
Install the ginac-excompiler script iff excompiler is supported and enabled.

14 years agoFix libtool versioning fiasco.
Richard Kreckel [Wed, 4 Nov 2009 20:58:26 +0000 (21:58 +0100)]
Fix libtool versioning fiasco.

Fix f2f67dde5c9caca, which caused the soname to be bumped too frequently.

14 years agoAdd mul::info() and add::info() support for numeric info_flags.
Richard Kreckel [Sun, 11 Oct 2009 21:19:21 +0000 (23:19 +0200)]
Add mul::info() and add::info() support for numeric info_flags.

This way, GiNaC knows that the sum or product of a number of positive
expressions is again a positive expression. [by Vladimir Kisil]

14 years agoOutput LaTeX-symbols using \mathrm, instead of \mbox.
Richard Kreckel [Sun, 4 Oct 2009 20:30:45 +0000 (22:30 +0200)]
Output LaTeX-symbols using \mathrm, instead of \mbox.

Using \mathrm improves printing in complex formulae.
One reason is that it scales in fractions. [by Vladimir Kisil]

14 years agoRemove debian/ directory.
Richard Kreckel [Tue, 29 Sep 2009 20:25:16 +0000 (22:25 +0200)]
Remove debian/ directory.

The lifecycle of the Debian packaging files is better maintained in
the Debian pool's diff file. Removing these files makes the life of
the GiNaC releaser easier.

14 years agoProperly document how to deal with libtool versioning.
Richard Kreckel [Tue, 29 Sep 2009 20:08:11 +0000 (22:08 +0200)]
Properly document how to deal with libtool versioning.

The old description was referring to ginac_lt_age which should always
stay 0, because we promised to mark incompatible binary interfaces by
bumping ginac_minor_version (or even ginac_major_version). Let's get
rid of ginac_lt_age.

14 years agomodular_matrix: don't use STL iterators in {mul, sub}_col and friends.
Alexei Sheplyakov [Sat, 8 Aug 2009 10:03:15 +0000 (13:03 +0300)]
modular_matrix: don't use STL iterators in {mul, sub}_col and friends.

Not using STL iterators makes the code simpler and cleaner. Also we don't
have to argue whether the standard ([lib.random.access.iterators]) imposes
any pre/post-condictions on operator+=.

14 years agoshaker_sort, permutation_sign: fix invalid use of STL iterators.
Alexei Sheplyakov [Sat, 8 Aug 2009 10:03:48 +0000 (13:03 +0300)]
shaker_sort, permutation_sign: fix invalid use of STL iterators.

According to the standard incrementing end(), and decrementing begin()
are ill-defined operations (see [lib.forward.iterators],

14 years agosymmetry::calchash(): be careful to not dereference past-the-end iterator.
Alexei Sheplyakov [Sat, 8 Aug 2009 10:07:14 +0000 (13:07 +0300)]
symmetry::calchash(): be careful to not dereference past-the-end iterator.

14 years agocheck_parameter_G: fix pontential increment of end().
Alexei Sheplyakov [Sat, 8 Aug 2009 10:06:36 +0000 (13:06 +0300)]
check_parameter_G: fix pontential increment of end().

Incrementing past-the-end iterator is not permitted by the standard, see

14 years agoG_eval: fix incorrect use of STL iterator.
Alexei Sheplyakov [Sat, 8 Aug 2009 10:02:47 +0000 (13:02 +0300)]
G_eval: fix incorrect use of STL iterator.

According to [lib.bidirectional.iterators] it's not OK to decrement
an iterator pointing to the beginning of the sequence. Fortunately random
access iterators provided by (current versions of) gcc/libstdc++ don't have
this silly limitation, so the code which works with pointers works with
iterators without any changes at all. However,
 - there's no guarantee that the current behavior won't change in the future
 - some non-GNU compilers are not that smart (i.e. the program segfaults
   upon when decrementing beginning-of-the-sequence iterator).

14 years agoAllow underscores in identifiers.
Jens Vollinga [Wed, 15 Jul 2009 03:19:07 +0000 (05:19 +0200)]
Allow underscores in identifiers.

14 years agoChanged the parser such that it understands all defined functions
Jens Vollinga [Fri, 10 Jul 2009 13:01:04 +0000 (15:01 +0200)]
Changed the parser such that it understands all defined functions
including the user defined ones.

To this end a method has been added to class function to allow the
modified get_default_reader() function to build up a complete prototype
table. The autogen tool is no longer required.

14 years agoFixed manual to correctly explain return_type_tinfo().
Jens Vollinga [Fri, 10 Jul 2009 07:54:09 +0000 (09:54 +0200)]
Fixed manual to correctly explain return_type_tinfo().

14 years agoRaised required version of CLN to 1.2.2.
Jens Vollinga [Wed, 10 Jun 2009 09:28:34 +0000 (11:28 +0200)]
Raised required version of CLN to 1.2.2.

14 years agoAdded include for cstdio header.
Jens Vollinga [Fri, 24 Apr 2009 21:37:44 +0000 (23:37 +0200)]
Added include for cstdio header.
gcc 4.0 does not include cstdio as part of other headers like string
anymore. As a result, gcc 4.0 complained about EOF being undefined.

14 years agocalchash(): work around broken RTTI.
Alexei Sheplyakov [Mon, 23 Feb 2009 12:08:42 +0000 (14:08 +0200)]
calchash(): work around broken RTTI.

Due to the strange (although permitted by the standard) behaviour of C++
RTTI on woe32 calchash() returns different hash values for equal objects.
As a result automatic evaluation gets spectacularly broken:

examining clifford objects.....({1+t,2+x,3+y,4+z}) - ({1+t,2+x,3+y,4+z}) erroneously returned -{1+t,2+x,3+y,4+z}+{1+t,2+x,3+y,4+z} instead of 0
({1+t,2+x,3+y,4+z}) - ({1+t,2+x,3+y,4+z}) erroneously returned -{1+t,2+x,3+y,4+z}+{1+t,2+x,3+y,4+z} instead of 0
.({1+t,2+x,3+y,4+z}) - ({1+t,2+x,3+y,4+z}) erroneously returned -{1+t,2+x,3+y,4+z}+{1+t,2+x,3+y,4+z} instead of 0
({1+t,2+x,3+y,4+z}) - ({1+t,2+x,3+y,4+z}) erroneously returned {1+t,2+x,3+y,4+z}-{1+t,2+x,3+y,4+z} instead of 0
.......FAIL: exam_clifford.exe

This patch works around `features' of woe32 RTTI, so calchash() works

14 years agoFix compilation failure due to (template) operator- defined in factor.cpp
Alexei Sheplyakov [Mon, 23 Feb 2009 12:03:16 +0000 (14:03 +0200)]
Fix compilation failure due to (template) operator- defined in factor.cpp

GiNaC 1.5.0 fails to compile with g++ 3.4.
The fix is simple: declare (and define) operator- (and operator+) only
for (univariate) polynomials.

14 years agoUnivariate GCD timing: use sr_gcd when appropriate. release_1-5-0
Alexei Sheplyakov [Mon, 16 Feb 2009 14:23:16 +0000 (16:23 +0200)]
Univariate GCD timing: use sr_gcd when appropriate.

The benchmark consists of two parts:
1) timing of different GCD calculation methods (i.e. subresultant PRS,
   heuristic, chinese remaindering).
2) timing of different implementations of the same method. The purpose
   is to find out how (in)efficient GiNaC::ex is as a representation
   of (univariate) polynomials (as a side note, the result is a bit
   depressing -- using coefficient vector instead of GiNaC:ex makes
   GCD calculation 50x -- 1000x faster).

Now GiNaC uses modular (chinese remaindering) GCD by default, so part 2)
got broken, i.e. instead of (intended) timings

a) (heuristic, GiNaC::ex) versus (heuristic, coefficient vector)
b) (PRS, GiNaC::ex) versus (PRS, coefficient vector)

one gets

a') (heuristic, GiNaC::ex) versus (heuristic, coefficient vector)
b') (chinese remaindering, GiNaC::ex) versus (PRS, coefficient vector)

Set the gcd_options::use_sr_gcd to restore the meaning of the benchmark.

Note: this patch does not affect the library proper.

14 years agoPolished NEWS a little bit.
Alexei Sheplyakov [Mon, 16 Feb 2009 14:24:15 +0000 (16:24 +0200)]
Polished NEWS a little bit.

14 years agoAdded release date.
Jens Vollinga [Tue, 17 Feb 2009 13:38:17 +0000 (14:38 +0100)]
Added release date.

14 years agoAdjusted NEWS and INSTALL documentation.
Jens Vollinga [Fri, 6 Feb 2009 15:49:47 +0000 (16:49 +0100)]
Adjusted NEWS and INSTALL documentation.

14 years agoMissed to change one date in function.pl.
Jens Vollinga [Fri, 6 Feb 2009 15:35:22 +0000 (16:35 +0100)]
Missed to change one date in function.pl.

14 years agoChanged name of debugging macro (to avoid warning cause by multiple definition).
Jens Vollinga [Fri, 6 Feb 2009 15:24:58 +0000 (16:24 +0100)]
Changed name of debugging macro (to avoid warning cause by multiple definition).

14 years agoFixed returning of test result (++result was +result).
Jens Vollinga [Fri, 6 Feb 2009 15:22:58 +0000 (16:22 +0100)]
Fixed returning of test result (++result was +result).

14 years agoPrettified source code.
Jens Vollinga [Fri, 6 Feb 2009 15:07:10 +0000 (16:07 +0100)]
Prettified source code.

- Added copyright and GPL licencing to new files.
- Increased year to 2009.
- Changed guarding macros in header to uniform pattern without leading or
  trailing __ (double underscores).
- Put includes of system wide header consistently below own includes (help
  a tiny bit to clarify dependencies).

14 years agoFix chinese_remainder() so modular GCD actually works.
Alexei Sheplyakov [Fri, 6 Feb 2009 06:57:32 +0000 (08:57 +0200)]
Fix chinese_remainder() so modular GCD actually works.

14 years agoAutomake now needs to be version >=1.8. Older versions like 1.7.9 do not create
Jens Vollinga [Fri, 6 Feb 2009 12:13:06 +0000 (13:13 +0100)]
Automake now needs to be version >=1.8. Older versions like 1.7.9 do not create
the directory m4 in a VPATH build.

14 years agoRenamed files *.tcc and *.hpp to *.h.
Jens Vollinga [Thu, 5 Feb 2009 09:54:21 +0000 (10:54 +0100)]
Renamed files *.tcc and *.hpp to *.h.

14 years agoFixed compile errors introduced in previous commit
Jens Vollinga [Tue, 3 Feb 2009 12:50:33 +0000 (13:50 +0100)]
Fixed compile errors introduced in previous commit

14 years agoImplement modular multivariate GCD (based on chinese remaindering algorithm).
Alexei Sheplyakov [Mon, 19 Jan 2009 06:45:38 +0000 (08:45 +0200)]
Implement modular multivariate GCD (based on chinese remaindering algorithm).

Both algorithm and implementation are a bit inefficient:

* algorithm does not make use of sparseness of inputs (and most of
  multivariate polynomials are quite sparse)
* GiNaC's expressions are essentially immutable. Thus some simple
  operations (i.e. multiplying a polynomial by an element of the base ring)
  are prohibitively expensive.
* All numbers (i.e. GiNaC::numeric objects) are heap allocated.

Still it's much faster (~5x on bivariate polynomials, ~100x on 3-variate
ones) than (subresultant) PRS algorithm, so gcd() uses modular algorithm
by default.

14 years agoImprove (fix?) smod: now it really converts into symmetric representation...
Alexei Sheplyakov [Mon, 19 Jan 2009 06:44:36 +0000 (08:44 +0200)]
Improve (fix?) smod: now it really converts into symmetric representation...

... instead of clumsy convention inspirited by some proprietary CAS.

14 years agoFix copy-paste error in GINACLIB_MICRO_VERSION.
Alexei Sheplyakov [Mon, 19 Jan 2009 06:43:50 +0000 (08:43 +0200)]
Fix copy-paste error in GINACLIB_MICRO_VERSION.

14 years agoFixed bug in binomial(). binomial(n,0) erroneously returned 0.
Jens Vollinga [Thu, 8 Jan 2009 09:26:50 +0000 (10:26 +0100)]
Fixed bug in binomial(). binomial(n,0) erroneously returned 0.

14 years agoSmall fixes to avoid compile warnings (-Wall).
Jens Vollinga [Thu, 18 Dec 2008 11:19:35 +0000 (12:19 +0100)]
Small fixes to avoid compile warnings (-Wall).

14 years agoFixed bug in multivariate factorization. Fractional numerical content was not
Jens Vollinga [Thu, 18 Dec 2008 10:10:50 +0000 (11:10 +0100)]
Fixed bug in multivariate factorization. Fractional numerical content was not
extracted and led to a not so finite running behavior. Added new checks for that

Added static keywords to hide debugging output operators.

15 years agoAdded new items.
Jens Vollinga [Mon, 1 Dec 2008 09:26:38 +0000 (10:26 +0100)]
Added new items.

15 years ago[PATCH] [build] Simplify generation of ginac/version.h
Alexei Sheplyakov [Mon, 1 Dec 2008 09:13:12 +0000 (10:13 +0100)]
[PATCH] [build] Simplify generation of ginac/version.h

15 years ago[PATCH] Fix GiNaC library version information.
Alexei Sheplyakov [Mon, 1 Dec 2008 09:12:25 +0000 (10:12 +0100)]
[PATCH] Fix GiNaC library version information.

The libtool naming scheme cannot guarantee that on all systems, the numbering
is consecutive. It only guarantees that it is increasing. This doesn't matter,
though: there is not incurred cost for numbers that are omitted, except for
shrinking the available space of leftover numbers. Not something we need to
worry about yet.  ;-)  On the other hand, tricks which we were using to make
version numbers consecutive on GNU/Linux break versioning on other OSes.

15 years agoFixed a problem in polynomial divide by deactivating a recursion that lead to a
Jens Vollinga [Mon, 1 Dec 2008 08:54:53 +0000 (09:54 +0100)]
Fixed a problem in polynomial divide by deactivating a recursion that lead to a
significant slowdown in sqrfree() and sometimes to a infinite loop.

15 years agoAdded section about factor(). Made appropriate changes at other places.
Jens Vollinga [Fri, 14 Nov 2008 11:00:52 +0000 (12:00 +0100)]
Added section about factor(). Made appropriate changes at other places.

15 years agoAdded many comments.
Jens Vollinga [Thu, 13 Nov 2008 15:36:02 +0000 (16:36 +0100)]
Added many comments.

15 years agoFixed lots of bugs in factor_multivariate().
Jens Vollinga [Thu, 13 Nov 2008 10:13:05 +0000 (11:13 +0100)]
Fixed lots of bugs in factor_multivariate().

factor_univariate() takes now the content of the polynomial into accout when
choosing a prime. It also returns the chosen prime. This supports the
factor_multivariate() code.

Polynomials are expanded before calling factor_sqrfree(). This avoids problems
with some input polynomials.

Added static qualifiers to all hidden functions.

15 years agoFixed a bug in squarefree(). Some polynomials were erroneously classified as
Jens Vollinga [Tue, 11 Nov 2008 09:33:29 +0000 (10:33 +0100)]
Fixed a bug in squarefree(). Some polynomials were erroneously classified as
square free (e.g. x^prime+1).

Fixed a bug in multivar_diophant() causing  sporadically an infinite loop.

Improved lifting bound code.

Univariate lifting can now use a cache for the modular factors. At the moment,
this gives no measurable speed gain.

15 years agoAdded modular square free factorization.
Jens Vollinga [Mon, 10 Nov 2008 12:38:11 +0000 (13:38 +0100)]
Added modular square free factorization.
Completed distinct degree factorization.
Univariate polynomial factorization uses now upoly.
Merged class Partition and function split into class factor_partition.

15 years agoStupid error: did the revert on the wrong branch (master instead of ginac_1-4).
Jens Vollinga [Thu, 6 Nov 2008 13:18:01 +0000 (14:18 +0100)]
Stupid error: did the revert on the wrong branch (master instead of ginac_1-4).

Revert "Revert "[portability] GiNaC::compile_ex works on OpenBSD now.""

This reverts commit a6854a8a0f1e5db722320f5d7ccb9097053500cf.

15 years agoRevert "[portability] GiNaC::compile_ex works on OpenBSD now."
Jens Vollinga [Thu, 6 Nov 2008 13:13:54 +0000 (14:13 +0100)]
Revert "[portability] GiNaC::compile_ex works on OpenBSD now."

This reverts commit 375a7aa1f13fa6061c278eb2c2447fd91521b45d.

15 years agoUnivariate Hensel lifting now uses upoly.
Jens Vollinga [Thu, 6 Nov 2008 13:11:02 +0000 (14:11 +0100)]
Univariate Hensel lifting now uses upoly.
Changed q_matrix code.

15 years agoEquip ginac-examples.texi with directory entry for info.
Paul Irofti [Tue, 4 Nov 2008 14:55:34 +0000 (17:55 +0300)]
Equip ginac-examples.texi with directory entry for info.

15 years ago[portability] GiNaC::compile_ex works on OpenBSD now.
Alexei Sheplyakov [Mon, 3 Nov 2008 16:17:16 +0000 (19:17 +0300)]
[portability] GiNaC::compile_ex works on OpenBSD now.

* acinclude.m4: check for dlopen() in libdl and in libc itself.

Thanks to Paul Irofti for a bug report and a suggestion.

15 years ago[build] Set correct rpath for linking with CLN...
Alexei Sheplyakov [Mon, 3 Nov 2008 14:34:29 +0000 (17:34 +0300)]
[build] Set correct rpath for linking with CLN...

... so users won't get 'error while loading shared libraries: no such file
or directory'. Also embed rpath into pkg-config meta data, so

g++ `pkg-config --cflags --libs ginac` foo.cc

actually works without any additional effort from the user side.

15 years ago[bugfix] integer_cra: check if arguments contain at least 2 moduli
Alexei Sheplyakov [Thu, 23 Oct 2008 13:48:14 +0000 (17:48 +0400)]
[bugfix] integer_cra: check if arguments contain at least 2 moduli

While at it, also fix exam_cra so it does not produce pointless inputs.

15 years agoexam_cra: explicitly #include <limits>. This should make g++ 4.3 happy.
Alexei Sheplyakov [Tue, 21 Oct 2008 06:09:33 +0000 (10:09 +0400)]
exam_cra: explicitly #include <limits>. This should make g++ 4.3 happy.

15 years agoChanged debugging facilities in factor.cpp.
Jens Vollinga [Wed, 5 Nov 2008 12:56:53 +0000 (13:56 +0100)]
Changed debugging facilities in factor.cpp.

15 years agoFixed some minor spelling errors.
Jens Vollinga [Wed, 5 Nov 2008 10:31:35 +0000 (11:31 +0100)]
Fixed some minor spelling errors.

15 years agoChanged code from using cl_UP_MI to using umodpoly. The cl_UP_MI interface was
Jens Vollinga [Wed, 5 Nov 2008 10:22:19 +0000 (11:22 +0100)]
Changed code from using cl_UP_MI to using umodpoly. The cl_UP_MI interface was
inconvenient to use and caused several very difficult bugs (some were still
unresolved before changing to umodpoly!).

Fixed severe bug in multivariate factorization. The condition that all modular
factors should be relatively prime in the base ring was violated. This caused
the factorization sometimes to go into an infinite loop.

15 years agoAdded code for distinct degree factorization.
Jens Vollinga [Mon, 3 Nov 2008 14:50:31 +0000 (15:50 +0100)]
Added code for distinct degree factorization.

15 years agotutorial: simplify the instructions on writing extension classes.
Alexei Sheplyakov [Sun, 19 Oct 2008 16:21:33 +0000 (20:21 +0400)]
tutorial: simplify the instructions on writing extension classes.

Don't mention (un)archiving while describing the `mystring' class
(the minimalistic extension class), so readers have less chances to get

15 years agoDon't force every algebraic class to implement archiving/unarchiving.
Alexei Sheplyakov [Sun, 19 Oct 2008 15:39:30 +0000 (19:39 +0400)]
Don't force every algebraic class to implement archiving/unarchiving.

So people who don't use (un)archiving don't need to bother with it.

15 years agotutorial: don't mention custom RTTI any more (as it does not exist).
Alexei Sheplyakov [Fri, 17 Oct 2008 13:57:27 +0000 (17:57 +0400)]
tutorial: don't mention custom RTTI any more (as it does not exist).

15 years agosymbol: make get_domain() a virtual method, remove symbol::domain.
Alexei Sheplyakov [Thu, 16 Oct 2008 11:43:32 +0000 (15:43 +0400)]
symbol: make get_domain() a virtual method, remove symbol::domain.

This cuts yet another 4 bytes from GiNaC::symbol. While at it, fix a memory
leak in ginsh.

15 years agosymbol: don't bother to set TeX name if user did not specified one.
Alexei Sheplyakov [Thu, 16 Oct 2008 11:43:32 +0000 (15:43 +0400)]
symbol: don't bother to set TeX name if user did not specified one.

Same for the usual name. As a result we use less memory (and the output
is exactly the same).

15 years agosymbol: remove return_type_tinfo() and return_type() (shrink symbol by 8 bytes)
Alexei Sheplyakov [Fri, 17 Oct 2008 10:56:54 +0000 (14:56 +0400)]
symbol: remove return_type_tinfo() and return_type() (shrink symbol by 8 bytes)

Bloating symbol to the state sizeof(symbol) == 64 is not appreciated at all.
If someone needs/wants non-commutative symbols or other fancy stuff, please
derive from class symbol and do whatever you want.

15 years agoWipe out remnants of custom RTTI.
Alexei Sheplyakov [Fri, 17 Oct 2008 09:41:01 +0000 (13:41 +0400)]
Wipe out remnants of custom RTTI.

Custom RTTI considered harmful, final part.

15 years agoregistered_class_info: use typeid() instead of tinfo_static.
Alexei Sheplyakov [Wed, 15 Oct 2008 11:32:11 +0000 (15:32 +0400)]
registered_class_info: use typeid() instead of tinfo_static.

(Custom RTTI considered harmful, part 5).

Since custom RTTI is going to be removed, registered_class_info needs to be
re-organazied. Now tinfo_key is a (const) pointer to std::type_info.

15 years agoA better return_type_tinfo() mechanism.
Alexei Sheplyakov [Fri, 17 Oct 2008 09:15:03 +0000 (13:15 +0400)]
A better return_type_tinfo() mechanism.

return_type_tinfo() is used in order to distingish between non-commutative
objects of different type. However, often it's necessary to distingish
between non-commutative objects of the same type, for example, between
gamma matrices with different representation label. return_type_tinfo()
does not provide any clean way to do that. Hence, introduce return_type_t
type which holds representation label along with type information, and
use it for return_type_tinfo().

15 years agocalchash(): use type_info::name() instead of tinfo().
Alexei Sheplyakov [Wed, 15 Oct 2008 11:32:11 +0000 (15:32 +0400)]
calchash(): use type_info::name() instead of tinfo().

Custom RTTI considered harmful, part 4.

The hash value of the object of different types should be different whenever
possible. Hence calcash() needs a unique per type number. Previously we used
tinfo_key for this. typeinfo::name() (a *pointer* to implementation dependent
string) is also unique for each class, so it's just as good as tinfo() is.

15 years agoindexed::eval: use standard C++ RTTI.
Alexei Sheplyakov [Wed, 15 Oct 2008 11:32:11 +0000 (15:32 +0400)]
indexed::eval: use standard C++ RTTI.

Custom RTTI considered harmful, part 3.

15 years agobasic, expairseq: use standard C++ RTTI in compare(), is_equal(), match(), etc.
Alexei Sheplyakov [Wed, 15 Oct 2008 11:32:11 +0000 (15:32 +0400)]
basic, expairseq: use standard C++ RTTI in compare(), is_equal(), match(), etc.

Custom RTTI considered harmful, part 2.

* basic.cpp: use standard C++ RTTI in compare(), is_equal(), operator=(),
* expairseq.cpp: use standard C++ RTTI in match(), make_flat(),

15 years agois_exactly_a: use typeid() to check the type of expression.
Alexei Sheplyakov [Wed, 15 Oct 2008 11:32:11 +0000 (15:32 +0400)]
is_exactly_a: use typeid() to check the type of expression.

Custom RTTI considered harmful, part 1.

Custom run time type information (RTTI) system implemented in GiNaC have
several serious drawbacks, such as

1. It makes writing GiNaC classes unnecessary cumbersome.
2. It wastes sizeof(void *) bytes per object, for small objects like
   symbol, numeric, etc. this overhead is considerable.

It turns out that GiNaC's RTTI is not any faster than the standard one
(at least on GNU/Linux and Solaris with GNU C++ library and compiler).
So, GiNaC RTTI have no reasons to exit any more.

15 years agoptr.h: use unsigned int to store reference counts (in order to save memory).
Alexei Sheplyakov [Wed, 15 Oct 2008 06:16:07 +0000 (10:16 +0400)]
ptr.h: use unsigned int to store reference counts (in order to save memory).

We'll hardly ever get more than 2^32 references to the same object. So using
size_t to store reference count only wastes 4 bytes per object (on 64-bit
architecture). Use unsigned int instead.

15 years agoRewritten heuristic and PRS GCD for univariate polynomials, added benchmark.
Alexei Sheplyakov [Sun, 19 Oct 2008 17:27:14 +0000 (21:27 +0400)]
Rewritten heuristic and PRS GCD for univariate polynomials, added benchmark.

Using a better data structure for univariate polynomials makes GCD 10 -- 300
times faster (and less memory hungry).