packages feed

vector-space 0.1 → 0.1.1

raw patch · 4 files changed

+23/−6 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Data.Derivative: linearD :: (VectorSpace v s) => (u :-* v) -> (u :~> v)
+ Data.VectorSpace: instance (RealFloat v, InnerSpace v s, VectorSpace s s') => InnerSpace (Complex v) s
+ Data.VectorSpace: instance (RealFloat v, VectorSpace v s) => VectorSpace (Complex v) s

Files

src/Data/Derivative.hs view
@@ -15,7 +15,8 @@  module Data.Derivative   (-    (:>)(..), (:~>), dZero, dConst, dId, bilinearD+    (:>)(..), (:~>), dZero, dConst, dId+  , linearD, bilinearD   , (@.), (>-<)   ) where @@ -85,12 +86,12 @@ -- or --   dId v = D v dConst --- Every linear function has a constant derivative equal to the function+-- | Every linear function has a constant derivative equal to the function -- itself (as a linear map). linearD :: VectorSpace v s => (u :-* v) -> (u :~> v) linearD f u = D (f u) (dConst . f) --- Derivative tower for applying a bilinear function, such as+-- | Derivative tower for applying a bilinear function, such as -- multiplication. bilinearD :: VectorSpace w s =>              (u -> v -> w) -> (t :> u) -> (t :> v) -> (t :> w)@@ -116,7 +117,7 @@     D c0 c' = h b0  --- Specialized chain rule.+-- | Specialized chain rule. (>-<) :: VectorSpace b s => (b -> b) -> ((a :> b) -> (a :> s))       -> (a :> b) -> (a :> b) f >-< f' = \ b@(D b0 b') -> D (f b0) ((f' b *^) . b')
src/Data/NumInstances.hs view
@@ -70,6 +70,8 @@ lift2 :: (a->u) -> (b->v) -> (a,b) -> (u,v) lift2 f g (a,b) = (f a, g b) +-- Equivalently, lift2 = (***)+ instance (Num a, Num b) => Num (a,b) where   fromInteger n   = (fromInteger n, fromInteger n)   (a,b) + (a',b') = (a+a',b+b')
src/Data/VectorSpace.hs view
@@ -22,7 +22,7 @@   ) where  import Control.Applicative-+import Data.Complex hiding (magnitude)  infixr 9 :-* infixr 7 *^, ^/, <.>@@ -109,6 +109,20 @@  instance InnerSpace Float Float where   (<.>) = (*)++instance (RealFloat v, VectorSpace v s) => VectorSpace (Complex v) s where+  zeroV       = zeroV :+ zeroV+  s*^(u :+ v) = s*^u :+ s*^v+  (^+^)       = (+)+  negateV     = negate++instance (RealFloat v, InnerSpace v s, VectorSpace s s')+     => InnerSpace (Complex v) s where+  (u :+ v) <.> (u' :+ v') = (u <.> u') ^+^ (v <.> v')++-- Hm.  The 'RealFloat' constraint is unfortunate here.  It's due to a+-- questionable decision to place 'RealFloat' into the definition of the+-- 'Complex' /type/, rather than in functions and instances as needed.  -- With UndecidableInstances, I get --   Illegal instance declaration for `VectorSpace (u, v) s' (the
vector-space.cabal view
@@ -1,5 +1,5 @@ Name:                vector-space-Version:             0.1+Version:             0.1.1 Synopsis: 	     Vector & affine spaces, plus derivatives Category:            math Description: