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 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 replyBill and all, - While I haven't used nor fully digested the axiom related patches, the author is apparently the same individual who so helpfully suggested an improvement to GCL ratio arithmetic recently, which has been implemented in CVS head (2.7.0). Rational arithmetic is now much faster in many regards, as GCL makes use of more functionality in the highly optimized gmp library. The bulk of the axiom patch appears to be intended to call the lisp arithmetic functions directly - apparently the spad compilation process results in a number of layers between axiom and lisp here (not verified). This is of course not particular to any implementation of lisp, it is just that one can at least expect significant performance advantages when GCL is the lisp. There are still calls to cancelGcd
- perhaps it would be useful to bring forward the gmp library function GCL uses internally for this purpose.
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)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)); /to if (type_of(x)==t_fixnum){ if (type_of(y)==t_fixnum) return make_fixnum(fix(x)/fix(y)); /in integer_exact_quotient function. - This is correct
- equivalent being committed to CVS head.
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. |

How to patch--unknown, Fri, 25 Mar 2005 12:06:22 -0600 reply