| Safe Haskell | None |
|---|---|
| Language | Haskell98 |
Number.GaloisField2p32m5
Description
This number type is intended for tests of functions over fields,
where the field elements need constant space.
This way we can provide a Storable instance.
For Rational this would not be possible.
However, be aware that sums of non-zero elements may yield zero. Thus division is not always defined, where it is for rational numbers.
Documentation
>>>import qualified Number.GaloisField2p32m5 as GF>>>import qualified Algebra.Laws as Laws>>>import Test.QuickCheck ((==>))>>>import NumericPrelude.Numeric>>>import NumericPrelude.Base>>>import Prelude ()>>>>>>gf :: GF.T -> GF.T>>>gf = id
Laws.identity (+) zero . gf
Laws.commutative (+) . gf
Laws.associative (+) . gf
Laws.inverse (+) negate zero . gf
\x -> Laws.inverse (+) (x-) (gf x)
Laws.identity (*) one . gf
Laws.commutative (*) . gf
Laws.associative (*) . gf
\y -> gf y /= zero ==> Laws.inverse (*) recip one y
\y x -> gf y /= zero ==> Laws.inverse (*) (x/) x y