packages feed

finite-field 0.5.0 → 0.6.0

raw patch · 4 files changed

+21/−3 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Data.FiniteField.Base: allValues :: FiniteField k => [k]

Files

finite-field.cabal view
@@ -1,15 +1,24 @@ Name:		finite-field-Version:	0.5.0+Version:	0.6.0 License:	BSD3 License-File:	COPYING Author:		Masahiro Sakai (masahiro.sakai@gmail.com) Maintainer:	masahiro.sakai@gmail.com-Category:	Math, Data+Category:	Math, Algebra, Data Cabal-Version:	>= 1.10 Synopsis:	Finite Fields Description:   This is an implementation of finite fields.   Currently only prime fields are supported.+  .+  Changes in 0.6.0+  .+  * add allValues to FiniteField class+  .+  Changes in 0.5.0+  .+  * introduce FiniteField class+ Bug-Reports:	https://github.com/msakai/finite-field/issues Extra-Source-Files:    README.md
src/Data/FiniteField/Base.hs view
@@ -28,3 +28,6 @@    -- | The inverse of Frobenius endomorphism @x@ ↦ @x^p@.   pthRoot :: k -> k++  -- | All values of a field+  allValues :: [k]
src/Data/FiniteField/PrimeField.hs view
@@ -87,6 +87,7 @@   order _   = TL.toInt (undefined :: p)   char _    = TL.toInt (undefined :: p)   pthRoot a = a+  allValues = [minBound .. maxBound]  -- --------------------------------------------------------------------------- 
test/TestPrimeField.hs view
@@ -7,6 +7,7 @@ import Test.Framework.Providers.HUnit  import Control.Monad+import Data.List (genericLength) import Data.Numbers.Primes (primes)  import Data.FiniteField@@ -107,12 +108,16 @@       a /= 0 ==> a * (recip a) == 1  -- ------------------------------------------------------------------------- pthRoot+-- FiniteField type class  prop_pthRoot =   forAll smallPrimes $ \(SomeNat (_ :: p)) ->     forAll arbitrary $ \(a :: PrimeField p) ->       pthRoot a ^ char a == a++prop_allValues = do+  forAll smallPrimes $ \(SomeNat (_ :: p)) ->+    genericLength (allValues :: [PrimeField p]) == order (undefined :: PrimeField p)  -- ----------------------------------------------------------------------