linear 1.16.1 → 1.16.2
raw patch · 11 files changed
+43/−4 lines, 11 filesdep +deepseqPVP ok
version bump matches the API change (PVP)
Dependencies added: deepseq
API changes (from Hackage documentation)
+ Linear.Matrix: (!!/) :: (Functor m, Functor r, Fractional a) => m (r a) -> a -> m (r a)
+ Linear.Plucker: instance NFData a => NFData (Plucker a)
+ Linear.Quaternion: instance NFData a => NFData (Quaternion a)
+ Linear.V: instance NFData a => NFData (V n a)
+ Linear.V0: instance NFData (V0 a)
+ Linear.V1: instance NFData a => NFData (V1 a)
+ Linear.V2: instance NFData a => NFData (V2 a)
+ Linear.V3: instance NFData a => NFData (V3 a)
+ Linear.V4: instance NFData a => NFData (V4 a)
Files
- CHANGELOG.markdown +5/−0
- linear.cabal +2/−1
- src/Linear/Matrix.hs +7/−1
- src/Linear/Plucker.hs +5/−0
- src/Linear/Quaternion.hs +4/−0
- src/Linear/V.hs +2/−1
- src/Linear/V0.hs +4/−0
- src/Linear/V1.hs +2/−1
- src/Linear/V2.hs +4/−0
- src/Linear/V3.hs +4/−0
- src/Linear/V4.hs +4/−0
CHANGELOG.markdown view
@@ -1,3 +1,8 @@+1.16.2+----+* Added `NFData` instances for the various vector types.+* Added `!!/` operator for matrix division by scalar.+ 1.16.1 ---- * Added `Trace` instance for `V1`.
linear.cabal view
@@ -1,6 +1,6 @@ name: linear category: Math, Algebra-version: 1.16.1+version: 1.16.2 license: BSD3 cabal-version: >= 1.8 license-file: LICENSE@@ -34,6 +34,7 @@ base >= 4.5 && < 5, binary >= 0.5 && < 0.8, containers >= 0.4 && < 0.6,+ deepseq >= 1.1 && < 1.5, distributive >= 0.2.2 && < 1, ghc-prim, hashable >= 1.1 && < 1.3,
src/Linear/Matrix.hs view
@@ -17,7 +17,7 @@ -- Simple matrix operation for low-dimensional primitives. --------------------------------------------------------------------------- module Linear.Matrix- ( (!*!), (!+!), (!-!), (!*) , (*!), (!!*), (*!!)+ ( (!*!), (!+!), (!-!), (!*), (*!), (!!*), (*!!), (!!/) , column , adjoint , M22, M23, M24, M32, M33, M34, M42, M43, M44@@ -140,6 +140,12 @@ (!!*) :: (Functor m, Functor r, Num a) => m (r a) -> a -> m (r a) (!!*) = flip (*!!) {-# INLINE (!!*) #-}++infixl 7 !!/+-- | Matrix-scalar division+(!!/) :: (Functor m, Functor r, Fractional a) => m (r a) -> a -> m (r a)+m !!/ s = fmap (^/ s) m+{-# INLINE (!!/) #-} -- | Hermitian conjugate or conjugate transpose --
src/Linear/Plucker.hs view
@@ -46,6 +46,7 @@ ) where import Control.Applicative+import Control.DeepSeq (NFData(rnf)) import Control.Monad (liftM) import Control.Monad.Fix import Control.Monad.Zip@@ -519,3 +520,7 @@ (let Plucker _ _ _ a _ _ = f a in a) (let Plucker _ _ _ _ a _ = f a in a) (let Plucker _ _ _ _ _ a = f a in a)++instance NFData a => NFData (Plucker a) where+ rnf (Plucker a b c d e f) = rnf a `seq` rnf b `seq` rnf c+ `seq` rnf d `seq` rnf e `seq` rnf f
src/Linear/Quaternion.hs view
@@ -39,6 +39,7 @@ ) where import Control.Applicative+import Control.DeepSeq (NFData(rnf)) import Control.Monad (liftM) import Control.Monad.Fix import Control.Monad.Zip@@ -550,3 +551,6 @@ (V3 (let Quaternion _ (V3 a _ _) = f a in a) (let Quaternion _ (V3 _ a _) = f a in a) (let Quaternion _ (V3 _ _ a) = f a in a))++instance NFData a => NFData (Quaternion a) where+ rnf (Quaternion a b) = rnf a `seq` rnf b
src/Linear/V.hs view
@@ -43,6 +43,7 @@ ) where import Control.Applicative+import Control.DeepSeq (NFData) import Control.Monad.Fix import Control.Monad.Zip import Control.Lens as Lens@@ -86,7 +87,7 @@ type role V nominal representational #endif -newtype V n a = V { toVector :: V.Vector a } deriving (Eq,Ord,Show,Read,Typeable+newtype V n a = V { toVector :: V.Vector a } deriving (Eq,Ord,Show,Read,Typeable,NFData , Generic -- GHC bug: https://ghc.haskell.org/trac/ghc/ticket/8468 #if __GLASGOW_HASKELL__ >= 707
src/Linear/V0.hs view
@@ -28,6 +28,7 @@ ) where import Control.Applicative+import Control.DeepSeq (NFData(rnf)) import Control.Lens import Control.Monad.Fix import Control.Monad.Zip@@ -232,3 +233,6 @@ {-# INLINE minBound #-} maxBound = V0 {-# INLINE maxBound #-}++instance NFData (V0 a) where+ rnf V0 = ()
src/Linear/V1.hs view
@@ -35,6 +35,7 @@ ) where import Control.Applicative+import Control.DeepSeq (NFData) import Control.Monad (liftM) import Control.Monad.Fix import Control.Monad.Zip@@ -89,7 +90,7 @@ newtype V1 a = V1 a deriving (Eq,Ord,Show,Read,Data,Typeable, Functor,Foldable,Traversable,- Epsilon,Storable+ Epsilon,Storable,NFData #if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702 ,Generic #endif
src/Linear/V2.hs view
@@ -32,6 +32,7 @@ ) where import Control.Applicative+import Control.DeepSeq (NFData(rnf)) import Control.Monad (liftM) import Control.Monad.Fix import Control.Monad.Zip@@ -328,3 +329,6 @@ {-# INLINE minBound #-} maxBound = pure maxBound {-# INLINE maxBound #-}++instance NFData a => NFData (V2 a) where+ rnf (V2 a b) = rnf a `seq` rnf b
src/Linear/V3.hs view
@@ -33,6 +33,7 @@ ) where import Control.Applicative+import Control.DeepSeq (NFData(rnf)) import Control.Monad (liftM) import Control.Monad.Fix import Control.Monad.Zip@@ -351,3 +352,6 @@ {-# INLINE minBound #-} maxBound = pure maxBound {-# INLINE maxBound #-}++instance NFData a => NFData (V3 a) where+ rnf (V3 a b c) = rnf a `seq` rnf b `seq` rnf c
src/Linear/V4.hs view
@@ -40,6 +40,7 @@ ) where import Control.Applicative+import Control.DeepSeq (NFData(rnf)) import Control.Monad (liftM) import Control.Monad.Fix import Control.Monad.Zip@@ -498,3 +499,6 @@ {-# INLINE minBound #-} maxBound = pure maxBound {-# INLINE maxBound #-}++instance NFData a => NFData (V4 a) where+ rnf (V4 a b c d) = rnf a `seq` rnf b `seq` rnf c `seq` rnf d