]> www.ginac.de Git - ginac.git/log
ginac.git
10 years agoFix evaluation of log(p^a) -> a*log(p), if p>0 and a is real.
Vladimir V. Kisil [Sat, 28 Dec 2013 23:58:40 +0000 (23:58 +0000)]
Fix evaluation of log(p^a) -> a*log(p), if p>0 and a is real.

This evaluation was broken with commit e5c76f659e2e882d.

10 years agoexpairseq::match(): no side effects if match failed. Fixes spurious match failures.
Matthias Dellweg [Tue, 10 Dec 2013 08:55:28 +0000 (10:55 +0200)]
expairseq::match(): no side effects if match failed. Fixes spurious match failures.

> match(sin(y)*exp(b)+sin(x)*exp(a), sin($0)*exp(a)+exp(b)*sin($1))
FAIL

The reason is that expairseq::match() might assign a wildcard even if
the match fails. The first attempted submatch is sin(y)*exp(b) with
sin($0)*exp(a). It fails (as it should) but $0 == y gets assigned as
a side effect (which is wrong). Next submatch is sin(x)*exp(a) with
sin($0)*exp(a) (the same pattern as in the first submatch). This one
fails because of spurious $0 == y assignment.

Due to the unpredicatable term ordering the sequence of submatches might
be different and the match might succeed (as it should). This makes
debugging a bit more funny.

Signed-off-by: Matthias Dellweg <dellweg@tp1.uni-duesseldorf.de>
[Alexei Sheplyakov: figure out the cause of the problem, make a test case]

10 years agoExpansion rules for exp(), log(), and abs().
Vladimir V. Kisil [Sun, 3 Nov 2013 20:21:00 +0000 (22:21 +0200)]
Expansion rules for exp(), log(), and abs().

exp(a + b) -> exp(a)*exp(b)
log(a*b) -> log(a) + log(b)
abs(z*w) -> abs(z)*abs(w)

log and exp are transformed only if expand_options::expand_transcendental
is given.

Signed-off-by: Vladimir V. Kisil <kisilv@maths.leeds.ac.uk>
10 years agoIntroduce expand_options::expand_transcendental.
Vladimir V. Kisil [Sat, 2 Nov 2013 19:06:53 +0000 (21:06 +0200)]
Introduce expand_options::expand_transcendental.

In general expand() treats the argument as a rational expression (and
leave transcendental functions as they are). However sometimes it's
convenient to expand transcendental functions too, like

log(a*b) = log(a) + log(b)
exp(a + b) = exp(a)*exp(b)

Applying such transformation by default doesn't seem to be a smart idea
(think of log(p^2/mu^2) transformed to 2*log(p) - 2*log(mu)). Therefore
introduce expand_options::expand_transcendental. As the name implies expand()
tries to transform transcendental functions only if this flag is set.

Signed-off-by: Vladimir V. Kisil <kisilv@maths.leeds.ac.uk>
10 years agoKeep CLang/libc++ happy.
Richard Kreckel [Sun, 3 Nov 2013 12:49:07 +0000 (12:49 +0000)]
Keep CLang/libc++ happy.

10 years agoabs() and conjugate() provide some info() now.
Vladimir V. Kisil [Wed, 11 Sep 2013 08:26:30 +0000 (09:26 +0100)]
abs() and conjugate() provide some info() now.

10 years agoMake it possible to override info() for functions.
Vladimir V. Kisil [Wed, 11 Sep 2013 08:26:30 +0000 (09:26 +0100)]
Make it possible to override info() for functions.

Signed-off-by: Vladimir V. Kisil <kisilv@maths.leeds.ac.uk>
10 years agoPower with a real base and even exponent reports that it's non-negative
Vladimir V. Kisil [Thu, 1 Aug 2013 13:37:45 +0000 (14:37 +0100)]
Power with a real base and even exponent reports that it's non-negative

Signed-off-by: Vladimir V. Kisil <kisilv@maths.leeds.ac.uk>
10 years agoImprove abs_eval(): abs(conjugate(z)) => abs(z), ...
Vladimir V. Kisil [Thu, 1 Aug 2013 13:37:45 +0000 (14:37 +0100)]
Improve abs_eval(): abs(conjugate(z)) => abs(z), ...

... abs(step(z)) => step(z)

Signed-off-by: Vladimir V. Kisil <kisilv@maths.leeds.ac.uk>
10 years agoFunctions can define a custom expand() now.
Vladimir V. Kisil [Mon, 7 Oct 2013 05:04:30 +0000 (08:04 +0300)]
Functions can define a custom expand() now.

Signed-off-by: Vladimir V. Kisil <kisilv@maths.leeds.ac.uk>
10 years agoMore evaluation rules: abs(x^n) => abs(x)^n (x > 0, n is real).
Vladimir V. Kisil [Wed, 31 Jul 2013 08:48:24 +0000 (09:48 +0100)]
More evaluation rules: abs(x^n) => abs(x)^n (x > 0, n is real).

A simple test is added as well.

Signed-off-by: Vladimir V. Kisil <kisilv@maths.leeds.ac.uk>
10 years agoTransform abs(x)^n => x^n if x is real and n is even.
Vladimir V. Kisil [Tue, 30 Jul 2013 15:40:38 +0000 (16:40 +0100)]
Transform abs(x)^n => x^n if x is real and n is even.

