login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

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 tree

This 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];
  before:    2.10 sec
  after:     0.53 sec
  factor: 0.25

a:=matrix [[j^1/(j-i) for i in 1..50] for j in 1000000001..1000000050]; a*a; before: 3.69 after: 1.56 factor: 0.42


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.

Anyone can make a new page --Bill Page, Sun, 27 Mar 2005 12:58:23 -0600 reply
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.

Pass all test --unknown, Sun, 27 Mar 2005 14:21:20 -0600 reply
I have worked with this modified domain for 6 months.
Strange : In axiom nearly all computations involve spad code. Here I use gcl.

What is strange? --Bill Page, Sun, 27 Mar 2005 16:32:03 -0600 reply
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,

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,

It's alpha code --unknown, Thu, 09 Jun 2005 11:21:04 -0500 reply
Example: (* -2147483648/2203319546073 4926328811737/4294967296) => Error: Caught fatal error [memory may be damaged]? on my machine (AMD64 (kernel => which works around a bug in the AMD K8 CPUs?.))

Seems to work for me... --Bill Page, Thu, 09 Jun 2005 12:08:59 -0500 reply
I don't really understand your example, but this works for me:
[-2147483648/2203319546073, 4926328811737/4294967296]

\label{eq1}\left[ -{{2147483648}\over{2203319546073}}, \:{{4926328811737}\over{4
Type: List(Fraction(Integer))
(-2147483648/2203319546073) * (4926328811737/4294967296)

Type: Fraction(Integer)

Come probably from the gcl.patch --unknown, Thu, 09 Jun 2005 13:06:17 -0500 reply
With this patch on 64bits_kernel/Debian_AMD64/gcc-3.3 gcl caught a fatal error

Update gcl.patch --unknown, Mon, 13 Jun 2005 14:37:35 -0500 reply
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 /;
  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 /;
    return make_fixnum(-1);
in integer_exact_quotient function.


Update gcl.patch --unknown, Tue, 14 Jun 2005 09:25:19 -0500 reply
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

Typo error in interp.patch --gregr, Mon, 15 Aug 2005 08:43:01 -0500 reply
There was a typo error in interp.patch. Corrected in this new patch.


  Subject:   Be Bold !!
  ( 14 subscribers )  
Please rate this page: