-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | numeric classes -- -- A numeric class heirarchy. @package numhask @version 0.3.1 -- | Additive module NumHask.Algebra.Abstract.Additive class Additive a (+) :: Additive a => a -> a -> a zero :: Additive a => a infixl 6 + sum :: (Additive a, Foldable f) => f a -> a class (Additive a) => Subtractive a negate :: Subtractive a => a -> a (-) :: Subtractive a => a -> a -> a infixl 6 - instance NumHask.Algebra.Abstract.Additive.Subtractive GHC.Types.Double instance NumHask.Algebra.Abstract.Additive.Subtractive GHC.Types.Float instance NumHask.Algebra.Abstract.Additive.Subtractive GHC.Types.Int instance NumHask.Algebra.Abstract.Additive.Subtractive GHC.Integer.Type.Integer instance NumHask.Algebra.Abstract.Additive.Subtractive GHC.Types.Bool instance NumHask.Algebra.Abstract.Additive.Subtractive GHC.Natural.Natural instance NumHask.Algebra.Abstract.Additive.Subtractive GHC.Int.Int8 instance NumHask.Algebra.Abstract.Additive.Subtractive GHC.Int.Int16 instance NumHask.Algebra.Abstract.Additive.Subtractive GHC.Int.Int32 instance NumHask.Algebra.Abstract.Additive.Subtractive GHC.Int.Int64 instance NumHask.Algebra.Abstract.Additive.Subtractive GHC.Types.Word instance NumHask.Algebra.Abstract.Additive.Subtractive GHC.Word.Word8 instance NumHask.Algebra.Abstract.Additive.Subtractive GHC.Word.Word16 instance NumHask.Algebra.Abstract.Additive.Subtractive GHC.Word.Word32 instance NumHask.Algebra.Abstract.Additive.Subtractive GHC.Word.Word64 instance NumHask.Algebra.Abstract.Additive.Subtractive b => NumHask.Algebra.Abstract.Additive.Subtractive (a -> b) instance NumHask.Algebra.Abstract.Additive.Additive GHC.Types.Double instance NumHask.Algebra.Abstract.Additive.Additive GHC.Types.Float instance NumHask.Algebra.Abstract.Additive.Additive GHC.Types.Int instance NumHask.Algebra.Abstract.Additive.Additive GHC.Integer.Type.Integer instance NumHask.Algebra.Abstract.Additive.Additive GHC.Types.Bool instance NumHask.Algebra.Abstract.Additive.Additive GHC.Natural.Natural instance NumHask.Algebra.Abstract.Additive.Additive GHC.Int.Int8 instance NumHask.Algebra.Abstract.Additive.Additive GHC.Int.Int16 instance NumHask.Algebra.Abstract.Additive.Additive GHC.Int.Int32 instance NumHask.Algebra.Abstract.Additive.Additive GHC.Int.Int64 instance NumHask.Algebra.Abstract.Additive.Additive GHC.Types.Word instance NumHask.Algebra.Abstract.Additive.Additive GHC.Word.Word8 instance NumHask.Algebra.Abstract.Additive.Additive GHC.Word.Word16 instance NumHask.Algebra.Abstract.Additive.Additive GHC.Word.Word32 instance NumHask.Algebra.Abstract.Additive.Additive GHC.Word.Word64 instance NumHask.Algebra.Abstract.Additive.Additive b => NumHask.Algebra.Abstract.Additive.Additive (a -> b) -- | The Group hierarchy module NumHask.Algebra.Abstract.Group -- | A Magma is a tuple (T,magma) consisting of -- --
-- ∀ a, b ∈ T: a magma b ∈ T ---- -- These laws are true by construction in haskell: the type signature of -- magma and the above mathematical laws are synonyms. class Magma a magma :: Magma a => a -> a -> a -- | A Unital Magma is a magma with an identity element (the unit). -- --
-- unit magma a = a -- a magma unit = a --class Magma a => Unital a unit :: Unital a => a -- | An Associative Magma -- --
-- (a magma b) magma c = a magma (b magma c) --class Magma a => Associative a -- | A Commutative Magma is a Magma where the binary operation is -- commutative. -- --
-- a magma b = b magma a --class Magma a => Commutative a -- | An Absorbing is a Magma with an Absorbing Element -- --
-- a `times` absorb = absorb --class Magma a => Absorbing a absorb :: Absorbing a => a -- | An Invertible Magma -- --
-- ∀ a,b ∈ T: inv a `magma` (a `magma` b) = b = (b `magma` a) `magma` inv a --class Magma a => Invertible a inv :: Invertible a => a -> a -- | An Idempotent Magma is a magma where every element is -- Idempotent. -- --
-- a magma a = a --class Magma a => Idempotent a -- | A Group is a Associative, Unital and Invertible Magma. class (Associative a, Unital a, Invertible a) => Group a -- | An Abelian Group is an Associative, Unital, Invertible and -- Commutative Magma . In other words, it is a Commutative Group class (Associative a, Unital a, Invertible a, Commutative a) => AbelianGroup a instance (NumHask.Algebra.Abstract.Group.Associative a, NumHask.Algebra.Abstract.Group.Unital a, NumHask.Algebra.Abstract.Group.Invertible a, NumHask.Algebra.Abstract.Group.Commutative a) => NumHask.Algebra.Abstract.Group.AbelianGroup a instance NumHask.Algebra.Abstract.Group.Idempotent b => NumHask.Algebra.Abstract.Group.Idempotent (a -> b) instance NumHask.Algebra.Abstract.Group.Absorbing b => NumHask.Algebra.Abstract.Group.Absorbing (a -> b) instance (NumHask.Algebra.Abstract.Group.Associative a, NumHask.Algebra.Abstract.Group.Unital a, NumHask.Algebra.Abstract.Group.Invertible a) => NumHask.Algebra.Abstract.Group.Group a instance NumHask.Algebra.Abstract.Group.Invertible b => NumHask.Algebra.Abstract.Group.Invertible (a -> b) instance NumHask.Algebra.Abstract.Group.Commutative b => NumHask.Algebra.Abstract.Group.Commutative (a -> b) instance NumHask.Algebra.Abstract.Group.Associative b => NumHask.Algebra.Abstract.Group.Associative (a -> b) instance NumHask.Algebra.Abstract.Group.Unital b => NumHask.Algebra.Abstract.Group.Unital (a -> b) instance NumHask.Algebra.Abstract.Group.Magma b => NumHask.Algebra.Abstract.Group.Magma (a -> b) -- | The Homomorphism Hierarchy module NumHask.Algebra.Abstract.Homomorphism -- | A Homomorphism between two magmas law: forall a b. hom(a magma -- b) = hom(a) magma hom(b) class (Magma a, Magma b) => Hom a b hom :: Hom a b => a -> b class (Hom a a) => End a -- | A Isomorphism between two magmas an Isomorphism is a bijective -- Homomorphism class (Hom a b, Hom b a) => Iso a b iso :: Iso a b => a -> b invIso :: Iso a b => b -> a class (Iso a a) => Automorphism a instance NumHask.Algebra.Abstract.Homomorphism.Iso a a => NumHask.Algebra.Abstract.Homomorphism.Automorphism a instance NumHask.Algebra.Abstract.Homomorphism.Iso b c => NumHask.Algebra.Abstract.Homomorphism.Iso (a -> b) (a -> c) instance NumHask.Algebra.Abstract.Homomorphism.Hom a a => NumHask.Algebra.Abstract.Homomorphism.End a instance NumHask.Algebra.Abstract.Homomorphism.Hom b c => NumHask.Algebra.Abstract.Homomorphism.Hom (a -> b) (a -> c) -- | Multiplicative module NumHask.Algebra.Abstract.Multiplicative class Multiplicative a (*) :: Multiplicative a => a -> a -> a one :: Multiplicative a => a infixl 7 * product :: (Multiplicative a, Foldable f) => f a -> a class (Multiplicative a) => Divisive a recip :: Divisive a => a -> a (/) :: Divisive a => a -> a -> a infixl 7 / instance NumHask.Algebra.Abstract.Multiplicative.Divisive GHC.Types.Double instance NumHask.Algebra.Abstract.Multiplicative.Divisive GHC.Types.Float instance NumHask.Algebra.Abstract.Multiplicative.Divisive b => NumHask.Algebra.Abstract.Multiplicative.Divisive (a -> b) instance NumHask.Algebra.Abstract.Multiplicative.Multiplicative GHC.Types.Double instance NumHask.Algebra.Abstract.Multiplicative.Multiplicative GHC.Types.Float instance NumHask.Algebra.Abstract.Multiplicative.Multiplicative GHC.Types.Int instance NumHask.Algebra.Abstract.Multiplicative.Multiplicative GHC.Integer.Type.Integer instance NumHask.Algebra.Abstract.Multiplicative.Multiplicative GHC.Types.Bool instance NumHask.Algebra.Abstract.Multiplicative.Multiplicative GHC.Natural.Natural instance NumHask.Algebra.Abstract.Multiplicative.Multiplicative GHC.Int.Int8 instance NumHask.Algebra.Abstract.Multiplicative.Multiplicative GHC.Int.Int16 instance NumHask.Algebra.Abstract.Multiplicative.Multiplicative GHC.Int.Int32 instance NumHask.Algebra.Abstract.Multiplicative.Multiplicative GHC.Int.Int64 instance NumHask.Algebra.Abstract.Multiplicative.Multiplicative GHC.Types.Word instance NumHask.Algebra.Abstract.Multiplicative.Multiplicative GHC.Word.Word8 instance NumHask.Algebra.Abstract.Multiplicative.Multiplicative GHC.Word.Word16 instance NumHask.Algebra.Abstract.Multiplicative.Multiplicative GHC.Word.Word32 instance NumHask.Algebra.Abstract.Multiplicative.Multiplicative GHC.Word.Word64 instance NumHask.Algebra.Abstract.Multiplicative.Multiplicative b => NumHask.Algebra.Abstract.Multiplicative.Multiplicative (a -> b) -- | Action module NumHask.Algebra.Abstract.Action -- | a type class to represent an action on a higher-kinded number type family Actor h class (Additive (Actor h)) => AdditiveAction h (.+) :: AdditiveAction h => h -> Actor h -> h (+.) :: AdditiveAction h => Actor h -> h -> h infixl 6 .+ infixl 6 +. class (Subtractive (Actor h)) => SubtractiveAction h (.-) :: SubtractiveAction h => h -> Actor h -> h (-.) :: SubtractiveAction h => Actor h -> h -> h infixl 6 .- infixl 6 -. class (Multiplicative (Actor h)) => MultiplicativeAction h (.*) :: MultiplicativeAction h => h -> Actor h -> h (*.) :: MultiplicativeAction h => Actor h -> h -> h infixl 7 .* infixl 7 *. class (Divisive (Actor h)) => DivisiveAction h (./) :: DivisiveAction h => h -> Actor h -> h (/.) :: DivisiveAction h => Actor h -> h -> h infixl 7 ./ infixl 7 /. -- | Ring module NumHask.Algebra.Abstract.Ring -- | Distributive laws -- --
-- a * (b + c) == a * b + a * c -- (a * b) * c == a * c + b * c --class (Additive a, Multiplicative a) => Distributive a -- | A Semiring is a ring without, necessarily, negative elements. -- -- FIXME: rule zero' = zero. Is this somehow expressible in haskell? class (Distributive a) => Semiring a -- | A Ring is an abelian group under addition and monoid under -- multiplication where multiplication distributes over addition. -- Alternatively, a ring is semiring where additive inverses exist class (Distributive a, Subtractive a) => Ring a -- | A Commutative Ring is a ring with a Commutative Multiplication -- operation. Recall that Addition is Commutative in all Rings class (Distributive a, Subtractive a) => CommutativeRing a -- | An Integral Domain generalizes a ring of integers by requiring -- the product of any two nonzero elements to be nonzero. This means that -- if a ≠ 0, an equality ab = ac implies b = c. FIXME: write a rule for -- this class (Distributive a, Divisive a) => IntegralDomain a -- | A StarSemiring is a semiring with an additional unary operator -- star satisfying: -- --
-- star a = one + a `times` star a --class (Distributive a) => StarSemiring a star :: StarSemiring a => a -> a plus :: StarSemiring a => a -> a -- | A Kleene Algebra is a Star Semiring with idempotent addition -- --
-- a `times` x + x = a ==> star a `times` x + x = x -- x `times` a + x = a ==> x `times` star a + x = x --class (StarSemiring a, Idempotent a) => KleeneAlgebra a -- | Involutive Ring -- --
-- adj (a + b) ==> adj a + adj b -- adj (a * b) ==> adj a * adj b -- adj one ==> one -- adj (adj a) ==> a ---- -- Note: elements for which adj a == a are called -- "self-adjoint". class (Distributive a) => InvolutiveRing a adj :: InvolutiveRing a => a -> a two :: (Multiplicative a, Additive a) => a instance NumHask.Algebra.Abstract.Ring.InvolutiveRing GHC.Types.Double instance NumHask.Algebra.Abstract.Ring.InvolutiveRing GHC.Types.Float instance NumHask.Algebra.Abstract.Ring.InvolutiveRing GHC.Integer.Type.Integer instance NumHask.Algebra.Abstract.Ring.InvolutiveRing GHC.Types.Int instance NumHask.Algebra.Abstract.Ring.InvolutiveRing GHC.Natural.Natural instance NumHask.Algebra.Abstract.Ring.InvolutiveRing GHC.Int.Int8 instance NumHask.Algebra.Abstract.Ring.InvolutiveRing GHC.Int.Int16 instance NumHask.Algebra.Abstract.Ring.InvolutiveRing GHC.Int.Int32 instance NumHask.Algebra.Abstract.Ring.InvolutiveRing GHC.Int.Int64 instance NumHask.Algebra.Abstract.Ring.InvolutiveRing GHC.Types.Word instance NumHask.Algebra.Abstract.Ring.InvolutiveRing GHC.Word.Word8 instance NumHask.Algebra.Abstract.Ring.InvolutiveRing GHC.Word.Word16 instance NumHask.Algebra.Abstract.Ring.InvolutiveRing GHC.Word.Word32 instance NumHask.Algebra.Abstract.Ring.InvolutiveRing GHC.Word.Word64 instance NumHask.Algebra.Abstract.Ring.InvolutiveRing b => NumHask.Algebra.Abstract.Ring.InvolutiveRing (a -> b) instance NumHask.Algebra.Abstract.Ring.KleeneAlgebra b => NumHask.Algebra.Abstract.Ring.KleeneAlgebra (a -> b) instance NumHask.Algebra.Abstract.Ring.StarSemiring b => NumHask.Algebra.Abstract.Ring.StarSemiring (a -> b) instance NumHask.Algebra.Abstract.Ring.IntegralDomain GHC.Types.Double instance NumHask.Algebra.Abstract.Ring.IntegralDomain GHC.Types.Float instance NumHask.Algebra.Abstract.Ring.IntegralDomain b => NumHask.Algebra.Abstract.Ring.IntegralDomain (a -> b) instance (NumHask.Algebra.Abstract.Ring.Distributive a, NumHask.Algebra.Abstract.Additive.Subtractive a) => NumHask.Algebra.Abstract.Ring.CommutativeRing a instance (NumHask.Algebra.Abstract.Ring.Distributive a, NumHask.Algebra.Abstract.Additive.Subtractive a) => NumHask.Algebra.Abstract.Ring.Ring a instance NumHask.Algebra.Abstract.Ring.Distributive a => NumHask.Algebra.Abstract.Ring.Semiring a instance NumHask.Algebra.Abstract.Ring.Distributive GHC.Types.Double instance NumHask.Algebra.Abstract.Ring.Distributive GHC.Types.Float instance NumHask.Algebra.Abstract.Ring.Distributive GHC.Types.Int instance NumHask.Algebra.Abstract.Ring.Distributive GHC.Integer.Type.Integer instance NumHask.Algebra.Abstract.Ring.Distributive GHC.Natural.Natural instance NumHask.Algebra.Abstract.Ring.Distributive GHC.Int.Int8 instance NumHask.Algebra.Abstract.Ring.Distributive GHC.Int.Int16 instance NumHask.Algebra.Abstract.Ring.Distributive GHC.Int.Int32 instance NumHask.Algebra.Abstract.Ring.Distributive GHC.Int.Int64 instance NumHask.Algebra.Abstract.Ring.Distributive GHC.Types.Word instance NumHask.Algebra.Abstract.Ring.Distributive GHC.Word.Word8 instance NumHask.Algebra.Abstract.Ring.Distributive GHC.Word.Word16 instance NumHask.Algebra.Abstract.Ring.Distributive GHC.Word.Word32 instance NumHask.Algebra.Abstract.Ring.Distributive GHC.Word.Word64 instance NumHask.Algebra.Abstract.Ring.Distributive GHC.Types.Bool instance NumHask.Algebra.Abstract.Ring.Distributive b => NumHask.Algebra.Abstract.Ring.Distributive (a -> b) -- | Algebra for Modules module NumHask.Algebra.Abstract.Module -- | A Module over r a is a (Ring a), an abelian (Group r a) and an -- scalar-mult. (.*, *.) with the laws: -- --
-- a .* one == a -- (a + b) .* c == (a .* c) + (b .* c) -- c *. (a + b) == (c *. a) + (c *. b) -- a .* zero == zero -- a .* b == b *. a --class (Distributive (Actor h), Divisive h, MultiplicativeAction h) => Module h -- | TensorProduct module NumHask.Algebra.Abstract.TensorProduct -- | generalised outer product -- --
-- a><b + c><b == (a+c) >< b -- a><b + a><c == a >< (b+c) -- a *. (b><c) == (a><b) .* c -- (a><b) .* c == a *. (b><c) --class TensorProduct a (><) :: TensorProduct a => a -> a -> a >< a outer :: TensorProduct a => a -> a -> a >< a timesleft :: TensorProduct a => a -> (a >< a) -> a timesright :: TensorProduct a => (a >< a) -> a -> a infix 8 >< -- | generalised outer product -- --
-- a><b + c><b == (a+c) >< b -- a><b + a><c == a >< (b+c) -- a *. (b><c) == (a><b) .* c -- (a><b) .* c == a *. (b><c) --class TensorProduct' a b outer' :: TensorProduct' a b => a -> b -> a >< b timesleft' :: TensorProduct' a b => a -> (a >< b) -> b timesright' :: TensorProduct' a b => (a >< b) -> a -> b -- | tensorial type type family (><) (a :: k1) (b :: k2) :: * infix 8 >< -- | Element-by-element operations module NumHask.Algebra.Linear.Hadamard -- | element by element multiplication -- --
-- (a .*. b) .*. c == a .*. (b .*. c) -- singleton one .*. a = a -- a .*. singleton one = a -- a .*. b == b .*. a --class (Multiplicative a) => HadamardMultiplication m a (.*.) :: HadamardMultiplication m a => m a -> m a -> m a infixl 7 .*. -- | element by element division -- --
-- a ./. a == singleton one --class (Divisive a) => HadamardDivision m a (./.) :: HadamardDivision m a => m a -> m a -> m a infixl 7 ./. class (HadamardMultiplication m a, HadamardDivision m a) => Hadamard m a instance (NumHask.Algebra.Linear.Hadamard.HadamardMultiplication m a, NumHask.Algebra.Linear.Hadamard.HadamardDivision m a) => NumHask.Algebra.Linear.Hadamard.Hadamard m a -- | Integral classes module NumHask.Data.Integral -- | Integral laws -- --
-- b == zero || b * (a `div` b) + (a `mod` b) == a --class (Distributive a) => Integral a div :: Integral a => a -> a -> a mod :: Integral a => a -> a -> a divMod :: Integral a => a -> a -> (a, a) quot :: Integral a => a -> a -> a rem :: Integral a => a -> a -> a quotRem :: Integral a => a -> a -> (a, a) infixl 7 `div` infixl 7 `mod` -- | toIntegral is kept separate from Integral to help with compatability -- issues. > toIntegral a == a class ToIntegral a b toIntegral :: ToIntegral a b => a -> b toIntegral :: (ToIntegral a b, a ~ b) => a -> b type ToInteger a = ToIntegral a Integer toInteger :: ToInteger a => a -> Integer -- | fromIntegral abstracts the codomain type, compared with the preludes -- Integral type. > fromIntegral_ a == a -- -- fromIntegral is widely used as general coercion, hence the underscore -- for the operator. class FromIntegral a b fromIntegral_ :: FromIntegral a b => b -> a fromIntegral_ :: (FromIntegral a b, a ~ b) => b -> a -- | ghc defaulting rules and, it seems, -XExtendedDefaultRules do not -- permit multiple parameter typeclasses to be in the mix when types are -- resolved, hence the simpler `type FromInteger a = FromIntegral a -- Integer` does not suffice. class FromInteger a fromInteger :: FromInteger a => Integer -> a fromInteger :: (FromInteger a, FromIntegral a Integer) => Integer -> a -- | general coercion via Integer fromIntegral :: (FromInteger b, ToInteger a) => a -> b even :: (Eq a, Integral a) => a -> Bool odd :: (Eq a, Integral a) => a -> Bool -- | raise a number to a non-negative integral power (^) :: (Ord b, Multiplicative a, Integral b) => a -> b -> a (^^) :: (Divisive a, Subtractive b, Integral b, Ord b) => a -> b -> a instance NumHask.Data.Integral.FromInteger GHC.Integer.Type.Integer instance NumHask.Data.Integral.FromInteger GHC.Types.Int instance NumHask.Data.Integral.FromInteger GHC.Types.Double instance NumHask.Data.Integral.FromInteger GHC.Types.Float instance NumHask.Data.Integral.FromInteger GHC.Natural.Natural instance NumHask.Data.Integral.FromInteger GHC.Int.Int8 instance NumHask.Data.Integral.FromInteger GHC.Int.Int16 instance NumHask.Data.Integral.FromInteger GHC.Int.Int32 instance NumHask.Data.Integral.FromInteger GHC.Int.Int64 instance NumHask.Data.Integral.FromInteger GHC.Types.Word instance NumHask.Data.Integral.FromInteger GHC.Word.Word8 instance NumHask.Data.Integral.FromInteger GHC.Word.Word16 instance NumHask.Data.Integral.FromInteger GHC.Word.Word32 instance NumHask.Data.Integral.FromInteger GHC.Word.Word64 instance NumHask.Data.Integral.FromIntegral a b => NumHask.Data.Integral.FromIntegral (c -> a) b instance NumHask.Data.Integral.FromIntegral GHC.Types.Double GHC.Integer.Type.Integer instance NumHask.Data.Integral.FromIntegral GHC.Types.Float GHC.Integer.Type.Integer instance NumHask.Data.Integral.FromIntegral GHC.Types.Int GHC.Integer.Type.Integer instance NumHask.Data.Integral.FromIntegral GHC.Integer.Type.Integer GHC.Integer.Type.Integer instance NumHask.Data.Integral.FromIntegral GHC.Natural.Natural GHC.Integer.Type.Integer instance NumHask.Data.Integral.FromIntegral GHC.Int.Int8 GHC.Integer.Type.Integer instance NumHask.Data.Integral.FromIntegral GHC.Int.Int16 GHC.Integer.Type.Integer instance NumHask.Data.Integral.FromIntegral GHC.Int.Int32 GHC.Integer.Type.Integer instance NumHask.Data.Integral.FromIntegral GHC.Int.Int64 GHC.Integer.Type.Integer instance NumHask.Data.Integral.FromIntegral GHC.Types.Word GHC.Integer.Type.Integer instance NumHask.Data.Integral.FromIntegral GHC.Word.Word8 GHC.Integer.Type.Integer instance NumHask.Data.Integral.FromIntegral GHC.Word.Word16 GHC.Integer.Type.Integer instance NumHask.Data.Integral.FromIntegral GHC.Word.Word32 GHC.Integer.Type.Integer instance NumHask.Data.Integral.FromIntegral GHC.Word.Word64 GHC.Integer.Type.Integer instance NumHask.Data.Integral.FromIntegral GHC.Types.Int GHC.Types.Int instance NumHask.Data.Integral.FromIntegral GHC.Natural.Natural GHC.Natural.Natural instance NumHask.Data.Integral.FromIntegral GHC.Int.Int8 GHC.Int.Int8 instance NumHask.Data.Integral.FromIntegral GHC.Int.Int16 GHC.Int.Int16 instance NumHask.Data.Integral.FromIntegral GHC.Int.Int32 GHC.Int.Int32 instance NumHask.Data.Integral.FromIntegral GHC.Int.Int64 GHC.Int.Int64 instance NumHask.Data.Integral.FromIntegral GHC.Types.Word GHC.Types.Word instance NumHask.Data.Integral.FromIntegral GHC.Word.Word8 GHC.Word.Word8 instance NumHask.Data.Integral.FromIntegral GHC.Word.Word16 GHC.Word.Word16 instance NumHask.Data.Integral.FromIntegral GHC.Word.Word32 GHC.Word.Word32 instance NumHask.Data.Integral.FromIntegral GHC.Word.Word64 GHC.Word.Word64 instance NumHask.Data.Integral.ToIntegral GHC.Integer.Type.Integer GHC.Integer.Type.Integer instance NumHask.Data.Integral.ToIntegral GHC.Types.Int GHC.Integer.Type.Integer instance NumHask.Data.Integral.ToIntegral GHC.Natural.Natural GHC.Integer.Type.Integer instance NumHask.Data.Integral.ToIntegral GHC.Int.Int8 GHC.Integer.Type.Integer instance NumHask.Data.Integral.ToIntegral GHC.Int.Int16 GHC.Integer.Type.Integer instance NumHask.Data.Integral.ToIntegral GHC.Int.Int32 GHC.Integer.Type.Integer instance NumHask.Data.Integral.ToIntegral GHC.Int.Int64 GHC.Integer.Type.Integer instance NumHask.Data.Integral.ToIntegral GHC.Types.Word GHC.Integer.Type.Integer instance NumHask.Data.Integral.ToIntegral GHC.Word.Word8 GHC.Integer.Type.Integer instance NumHask.Data.Integral.ToIntegral GHC.Word.Word16 GHC.Integer.Type.Integer instance NumHask.Data.Integral.ToIntegral GHC.Word.Word32 GHC.Integer.Type.Integer instance NumHask.Data.Integral.ToIntegral GHC.Word.Word64 GHC.Integer.Type.Integer instance NumHask.Data.Integral.ToIntegral GHC.Types.Int GHC.Types.Int instance NumHask.Data.Integral.ToIntegral GHC.Natural.Natural GHC.Natural.Natural instance NumHask.Data.Integral.ToIntegral GHC.Int.Int8 GHC.Int.Int8 instance NumHask.Data.Integral.ToIntegral GHC.Int.Int16 GHC.Int.Int16 instance NumHask.Data.Integral.ToIntegral GHC.Int.Int32 GHC.Int.Int32 instance NumHask.Data.Integral.ToIntegral GHC.Int.Int64 GHC.Int.Int64 instance NumHask.Data.Integral.ToIntegral GHC.Types.Word GHC.Types.Word instance NumHask.Data.Integral.ToIntegral GHC.Word.Word8 GHC.Word.Word8 instance NumHask.Data.Integral.ToIntegral GHC.Word.Word16 GHC.Word.Word16 instance NumHask.Data.Integral.ToIntegral GHC.Word.Word32 GHC.Word.Word32 instance NumHask.Data.Integral.ToIntegral GHC.Word.Word64 GHC.Word.Word64 instance NumHask.Data.Integral.Integral GHC.Types.Int instance NumHask.Data.Integral.Integral GHC.Integer.Type.Integer instance NumHask.Data.Integral.Integral GHC.Natural.Natural instance NumHask.Data.Integral.Integral GHC.Int.Int8 instance NumHask.Data.Integral.Integral GHC.Int.Int16 instance NumHask.Data.Integral.Integral GHC.Int.Int32 instance NumHask.Data.Integral.Integral GHC.Int.Int64 instance NumHask.Data.Integral.Integral GHC.Types.Word instance NumHask.Data.Integral.Integral GHC.Word.Word8 instance NumHask.Data.Integral.Integral GHC.Word.Word16 instance NumHask.Data.Integral.Integral GHC.Word.Word32 instance NumHask.Data.Integral.Integral GHC.Word.Word64 instance NumHask.Data.Integral.Integral b => NumHask.Data.Integral.Integral (a -> b) -- | Field classes module NumHask.Algebra.Abstract.Field -- | A Field is an Integral domain in which every non-zero element -- has a multiplicative inverse. -- -- A summary of the rules inherited from super-classes of Field -- --
-- zero + a == a -- a + zero == a -- (a + b) + c == a + (b + c) -- a + b == b + a -- a - a = zero -- negate a = zero - a -- negate a + a = zero -- a + negate a = zero -- one * a == a -- a * one == a -- (a * b) * c == a * (b * c) -- a * (b + c) == a * b + a * c -- (a + b) * c == a * c + b * c -- a * zero == zero -- zero * a == zero -- a * b == b * a -- a / a = one -- recip a = one / a -- recip a * a = one -- a * recip a = one --class (IntegralDomain a) => Field a -- | A hyperbolic field class -- --
-- sqrt . (**2) == identity -- log . exp == identity -- for +ive b, a != 0,1: a ** logBase a b ≈ b --class (Field a) => ExpField a exp :: ExpField a => a -> a log :: ExpField a => a -> a logBase :: ExpField a => a -> a -> a (**) :: ExpField a => a -> a -> a sqrt :: ExpField a => a -> a class (Field a, Subtractive a, Multiplicative b, Additive b) => QuotientField a b properFraction :: QuotientField a b => a -> (b, a) round :: QuotientField a b => a -> b round :: (QuotientField a b, Ord a, Ord b, Subtractive b, Integral b) => a -> b ceiling :: QuotientField a b => a -> b ceiling :: (QuotientField a b, Ord a) => a -> b floor :: QuotientField a b => a -> b floor :: (QuotientField a b, Ord a, Subtractive b) => a -> b truncate :: QuotientField a b => a -> b truncate :: (QuotientField a b, Ord a) => a -> b -- | A bounded field includes the concepts of infinity and NaN, thus moving -- away from error throwing. -- --
-- one / zero + infinity == infinity -- infinity + a == infinity -- zero / zero != nan ---- -- Note the tricky law that, although nan is assigned to zero/zero, they -- are never-the-less not equal. A committee decided this. class (IntegralDomain a) => UpperBoundedField a infinity :: UpperBoundedField a => a nan :: UpperBoundedField a => a class (Subtractive a, Field a) => LowerBoundedField a negInfinity :: LowerBoundedField a => a -- | Trigonometric Field class (Field a) => TrigField a pi :: TrigField a => a sin :: TrigField a => a -> a cos :: TrigField a => a -> a tan :: TrigField a => a -> a asin :: TrigField a => a -> a acos :: TrigField a => a -> a atan :: TrigField a => a -> a sinh :: TrigField a => a -> a cosh :: TrigField a => a -> a tanh :: TrigField a => a -> a asinh :: TrigField a => a -> a acosh :: TrigField a => a -> a atanh :: TrigField a => a -> a half :: Field a => a instance NumHask.Algebra.Abstract.Field.TrigField GHC.Types.Double instance NumHask.Algebra.Abstract.Field.TrigField GHC.Types.Float instance NumHask.Algebra.Abstract.Field.TrigField b => NumHask.Algebra.Abstract.Field.TrigField (a -> b) instance NumHask.Algebra.Abstract.Field.LowerBoundedField GHC.Types.Float instance NumHask.Algebra.Abstract.Field.LowerBoundedField GHC.Types.Double instance NumHask.Algebra.Abstract.Field.LowerBoundedField b => NumHask.Algebra.Abstract.Field.LowerBoundedField (a -> b) instance NumHask.Algebra.Abstract.Field.UpperBoundedField GHC.Types.Float instance NumHask.Algebra.Abstract.Field.UpperBoundedField GHC.Types.Double instance NumHask.Algebra.Abstract.Field.UpperBoundedField b => NumHask.Algebra.Abstract.Field.UpperBoundedField (a -> b) instance NumHask.Algebra.Abstract.Field.QuotientField GHC.Types.Float GHC.Integer.Type.Integer instance NumHask.Algebra.Abstract.Field.QuotientField GHC.Types.Double GHC.Integer.Type.Integer instance NumHask.Algebra.Abstract.Field.QuotientField b c => NumHask.Algebra.Abstract.Field.QuotientField (a -> b) (a -> c) instance NumHask.Algebra.Abstract.Field.ExpField GHC.Types.Double instance NumHask.Algebra.Abstract.Field.ExpField GHC.Types.Float instance NumHask.Algebra.Abstract.Field.ExpField b => NumHask.Algebra.Abstract.Field.ExpField (a -> b) instance NumHask.Algebra.Abstract.Field.Field GHC.Types.Double instance NumHask.Algebra.Abstract.Field.Field GHC.Types.Float instance NumHask.Algebra.Abstract.Field.Field b => NumHask.Algebra.Abstract.Field.Field (a -> b) module NumHask.Algebra.Abstract.Lattice -- | A algebraic structure with element joins: -- http://en.wikipedia.org/wiki/Semilattice -- --
-- Associativity: x \/ (y \/ z) == (x \/ y) \/ z -- Commutativity: x \/ y == y \/ x -- Idempotency: x \/ x == x --class (Eq a) => JoinSemiLattice a (\/) :: JoinSemiLattice a => a -> a -> a infixr 5 \/ -- | The partial ordering induced by the join-semilattice structure joinLeq :: JoinSemiLattice a => a -> a -> Bool -- | A algebraic structure with element meets: -- http://en.wikipedia.org/wiki/Semilattice -- --
-- Associativity: x /\ (y /\ z) == (x /\ y) /\ z -- Commutativity: x /\ y == y /\ x -- Idempotency: x /\ x == x --class (Eq a) => MeetSemiLattice a (/\) :: MeetSemiLattice a => a -> a -> a infixr 6 /\ -- | The partial ordering induced by the meet-semilattice structure meetLeq :: MeetSemiLattice a => a -> a -> Bool -- | The combination of two semi lattices makes a lattice if the absorption -- law holds: see http://en.wikipedia.org/wiki/Absorption_law and -- http://en.wikipedia.org/wiki/Lattice_(order) -- --
-- Absorption: a \/ (a /\ b) == a /\ (a \/ b) == a --class (JoinSemiLattice a, MeetSemiLattice a) => Lattice a -- | A join-semilattice with an identity element bottom for -- \/. -- --
-- Identity: x \/ bottom == x --class JoinSemiLattice a => BoundedJoinSemiLattice a bottom :: BoundedJoinSemiLattice a => a -- | A meet-semilattice with an identity element top for /\. -- --
-- Identity: x /\ top == x --class MeetSemiLattice a => BoundedMeetSemiLattice a top :: BoundedMeetSemiLattice a => a -- | Lattices with both bounds class (JoinSemiLattice a, MeetSemiLattice a, BoundedJoinSemiLattice a, BoundedMeetSemiLattice a) => BoundedLattice a instance (NumHask.Algebra.Abstract.Lattice.JoinSemiLattice a, NumHask.Algebra.Abstract.Lattice.MeetSemiLattice a, NumHask.Algebra.Abstract.Lattice.BoundedJoinSemiLattice a, NumHask.Algebra.Abstract.Lattice.BoundedMeetSemiLattice a) => NumHask.Algebra.Abstract.Lattice.BoundedLattice a instance NumHask.Algebra.Abstract.Lattice.BoundedMeetSemiLattice GHC.Types.Float instance NumHask.Algebra.Abstract.Lattice.BoundedMeetSemiLattice GHC.Types.Double instance NumHask.Algebra.Abstract.Lattice.BoundedMeetSemiLattice GHC.Types.Int instance NumHask.Algebra.Abstract.Lattice.BoundedMeetSemiLattice GHC.Types.Bool instance NumHask.Algebra.Abstract.Lattice.BoundedMeetSemiLattice GHC.Int.Int8 instance NumHask.Algebra.Abstract.Lattice.BoundedMeetSemiLattice GHC.Int.Int16 instance NumHask.Algebra.Abstract.Lattice.BoundedMeetSemiLattice GHC.Int.Int32 instance NumHask.Algebra.Abstract.Lattice.BoundedMeetSemiLattice GHC.Int.Int64 instance NumHask.Algebra.Abstract.Lattice.BoundedMeetSemiLattice GHC.Types.Word instance NumHask.Algebra.Abstract.Lattice.BoundedMeetSemiLattice GHC.Word.Word8 instance NumHask.Algebra.Abstract.Lattice.BoundedMeetSemiLattice GHC.Word.Word16 instance NumHask.Algebra.Abstract.Lattice.BoundedMeetSemiLattice GHC.Word.Word32 instance NumHask.Algebra.Abstract.Lattice.BoundedMeetSemiLattice GHC.Word.Word64 instance (GHC.Classes.Eq (a -> b), NumHask.Algebra.Abstract.Lattice.BoundedMeetSemiLattice b) => NumHask.Algebra.Abstract.Lattice.BoundedMeetSemiLattice (a -> b) instance NumHask.Algebra.Abstract.Lattice.BoundedJoinSemiLattice GHC.Types.Float instance NumHask.Algebra.Abstract.Lattice.BoundedJoinSemiLattice GHC.Types.Double instance NumHask.Algebra.Abstract.Lattice.BoundedJoinSemiLattice GHC.Types.Int instance NumHask.Algebra.Abstract.Lattice.BoundedJoinSemiLattice GHC.Types.Bool instance NumHask.Algebra.Abstract.Lattice.BoundedJoinSemiLattice GHC.Natural.Natural instance NumHask.Algebra.Abstract.Lattice.BoundedJoinSemiLattice GHC.Int.Int8 instance NumHask.Algebra.Abstract.Lattice.BoundedJoinSemiLattice GHC.Int.Int16 instance NumHask.Algebra.Abstract.Lattice.BoundedJoinSemiLattice GHC.Int.Int32 instance NumHask.Algebra.Abstract.Lattice.BoundedJoinSemiLattice GHC.Int.Int64 instance NumHask.Algebra.Abstract.Lattice.BoundedJoinSemiLattice GHC.Types.Word instance NumHask.Algebra.Abstract.Lattice.BoundedJoinSemiLattice GHC.Word.Word8 instance NumHask.Algebra.Abstract.Lattice.BoundedJoinSemiLattice GHC.Word.Word16 instance NumHask.Algebra.Abstract.Lattice.BoundedJoinSemiLattice GHC.Word.Word32 instance NumHask.Algebra.Abstract.Lattice.BoundedJoinSemiLattice GHC.Word.Word64 instance (GHC.Classes.Eq (a -> b), NumHask.Algebra.Abstract.Lattice.BoundedJoinSemiLattice b) => NumHask.Algebra.Abstract.Lattice.BoundedJoinSemiLattice (a -> b) instance (NumHask.Algebra.Abstract.Lattice.JoinSemiLattice a, NumHask.Algebra.Abstract.Lattice.MeetSemiLattice a) => NumHask.Algebra.Abstract.Lattice.Lattice a instance NumHask.Algebra.Abstract.Lattice.MeetSemiLattice GHC.Types.Float instance NumHask.Algebra.Abstract.Lattice.MeetSemiLattice GHC.Types.Double instance NumHask.Algebra.Abstract.Lattice.MeetSemiLattice GHC.Types.Int instance NumHask.Algebra.Abstract.Lattice.MeetSemiLattice GHC.Integer.Type.Integer instance NumHask.Algebra.Abstract.Lattice.MeetSemiLattice GHC.Types.Bool instance NumHask.Algebra.Abstract.Lattice.MeetSemiLattice GHC.Natural.Natural instance NumHask.Algebra.Abstract.Lattice.MeetSemiLattice GHC.Int.Int8 instance NumHask.Algebra.Abstract.Lattice.MeetSemiLattice GHC.Int.Int16 instance NumHask.Algebra.Abstract.Lattice.MeetSemiLattice GHC.Int.Int32 instance NumHask.Algebra.Abstract.Lattice.MeetSemiLattice GHC.Int.Int64 instance NumHask.Algebra.Abstract.Lattice.MeetSemiLattice GHC.Types.Word instance NumHask.Algebra.Abstract.Lattice.MeetSemiLattice GHC.Word.Word8 instance NumHask.Algebra.Abstract.Lattice.MeetSemiLattice GHC.Word.Word16 instance NumHask.Algebra.Abstract.Lattice.MeetSemiLattice GHC.Word.Word32 instance NumHask.Algebra.Abstract.Lattice.MeetSemiLattice GHC.Word.Word64 instance (GHC.Classes.Eq (a -> b), NumHask.Algebra.Abstract.Lattice.MeetSemiLattice b) => NumHask.Algebra.Abstract.Lattice.MeetSemiLattice (a -> b) instance NumHask.Algebra.Abstract.Lattice.JoinSemiLattice GHC.Types.Float instance NumHask.Algebra.Abstract.Lattice.JoinSemiLattice GHC.Types.Double instance NumHask.Algebra.Abstract.Lattice.JoinSemiLattice GHC.Types.Int instance NumHask.Algebra.Abstract.Lattice.JoinSemiLattice GHC.Integer.Type.Integer instance NumHask.Algebra.Abstract.Lattice.JoinSemiLattice GHC.Types.Bool instance NumHask.Algebra.Abstract.Lattice.JoinSemiLattice GHC.Natural.Natural instance NumHask.Algebra.Abstract.Lattice.JoinSemiLattice GHC.Int.Int8 instance NumHask.Algebra.Abstract.Lattice.JoinSemiLattice GHC.Int.Int16 instance NumHask.Algebra.Abstract.Lattice.JoinSemiLattice GHC.Int.Int32 instance NumHask.Algebra.Abstract.Lattice.JoinSemiLattice GHC.Int.Int64 instance NumHask.Algebra.Abstract.Lattice.JoinSemiLattice GHC.Types.Word instance NumHask.Algebra.Abstract.Lattice.JoinSemiLattice GHC.Word.Word8 instance NumHask.Algebra.Abstract.Lattice.JoinSemiLattice GHC.Word.Word16 instance NumHask.Algebra.Abstract.Lattice.JoinSemiLattice GHC.Word.Word32 instance NumHask.Algebra.Abstract.Lattice.JoinSemiLattice GHC.Word.Word64 instance (GHC.Classes.Eq (a -> b), NumHask.Algebra.Abstract.Lattice.JoinSemiLattice b) => NumHask.Algebra.Abstract.Lattice.JoinSemiLattice (a -> b) -- | Metric classes module NumHask.Analysis.Metric -- | signum from base is not an operator replicated in numhask, -- being such a very silly name, and preferred is the much more obvious -- sign. Compare with Norm and Banach where -- there is a change in codomain -- --
-- abs a * sign a == a ---- -- Generalising this class tends towards size and direction (abs is the -- size on the one-dim number line of a vector with its tail at zero, and -- sign is the direction, right?). class (Multiplicative a) => Signed a sign :: Signed a => a -> a abs :: Signed a => a -> a -- | L1 and L2 norms are provided for potential speedups, as well as the -- generalized p-norm. -- -- for p >= 1 -- --
-- normLp p a >= zero -- normLp p zero == zero ---- -- Note that the Normed codomain can be different to the domain. class (Additive a, Additive b) => Normed a b normL1 :: Normed a b => a -> b normL2 :: Normed a b => a -> b -- | distance between numbers using L1, L2 or Lp-norms -- --
-- distanceL2 a b >= zero -- distanceL2 a a == zero -- \a b c -> distanceL2 a c + distanceL2 b c - distanceL2 a b >= zero && -- distanceL2 a b + distanceL2 b c - distanceL2 a c >= zero && -- distanceL2 a b + distanceL2 a c - distanceL2 b c >= zero && --class Metric a b distanceL1 :: Metric a b => a -> a -> b distanceL2 :: Metric a b => a -> a -> b class (Eq a, Additive a, Subtractive a, MeetSemiLattice a) => Epsilon a epsilon :: Epsilon a => a nearZero :: Epsilon a => a -> Bool aboutEqual :: Epsilon a => a -> a -> Bool (~=) :: Epsilon a => a -> a -> Bool infixl 4 ~= instance NumHask.Analysis.Metric.Epsilon GHC.Types.Double instance NumHask.Analysis.Metric.Epsilon GHC.Types.Float instance NumHask.Analysis.Metric.Epsilon GHC.Types.Int instance NumHask.Analysis.Metric.Epsilon GHC.Integer.Type.Integer instance NumHask.Analysis.Metric.Epsilon GHC.Int.Int8 instance NumHask.Analysis.Metric.Epsilon GHC.Int.Int16 instance NumHask.Analysis.Metric.Epsilon GHC.Int.Int32 instance NumHask.Analysis.Metric.Epsilon GHC.Int.Int64 instance NumHask.Analysis.Metric.Epsilon GHC.Types.Word instance NumHask.Analysis.Metric.Epsilon GHC.Word.Word8 instance NumHask.Analysis.Metric.Epsilon GHC.Word.Word16 instance NumHask.Analysis.Metric.Epsilon GHC.Word.Word32 instance NumHask.Analysis.Metric.Epsilon GHC.Word.Word64 instance NumHask.Analysis.Metric.Metric GHC.Types.Double GHC.Types.Double instance NumHask.Analysis.Metric.Metric GHC.Types.Float GHC.Types.Float instance NumHask.Analysis.Metric.Metric GHC.Types.Int GHC.Types.Int instance NumHask.Analysis.Metric.Metric GHC.Integer.Type.Integer GHC.Integer.Type.Integer instance NumHask.Analysis.Metric.Metric GHC.Natural.Natural GHC.Natural.Natural instance NumHask.Analysis.Metric.Metric GHC.Int.Int8 GHC.Int.Int8 instance NumHask.Analysis.Metric.Metric GHC.Int.Int16 GHC.Int.Int16 instance NumHask.Analysis.Metric.Metric GHC.Int.Int32 GHC.Int.Int32 instance NumHask.Analysis.Metric.Metric GHC.Int.Int64 GHC.Int.Int64 instance NumHask.Analysis.Metric.Metric GHC.Types.Word GHC.Types.Word instance NumHask.Analysis.Metric.Metric GHC.Word.Word8 GHC.Word.Word8 instance NumHask.Analysis.Metric.Metric GHC.Word.Word16 GHC.Word.Word16 instance NumHask.Analysis.Metric.Metric GHC.Word.Word32 GHC.Word.Word32 instance NumHask.Analysis.Metric.Metric GHC.Word.Word64 GHC.Word.Word64 instance NumHask.Analysis.Metric.Normed GHC.Types.Double GHC.Types.Double instance NumHask.Analysis.Metric.Normed GHC.Types.Float GHC.Types.Float instance NumHask.Analysis.Metric.Normed GHC.Types.Int GHC.Types.Int instance NumHask.Analysis.Metric.Normed GHC.Integer.Type.Integer GHC.Integer.Type.Integer instance NumHask.Analysis.Metric.Normed GHC.Natural.Natural GHC.Natural.Natural instance NumHask.Analysis.Metric.Normed GHC.Int.Int8 GHC.Int.Int8 instance NumHask.Analysis.Metric.Normed GHC.Int.Int16 GHC.Int.Int16 instance NumHask.Analysis.Metric.Normed GHC.Int.Int32 GHC.Int.Int32 instance NumHask.Analysis.Metric.Normed GHC.Int.Int64 GHC.Int.Int64 instance NumHask.Analysis.Metric.Normed GHC.Types.Word GHC.Types.Word instance NumHask.Analysis.Metric.Normed GHC.Word.Word8 GHC.Word.Word8 instance NumHask.Analysis.Metric.Normed GHC.Word.Word16 GHC.Word.Word16 instance NumHask.Analysis.Metric.Normed GHC.Word.Word32 GHC.Word.Word32 instance NumHask.Analysis.Metric.Normed GHC.Word.Word64 GHC.Word.Word64 instance NumHask.Analysis.Metric.Signed GHC.Types.Double instance NumHask.Analysis.Metric.Signed GHC.Types.Float instance NumHask.Analysis.Metric.Signed GHC.Types.Int instance NumHask.Analysis.Metric.Signed GHC.Integer.Type.Integer instance NumHask.Analysis.Metric.Signed GHC.Natural.Natural instance NumHask.Analysis.Metric.Signed GHC.Int.Int8 instance NumHask.Analysis.Metric.Signed GHC.Int.Int16 instance NumHask.Analysis.Metric.Signed GHC.Int.Int32 instance NumHask.Analysis.Metric.Signed GHC.Int.Int64 instance NumHask.Analysis.Metric.Signed GHC.Types.Word instance NumHask.Analysis.Metric.Signed GHC.Word.Word8 instance NumHask.Analysis.Metric.Signed GHC.Word.Word16 instance NumHask.Analysis.Metric.Signed GHC.Word.Word32 instance NumHask.Analysis.Metric.Signed GHC.Word.Word64 module NumHask.Data.Complex -- | Complex numbers are an algebraic type. -- -- For a complex number z, abs z is a number -- with the magnitude of z, but oriented in the positive real -- direction, whereas sign z has the phase of z, -- but unit magnitude. -- -- The Foldable and Traversable instances traverse the real -- part first. data Complex a -- | forms a complex number from its real and imaginary rectangular -- components. (:+) :: !a -> !a -> Complex a infix 6 :+ -- | Extracts the real part of a complex number. realPart :: Complex a -> a -- | Extracts the imaginary part of a complex number. imagPart :: Complex a -> a mkPolar :: TrigField a => a -> a -> Complex a -- | cis t is a complex value with magnitude 1 and -- phase t (modulo 2*pi). cis :: TrigField a => a -> Complex a -- | The function polar takes a complex number and returns a -- (magnitude, phase) pair in canonical form: the magnitude is -- nonnegative, and the phase in the range (-pi, -- pi]; if the magnitude is zero, then so is the phase. polar :: (RealFloat a, ExpField a) => Complex a -> (a, a) -- | The nonnegative magnitude of a complex number. magnitude :: (ExpField a, RealFloat a) => Complex a -> a -- | The phase of a complex number, in the range (-pi, -- pi]. If the magnitude is zero, then so is the phase. phase :: RealFloat a => Complex a -> a instance Data.Traversable.Traversable NumHask.Data.Complex.Complex instance Data.Foldable.Foldable NumHask.Data.Complex.Complex instance GHC.Base.Functor NumHask.Data.Complex.Complex instance GHC.Generics.Generic1 NumHask.Data.Complex.Complex instance GHC.Generics.Generic (NumHask.Data.Complex.Complex a) instance Data.Data.Data a => Data.Data.Data (NumHask.Data.Complex.Complex a) instance GHC.Read.Read a => GHC.Read.Read (NumHask.Data.Complex.Complex a) instance GHC.Show.Show a => GHC.Show.Show (NumHask.Data.Complex.Complex a) instance GHC.Classes.Eq a => GHC.Classes.Eq (NumHask.Data.Complex.Complex a) instance NumHask.Algebra.Abstract.Additive.Additive a => NumHask.Algebra.Abstract.Additive.Additive (NumHask.Data.Complex.Complex a) instance NumHask.Algebra.Abstract.Additive.Subtractive a => NumHask.Algebra.Abstract.Additive.Subtractive (NumHask.Data.Complex.Complex a) instance (NumHask.Algebra.Abstract.Ring.Distributive a, NumHask.Algebra.Abstract.Additive.Subtractive a) => NumHask.Algebra.Abstract.Ring.Distributive (NumHask.Data.Complex.Complex a) instance (NumHask.Algebra.Abstract.Additive.Subtractive a, NumHask.Algebra.Abstract.Multiplicative.Multiplicative a) => NumHask.Algebra.Abstract.Multiplicative.Multiplicative (NumHask.Data.Complex.Complex a) instance (NumHask.Algebra.Abstract.Additive.Subtractive a, NumHask.Algebra.Abstract.Multiplicative.Divisive a) => NumHask.Algebra.Abstract.Multiplicative.Divisive (NumHask.Data.Complex.Complex a) instance (NumHask.Algebra.Abstract.Additive.Additive a, NumHask.Data.Integral.FromIntegral a b) => NumHask.Data.Integral.FromIntegral (NumHask.Data.Complex.Complex a) b instance (NumHask.Algebra.Abstract.Multiplicative.Multiplicative a, NumHask.Algebra.Abstract.Field.ExpField a, NumHask.Analysis.Metric.Normed a a) => NumHask.Analysis.Metric.Normed (NumHask.Data.Complex.Complex a) a instance (NumHask.Algebra.Abstract.Multiplicative.Multiplicative a, NumHask.Algebra.Abstract.Additive.Subtractive a, NumHask.Algebra.Abstract.Field.ExpField a, NumHask.Analysis.Metric.Normed a a) => NumHask.Analysis.Metric.Metric (NumHask.Data.Complex.Complex a) a instance (GHC.Classes.Ord a, NumHask.Analysis.Metric.Signed a, NumHask.Algebra.Abstract.Additive.Subtractive a, NumHask.Analysis.Metric.Epsilon a) => NumHask.Analysis.Metric.Epsilon (NumHask.Data.Complex.Complex a) instance (NumHask.Algebra.Abstract.Ring.IntegralDomain a, NumHask.Algebra.Abstract.Additive.Subtractive a) => NumHask.Algebra.Abstract.Ring.IntegralDomain (NumHask.Data.Complex.Complex a) instance (NumHask.Algebra.Abstract.Field.Field a, NumHask.Algebra.Abstract.Additive.Subtractive a) => NumHask.Algebra.Abstract.Field.Field (NumHask.Data.Complex.Complex a) instance (GHC.Classes.Ord a, NumHask.Algebra.Abstract.Field.TrigField a, NumHask.Algebra.Abstract.Field.ExpField a, NumHask.Algebra.Abstract.Additive.Subtractive a) => NumHask.Algebra.Abstract.Field.ExpField (NumHask.Data.Complex.Complex a) instance (NumHask.Algebra.Abstract.Ring.Distributive a, NumHask.Algebra.Abstract.Additive.Subtractive a) => NumHask.Algebra.Abstract.Ring.InvolutiveRing (NumHask.Data.Complex.Complex a) instance (NumHask.Algebra.Abstract.Field.UpperBoundedField a, NumHask.Algebra.Abstract.Ring.IntegralDomain a, NumHask.Algebra.Abstract.Additive.Subtractive a) => NumHask.Algebra.Abstract.Field.UpperBoundedField (NumHask.Data.Complex.Complex a) instance NumHask.Algebra.Abstract.Field.LowerBoundedField a => NumHask.Algebra.Abstract.Field.LowerBoundedField (NumHask.Data.Complex.Complex a) instance NumHask.Algebra.Abstract.Lattice.JoinSemiLattice a => NumHask.Algebra.Abstract.Lattice.JoinSemiLattice (NumHask.Data.Complex.Complex a) instance NumHask.Algebra.Abstract.Lattice.MeetSemiLattice a => NumHask.Algebra.Abstract.Lattice.MeetSemiLattice (NumHask.Data.Complex.Complex a) instance NumHask.Algebra.Abstract.Lattice.BoundedJoinSemiLattice a => NumHask.Algebra.Abstract.Lattice.BoundedJoinSemiLattice (NumHask.Data.Complex.Complex a) instance NumHask.Algebra.Abstract.Lattice.BoundedMeetSemiLattice a => NumHask.Algebra.Abstract.Lattice.BoundedMeetSemiLattice (NumHask.Data.Complex.Complex a) -- | Metric classes module NumHask.Analysis.Banach -- | Banach (with Norm) laws form rules around size and direction of a -- number, with a potential crossing into another codomain. -- --
-- a == singleton zero || normalizeL2 a *. normL2 a == a --class (ExpField (Actor h), Normed h (Actor h), DivisiveAction h) => Banach h normalizeL1 :: Banach h => h -> h normalizeL2 :: Banach h => h -> h -- | the inner product: a distributive fold -- --
-- a <.> b == b <.> a -- a <.> (b +c) == a <.> b + a <.> c -- a <.> (s *. b + c) == s * (a <.> b) + a <.> c ---- -- (s0 *. a) . (s1 *. b) == s0 * s1 * (a . b) class (Distributive (Actor h)) => Hilbert h (<.>) :: Hilbert h => h -> h -> Actor h infix 8 <.> -- | The abstract algebraic class structure of a number. module NumHask.Algebra.Abstract -- | Integral classes module NumHask.Data.Rational data Ratio a (:%) :: !a -> !a -> Ratio a -- | Arbitrary-precision rational numbers, represented as a ratio of two -- Integer values. A rational number may be constructed using the -- % operator. type Rational = Ratio Integer -- | toRatio is equivalent to Real in base, but is polymorphic in -- the Integral type. class ToRatio a b toRatio :: ToRatio a b => a -> Ratio b toRatio :: (ToRatio a b, Ratio c ~ a, ToIntegral c Integer, ToRatio (Ratio b) b, FromInteger b) => a -> Ratio b type ToRational a = ToRatio a Integer toRational :: ToRatio a Integer => a -> Ratio Integer -- | Fractional in base splits into fromRatio and Field FIXME: -- work out why the default type isn't firing so that an explicit -- instance is needed for `FromRatio (Ratio Integer) Integer` class FromRatio a b fromRatio :: FromRatio a b => Ratio b -> a fromRatio :: (FromRatio a b, Ratio b ~ a) => Ratio b -> a -- | with RebindableSyntax the literal '1.0' mean exactly `fromRational -- (1.0::GHC.Real.Rational)`. class FromRational a fromRational :: FromRational a => Rational -> a -- | Given that fromRational is reserved, fromRational' provides general -- conversion between numhask rationals. fromRational' :: (FromRatio b Integer, ToRatio a Integer) => a -> b fromBaseRational :: Rational -> Ratio Integer -- | reduce is a subsidiary function used only in this module. It -- normalises a ratio by dividing both numerator and denominator by their -- greatest common divisor. reduce :: (Eq a, Subtractive a, Signed a, Integral a) => a -> a -> Ratio a -- | gcd x y is the non-negative factor of both x -- and y of which every common factor of x and -- y is also a factor; for example gcd 4 2 = 2, -- gcd (-4) 6 = 2, gcd 0 4 = 4. -- gcd 0 0 = 0. (That is, the common divisor -- that is "greatest" in the divisibility preordering.) -- -- Note: Since for signed fixed-width integer types, abs -- minBound < 0, the result may be negative if one of -- the arguments is minBound (and necessarily is if the -- other is 0 or minBound) for such types. gcd :: (Eq a, Signed a, Integral a) => a -> a -> a instance GHC.Show.Show a => GHC.Show.Show (NumHask.Data.Rational.Ratio a) instance NumHask.Data.Rational.FromRational GHC.Types.Double instance NumHask.Data.Rational.FromRational GHC.Types.Float instance NumHask.Data.Rational.FromRational GHC.Real.Rational instance NumHask.Data.Rational.FromRatio GHC.Types.Double GHC.Integer.Type.Integer instance NumHask.Data.Rational.FromRatio GHC.Types.Float GHC.Integer.Type.Integer instance NumHask.Data.Rational.FromRatio GHC.Real.Rational GHC.Integer.Type.Integer instance NumHask.Data.Rational.FromRatio (NumHask.Data.Rational.Ratio GHC.Integer.Type.Integer) GHC.Integer.Type.Integer instance NumHask.Data.Rational.ToRatio GHC.Types.Double GHC.Integer.Type.Integer instance NumHask.Data.Rational.ToRatio GHC.Types.Float GHC.Integer.Type.Integer instance NumHask.Data.Rational.ToRatio GHC.Real.Rational GHC.Integer.Type.Integer instance NumHask.Data.Rational.ToRatio (NumHask.Data.Rational.Ratio GHC.Integer.Type.Integer) GHC.Integer.Type.Integer instance NumHask.Data.Rational.ToRatio GHC.Types.Int GHC.Integer.Type.Integer instance NumHask.Data.Rational.ToRatio GHC.Integer.Type.Integer GHC.Integer.Type.Integer instance NumHask.Data.Rational.ToRatio GHC.Natural.Natural GHC.Integer.Type.Integer instance NumHask.Data.Rational.ToRatio GHC.Int.Int8 GHC.Integer.Type.Integer instance NumHask.Data.Rational.ToRatio GHC.Int.Int16 GHC.Integer.Type.Integer instance NumHask.Data.Rational.ToRatio GHC.Int.Int32 GHC.Integer.Type.Integer instance NumHask.Data.Rational.ToRatio GHC.Int.Int64 GHC.Integer.Type.Integer instance NumHask.Data.Rational.ToRatio GHC.Types.Word GHC.Integer.Type.Integer instance NumHask.Data.Rational.ToRatio GHC.Word.Word8 GHC.Integer.Type.Integer instance NumHask.Data.Rational.ToRatio GHC.Word.Word16 GHC.Integer.Type.Integer instance NumHask.Data.Rational.ToRatio GHC.Word.Word32 GHC.Integer.Type.Integer instance NumHask.Data.Rational.ToRatio GHC.Word.Word64 GHC.Integer.Type.Integer instance NumHask.Data.Rational.GCDConstraints a => NumHask.Algebra.Abstract.Additive.Additive (NumHask.Data.Rational.Ratio a) instance NumHask.Data.Rational.GCDConstraints a => NumHask.Algebra.Abstract.Additive.Subtractive (NumHask.Data.Rational.Ratio a) instance NumHask.Data.Rational.GCDConstraints a => NumHask.Algebra.Abstract.Multiplicative.Multiplicative (NumHask.Data.Rational.Ratio a) instance NumHask.Data.Rational.GCDConstraints a => NumHask.Algebra.Abstract.Multiplicative.Divisive (NumHask.Data.Rational.Ratio a) instance NumHask.Data.Rational.GCDConstraints a => NumHask.Algebra.Abstract.Ring.Distributive (NumHask.Data.Rational.Ratio a) instance NumHask.Data.Rational.GCDConstraints a => NumHask.Algebra.Abstract.Ring.IntegralDomain (NumHask.Data.Rational.Ratio a) instance NumHask.Data.Rational.GCDConstraints a => NumHask.Algebra.Abstract.Field.Field (NumHask.Data.Rational.Ratio a) instance (NumHask.Data.Rational.GCDConstraints a, NumHask.Data.Rational.GCDConstraints b, NumHask.Data.Integral.ToInteger a, NumHask.Algebra.Abstract.Field.Field a, NumHask.Data.Integral.FromIntegral b a) => NumHask.Algebra.Abstract.Field.QuotientField (NumHask.Data.Rational.Ratio a) b instance (NumHask.Data.Rational.GCDConstraints a, NumHask.Algebra.Abstract.Ring.Distributive a, NumHask.Algebra.Abstract.Ring.IntegralDomain a) => NumHask.Algebra.Abstract.Field.UpperBoundedField (NumHask.Data.Rational.Ratio a) instance (NumHask.Data.Rational.GCDConstraints a, NumHask.Algebra.Abstract.Field.Field a) => NumHask.Algebra.Abstract.Field.LowerBoundedField (NumHask.Data.Rational.Ratio a) instance NumHask.Data.Rational.GCDConstraints a => NumHask.Analysis.Metric.Signed (NumHask.Data.Rational.Ratio a) instance NumHask.Data.Rational.GCDConstraints a => NumHask.Analysis.Metric.Normed (NumHask.Data.Rational.Ratio a) (NumHask.Data.Rational.Ratio a) instance NumHask.Data.Rational.GCDConstraints a => NumHask.Analysis.Metric.Metric (NumHask.Data.Rational.Ratio a) (NumHask.Data.Rational.Ratio a) instance (NumHask.Data.Rational.GCDConstraints a, NumHask.Algebra.Abstract.Lattice.MeetSemiLattice a) => NumHask.Analysis.Metric.Epsilon (NumHask.Data.Rational.Ratio a) instance NumHask.Data.Rational.GCDConstraints a => NumHask.Algebra.Abstract.Lattice.JoinSemiLattice (NumHask.Data.Rational.Ratio a) instance NumHask.Data.Rational.GCDConstraints a => NumHask.Algebra.Abstract.Lattice.MeetSemiLattice (NumHask.Data.Rational.Ratio a) instance (GHC.Classes.Eq a, NumHask.Algebra.Abstract.Additive.Additive a) => GHC.Classes.Eq (NumHask.Data.Rational.Ratio a) instance (GHC.Classes.Ord a, NumHask.Algebra.Abstract.Multiplicative.Multiplicative a, NumHask.Algebra.Abstract.Additive.Additive a) => GHC.Classes.Ord (NumHask.Data.Rational.Ratio a) instance (NumHask.Data.Integral.FromIntegral a b, NumHask.Algebra.Abstract.Multiplicative.Multiplicative a) => NumHask.Data.Integral.FromIntegral (NumHask.Data.Rational.Ratio a) b -- | A Pair is *the* classical higher-kinded number but there is no canon. module NumHask.Data.Pair -- | A pair of a's, implemented as a tuple, but api represented as a Pair -- of a's. -- --
-- >>> fmap (+1) (Pair 1 2) -- Pair 2 3 -- -- >>> pure one :: Pair Int -- Pair 1 1 -- -- >>> (*) <$> Pair 1 2 <*> pure 2 -- Pair 2 4 -- -- >>> foldr (++) [] (Pair [1,2] [3]) -- [1,2,3] -- -- >>> Pair "a" "pair" `mappend` pure " " `mappend` Pair "string" "mappended" -- Pair "a string" "pair mappended" ---- -- As a Ring and Field class -- --
-- >>> Pair 0 1 + zero -- Pair 0 1 -- -- >>> Pair 0 1 + Pair 2 3 -- Pair 2 4 -- -- >>> Pair 1 1 - one -- Pair 0 0 -- -- >>> Pair 0 1 * one -- Pair 0 1 -- -- >>> Pair 0.0 1.0 / one -- Pair 0.0 1.0 -- -- >>> Pair 11 12 `mod` (pure 6) -- Pair 5 0 ---- -- As an action -- --
-- >>> Pair 1 2 .+ 3 -- Pair 4 5 --newtype Pair a Pair' :: (a, a) -> Pair a -- | the preferred pattern pattern Pair :: a -> a -> Pair a instance GHC.Generics.Generic (NumHask.Data.Pair.Pair a) instance GHC.Classes.Eq a => GHC.Classes.Eq (NumHask.Data.Pair.Pair a) instance GHC.Show.Show a => GHC.Show.Show (NumHask.Data.Pair.Pair a) instance GHC.Base.Functor NumHask.Data.Pair.Pair instance Data.Functor.Classes.Eq1 NumHask.Data.Pair.Pair instance Data.Functor.Classes.Show1 NumHask.Data.Pair.Pair instance GHC.Base.Applicative NumHask.Data.Pair.Pair instance GHC.Base.Monad NumHask.Data.Pair.Pair instance Data.Foldable.Foldable NumHask.Data.Pair.Pair instance Data.Traversable.Traversable NumHask.Data.Pair.Pair instance GHC.Base.Semigroup a => GHC.Base.Semigroup (NumHask.Data.Pair.Pair a) instance (GHC.Base.Semigroup a, GHC.Base.Monoid a) => GHC.Base.Monoid (NumHask.Data.Pair.Pair a) instance GHC.Enum.Bounded a => GHC.Enum.Bounded (NumHask.Data.Pair.Pair a) instance NumHask.Algebra.Abstract.Additive.Additive a => NumHask.Algebra.Abstract.Additive.Additive (NumHask.Data.Pair.Pair a) instance NumHask.Algebra.Abstract.Additive.Subtractive a => NumHask.Algebra.Abstract.Additive.Subtractive (NumHask.Data.Pair.Pair a) instance NumHask.Algebra.Abstract.Multiplicative.Multiplicative a => NumHask.Algebra.Abstract.Multiplicative.Multiplicative (NumHask.Data.Pair.Pair a) instance NumHask.Algebra.Abstract.Multiplicative.Divisive a => NumHask.Algebra.Abstract.Multiplicative.Divisive (NumHask.Data.Pair.Pair a) instance NumHask.Data.Integral.Integral a => NumHask.Data.Integral.Integral (NumHask.Data.Pair.Pair a) instance NumHask.Analysis.Metric.Signed a => NumHask.Analysis.Metric.Signed (NumHask.Data.Pair.Pair a) instance (NumHask.Algebra.Abstract.Field.ExpField a, NumHask.Analysis.Metric.Normed a a) => NumHask.Analysis.Metric.Normed (NumHask.Data.Pair.Pair a) a instance (NumHask.Algebra.Abstract.Additive.Subtractive a, NumHask.Analysis.Metric.Epsilon a) => NumHask.Analysis.Metric.Epsilon (NumHask.Data.Pair.Pair a) instance (NumHask.Algebra.Abstract.Field.ExpField a, NumHask.Algebra.Abstract.Additive.Subtractive a, NumHask.Analysis.Metric.Normed a a) => NumHask.Analysis.Metric.Metric (NumHask.Data.Pair.Pair a) a instance NumHask.Algebra.Abstract.Ring.Distributive a => NumHask.Algebra.Abstract.Ring.Distributive (NumHask.Data.Pair.Pair a) instance NumHask.Algebra.Abstract.Field.Field a => NumHask.Algebra.Abstract.Field.Field (NumHask.Data.Pair.Pair a) instance NumHask.Algebra.Abstract.Ring.IntegralDomain a => NumHask.Algebra.Abstract.Ring.IntegralDomain (NumHask.Data.Pair.Pair a) instance NumHask.Algebra.Abstract.Field.ExpField a => NumHask.Algebra.Abstract.Field.ExpField (NumHask.Data.Pair.Pair a) instance NumHask.Algebra.Abstract.Field.UpperBoundedField a => NumHask.Algebra.Abstract.Field.UpperBoundedField (NumHask.Data.Pair.Pair a) instance NumHask.Algebra.Abstract.Field.LowerBoundedField a => NumHask.Algebra.Abstract.Field.LowerBoundedField (NumHask.Data.Pair.Pair a) instance NumHask.Algebra.Abstract.Additive.Additive a => NumHask.Algebra.Abstract.Action.AdditiveAction (NumHask.Data.Pair.Pair a) instance NumHask.Algebra.Abstract.Additive.Subtractive a => NumHask.Algebra.Abstract.Action.SubtractiveAction (NumHask.Data.Pair.Pair a) instance NumHask.Algebra.Abstract.Multiplicative.Multiplicative a => NumHask.Algebra.Abstract.Action.MultiplicativeAction (NumHask.Data.Pair.Pair a) instance NumHask.Algebra.Abstract.Multiplicative.Divisive a => NumHask.Algebra.Abstract.Action.DivisiveAction (NumHask.Data.Pair.Pair a) instance NumHask.Algebra.Abstract.Lattice.JoinSemiLattice a => NumHask.Algebra.Abstract.Lattice.JoinSemiLattice (NumHask.Data.Pair.Pair a) instance NumHask.Algebra.Abstract.Lattice.MeetSemiLattice a => NumHask.Algebra.Abstract.Lattice.MeetSemiLattice (NumHask.Data.Pair.Pair a) instance NumHask.Algebra.Abstract.Lattice.BoundedJoinSemiLattice a => NumHask.Algebra.Abstract.Lattice.BoundedJoinSemiLattice (NumHask.Data.Pair.Pair a) instance NumHask.Algebra.Abstract.Lattice.BoundedMeetSemiLattice a => NumHask.Algebra.Abstract.Lattice.BoundedMeetSemiLattice (NumHask.Data.Pair.Pair a) instance NumHask.Data.Integral.FromIntegral a b => NumHask.Data.Integral.FromIntegral (NumHask.Data.Pair.Pair a) b instance NumHask.Data.Rational.FromRatio a b => NumHask.Data.Rational.FromRatio (NumHask.Data.Pair.Pair a) b instance NumHask.Analysis.Metric.Normed a a => NumHask.Analysis.Metric.Normed (NumHask.Data.Pair.Pair a) (NumHask.Data.Pair.Pair a) instance (NumHask.Algebra.Abstract.Additive.Subtractive a, NumHask.Analysis.Metric.Normed a a) => NumHask.Analysis.Metric.Metric (NumHask.Data.Pair.Pair a) (NumHask.Data.Pair.Pair a) module NumHask.Data.LogField -- | Module : Data.Number.LogFloat Copyright : Copyright (c) 2007--2015 -- wren gayle romano License : BSD3 Maintainer : -- wren@community.haskell.org Stability : stable Portability : portable -- (with CPP, FFI) Link : -- https://hackage.haskell.org/package/logfloat -- -- A LogField is just a Field with a special -- interpretation. The LogField function is presented instead of -- the constructor, in order to ensure semantic conversion. At present -- the Show instance will convert back to the normal-domain, and -- hence will underflow at that point. This behavior may change in the -- future. -- -- Because logField performs the semantic conversion, we can use -- operators which say what we *mean* rather than saying what we're -- actually doing to the underlying representation. That is, equivalences -- like the following are true[1] thanks to type-class overloading: -- --
-- logField (p + q) == logField p + logField q -- logField (p * q) == logField p * logField q ---- -- Performing operations in the log-domain is cheap, prevents underflow, -- and is otherwise very nice for dealing with miniscule probabilities. -- However, crossing into and out of the log-domain is expensive and -- should be avoided as much as possible. In particular, if you're doing -- a series of multiplications as in lp * LogField q * LogField -- r it's faster to do lp * LogField (q * r) if you're -- reasonably sure the normal-domain multiplication won't underflow; -- because that way you enter the log-domain only once, instead of twice. -- Also note that, for precision, if you're doing more than a few -- multiplications in the log-domain, you should use product -- rather than using '(*)' repeatedly. -- -- Even more particularly, you should avoid addition whenever -- possible. Addition is provided because sometimes we need it, and the -- proper implementation is not immediately apparent. However, between -- two LogFields addition requires crossing the exp/log boundary -- twice; with a LogField and a Double it's three times, -- since the regular number needs to enter the log-domain first. This -- makes addition incredibly slow. Again, if you can parenthesize to do -- normal-domain operations first, do it! -- --
-- logField p == logToLogField (log p) --logField :: ExpField a => a -> LogField a -- | Semantically convert our log-domain value back into the normal-domain. -- Beware of overflow/underflow. The following equivalence holds (without -- qualification): -- --
-- fromLogField == exp . logFromLogField --fromLogField :: ExpField a => LogField a -> a -- | Constructor which assumes the argument is already in the log-domain. logToLogField :: a -> LogField a -- | Return the log-domain value itself without conversion. logFromLogField :: LogField a -> a -- | O(n). Compute the sum of a finite list of LogFields, -- being careful to avoid underflow issues. That is, the following -- equivalence holds (modulo underflow and all that): -- --
-- LogField . accurateSum == accurateSum . map LogField ---- -- N.B., this function requires two passes over the input. Thus, -- it is not amenable to list fusion, and hence will use a lot of memory -- when summing long lists. accurateSum :: (ExpField a, Subtractive a, Foldable f, Ord a) => f (LogField a) -> LogField a -- | O(n). Compute the product of a finite list of LogFields, -- being careful to avoid numerical error due to loss of precision. That -- is, the following equivalence holds (modulo underflow and all that): -- --
-- LogField . accurateProduct == accurateProduct . map LogField --accurateProduct :: (ExpField a, Subtractive a, Foldable f) => f (LogField a) -> LogField a -- | O(1). Compute powers in the log-domain; that is, the following -- equivalence holds (modulo underflow and all that): -- --
-- LogField (p ** m) == LogField p `pow` m ---- -- Since: 0.13 pow :: (ExpField a, LowerBoundedField a, Ord a) => LogField a -> a -> LogField a infixr 8 `pow` instance Data.Traversable.Traversable NumHask.Data.LogField.LogField instance Data.Foldable.Foldable NumHask.Data.LogField.LogField instance GHC.Base.Functor NumHask.Data.LogField.LogField instance GHC.Generics.Generic1 NumHask.Data.LogField.LogField instance GHC.Generics.Generic (NumHask.Data.LogField.LogField a) instance Data.Data.Data a => Data.Data.Data (NumHask.Data.LogField.LogField a) instance GHC.Read.Read a => GHC.Read.Read (NumHask.Data.LogField.LogField a) instance GHC.Classes.Ord a => GHC.Classes.Ord (NumHask.Data.LogField.LogField a) instance GHC.Classes.Eq a => GHC.Classes.Eq (NumHask.Data.LogField.LogField a) instance (NumHask.Algebra.Abstract.Field.ExpField a, GHC.Show.Show a) => GHC.Show.Show (NumHask.Data.LogField.LogField a) instance (NumHask.Algebra.Abstract.Field.ExpField a, NumHask.Algebra.Abstract.Field.LowerBoundedField a, GHC.Classes.Ord a) => NumHask.Algebra.Abstract.Additive.Additive (NumHask.Data.LogField.LogField a) instance (NumHask.Algebra.Abstract.Field.ExpField a, GHC.Classes.Ord a, NumHask.Algebra.Abstract.Field.LowerBoundedField a, NumHask.Algebra.Abstract.Field.UpperBoundedField a) => NumHask.Algebra.Abstract.Additive.Subtractive (NumHask.Data.LogField.LogField a) instance (NumHask.Algebra.Abstract.Field.LowerBoundedField a, GHC.Classes.Eq a) => NumHask.Algebra.Abstract.Multiplicative.Multiplicative (NumHask.Data.LogField.LogField a) instance (NumHask.Algebra.Abstract.Field.LowerBoundedField a, GHC.Classes.Eq a) => NumHask.Algebra.Abstract.Multiplicative.Divisive (NumHask.Data.LogField.LogField a) instance (GHC.Classes.Ord a, NumHask.Algebra.Abstract.Field.LowerBoundedField a, NumHask.Algebra.Abstract.Field.ExpField a) => NumHask.Algebra.Abstract.Ring.Distributive (NumHask.Data.LogField.LogField a) instance (NumHask.Algebra.Abstract.Field.Field (NumHask.Data.LogField.LogField a), NumHask.Algebra.Abstract.Field.ExpField a, NumHask.Algebra.Abstract.Field.LowerBoundedField a, GHC.Classes.Ord a) => NumHask.Algebra.Abstract.Field.ExpField (NumHask.Data.LogField.LogField a) instance (NumHask.Data.Integral.FromIntegral a b, NumHask.Algebra.Abstract.Field.ExpField a) => NumHask.Data.Integral.FromIntegral (NumHask.Data.LogField.LogField a) b instance (NumHask.Data.Integral.ToIntegral a b, NumHask.Algebra.Abstract.Field.ExpField a) => NumHask.Data.Integral.ToIntegral (NumHask.Data.LogField.LogField a) b instance (NumHask.Data.Rational.FromRatio a b, NumHask.Algebra.Abstract.Field.ExpField a) => NumHask.Data.Rational.FromRatio (NumHask.Data.LogField.LogField a) b instance (NumHask.Data.Rational.ToRatio a b, NumHask.Algebra.Abstract.Field.ExpField a) => NumHask.Data.Rational.ToRatio (NumHask.Data.LogField.LogField a) b instance GHC.Classes.Ord a => NumHask.Algebra.Abstract.Lattice.JoinSemiLattice (NumHask.Data.LogField.LogField a) instance GHC.Classes.Ord a => NumHask.Algebra.Abstract.Lattice.MeetSemiLattice (NumHask.Data.LogField.LogField a) instance (NumHask.Analysis.Metric.Epsilon a, NumHask.Algebra.Abstract.Field.ExpField a, NumHask.Algebra.Abstract.Field.LowerBoundedField a, NumHask.Algebra.Abstract.Field.UpperBoundedField a, GHC.Classes.Ord a) => NumHask.Analysis.Metric.Epsilon (NumHask.Data.LogField.LogField a) instance (GHC.Classes.Ord a, NumHask.Algebra.Abstract.Field.ExpField a, NumHask.Algebra.Abstract.Field.LowerBoundedField a) => NumHask.Algebra.Abstract.Field.Field (NumHask.Data.LogField.LogField a) instance (GHC.Classes.Ord a, NumHask.Algebra.Abstract.Field.ExpField a, NumHask.Algebra.Abstract.Field.LowerBoundedField a, NumHask.Algebra.Abstract.Field.UpperBoundedField a) => NumHask.Algebra.Abstract.Field.LowerBoundedField (NumHask.Data.LogField.LogField a) instance (GHC.Classes.Ord a, NumHask.Algebra.Abstract.Field.ExpField a, NumHask.Algebra.Abstract.Field.LowerBoundedField a) => NumHask.Algebra.Abstract.Ring.IntegralDomain (NumHask.Data.LogField.LogField a) instance (GHC.Classes.Ord a, NumHask.Algebra.Abstract.Field.ExpField a, NumHask.Algebra.Abstract.Field.LowerBoundedField a, NumHask.Algebra.Abstract.Field.UpperBoundedField a) => NumHask.Algebra.Abstract.Field.UpperBoundedField (NumHask.Data.LogField.LogField a) instance (GHC.Classes.Ord a, NumHask.Algebra.Abstract.Field.LowerBoundedField a, NumHask.Algebra.Abstract.Field.UpperBoundedField a, NumHask.Algebra.Abstract.Field.ExpField a) => NumHask.Analysis.Metric.Signed (NumHask.Data.LogField.LogField a) module NumHask.Data.Wrapped newtype Wrapped a Wrapped :: a -> Wrapped a [unWrapped] :: Wrapped a -> a instance NumHask.Algebra.Abstract.Field.LowerBoundedField a => NumHask.Algebra.Abstract.Field.LowerBoundedField (NumHask.Data.Wrapped.Wrapped a) instance NumHask.Algebra.Abstract.Field.UpperBoundedField a => NumHask.Algebra.Abstract.Field.UpperBoundedField (NumHask.Data.Wrapped.Wrapped a) instance NumHask.Analysis.Metric.Epsilon a => NumHask.Analysis.Metric.Epsilon (NumHask.Data.Wrapped.Wrapped a) instance NumHask.Algebra.Abstract.Lattice.JoinSemiLattice a => NumHask.Algebra.Abstract.Lattice.JoinSemiLattice (NumHask.Data.Wrapped.Wrapped a) instance NumHask.Algebra.Abstract.Lattice.MeetSemiLattice a => NumHask.Algebra.Abstract.Lattice.MeetSemiLattice (NumHask.Data.Wrapped.Wrapped a) instance NumHask.Analysis.Metric.Signed a => NumHask.Analysis.Metric.Signed (NumHask.Data.Wrapped.Wrapped a) instance NumHask.Data.Integral.Integral a => NumHask.Data.Integral.Integral (NumHask.Data.Wrapped.Wrapped a) instance NumHask.Algebra.Abstract.Field.TrigField a => NumHask.Algebra.Abstract.Field.TrigField (NumHask.Data.Wrapped.Wrapped a) instance NumHask.Algebra.Abstract.Field.ExpField a => NumHask.Algebra.Abstract.Field.ExpField (NumHask.Data.Wrapped.Wrapped a) instance (NumHask.Algebra.Abstract.Additive.Additive a, NumHask.Algebra.Abstract.Multiplicative.Divisive a) => NumHask.Algebra.Abstract.Field.Field (NumHask.Data.Wrapped.Wrapped a) instance (NumHask.Algebra.Abstract.Ring.StarSemiring a, NumHask.Algebra.Abstract.Group.Magma a) => NumHask.Algebra.Abstract.Ring.KleeneAlgebra (NumHask.Data.Wrapped.Wrapped a) instance NumHask.Algebra.Abstract.Ring.StarSemiring a => NumHask.Algebra.Abstract.Ring.StarSemiring (NumHask.Data.Wrapped.Wrapped a) instance NumHask.Algebra.Abstract.Ring.InvolutiveRing a => NumHask.Algebra.Abstract.Ring.InvolutiveRing (NumHask.Data.Wrapped.Wrapped a) instance (NumHask.Algebra.Abstract.Additive.Additive a, NumHask.Algebra.Abstract.Multiplicative.Divisive a) => NumHask.Algebra.Abstract.Ring.IntegralDomain (NumHask.Data.Wrapped.Wrapped a) instance (NumHask.Algebra.Abstract.Additive.Additive a, NumHask.Algebra.Abstract.Multiplicative.Multiplicative a) => NumHask.Algebra.Abstract.Ring.Distributive (NumHask.Data.Wrapped.Wrapped a) instance NumHask.Algebra.Abstract.Multiplicative.Divisive a => NumHask.Algebra.Abstract.Multiplicative.Divisive (NumHask.Data.Wrapped.Wrapped a) instance NumHask.Algebra.Abstract.Multiplicative.Multiplicative a => NumHask.Algebra.Abstract.Multiplicative.Multiplicative (NumHask.Data.Wrapped.Wrapped a) instance NumHask.Algebra.Abstract.Additive.Subtractive a => NumHask.Algebra.Abstract.Additive.Subtractive (NumHask.Data.Wrapped.Wrapped a) instance NumHask.Algebra.Abstract.Additive.Additive a => NumHask.Algebra.Abstract.Additive.Additive (NumHask.Data.Wrapped.Wrapped a) instance NumHask.Algebra.Abstract.Group.Magma a => NumHask.Algebra.Abstract.Group.Idempotent (NumHask.Data.Wrapped.Wrapped a) instance NumHask.Algebra.Abstract.Group.Magma a => NumHask.Algebra.Abstract.Group.Magma (NumHask.Data.Wrapped.Wrapped a) instance GHC.Classes.Ord a => GHC.Classes.Ord (NumHask.Data.Wrapped.Wrapped a) instance GHC.Classes.Eq a => GHC.Classes.Eq (NumHask.Data.Wrapped.Wrapped a) instance GHC.Show.Show a => GHC.Show.Show (NumHask.Data.Wrapped.Wrapped a) instance (GHC.Classes.Ord a, NumHask.Algebra.Abstract.Field.QuotientField a GHC.Integer.Type.Integer) => NumHask.Algebra.Abstract.Field.QuotientField (NumHask.Data.Wrapped.Wrapped a) (NumHask.Data.Wrapped.Wrapped GHC.Integer.Type.Integer) instance NumHask.Data.Integral.FromIntegral a b => NumHask.Data.Integral.FromIntegral (NumHask.Data.Wrapped.Wrapped a) b instance NumHask.Data.Integral.ToIntegral a b => NumHask.Data.Integral.ToIntegral (NumHask.Data.Wrapped.Wrapped a) b instance NumHask.Data.Rational.FromRatio a b => NumHask.Data.Rational.FromRatio (NumHask.Data.Wrapped.Wrapped a) b instance NumHask.Data.Rational.ToRatio a b => NumHask.Data.Rational.ToRatio (NumHask.Data.Wrapped.Wrapped a) b instance NumHask.Analysis.Metric.Normed a b => NumHask.Analysis.Metric.Normed (NumHask.Data.Wrapped.Wrapped a) (NumHask.Data.Wrapped.Wrapped b) instance NumHask.Analysis.Metric.Metric a b => NumHask.Analysis.Metric.Metric (NumHask.Data.Wrapped.Wrapped a) (NumHask.Data.Wrapped.Wrapped b) module NumHask.Exception newtype NumHaskException NumHaskException :: String -> NumHaskException [errorMessage] :: NumHaskException -> String -- | Throw an exception. Exceptions may be thrown from purely functional -- code, but may only be caught within the IO monad. throw :: Exception e => e -> a instance GHC.Show.Show NumHask.Exception.NumHaskException instance GHC.Exception.Type.Exception NumHask.Exception.NumHaskException module NumHask.Data.Positive newtype Positive a Positive :: a -> Positive a [unPositive] :: Positive a -> a positive :: (Ord a, Additive a) => a -> Maybe (Positive a) positive_ :: (Ord a, Additive a) => a -> Positive a instance (NumHask.Analysis.Metric.Epsilon a, GHC.Classes.Ord a) => NumHask.Analysis.Metric.Epsilon (NumHask.Data.Positive.Positive a) instance NumHask.Algebra.Abstract.Lattice.MeetSemiLattice a => NumHask.Algebra.Abstract.Lattice.MeetSemiLattice (NumHask.Data.Positive.Positive a) instance NumHask.Algebra.Abstract.Lattice.JoinSemiLattice a => NumHask.Algebra.Abstract.Lattice.JoinSemiLattice (NumHask.Data.Positive.Positive a) instance NumHask.Analysis.Metric.Signed a => NumHask.Analysis.Metric.Signed (NumHask.Data.Positive.Positive a) instance NumHask.Data.Integral.Integral a => NumHask.Data.Integral.Integral (NumHask.Data.Positive.Positive a) instance NumHask.Algebra.Abstract.Field.TrigField a => NumHask.Algebra.Abstract.Field.TrigField (NumHask.Data.Positive.Positive a) instance NumHask.Algebra.Abstract.Field.ExpField a => NumHask.Algebra.Abstract.Field.ExpField (NumHask.Data.Positive.Positive a) instance (NumHask.Algebra.Abstract.Additive.Additive a, NumHask.Algebra.Abstract.Multiplicative.Divisive a) => NumHask.Algebra.Abstract.Field.Field (NumHask.Data.Positive.Positive a) instance (NumHask.Algebra.Abstract.Additive.Additive a, NumHask.Algebra.Abstract.Multiplicative.Divisive a) => NumHask.Algebra.Abstract.Ring.IntegralDomain (NumHask.Data.Positive.Positive a) instance (NumHask.Algebra.Abstract.Additive.Additive a, NumHask.Algebra.Abstract.Multiplicative.Multiplicative a) => NumHask.Algebra.Abstract.Ring.Distributive (NumHask.Data.Positive.Positive a) instance NumHask.Algebra.Abstract.Multiplicative.Divisive a => NumHask.Algebra.Abstract.Multiplicative.Divisive (NumHask.Data.Positive.Positive a) instance NumHask.Algebra.Abstract.Multiplicative.Multiplicative a => NumHask.Algebra.Abstract.Multiplicative.Multiplicative (NumHask.Data.Positive.Positive a) instance NumHask.Algebra.Abstract.Additive.Additive a => NumHask.Algebra.Abstract.Additive.Additive (NumHask.Data.Positive.Positive a) instance GHC.Classes.Ord a => GHC.Classes.Ord (NumHask.Data.Positive.Positive a) instance GHC.Classes.Eq a => GHC.Classes.Eq (NumHask.Data.Positive.Positive a) instance GHC.Show.Show a => GHC.Show.Show (NumHask.Data.Positive.Positive a) instance (GHC.Classes.Ord a, NumHask.Algebra.Abstract.Additive.Subtractive a) => NumHask.Algebra.Abstract.Additive.Subtractive (NumHask.Data.Positive.Positive a) instance (GHC.Classes.Ord a, NumHask.Algebra.Abstract.Field.QuotientField a GHC.Integer.Type.Integer) => NumHask.Algebra.Abstract.Field.QuotientField (NumHask.Data.Positive.Positive a) (NumHask.Data.Positive.Positive GHC.Integer.Type.Integer) instance NumHask.Algebra.Abstract.Field.UpperBoundedField a => NumHask.Algebra.Abstract.Field.UpperBoundedField (NumHask.Data.Positive.Positive a) instance NumHask.Algebra.Abstract.Field.UpperBoundedField a => GHC.Enum.Bounded (NumHask.Data.Positive.Positive a) instance NumHask.Analysis.Metric.Normed a a => NumHask.Analysis.Metric.Normed a (NumHask.Data.Positive.Positive a) instance (NumHask.Algebra.Abstract.Additive.Subtractive a, NumHask.Analysis.Metric.Normed a a) => NumHask.Analysis.Metric.Metric a (NumHask.Data.Positive.Positive a)