Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This contrib was developed by Stephan Frank to replace some of our bignum and rational arithmetic code with calls to libgmp. Simply loading the contrib will transparently accelerate arithmetic on large rationals when libgmp is available; if libgmp cannot be found, the contrib should change nothing. The contrib also wraps additional functions in GNU MP, so that they accept and return SBCL-native integers or ratios. See GNU MP's manual for more information.
- Loading branch information
Showing
7 changed files
with
1,191 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
SYSTEM=sb-gmp | ||
include ../asdf-module.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
SB-GMP | ||
====== | ||
|
||
GMP integration for SBCL | ||
|
||
This contrib enables the use of bignum computation routines from the | ||
GMP library for SBCL internal bignum calculations. | ||
|
||
Some functions can be transparently replaced within SBCL, namely: | ||
|
||
- sb-bignum:multiply-bignum | ||
- sb-bignum:bignum-truncate | ||
- sb-bignum:bignum-gcd | ||
- sb-kernel::two-arg-lcm | ||
- cl:isqrt | ||
|
||
and for making use of the GMP rational arithmetic: | ||
|
||
- sb-kernel::two-arg-+ | ||
- sb-kernel::two-arg-- | ||
- sb-kernel::two-arg-* | ||
- sb-kernel::two-arg-/ | ||
|
||
Most of the other SBCL bignum routines rely on these functions for the | ||
heavy computational lifting. | ||
|
||
However, SB-GMP also provides easy and transparent access to several | ||
other functions of the GMP library and may be able to replace other | ||
parts of the SBCL bignum machinery in the future. Refer to the GMP | ||
documentation for the respective function specification. | ||
|
||
The transparent SBCL integration is automatically activated by loading | ||
SB-GMP. Some care is taken to behave correctly across core saves and | ||
loads; however, if this does not work correctly, `SB-GMP:UNLOAD-GMP` | ||
and `SB-GMP:LOAD-GMP` can be called to explicitly unload and reload | ||
libgmp and uninstall/reinstall the hooks. The hooks can also be | ||
directly uninstalled and installed with `SB-GMP:UNINSTALL-GMP-FUNS` | ||
and `SB-GMP:INSTALL-GMP-FUNS`. However, in most cases, binding | ||
`SB-GMP:*GMP-DISABLED*` to `T` should suffice. |
Oops, something went wrong.