While at it add some .hold() to returns which cannot be processed further.

Signed-off-by: Vladimir V. Kisil <kisilv@maths.leeds.ac.uk>
10 years agomul::info(): cache the result of the positiveness/negativeness checks, ...
Alexei Sheplyakov [Sun, 13 Oct 2013 10:16:16 +0000 (13:16 +0300)]
mul::info(): cache the result of the positiveness/negativeness checks, ...

... and use the cached result if possible.

10 years agoIntroduce status_flags::{is_positive,is_negative,purely_indefinite}
Alexei Sheplyakov [Sat, 3 Aug 2013 14:01:42 +0000 (17:01 +0300)]
Introduce status_flags::{is_positive,is_negative,purely_indefinite}

Quite a number of transformations can be applied if the expression
is known to be positive (negative) (for instance, sqrt(x^2*y^2) = x*y
if x >= 0 and y >= 0). However the check itself might be quite expensive.
Hence a few status_flags are introduced to cache the result.

10 years agoAdd subdir-objects to Automake options.
Richard Kreckel [Fri, 11 Oct 2013 21:11:35 +0000 (23:11 +0200)]
Add subdir-objects to Automake options.

This option is needed to keep automake 1.14 happy.

10 years ago[build] fix ginsh build for automake <=1.11.
Richard Kreckel [Sun, 11 Aug 2013 11:16:15 +0000 (13:16 +0200)]
[build] fix ginsh build for automake <=1.11.

automake <=1.11 and automake >=1.12 have different conventions for naming
C++ header files made by yacc.  To work with both, we write our own rule
rather than using automake's.

10 years ago[build] auto* tools based build: fix `make dist'.
Alexei Sheplyakov [Sun, 11 Aug 2013 06:59:53 +0000 (09:59 +0300)]
[build] auto* tools based build: fix `make dist'.

10 years agoimprove mul::info(): the product of two negative terms is positive, ...
Vladimir V. Kisil [Mon, 29 Jul 2013 16:25:25 +0000 (17:25 +0100)]
improve mul::info(): the product of two negative terms is positive, ...

... and the product of a positive and non-negative terms is non-negative.

10 years agoFix build from git repository.
Richard Kreckel [Wed, 31 Jul 2013 21:33:44 +0000 (21:33 +0000)]
Fix build from git repository.

To make automake aware of lex and yacc files, they must be renamed.

10 years agoAdd support for Texinfo-5.0.
Richard Kreckel [Wed, 31 Jul 2013 20:42:16 +0000 (20:42 +0000)]
Add support for Texinfo-5.0.

Recent versions of Texinfo complained about misplaced @subsection.
Change them into @appendixsection.

10 years agoShut up recent texinfo warning.
Richard Kreckel [Tue, 30 Jul 2013 18:19:49 +0000 (18:19 +0000)]
Shut up recent texinfo warning.

It seems like dircategory has to come before the first node.

10 years agoShut up recent automake warning.
Richard Kreckel [Mon, 29 Jul 2013 08:05:22 +0000 (08:05 +0000)]
Shut up recent automake warning.

'INCLUDES' was the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS').

10 years agoAdd the case of c1=-1 and c2>0 to the rewriting rule of exponents: (x^c1)^c2 -> x...
Vladimir V. Kisil [Sun, 28 Jul 2013 22:25:01 +0000 (23:25 +0100)]
Add the case of c1=-1 and c2>0 to the rewriting rule of exponents: (x^c1)^c2 -> x^(c1 * c2)

