packages feed

vector-space 0.16 → 0.19

raw patch · 5 files changed

+18/−13 lines, 5 filesdep ~base

Dependency ranges changed: base

Files

src/Data/AffineSpace.hs view
@@ -21,8 +21,9 @@   (     AffineSpace(..), (.-^), distanceSq, distance, alerp, affineCombo   ) where-+#if !MIN_VERSION_base(4,10,0) import Control.Applicative (liftA2)+#endif import Data.Ratio import Foreign.C.Types (CSChar, CInt, CShort, CLong, CLLong, CIntMax, CFloat, CDouble) import Control.Arrow(first)@@ -149,7 +150,7 @@  instance AdditiveGroup (Diff (VRep p)) => AdditiveGroup (GenericDiff p) instance VectorSpace (Diff (VRep p)) => VectorSpace (GenericDiff p)-instance InnerSpace (Diff (VRep p)) => InnerSpace (GenericDiff p)+instance (AdditiveGroup (Scalar (Diff (VRep p))), InnerSpace (Diff (VRep p))) => InnerSpace (GenericDiff p) instance HasBasis (Diff (VRep p)) => HasBasis (GenericDiff p)  data AffineDiffProductSpace f g p = AffineDiffProductSpace@@ -160,7 +161,8 @@          , VectorSpace (Diff (f p)), VectorSpace (Diff (g p))          , Scalar (Diff (f p)) ~ Scalar (Diff (g p)) )     => VectorSpace (AffineDiffProductSpace f g p)-instance ( AffineSpace (f p), AffineSpace (g p)+instance ( AdditiveGroup (Scalar (Diff (g p)))+         , AffineSpace (f p), AffineSpace (g p)          , InnerSpace (Diff (f p)), InnerSpace (Diff (g p))          , Scalar (Diff (f p)) ~ Scalar (Diff (g p))          , Num (Scalar (Diff (f p))) )
src/Data/Basis.hs view
@@ -23,6 +23,7 @@ import Control.Arrow (first) import Data.Ratio import Foreign.C.Types (CFloat, CDouble)+import Data.Kind -- import Data.Either  import Data.VectorSpace@@ -36,7 +37,7 @@  class VectorSpace v => HasBasis v where   -- | Representation of the canonical basis for @v@-  type Basis v :: *+  type Basis v :: Type   type Basis v = Basis (VRep v)   -- | Interpret basis rep as a vector   basisValue   :: Basis v -> v
src/Data/LinearMap.hs view
@@ -25,9 +25,9 @@   where  #if !(MIN_VERSION_base(4,8,0))-import Control.Applicative (Applicative)+import Control.Applicative (Applicative, liftA2) #endif-import Control.Applicative (liftA2, liftA3)+import Control.Applicative (liftA3) import Control.Arrow       (first,second)  import Data.MemoTrie      (HasTrie(..),(:->:))
src/Data/VectorSpace.hs view
@@ -32,11 +32,13 @@   , InnerSpace(..)   , lerp, linearCombo, magnitudeSq, magnitude, normalized, project   ) where-+#if !(MIN_VERSION_base(4,8,0)) import Control.Applicative (liftA2)+#endif import Data.Complex hiding (magnitude) import Foreign.C.Types (CSChar, CInt, CShort, CLong, CLLong, CIntMax, CFloat, CDouble) import Data.Ratio+import Data.Kind  import Data.AdditiveGroup import Data.MemoTrie@@ -49,7 +51,7 @@  -- | Vector space @v@. class AdditiveGroup v => VectorSpace v where-  type Scalar v :: *+  type Scalar v :: Type   type Scalar v = Scalar (VRep v)   -- | Scale a vector   (*^) :: Scalar v -> v -> v@@ -105,8 +107,8 @@ magnitude = sqrt . magnitudeSq {-# INLINE magnitude #-} --- | Vector in same direction as given one but with length of one.  If--- given the zero vector, then return it.+-- | Vector in same direction as given one but with length of one.+-- Divides by zero for the zero vector. normalized :: (InnerSpace v, s ~ Scalar v, Floating s) =>  v -> v normalized v = v ^/ magnitude v {-# INLINE normalized #-}
vector-space.cabal view
@@ -1,6 +1,6 @@ Name:                vector-space-Version:             0.16-Cabal-Version:       >= 1.8+Version:             0.19+Cabal-Version:       >= 1.10 Synopsis:            Vector & affine spaces, linear maps, and derivatives Category:            math Description:@@ -29,6 +29,7 @@   location: git://github.com/conal/vector-space.git  Library+  default-language:  Haskell2010   hs-Source-Dirs:      src   Extensions:             Build-Depends:       base<5, MemoTrie >= 0.5@@ -52,4 +53,3 @@   if !impl(ghc >= 7.6) { Build-Depends: ghc-prim >= 0.2 }   if !impl(ghc >= 7.9) { Build-Depends: void >= 0.4 }   if !impl(ghc >= 8.0) { Build-Depends: semigroups >= 0.16 }-  ghc-options:         -Wall -O2