Last change
on this file since 1 was 1, checked in by Marek Rychlik, 15 years ago |
First import of a version circa 1997.
|
File size:
1.1 KB
|
Line | |
---|
1 |
|
---|
2 | ;;; MODULAR-INVERSE (x p) [FUNCTION]
|
---|
3 | ;;; Find the inverse of X modulo prime P, using Euclid algorithm.
|
---|
4 | ;;;
|
---|
5 | ;;; MODULAR-DIVISION (x y p) [FUNCTION]
|
---|
6 | ;;; Divide X by Y modulo prime P.
|
---|
7 | ;;;
|
---|
8 | ;;; *INVERSE-BY-LOOKUP-LIMIT* (100000) [VARIABLE]
|
---|
9 | ;;; If prime modulus is < this number then the division algorithm
|
---|
10 | ;;; will use a lookup table of inverses created at the time when
|
---|
11 | ;;; field-modulo-prime is called.
|
---|
12 | ;;;
|
---|
13 | ;;; MAKE-INVERSE-TABLE (modulus &aux (table (list 0))) [FUNCTION]
|
---|
14 | ;;; Make a vector of length MODULUS containing all inverses modulo
|
---|
15 | ;;; MODULUS, which should be a prime number. The inverse of 0 is 0.
|
---|
16 | ;;;
|
---|
17 | ;;; MAKE-MODULAR-DIVISION (modulus) [FUNCTION]
|
---|
18 | ;;; Return a function of two arguments which will perform division
|
---|
19 | ;;; modulo MODULUS. Currently, if MODULUS is < *INVERSE-BY-LOOKUP-LIMIT*
|
---|
20 | ;;; then the returned function does table lookup, otherwise it uses
|
---|
21 | ;;; the Euclid algorithm to find the inverse.
|
---|
22 | ;;;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.