10 years ago[bugfix] factor_univariate(): handle polinomials over rationals (no segfaults any...
Alexei Sheplyakov [Sun, 28 Jul 2013 15:43:06 +0000 (18:43 +0300)]
[bugfix] factor_univariate(): handle polinomials over rationals (no segfaults any more).

11 years agoAdd symbol::set_TeX_name(string) member function.
Richard Kreckel [Wed, 23 Jan 2013 08:19:26 +0000 (09:19 +0100)]
Add symbol::set_TeX_name(string) member function.

This allows setting a symbol's TeX-name after construction.

11 years agoMake FindCLN actually work without pkg-config.
Alexei Sheplyakov [Fri, 27 Jul 2012 19:04:54 +0000 (22:04 +0300)]
Make FindCLN actually work without pkg-config.

11 years agoTrick CTest so the test suite runs when cross-compiling.
Alexei Sheplyakov [Fri, 27 Jul 2012 18:56:40 +0000 (21:56 +0300)]
Trick CTest so the test suite runs when cross-compiling.

The test suite can be run in some cross-compilation setups (say, MinGW
on Linux). Howerver CTest's add_test command does not add the .exe
suffix on its own, as a result `make test' fails. Let's help add_test a bit.

11 years agoWork around Tex Live 2012 versus doxygen problem.
Alexei Sheplyakov [Fri, 27 Jul 2012 18:55:35 +0000 (21:55 +0300)]
Work around Tex Live 2012 versus doxygen problem.

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. This patch works around the problem by
post-processing the generated *.ind file. This hack is a bit crude, however
it gets the job done (a proper fix is welcome, though).

11 years ago[build] GiNaC can be built with CMake now.
Alexei Sheplyakov [Mon, 30 May 2011 23:50:01 +0000 (02:50 +0300)]
[build] GiNaC can be built with CMake now.

Known issues:

* no make dist
* no make install-pdf

11 years ago[build] Move library version info into the version.h file.
Alexei Sheplyakov [Thu, 23 Feb 2012 20:20:44 +0000 (22:20 +0200)]
[build] Move library version info into the version.h file.

The point is to have this info easily available for both build systems.

11 years ago[build] Rewrite ginsh related sed scripts in python.
Alexei Sheplyakov [Tue, 10 Jan 2012 05:48:29 +0000 (08:48 +0300)]
[build] Rewrite ginsh related sed scripts in python.

This makes build scripts more portable and human readable.

11 years ago[build] Move archive version info into version.h (for non autotools build).
Alexei Sheplyakov [Sun, 29 May 2011 14:15:42 +0000 (17:15 +0300)]
[build] Move archive version info into version.h (for non autotools build).

The canonical location for all version info is the ginac/version.h file
now (so we can have two build systems without duplicating the version info
in configure.ac and CMakeLists.txt).

11 years ago[build] Define package version number in version.h (for non autotools build).
Alexei Sheplyakov [Sun, 29 May 2011 13:27:49 +0000 (16:27 +0300)]
[build] Define package version number in version.h (for non autotools build).

11 years ago[build] include config.h conditionally to not break non-autotools build.
Alexei Sheplyakov [Sun, 29 May 2011 13:18:39 +0000 (16:18 +0300)]
[build] include config.h conditionally to not break non-autotools build.

11 years agoConvert function.pl into C++ (well, almost) source and header.
Alexei Sheplyakov [Sun, 29 May 2011 12:26:37 +0000 (15:26 +0300)]
Convert function.pl into C++ (well, almost) source and header.

The code is much more readable now, as it's (almost) plain C++ (except
simple pythonic `preprocessor' instructions). As a side effect perl is
no longer necessary for building GiNaC.

11 years ago[bugfix] Always #include <lst.h> before using lst. Fixes build error on MinGW.
Alexei Sheplyakov [Tue, 17 Jul 2012 03:32:45 +0000 (06:32 +0300)]
[bugfix] Always #include <lst.h> before using lst. Fixes build error on MinGW.

[temp.expl.spec] says:

6 If a template, a member template or the member of a class template
  is explicitly specialized then that specialization shall be declared
  before the first use of that specialization that would cause an implicit
  instantiation to take place, in every translation unit in which such a
  use occurs; no diagnostic is required. If the program does not provide
  a definition for an explicit specialization and either the specialization
  is used in a way that would cause an implicit instantiation to take place
  or the member is a virtual member function, the program is ill-formed,
  no diagnostic required. An implicit instantiation is never generated for
  an explicit specialization that is declared but not defined.

Apparently we are breaking this rule (presumably since the commit 99901bd5c742
`Parser can now read GiNaC lists (lst) defined by braces.'). In particular,
parser.cpp does not include lst.h (neither directly nor indirectly) which
contains explicit specialization of lst::info(). However, parser.cpp
(indirectly) includes both container.h and registar.h, so the GiNaC::lst type
is declared (and is complete) before the first usage. Thus lst::info() gets
implicitly instantiated (using the general definition provided in container.h)
when compiling the parser.cpp file, and libginac fails to link properly due
to mutliply defined symbols:

libtool: link: ccache i686-w64-mingw32-g++ -shared -nostdlib /usr/lib/gcc/i686-w64-mingw32/4.6/../../../../i686-w64-mingw32/lib/../lib/dllcrt2.o /usr/lib/gcc/i686-w64-mingw32/4.6/crtbegin.o  .libs/add.o .libs/archive.o .libs/basic.o .libs/clifford.o .libs/color.o .libs/constant.o .libs/ex.o .libs/excompiler.o .libs/expair.o .libs/expairseq.o .libs/exprseq.o .libs/fail.o .libs/factor.o .libs/fderivative.o .libs/function.o .libs/idx.o .libs/indexed.o .libs/inifcns.o .libs/inifcns_trans.o .libs/inifcns_gamma.o .libs/inifcns_nstdsums.o .libs/integral.o .libs/lst.o .libs/matrix.o .libs/mul.o .libs/ncmul.o .libs/normal.o .libs/numeric.o .libs/operators.o .libs/power.o .libs/registrar.o .libs/relational.o .libs/remember.o .libs/pseries.o .libs/print.o .libs/symbol.o .libs/symmetry.o .libs/tensor.o .libs/utils.o .libs/wildcard.o .libs/parse_binop_rhs.o .libs/parser.o .libs/parse_context.o .libs/default_reader.o .libs/lexer.o .libs/parser_compat.o .libs/mod_gcd.o .libs/cra_garner.o .libs/upoly_io.o .libs/gcd_uvar.o .libs/chinrem_gcd.o .libs/collect_vargs.o .libs/divide_in_z_p.o .libs/mgcd.o .libs/optimal_vars_finder.o .libs/pgcd.o .libs/primpart_content.o   -L/home/build/GiNaC.pkg/mk/ginac/../../build-tree/inst/all/opt/i686-w64-mingw32/ginac/lib -lcln -L/usr/lib/gcc/i686-w64-mingw32/4.6 -L/usr/lib/gcc/i686-w64-mingw32/4.6/../../../../i686-w64-mingw32/lib/../lib -L/usr/lib/gcc/i686-w64-mingw32/4.6/../../../../i686-w64-mingw32/lib -lstdc++ -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt /usr/lib/gcc/i686-w64-mingw32/4.6/crtend.o  -O2 -march=i686 -Wl,--enable-auto-import -Wl,--export-all-symbols   -o .libs/libginac-2.dll -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker .libs/libginac.dll.a
Creating library file: .libs/libginac.dll.a
.libs/parser.o: In function `_ZNK5GiNaC9containerISt4listE4infoEj':
/home/build/GiNaC.pkg/mk/ginac/../../ginac/ginac/container.h:359: multiple definition of `GiNaC::container<std::list>::info(unsigned int) const'
.libs/lst.o:/usr/include/c++/4.6/bits/vector.tcc:390: first defined here
collect2: ld returned 1 exit status
make[4]: *** [libginac.la] Error 1
make[4]: Leaving directory `/home/build/GiNaC.pkg/build-tree/build/ginac-1.6.2/ginac'
make[3]: *** [all] Error 2

Thanks to Robert Durkacz for reporting.

12 years ago[BUGFIX] numeric::info(nonnegative): correctly handle complex numbers.
Alexei Sheplyakov [Tue, 28 Feb 2012 14:12:56 +0000 (16:12 +0200)]
[BUGFIX] numeric::info(nonnegative): correctly handle complex numbers.

numeric::info(info_flags::nonnegative) returns true for an arbitrary
complex number with non-zero imaginary part.

Thanks to Burcin Erocal for reporting.

12 years agoMerge branch 'master' of git://github.com/AlexeiSheplyakov/GiNaC
Alexei Sheplyakov [Thu, 23 Feb 2012 15:44:00 +0000 (17:44 +0200)]
Merge branch 'master' of git://github.com/AlexeiSheplyakov/GiNaC

12 years agoconfigure: correctly set rpath for linking with CLN ...
Alexei Sheplyakov [Thu, 23 Feb 2012 13:16:55 +0000 (15:16 +0200)]
configure: correctly set rpath for linking with CLN ...

... as to not break tests for libreadline and dlopen().

Problem:

When using GCC 4.6 the configure script fails to find libreadline and
libdl, although both libraries are definitely installed. See
http://www.ginac.de/pipermail/ginac-list/2012-January/001868.html for
more details.

Reason:

Apparently GCC 4.6 dislikes the -R/the/path switch (libtool way to say
-Wl,-rpath,/the/path in a cross platform manner). Previous versions of
GCC used to ignore the -R switch, however, GCC 4.6 errors out instead.
Thus the configure script fails to detect readline and dlopen.

Solution:

Set the rpath (for linking with CLN) using the compiler friendly syntax
(i.e. -Wl,-rpath -Wl,/the/path instead of -R/the/path).

12 years agoDocumentation: Update branch cut convention
Richard B. Kreckel [Thu, 8 Dec 2011 16:59:16 +0000 (16:59 +0000)]
Documentation: Update branch cut convention

Now that C++11 is out, there is no more need for oracling
about how it might eventually standardize the branch cuts of
elementary and inverse trigonometric and hyperbolic functions.

12 years agoPreparing for release 1.6.2. release_1-6-2
Jens Vollinga [Sun, 6 Nov 2011 14:10:50 +0000 (15:10 +0100)]
Preparing for release 1.6.2.

12 years agoParser can now read GiNaC lists (lst) defined by braces.
Jens Vollinga [Fri, 28 Oct 2011 19:09:33 +0000 (21:09 +0200)]
Parser can now read GiNaC lists (lst) defined by braces.
This commit completes the bug fix in commit
9a4f392521083d28e1c238e7898ab1d2ac5b73cd.

12 years agoFix warning "control reaches end of non-void function".
Richard Kreckel [Sat, 22 Oct 2011 19:37:13 +0000 (21:37 +0200)]
Fix warning "control reaches end of non-void function".

Being careful about this is required to pass the openSUSE build process.

12 years agoQuick and dirty bug fix for the parser to read GiNaC::lst again.
Jens Vollinga [Tue, 26 Jul 2011 18:39:29 +0000 (20:39 +0200)]
Quick and dirty bug fix for the parser to read GiNaC::lst again.
The parser only accepts lst in the form lst(...) not {...}, though.
Function prototype can now have a argument size of 0 to indicate
functions with an arbitrary number of arguments (like lst).

12 years agoFixed a bug in the code for subsitutions in indexed expressions.
Jens Vollinga [Fri, 22 Jul 2011 21:27:37 +0000 (23:27 +0200)]
Fixed a bug in the code for subsitutions in indexed expressions.
subs_options::no_index_renaming was ignored.
Thanks to Gerhard Hejc for reporting and suggesting a fix.

12 years agoPreparing for release. release_1-6-1
Jens Vollinga [Mon, 18 Jul 2011 19:24:09 +0000 (21:24 +0200)]
Preparing for release.

12 years agoBe more careful before converting to indexed.
Vladimir V. Kisil [Thu, 23 Jun 2011 14:20:59 +0000 (16:20 +0200)]
Be more careful before converting to indexed.

This patch makes GiNaC pass it's test suite when compiled with
-DDO_GINAC_ASSERT.

12 years agoMade yyerror() string argument constant to avoid an compile error with
Jens Vollinga [Tue, 21 Jun 2011 19:36:16 +0000 (21:36 +0200)]
Made yyerror() string argument constant to avoid an compile error with
gcc 4.6.

12 years agoRelax assertion in clifford ctor.
Richard Kreckel [Sun, 12 Jun 2011 21:10:07 +0000 (23:10 +0200)]
Relax assertion in clifford ctor.

Class clifford can be constructed with an idx object, now, not just
with a varidx.

12 years agoCare about refcounts when reclaiming memory allocated for static objects.
Richard Kreckel [Tue, 31 May 2011 06:46:32 +0000 (08:46 +0200)]
Care about refcounts when reclaiming memory allocated for static objects.

With commit aff357309f6 we started freeing numeric flyweights when the library
usage count drops to zero. But that triggers assertions in basic::~basic
when compiled with -DDO_GINAC_ASSERT because these flyweights are still being
used by their matching ex objects (their refcount is still 1). Instead of
removing that assertion, let's just call the ex::~ex manually and let it do
the freeing.

12 years agoJanitorial commit.
Richard Kreckel [Fri, 27 May 2011 06:51:05 +0000 (08:51 +0200)]
Janitorial commit.

Remove some assertions that have been wrong since a while, in particular since
8ba901b532b, when we started to factor numerical factors from power objects.

Fix some broken indentation. Fix some comment errors. Remove unused variable.

12 years agoconfigure: correctly warn about missing flex and/or bison.
Alexei Sheplyakov [Wed, 25 May 2011 09:18:27 +0000 (12:18 +0300)]
configure: correctly warn about missing flex and/or bison.

This version correctly handles out of source builds, does not break
cross compilation, and contains no bashisms.

12 years ago[build] configure: don't abuse AC_CHECK_FILE. Unbreaks the cross-compilation.
Alexei Sheplyakov [Mon, 23 May 2011 21:37:09 +0000 (00:37 +0300)]
[build] configure: don't abuse AC_CHECK_FILE. Unbreaks the cross-compilation.

Checking for ginsh_parser.h in configure is not a good idea, since it
1) produces a bogus warning during an out of source build,
2) breaks cross-compilation.

