packages feed

accelerate-io 1.0.0.0 → 1.0.0.1

raw patch · 4 files changed

+57/−8 lines, 4 files

Files

+ CHANGELOG.md view
@@ -0,0 +1,20 @@+# Change Log++Notable changes to the project will be documented in this file.++The format is based on [Keep a Changelog](http://keepachangelog.com/) and the+project adheres to the [Haskell Package Versioning+Policy (PVP)](https://pvp.haskell.org)++## [1.0.0.1] - 2017-10-14+### Fixed+ * `fromIArray` would fail with exception "Error in array index" when the IArray+   indices were not zero-based. This has been fixed.++## [1.0.0.0] - 2017-03-31+  * stable release+++[1.1.0.0]:    https://github.com/AccelerateHS/accelerate-llvm/compare/1.0.0.0...1.0.0.1+[1.0.0.0]:    https://github.com/AccelerateHS/accelerate-llvm/compare/0.15.1.0...1.0.0.0+
Data/Array/Accelerate/IO/IArray.hs view
@@ -39,11 +39,27 @@     :: (IxShapeRepr (EltRepr ix) ~ EltRepr sh, IArray a e, IArray.Ix ix, Shape sh, Elt ix, Elt e)     => a ix e     -> Array sh e-fromIArray iarr = fromFunction sh (\ix -> iarr IArray.! fromIxShapeRepr ix)+fromIArray iarr = fromFunction sh (\ix -> iarr IArray.! fromIxShapeRepr (offset lo' ix))   where     (lo,hi) = IArray.bounds iarr-    sh      = rangeToShape (toIxShapeRepr lo, toIxShapeRepr hi)+    lo'     = toIxShapeRepr lo+    hi'     = toIxShapeRepr hi+    sh      = rangeToShape (lo', hi') +    -- IArray does not necessarily start indexing from zero. Thus, we need to+    -- add some offset to the Accelerate indices to map them onto the valid+    -- index range of the IArray+    --+    offset :: forall sh. Shape sh => sh -> sh -> sh+    offset ix0 ix = toElt $ go (eltType (undefined::sh)) (fromElt ix0) (fromElt ix)+      where+        go :: TupleType ix -> ix -> ix -> ix+        go UnitTuple                                                 ()       ()    = ()+        go (PairTuple tl tr)                                         (l0, r0) (l,r) = (go tl l0 l, go tr r0 r)+        go (SingleTuple (NumScalarType (IntegralNumType TypeInt{}))) i0       i     = i0+i+        go _ _ _+          = error "Data.Array.Accelerate.IO.IArray: error in index offset"+ -- | Convert an accelerated array to an 'IArray'. -- toIArray@@ -68,7 +84,7 @@     go UnitTuple ()                                                         = ()     go (SingleTuple     (NumScalarType (IntegralNumType TypeInt{}))) ((),h) = h     go (PairTuple tt _) (t, h)                                              = (go tt t, h)-    go _ _ = error "Not a valid IArray.Ix"+    go _ _ = error "Data.Array.Accelerate.IO.IArray: not a valid IArray.Ix"  toIxShapeRepr :: forall ix sh. (IxShapeRepr (EltRepr ix) ~ EltRepr sh, Shape sh, Elt ix) => ix -> sh toIxShapeRepr ix = toElt (go (eltType (undefined::ix)) (fromElt ix))@@ -77,5 +93,5 @@     go UnitTuple        ()                                             = ()     go (SingleTuple     (NumScalarType (IntegralNumType TypeInt{}))) h = ((), h)     go (PairTuple tt _) (t, h)                                         = (go tt t, h)-    go _ _ = error "Not a valid IArray.Ix"+    go _ _ = error "Data.Array.Accelerate.IO.IArray: not a valid IArray.Ix" 
+ README.md view
@@ -0,0 +1,10 @@+Array Conversion Component for the Accelerate Array Language+============================================================++[![Build Status](https://travis-ci.org/AccelerateHS/accelerate-io.svg?branch=master)](https://travis-ci.org/AccelerateHS/accelerate-io)+[![Hackage](https://img.shields.io/hackage/v/accelerate-io.svg)](https://hackage.haskell.org/package/accelerate-io)++This package provides efficient conversion routines between a range of array types and Accelerate arrays. For details on Accelerate, refer to the [main repository][GitHub].++  [GitHub]: https://github.com/AccelerateHS/accelerate+
accelerate-io.cabal view
@@ -1,5 +1,5 @@ Name:                   accelerate-io-Version:                1.0.0.0+Version:                1.0.0.1 Cabal-version:          >= 1.6 Tested-with:            GHC >= 7.8 Build-type:             Simple@@ -25,6 +25,9 @@ Category:               Compilers/Interpreters, Concurrency, Data, Parallelism Stability:              Experimental +Extra-source-files:+    README.md+    CHANGELOG.md  Flag bounds-checks   Description:          Enable bounds checking@@ -40,8 +43,8 @@  Library   Build-depends:-          base            >= 4.7 && < 4.10-        , accelerate      == 1.0.*+          base            >= 4.7 && < 4.11+        , accelerate      >= 1.0         , array           >= 0.3         , bmp             >= 1.2         , bytestring      >= 0.9@@ -86,7 +89,7 @@  Source-repository this   Type:                 git-  Tag:                  1.0.0.0+  Tag:                  1.0.0.1   Location:             git://github.com/AccelerateHS/accelerate-io.git  -- vim: nospell