Original Date: Fri, 25 Mar 2005 12:01:44 -0600 Here is a serie of patch to enhance computation that involves fraction integer. Do download gcl source, decompress this archive apply gcl.patch (this patch come from gcl-2.6.5 but can probably be applied on 2.6.6). recompress gcl, copy it to zips directory (keep the same name) remove gcldir and gcl-2.6.* in lsp directory patch the interpreter with interp.patch. (change behavior of coercion of fraction(integer)) patch fraction.spad.pamphlet (handle fraction(integer) as integer i.e by gcl) remove mnt/linux/algebra/FRAC.o, int/algebra/FRAC.NRLIB/code.o and int/algebra/FRAC.spad type make remove mnt/linux/algebra/FRAC.o, int/algebra/FRAC.NRLIB/code.o and int/algebra/FRAC.spad type touch src/algebra/fraction.spad.pamphlet or open it in an editor and resave it type make Have fun This involves one patch (gcl.patch) backported from gcl-2.7.0-cvs. It 's a request made to use algorithm from libgmp in cancellation of gcd. Copying of this patch is GNU LIBRARY GENERAL PUBLIC LICENSE Version 2, June 1991 How to patch --unknown, Fri, 25 Mar 2005 12:06:22 -0600 reply Change in root of application to patch (for example with gcl cd gcl-2.6.5) and type cat gcl.patch |patch -p0
If that doesn't work type cat gcl.patch |patch -p1
p0 or p1 depends of your place in the treeThis patch is just a code optimization (same algorithm is used). a:=matrix [[j^1/(j-i) for i in 1..50] for j in 51..100]; a*a; before: 2.10 sec after: 0.53 sec factor: 0.25Cheers seems that the changes to axiom only work with gcl. Is this correct? J Weiss Work with all implementations of common lisp. I use lisp rational. I just asked to change some algorithms (euclidean) in gcl. Bill, Can you make a new page for this? This looks strange... tested for several months. It is not necessary to ask me to make a new page... but I did it for you this time :) What do you mean: "This looks strange"? What has been "tested for several months"? Please explain in detail. I have worked with this modified domain for 6 months.Strange : In axiom nearly all computations involve spad code. Here I use gcl. What do you work with for 6 months? Do you mean this proposed patch? Do you have any specific unit test programs to show that it works properly? Yes, Axiom library is written using spad code. Axiom itself, including the spad compiler is written in lisp and one of the versions of lisp that supports Axiom is GCL. This is not strange. I wish you would take the time to explain what you are talking about. Short sentences with no background background information do not make any sense. I think your work deserves to be described in detail so that other people will understand. Please provide a detailed description. ... --unknown, None reply Date: Mon, 28 Mar 2005 12:10:43 -0600
Subject: A little background
Message-ID: <20050328121043-0600@page.axiom-developer.org>
Bill and all,
Take care, Example: (* -2147483648/2203319546073 4926328811737/4294967296) => Error: Caught fatal error [memory may be damaged]? on my machine (AMD64 (kernel 2.6.11.11 => which works around a bug in the AMD K8 CPUs?.)) I don't really understand your example, but this works for me:fricas [-2147483648/2203319546073,
Type: List(Fraction(Integer))
fricas (-2147483648/2203319546073) * (4926328811737/4294967296)
Type: Fraction(Integer)
With this patch on 64bits_kernel/Debian_AMD64/gcc-3.3 gcl caught a fatal error
About (* -2147483648/2203319546073 4926328811737/4294967296) bug, -2147483648
is the MOST-NEGATIVE-FIXNUM. If we negate it, it become a bignum
and it is handled differently.
This new patch (for gcl-2.6.6) fix this bug.
For old gcl, edit the old gcl.patch and change
if (type_of(y)==t_fixnum && type_of(x)==t_fixnum) return make_fixnum(fix(x)/fix(y)); / no in_place for fixnums as could be small /;to if (type_of(x)==t_fixnum){ if (type_of(y)==t_fixnum) return make_fixnum(fix(x)/fix(y)); / no in_place for fixnums as could be small /; // ABS (MOST-NEGATIVE-FIXNUM) => BIGNUM return make_fixnum(-1); }in integer_exact_quotient function.
Take care, Camm Maguire camm@enhanced.com ========================================================================== "The earth is but one country, and mankind its citizens." -- Baha'u'llah There was a typo error in interp.patch. Corrected in this new patch. |