Solution: just skip that bogus check (auto* tools do a similar check in
the run-time *for a reason*).

12 years agoPreparing for release 1.6.0. release_1-6-0
Jens Vollinga [Sun, 22 May 2011 19:43:39 +0000 (21:43 +0200)]
Preparing for release 1.6.0.

12 years agoThis patch fixes a bug on machines where char is unsigned by default, by
Jens Vollinga [Sun, 22 May 2011 14:19:17 +0000 (16:19 +0200)]
This patch fixes a bug on machines where char is unsigned by default, by
extending the type of clifford_max_label to include all 257 possible
return values. Thanks to Martin Guy for the bug report and patch.

12 years agoRemoved autogen stuff from the configuration.
Jens Vollinga [Sun, 22 May 2011 13:49:50 +0000 (15:49 +0200)]
Removed autogen stuff from the configuration.

12 years agoUpdate the supported platforms/compilers list.
Alexei Sheplyakov [Sun, 22 May 2011 12:17:35 +0000 (15:17 +0300)]
Update the supported platforms/compilers list.

12 years agoParser: don't bother to generate 3 (C++) functions with autogen.
Alexei Sheplyakov [Sun, 22 May 2011 12:15:42 +0000 (15:15 +0300)]
Parser: don't bother to generate 3 (C++) functions with autogen.

