packages feed

linear-accelerate 0.5 → 0.5.0.1

raw patch · 9 files changed

+112/−60 lines, 9 filesdep ~doctestPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: doctest

API changes (from Hackage documentation)

Files

.travis.yml view
@@ -12,6 +12,10 @@     - $HOME/.stack     - .stack-work/install +before_cache:+  - rm -rf $(stack path --local-install-root)/bin+  - rm -rf $(stack path --local-install-root)/doc+ addons:   apt:     sources: &apt_sources
CHANGELOG.markdown view
@@ -7,6 +7,10 @@ (PVP)](https://pvp.haskell.org)  +## [0.5.0.1]++* Fix [#10]: doctest failure with accelerate-1.1.1.0+ ## [0.5]  * Fix [#25][acc-llvm#25]: "impossible evaluation" error with accelerate-llvm-native@@ -34,6 +38,8 @@  * Repository initialized ++[0.5.0.1]:          https://github.com/ekmett/linear-accelerate/compare/v0.5...v0.5.0.1 [0.5]:              https://github.com/ekmett/linear-accelerate/compare/v0.4.1...v0.5 [0.4.1]:            https://github.com/ekmett/linear-accelerate/compare/v0.4...v0.4.1 [0.4]:              https://github.com/ekmett/linear-accelerate/compare/v0.3...v0.4@@ -42,5 +48,6 @@ [0.1]:              https://github.com/ekmett/linear-accelerate/compare/3db20f05af0a1488fcbc3ea28f8561ce73289b73...v0.1  [#1]:               https://github.com/ekmett/linear-accelerate/issues/1+[#10]:              https://github.com/ekmett/linear-accelerate/issues/10 [acc-llvm#25]:      https://github.com/AccelerateHS/accelerate-llvm/issues/25 
linear-accelerate.cabal view
@@ -1,6 +1,6 @@ name:          linear-accelerate category:      Math, Algebra, Compilers/Interpreters, Concurrency, Data, Parallelism-version:       0.5+version:       0.5.0.1 license:       BSD3 cabal-version: >= 1.10 license-file:  LICENSE@@ -26,7 +26,7 @@  source-repository this   type: git-  tag: v0.5+  tag: v0.5.0.1   location: git://github.com/ekmett/linear-accelerate.git  custom-setup
src/Data/Array/Accelerate/Linear/Matrix.hs view
@@ -49,13 +49,19 @@ import Control.Applicative import Prelude                                  as P +-- $setup+-- >>> import Data.Array.Accelerate.Interpreter+-- >>> :{+--   let test :: Elt e => Exp e -> e+--       test e = indexArray (run (unit e)) Z+-- :}   infixl 7 !*! -- | Matrix product. This can compute any combination of sparse and dense multiplication. ----- >>> lift (V2 (V3 1 2 3) (V3 4 5 6) :: M23 Int) !*! lift (V3 (V2 1 2) (V2 3 4) (V2 4 5) :: M32 Int)--- ((19,25),(43,58))+-- >>> test $ lift (V2 (V3 1 2 3) (V3 4 5 6) :: M23 Int) !*! lift (V3 (V2 1 2) (V2 3 4) (V2 4 5) :: M32 Int)+-- V2 (V2 19 25) (V2 43 58) -- (!*!) :: (Functor m, Foldable t, Additive t, Additive n, A.Num a, Box2 m t a, Box2 t n a, Box2 m n a)       => Exp (m (t a))@@ -67,8 +73,8 @@ infixl 6 !+! -- | Entry-wise matrix addition. ----- >>> lift (V2 (V3 1 2 3) (V3 4 5 6) :: M23 Int) !+! lift (V2 (V3 7 8 9) (V3 1 2 3) :: M23 Int)--- ((8,10,12),(5,7,9))+-- >>> test $ lift (V2 (V3 1 2 3) (V3 4 5 6) :: M23 Int) !+! lift (V2 (V3 7 8 9) (V3 1 2 3) :: M23 Int)+-- V2 (V3 8 10 12) (V3 5 7 9) -- (!+!) :: (Additive m, Additive n, A.Num a, Box2 m n a)       => Exp (m (n a))@@ -80,8 +86,8 @@ infixl 6 !-! -- | Entry-wise matrix subtraction. ----- >>> lift (V2 (V3 1 2 3) (V3 4 5 6) :: M23 Int) !-! lift (V2 (V3 7 8 9) (V3 1 2 3) :: M23 Int)--- ((-6,-6,-6),(3,3,3))+-- >>> test $ lift (V2 (V3 1 2 3) (V3 4 5 6) :: M23 Int) !-! lift (V2 (V3 7 8 9) (V3 1 2 3) :: M23 Int)+-- V2 (V3 (-6) (-6) (-6)) (V3 3 3 3) -- (!-!) :: (Additive m, Additive n, A.Num a, Box2 m n a)       => Exp (m (n a))@@ -93,8 +99,8 @@ infixl 7 !* -- | Matrix * column vector ----- >>> lift (V2 (V3 1 2 3) (V3 4 5 6) :: M23 Int) !* lift (V3 7 8 9 :: V3 Int)--- (50,122)+-- >>> test $ lift (V2 (V3 1 2 3) (V3 4 5 6) :: M23 Int) !* lift (V3 7 8 9 :: V3 Int)+-- V2 50 122 -- (!*) :: (Functor m, Foldable r, Additive r, A.Num a, Box2 m r a, Box m a)      => Exp (m (r a))@@ -106,8 +112,8 @@ infixl 7 *! -- | Row vector * matrix ----- >>> lift (V2 1 2 :: V2 Int) *! lift (V2 (V3 3 4 5) (V3 6 7 8) :: M23 Int)--- (15,18,21)+-- >>> test $ lift (V2 1 2 :: V2 Int) *! lift (V2 (V3 3 4 5) (V3 6 7 8) :: M23 Int)+-- V3 15 18 21  -- (*!) :: (Metric r, Additive n, Num a) => r a -> r (n a) -> n a -- f *! g = dot f <$> distribute g@@ -122,8 +128,8 @@ infixl 7 *!! -- | Scalar-matrix product ----- >>> 5 *!! lift (V2 (V2 1 2) (V2 3 4) :: M22 Int)--- ((5,10),(15,20))+-- >>> test $ 5 *!! lift (V2 (V2 1 2) (V2 3 4) :: M22 Int)+-- V2 (V2 5 10) (V2 15 20) -- (*!!) :: (Functor m, Functor r, A.Num a, Box2 m r a)       => Exp a@@ -135,8 +141,8 @@ infixl 7 !!* -- | Matrix-scalar product ----- >>> lift (V2 (V2 1 2) (V2 3 4) :: M22 Int) !!* 5--- ((5,10),(15,20))+-- >>> test $ lift (V2 (V2 1 2) (V2 3 4) :: M22 Int) !!* 5+-- V2 (V2 5 10) (V2 15 20) -- (!!*) :: (Functor m, Functor r, A.Num a, Box2 m r a)       => Exp (m (r a))@@ -157,15 +163,11 @@  -- |The identity matrix for any dimension vector. ----- >>> identity :: Exp (M44 Int)--- let x0 = 1 in--- let x1 = 0--- in ((x0,x1,x1,x1),(x1,x0,x1,x1),(x1,x1,x0,x1),(x1,x1,x1,x0))+-- >>> test $ (identity :: Exp (M44 Int))+-- V4 (V4 1 0 0 0) (V4 0 1 0 0) (V4 0 0 1 0) (V4 0 0 0 1) ----- >>> identity :: Exp (V3 (V3 Int))--- let x0 = 1 in--- let x1 = 0--- in ((x0,x1,x1),(x1,x0,x1),(x1,x1,x0))+-- >>> test $ (identity :: Exp (V3 (V3 Int)))+-- V3 (V3 1 0 0) (V3 0 1 0) (V3 0 0 1) -- identity :: forall t a. (Traversable t, Applicative t, A.Num a, Box2 t t a) => Exp (t (t a)) identity = lift (L.identity :: t (t (Exp a)))@@ -173,7 +175,7 @@  -- | 'transpose' is just an alias for 'distribute' ----- > transpose (V3 (V2 1 2) (V2 3 4) (V2 5 6))+-- >>> test $ transpose $ lift (V3 (V2 1 2) (V2 3 4) (V2 5 6) :: M32 Int) -- V2 (V3 1 3 5) (V3 2 4 6) -- transpose
src/Data/Array/Accelerate/Linear/V1.hs view
@@ -44,16 +44,23 @@ import qualified Linear.V1                      as L import Prelude                                  as P +-- $setup+-- >>> import Data.Array.Accelerate.Interpreter+-- >>> :{+--   let test :: Elt e => Exp e -> e+--       test e = indexArray (run (unit e)) Z+-- :} + -- | A space that has at least 1 basis vector '_x'. -- class L.R1 t => R1 t where   -- |-  -- >>> lift (V1 2 :: V1 Int) ^._x+  -- >>> test $ lift (V1 2 :: V1 Int) ^._x   -- 2   ---  -- >>> lift (V1 2 :: V1 Int) & _x .~ 3-  -- (3)+  -- >>> test $ lift (V1 2 :: V1 Int) & _x .~ 3+  -- V1 3   --   _x :: (Elt a, Box t a) => Lens' (Exp (t a)) (Exp a)   _x = liftLens (L._x :: Lens' (t (Exp a)) (Exp a))
src/Data/Array/Accelerate/Linear/V2.hs view
@@ -47,11 +47,18 @@ import qualified Linear.V2                      as L import Prelude                                  as P +-- $setup+-- >>> import Data.Array.Accelerate.Interpreter+-- >>> :{+--   let test :: Elt e => Exp e -> e+--       test e = indexArray (run (unit e)) Z+-- :} + -- | the counter-clockwise perpendicular vector ----- >>> perp $ lift (V2 10 20 :: V2 Int)--- (-20,10)+-- >>> test $ perp $ lift (V2 10 20 :: V2 Int)+-- V2 (-20) 10 -- perp :: forall a. A.Num a => Exp (V2 a) -> Exp (V2 a) perp = lift1 (L.perp :: V2 (Exp a) -> V2 (Exp a))@@ -68,11 +75,11 @@ -- class (L.R2 t, R1 t) => R2 t where   -- |-  -- >>> lift (V2 1 2 :: V2 Int) ^._y+  -- >>> test $ lift (V2 1 2 :: V2 Int) ^._y   -- 2   ---  -- >>> lift (V2 1 2 :: V2 Int) & _y .~ 3-  -- (1,3)+  -- >>> test $ lift (V2 1 2 :: V2 Int) & _y .~ 3+  -- V2 1 3   --   _y :: (Elt a, Box t a) => Lens' (Exp (t a)) (Exp a)   _y = liftLens (L._y :: Lens' (t (Exp a)) (Exp a))@@ -82,8 +89,8 @@   -- |--- >>> lift (V2 1 2 :: V2 Int) ^. _yx--- (2,1)+-- >>> test $ lift (V2 1 2 :: V2 Int) ^. _yx+-- V2 2 1 -- _yx :: forall t a. (R2 t, Elt a, Box t a) => Lens' (Exp (t a)) (Exp (V2 a)) _yx = liftLens (L._yx :: Lens' (t (Exp a)) (V2 (Exp a)))
src/Data/Array/Accelerate/Linear/V3.hs view
@@ -52,7 +52,14 @@ import qualified Linear.V3                      as L import Prelude                                  as P +-- $setup+-- >>> import Data.Array.Accelerate.Interpreter+-- >>> :{+--   let test :: Elt e => Exp e -> e+--       test e = indexArray (run (unit e)) Z+-- :} + -- | cross product -- cross :: forall a. A.Num a => Exp (V3 a) -> Exp (V3 a) -> Exp (V3 a)@@ -69,8 +76,11 @@ -- class (L.R3 t, R2 t) => R3 t where   -- |-  -- >>> lift (V3 1 2 3 :: V3 Int) ^. _z+  -- >>> test $ lift (V3 1 2 3 :: V3 Int) ^. _z   -- 3+  --+  -- >>> test $ lift (V3 1 2 3 :: V3 Int) & _z .~ 42+  -- V3 1 2 42   --   _z :: forall a. (Elt a, Box t a) => Lens' (Exp (t a)) (Exp a)   _z = liftLens (L._z :: Lens' (t (Exp a)) (Exp a))
src/Data/Array/Accelerate/Linear/V4.hs view
@@ -60,7 +60,14 @@ import qualified Linear.V4                      as L import Prelude                                  as P +-- $setup+-- >>> import Data.Array.Accelerate.Interpreter+-- >>> :{+--   let test :: Elt e => Exp e -> e+--       test e = indexArray (run (unit e)) Z+-- :} + -- | Convert a 3-dimensional affine vector into a 4-dimensional homogeneous -- vector. --@@ -86,8 +93,11 @@ -- class (L.R4 t, R3 t) => R4 t where   -- |-  -- >>> lift (V4 1 2 3 4 :: V4 Int) ^._w+  -- >>> test $ lift (V4 1 2 3 4 :: V4 Int) ^._w   -- 4+  --+  -- >>> test $ lift (V4 1 2 3 4 :: V4 Int) & _w .~ 42+  -- V4 1 2 3 42   --   _w :: forall a. (Elt a, Box t a) => Lens' (Exp (t a)) (Exp a)   _w = liftLens (L._w :: Lens' (t (Exp a)) (Exp a))
src/Data/Array/Accelerate/Linear/Vector.hs view
@@ -32,8 +32,13 @@ infixl 7 ^*, *^, ^/, /^  -- $setup--- >>> import Data.Array.Accelerate.Linear.V2 () -- >>> import Linear.V2+-- >>> import Data.Array.Accelerate.Linear.V2 ()+-- >>> import Data.Array.Accelerate.Interpreter+-- >>> :{+--   let test :: Elt e => Exp e -> e+--       test e = indexArray (run (unit e)) Z+-- :}  -- | A vector is an additive group with additional structure. --@@ -48,8 +53,8 @@    -- | Compute the sum of two vectors   ---  -- >>> lift (V2 1 2 :: V2 Int) ^+^ lift (V2 3 4 :: V2 Int)-  -- (4,6)+  -- >>> test $ lift (V2 1 2 :: V2 Int) ^+^ lift (V2 3 4 :: V2 Int)+  -- V2 4 6   --   (^+^) :: forall a. (A.Num a, Box f a)         => Exp (f a)@@ -59,8 +64,8 @@    -- | Compute the difference between two vectors   ---  -- >>> lift (V2 4 5 :: V2 Int) ^-^ lift (V2 3 1 :: V2 Int)-  -- (1,4)+  -- >>> test $ lift (V2 4 5 :: V2 Int) ^-^ lift (V2 3 1 :: V2 Int)+  -- V2 1 4   --   (^-^) :: forall a. (A.Num a, Box f a)         => Exp (f a)@@ -90,8 +95,8 @@  -- | Compute the negation of a vector ----- >>> negated (lift (V2 2 4 :: V2 Int))--- (-2,-4)+-- >>> test $ negated (lift (V2 2 4 :: V2 Int))+-- V2 (-2) (-4) -- negated     :: forall f a. (Functor f, A.Num a, Box f a)@@ -101,8 +106,8 @@  -- | Compute the left scalar product ----- >>> 2 *^ lift (V2 3 4 :: V2 Int)--- (6,8)+-- >>> test $ 2 *^ lift (V2 3 4 :: V2 Int)+-- V2 6 8 -- (*^) :: forall f a. (Functor f, A.Num a, Box f a)      => Exp a@@ -112,8 +117,8 @@  -- | Compute the right scalar product ----- >>> lift (V2 3 4 :: V2 Int) ^* 2--- (6,8)+-- >>> test $ lift (V2 3 4 :: V2 Int) ^* 2+-- V2 6 8 -- (^*) :: forall f a. (Functor f, A.Num a, Box f a)      => Exp (f a)@@ -123,8 +128,8 @@  -- | Compute division by a scalar on the right ----- lift (V2 4 6 :: V2 Double) ^/ 2--- V2 2 3+-- >>> test $ lift (V2 4 6 :: V2 Double) ^/ 2+-- V2 2.0 3.0 -- (^/) :: forall f a. (Functor f, A.Fractional a, Box f a)      => Exp (f a)@@ -134,8 +139,8 @@  -- | Compute division of a scalar on the left ----- >>> 4 /^ lift (V2 2 4 :: V2 Double)--- (2.0,1.0)+-- >>> test $ 4 /^ lift (V2 2 4 :: V2 Double)+-- V2 2.0 1.0 -- (/^) :: forall f a. (Functor f, A.Fractional a, Box f a)      => Exp a@@ -145,8 +150,8 @@  -- | Addition with a scalar on the left ----- >>> 2 +^ lift (V2 3 4 :: V2 Int)--- (5,6)+-- >>> test $ 2 +^ lift (V2 3 4 :: V2 Int)+-- V2 5 6 -- (+^) :: forall f a. (Functor f, A.Num a, Box f a)      => Exp a@@ -156,8 +161,8 @@  -- | Addition with a scalar on the right ----- >>> lift (V2 1 2 :: V2 Int) ^+ 3--- (4,5)+-- >>> test $ lift (V2 1 2 :: V2 Int) ^+ 3+-- V2 4 5 -- (^+) :: forall f a. (Functor f, A.Num a, Box f a)      => Exp (f a)@@ -167,8 +172,8 @@  -- | Subtraction with a scalar on the left ----- >>> 2 -^ lift (V2 3 4 :: V2 Int)--- (-1,-2)+-- >>> test $ 2 -^ lift (V2 3 4 :: V2 Int)+-- V2 (-1) (-2) -- (-^) :: forall f a. (Functor f, A.Num a, Box f a)      => Exp a@@ -178,8 +183,8 @@  -- | Subtraction with a scalar on the right ----- >>> lift (V2 1 2 :: V2 Int) ^- 3--- (-2,-1)+-- >>> test $ lift (V2 1 2 :: V2 Int) ^- 3+-- V2 (-2) (-1) -- (^-) :: forall f a. (Functor f, A.Num a, Box f a)      => Exp (f a)