12 years agoFix a typo in the GCD testcase.
Alexei Sheplyakov [Sun, 22 May 2011 12:15:07 +0000 (15:15 +0300)]
Fix a typo in the GCD testcase.

12 years agoLimiting the costly symmetrization tests inside simplify_indexed() to
Jens Vollinga [Fri, 20 May 2011 23:30:08 +0000 (01:30 +0200)]
Limiting the costly symmetrization tests inside simplify_indexed() to
cases where at least one antisymmetric or cyclic non-free index is
involved. Thanks to P.G.Clark for reporting the problem.

12 years agoChanged naming convention for the library. Now, it is only libginac.so
Jens Vollinga [Fri, 20 May 2011 21:30:38 +0000 (23:30 +0200)]
Changed naming convention for the library. Now, it is only libginac.so
without the release version included (instead of libginac-1.5.so, for
example). Since the previous commit broke the ABI, we are free to
implement this long planned change now.

12 years agoFixed a bug introduced in last commit.
Richard Kreckel [Fri, 20 May 2011 20:20:57 +0000 (22:20 +0200)]
Fixed a bug introduced in last commit.

Before, sqrt(2)*x used to be a polynomial in x.
Now, it is a polynomial in x again.

12 years agoFixed a bug in is_polynomial() that caused expressions like
Jens Vollinga [Fri, 20 May 2011 11:55:35 +0000 (13:55 +0200)]
Fixed a bug in is_polynomial() that caused expressions like
sqrt(x*x+1)*sqrt(x+1) to be wrongly identified as polynomials in x.
Thanks to Florent Hivert for reporting.

12 years ago./configure now gives more information/warnings about missing utilities.
Jens Vollinga [Fri, 20 May 2011 09:54:27 +0000 (11:54 +0200)]
./configure now gives more information/warnings about missing utilities.

12 years agoAvoiding a spurious missing ginac_parser.h error when doing a parallel
Jens Vollinga [Thu, 19 May 2011 08:29:14 +0000 (10:29 +0200)]
Avoiding a spurious missing ginac_parser.h error when doing a parallel
build (make -j..).

12 years agoThe patch improves the run time at the expense of using more RAM in some
Jens Vollinga [Thu, 19 May 2011 07:44:11 +0000 (09:44 +0200)]
The patch improves the run time at the expense of using more RAM in some
situations. Please note: it doesn't improve the actual algorithm
(iteration over all permutations). Thanks to Alexei Sheplyakov.

12 years agoFix mul::conjugate().
Richard Kreckel [Sun, 15 May 2011 16:40:44 +0000 (18:40 +0200)]
Fix mul::conjugate().

Overwrite conjugate() for mul objects because the base class's conjugate
function is incorrect at branch cuts when exponents are fractional (roots).
This has been reported as Sage #10964.

While at it, fix some funny indentation and remove unneeded tests.

12 years agoUpdated the news about changes done since the last release (2010-07-06).
Jens Vollinga [Tue, 10 May 2011 21:44:57 +0000 (23:44 +0200)]
Updated the news about changes done since the last release (2010-07-06).

13 years agoAdd conjugate() methods to functions cosh, sinh, tanh.
Vladimir V. Kisil [Sat, 9 Apr 2011 10:40:38 +0000 (12:40 +0200)]
Add conjugate() methods to functions cosh, sinh, tanh.

13 years ago[docs] Update the supported platforms/compilers list.
Alexei Sheplyakov [Thu, 3 Mar 2011 21:16:34 +0000 (23:16 +0200)]
[docs] Update the supported platforms/compilers list.

13 years agoParser: don't bother to generate 3 (C++) functions with autogen.
Alexei Sheplyakov [Sat, 26 Feb 2011 08:39:29 +0000 (10:39 +0200)]
Parser: don't bother to generate 3 (C++) functions with autogen.

13 years ago[trivia] Fix a typo in the GCD testcase.
Alexei Sheplyakov [Wed, 9 Feb 2011 05:48:08 +0000 (07:48 +0200)]
[trivia] Fix a typo in the GCD testcase.

13 years agoExtend copyright to 2011.
Richard Kreckel [Fri, 4 Feb 2011 07:59:28 +0000 (08:59 +0100)]
Extend copyright to 2011.

13 years agoFix compilation with clang.
Richard Kreckel [Thu, 3 Feb 2011 23:20:48 +0000 (00:20 +0100)]
Fix compilation with clang.

This resolves some depending names that GCC generously accepts.

13 years agoDon't try to tie the library version to the package version number.
Richard Kreckel [Thu, 3 Feb 2011 23:14:00 +0000 (00:14 +0100)]
Don't try to tie the library version to the package version number.

Merge branch 'master' of git://github.com/AlexeiSheplyakov/GiNaC.tmp

13 years agoMerge branch 'master.msvc.support' of git://github.com/AlexeiSheplyakov/GiNaC
Richard Kreckel [Thu, 3 Feb 2011 22:48:21 +0000 (23:48 +0100)]
Merge branch 'master.msvc.support' of git://github.com/AlexeiSheplyakov/GiNaC

* 'master.msvc.support' of git://github.com/AlexeiSheplyakov/GiNaC:
  Omit extra qualification (as in struct foo f() vs foo f()).
  [msvc] msvc cannot handle string constants above 16k
  [msvc] Yet another compiler bug work around.
  [msvc] Work around strange scoping and name mangling rules.
  Add few defines for msvc (__func__, __alignof__).
  symmetry::compare_same_type(): const-correctness fix
  clifford: fix a few GCCisms (or, not).

13 years agoDon't try to tie the library version to the package version number.
Alexei Sheplyakov [Fri, 10 Dec 2010 17:06:17 +0000 (19:06 +0200)]
Don't try to tie the library version to the package version number.

Use curret:release:age to indicate ABI changes instead. Hard-code LT_RELEASE
to 1.5 to avoid spurious SONAME change (current code is binary-compatible
with GiNaC 1.5.8).

13 years agoMerge branch 'ginac_1-5' of git://www.ginac.de/ginac
Alexei Sheplyakov [Fri, 10 Dec 2010 16:34:22 +0000 (18:34 +0200)]
Merge branch 'ginac_1-5' of git://www.ginac.de/ginac

13 years agoUse C style cast when converting void* into function pointer.
Alexei Sheplyakov [Wed, 6 Jan 2010 17:55:43 +0000 (19:55 +0200)]
Use C style cast when converting void* into function pointer.

Building GiNaC 1.5.5 with GCC 3.4 fails with the following error:

libtool: compile:  ccache g++-3.4 -DHAVE_CONFIG_H -I. -I../../ginac -I../config -I/home/pc7135/varg/target/x86_64-linux-gnu/include -O2 -g -Wall -pipe -MT builtin_fcns.lo -MD -MP -MF .deps/builtin_fcns.Tpo -c ../../ginac/parser/builtin_fcns.cpp  -fPIC -DPIC -o .libs/builtin_fcns.o
../../ginac/parser/builtin_fcns.cpp: In function `GiNaC::ex (* GiNaC::encode_serial_as_reader_func(unsigned int))(const GiNaC::exvector&)':
/home/pc7135/varg/tmp/build/GiNaC/build-linux-gcc-3.4/ginac/../../ginac/parser/builtin_fcns.cpp|67| error: ISO C++ forbids casting between pointer-to-function and pointer-to-object
make[2]: *** [builtin_fcns.lo] Error 1

The C++98 standard [expr.reinterpret.cast] does not allow

reinterpret_cast<function_pointer>(void*)
reinterpret_cast<void*>(function_pointer)

But the ability to do so is important for a lot of practical uses. So soon
after the C++98 standard was approved, a language defect report was filed
on this topic, see
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#195
The result is that compilers will be allowed to support reinterpret_cast
conversions of function pointers to other (pointers) types, and vice a versa.
Such conversions work with *current* compilers (GCC 4.x), but don't work
with older ones, hence this patch.

13 years agoAdded get_builtin_reader() that parses only the builtin GiNaC functions
Jens Vollinga [Sun, 9 Aug 2009 21:38:48 +0000 (23:38 +0200)]
Added get_builtin_reader() that parses only the builtin GiNaC functions
and pow, sqrt, and power.

13 years agoFixed include of stdint.h (parser.cpp needs the header as well).
Jens Vollinga [Sun, 9 Aug 2009 21:27:10 +0000 (23:27 +0200)]
Fixed include of stdint.h (parser.cpp needs the header as well).

13 years agoFix the compliation error *for real* ... and restore performance
Alexei Sheplyakov [Sat, 8 Aug 2009 08:43:12 +0000 (11:43 +0300)]
Fix the compliation error *for real* ... and restore performance

Commit 8bf0597dde55e4c94a2ff39f1d8130902e3d7a9b (titled as 'Fixed the parser
such that it can read in user defined classes again.') made the parser a bit
slower, especially if the input contains many terms of user-defined type.
The reason for that is quite simple: we throw and catch an exception every
time we construct an object of user-defined type:

       // dirty hack to distinguish between serial numbers of functions and real
       // pointers.
       GiNaC::function* f = NULL;
       try {
               unsigned serial = (unsigned)(unsigned long)(void *)(reader->second);
               f = new GiNaC::function(serial, args);
       }
       catch ( std::runtime_error ) {
               if ( f ) delete f;
               ex ret = reader->second(args);
               return ret;
       }

Fortunately functions are aligned and we can use much more efficient
technique to distinguish between serial and pointers to functions.

13 years agoFix the compliation error *for real*
Alexei Sheplyakov [Fri, 7 Aug 2009 20:22:18 +0000 (23:22 +0300)]
Fix the compliation error *for real*

13 years agoFixed memory leak.
Jens Vollinga [Fri, 31 Jul 2009 15:54:16 +0000 (17:54 +0200)]
Fixed memory leak.

13 years agoFixed the fix in commit f059ebe117d15292e0d262e6e8e232e835c7e33c.
Jens Vollinga [Fri, 31 Jul 2009 13:29:17 +0000 (15:29 +0200)]
Fixed the fix in commit f059ebe117d15292e0d262e6e8e232e835c7e33c.

13 years agoFixed dirty hack in parser to distinguish between serial numbers and pointers.
Jens Vollinga [Fri, 31 Jul 2009 12:41:08 +0000 (14:41 +0200)]
Fixed dirty hack in parser to distinguish between serial numbers and pointers.

13 years agoFixed the parser such that it can read in user defined classes again.
Jens Vollinga [Fri, 31 Jul 2009 10:48:58 +0000 (12:48 +0200)]
Fixed the parser such that it can read in user defined classes again.
Fixed default reader to parse also pow, sqrt and power.

13 years agoFixed cast that caused compile error on 64bit machines.
Jens Vollinga [Fri, 31 Jul 2009 09:14:01 +0000 (11:14 +0200)]
Fixed cast that caused compile error on 64bit machines.

13 years agoAllow user defined functions to be parsed.
Jens Vollinga [Wed, 15 Jul 2009 06:26:33 +0000 (08:26 +0200)]
Allow user defined functions to be parsed.

This patch is an ugly hack that does the same as the commit
f38cbcd651246fb5c1294705d29399f3cbfddaf5
but without changing the ABI (so it can be used in ginac_1-5).

13 years agoRevert "Changed the parser such that it understands all defined functions"
Alexei Sheplyakov [Thu, 9 Dec 2010 18:42:50 +0000 (20:42 +0200)]
Revert "Changed the parser such that it understands all defined functions"

This reverts commit f38cbcd651246fb5c1294705d29399f3cbfddaf5, which
broke parsing user-defined classes.

13 years agoMake symbol::name be initialized lazily. ginac_1-5
Richard Kreckel [Thu, 9 Dec 2010 08:18:34 +0000 (09:18 +0100)]
Make symbol::name be initialized lazily.

This fixes symbol::get_name(), which returned an empty string instead of
"symbol" followed by the serial number if the symbol's name wasn't
specified in the constructor.

Thanks to Warren Weckesser for reporting this bug.
(cherry picked from commit f5abf61d2cb1a1d1809d270a24fa098575b172c4)

13 years agoMake symbol::name be initialized lazily.
Richard Kreckel [Thu, 9 Dec 2010 08:18:34 +0000 (09:18 +0100)]
Make symbol::name be initialized lazily.

This fixes symbol::get_name(), which returned an empty string instead of
"symbol" followed by the serial number if the symbol's name wasn't
specified in the constructor.

Thanks to Warren Weckesser for reporting this bug.

13 years ago[PATCH 2/2] chinrem_gcd: return correct integer content when GCD is a number.
Alexei Sheplyakov [Fri, 3 Dec 2010 23:36:50 +0000 (00:36 +0100)]
[PATCH 2/2] chinrem_gcd: return correct integer content when GCD is a number.

This patch fixes a silly typo and makes chinrem_gcd work correctly with
polynomials which are "almost" (up to an integer coefficient) relatively
prime.

Thanks to Ernst Moritz Hahn for a bug report and a test case.
(cherry picked from commit 00507499530d90533cf029bd503be326d9018138)

13 years ago[PATCH 1/2] extract_integer_content: check for rational numbers properly.
Alexei Sheplyakov [Fri, 3 Dec 2010 23:35:06 +0000 (00:35 +0100)]
[PATCH 1/2] extract_integer_content: check for rational numbers properly.

Commit 3d09388a (titled as `[bugfix] chinrem_gcd: handle polynomials over
rationals properly.') broke extract_integer_content: now it always returns 1.
The check for rational `integer_contnent' introduced by that commit is wrong
(since integers is a subset of rationals). Rewrite the check proprerly.
(cherry picked from commit f0fb303711b4334ce59f7da63bfa7cb49f46265f)

13 years ago[PATCH 2/2] chinrem_gcd: return correct integer content when GCD is a number.
Alexei Sheplyakov [Fri, 3 Dec 2010 23:36:50 +0000 (00:36 +0100)]
[PATCH 2/2] chinrem_gcd: return correct integer content when GCD is a number.

This patch fixes a silly typo and makes chinrem_gcd work correctly with
polynomials which are "almost" (up to an integer coefficient) relatively
prime.

Thanks to Ernst Moritz Hahn for a bug report and a test case.

13 years ago[PATCH 1/2] extract_integer_content: check for rational numbers properly.
Alexei Sheplyakov [Fri, 3 Dec 2010 23:35:06 +0000 (00:35 +0100)]
[PATCH 1/2] extract_integer_content: check for rational numbers properly.

Commit 3d09388a (titled as `[bugfix] chinrem_gcd: handle polynomials over
rationals properly.') broke extract_integer_content: now it always returns 1.
The check for rational `integer_contnent' introduced by that commit is wrong
(since integers is a subset of rationals). Rewrite the check proprerly.

13 years agoOmit extra qualification (as in struct foo f() vs foo f()).
Jan Rheinländer [Sun, 26 Sep 2010 12:23:01 +0000 (12:23 +0000)]
Omit extra qualification (as in struct foo f() vs foo f()).

According to the Standard extra qualification like this

struct foo;
struct foo f();

is valid. However msvc does not accept such a code. So let's omit extra
qualification, as in

struct foo;
foo f();

(it's still valid C++) to make msvc happy.

13 years ago[msvc] msvc cannot handle string constants above 16k
Jan Rheinländer [Mon, 20 Sep 2010 13:39:15 +0000 (13:39 +0000)]
[msvc] msvc cannot handle string constants above 16k

So let's split them.

13 years ago[msvc] Yet another compiler bug work around.
Jan Rheinländer [Mon, 20 Sep 2010 12:29:20 +0000 (12:29 +0000)]
[msvc] Yet another compiler bug work around.

msvc does not include the exprseq::info() method, giving unresolved symbols
when linking. Apparently adding a dummy function "fixes" the problem.

13 years ago[msvc] Work around strange scoping and name mangling rules.
Jan Rheinländer [Mon, 20 Sep 2010 12:23:14 +0000 (12:23 +0000)]
[msvc] Work around strange scoping and name mangling rules.

1. msvc creates different symbols for a variable declared in
   a namespace scope and (the same variable) in a class method
   scope. That is,

   // util.cpp
   namespace GiNaC {
   extern const ex _ex0; // [1]
   }
   // ex.h
   namespace GiNaC {
   class ex {
   public:
          bool is_zero() {
                extern const ex _ex0;
                // mangled name of _ex0 is different that of [1]
          }
   };
   }

2. The mangled names for cv-qualified and cv-unqualified versions
   of a type are different (which violates the requirements stated
   in [basic.type.qualifier])

These msvc's "features" cause linking failures due to unresolved
external symbols.

Solution:
1. Declare variables (_ex0) in the GiNaC namespace scope (for msvc only).
2. Add corresponding cv-qualifier(s).