packages feed

repa 1.0.0.0 → 1.1.0.0

raw patch · 3 files changed

+201/−32 lines, 3 filesdep ~QuickCheckdep ~dph-prim-pardep ~dph-prim-seqPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: QuickCheck, dph-prim-par, dph-prim-seq

API changes (from Hackage documentation)

- Data.Array.Repa: isManifest :: Array sh a -> Array sh a
+ Data.Array.Repa: foldAll :: (Shape sh, Elt a) => (a -> a -> a) -> a -> Array sh a -> a
+ Data.Array.Repa: interleave2 :: (Shape sh, Elt a) => Array (sh :. Int) a -> Array (sh :. Int) a -> Array (sh :. Int) a
+ Data.Array.Repa: interleave3 :: (Shape sh, Elt a) => Array (sh :. Int) a -> Array (sh :. Int) a -> Array (sh :. Int) a -> Array (sh :. Int) a
+ Data.Array.Repa: interleave4 :: (Shape sh, Elt a) => Array (sh :. Int) a -> Array (sh :. Int) a -> Array (sh :. Int) a -> Array (sh :. Int) a -> Array (sh :. Int) a
+ Data.Array.Repa: traverse3 :: (Shape sh1, Shape sh2, Shape sh3, Shape sh4, Elt a, Elt b, Elt c, Elt d) => Array sh1 a -> Array sh2 b -> Array sh3 c -> (sh1 -> sh2 -> sh3 -> sh4) -> ((sh1 -> a) -> (sh2 -> b) -> (sh3 -> c) -> sh4 -> d) -> Array sh4 d
+ Data.Array.Repa: traverse4 :: (Shape sh1, Shape sh2, Shape sh3, Shape sh4, Shape sh5, Elt a, Elt b, Elt c, Elt d, Elt e) => Array sh1 a -> Array sh2 b -> Array sh3 c -> Array sh4 d -> (sh1 -> sh2 -> sh3 -> sh4 -> sh5) -> ((sh1 -> a) -> (sh2 -> b) -> (sh3 -> c) -> (sh4 -> d) -> sh5 -> e) -> Array sh5 e

Files

Data/Array/Repa.hs view
@@ -4,7 +4,7 @@  -- | See the repa-examples package for examples. --   ---   More information is also at http://code.haskell.org/trac/repa  +--   More information is also at <http://trac.haskell.org/repa> --  --   NOTE: 	To get decent performance you must use GHC head branch > 6.13.20100309. --@@ -35,7 +35,6 @@  	 -- * Basic Operations 	, force-	, isManifest 	, deepSeqArray 	 	 -- * Conversion@@ -56,14 +55,20 @@ 	, zipWith  	 -- * Reductions-	, fold-	, sum-	, sumAll+	, fold,	foldAll+	, sum,	sumAll 	 	 -- * Generic traversal 	, traverse 	, traverse2+	, traverse3+	, traverse4 		+	 -- * Interleaving+	, interleave2+	, interleave3+	, interleave4+		 	 -- * Testing 	, arbitrarySmallArray 	, props_DataArrayRepa)@@ -212,15 +217,7 @@ 			$! U.enumFromTo (0 :: Int) (S.size sh - 1) 	    in	sh `S.deepSeq` uarr `seq` 		Manifest sh uarr-		--isManifest :: Array sh a -> Array sh a-{-# INLINE isManifest #-}-isManifest arr- = case arr of-	Manifest{}	-> arr-	_		-> error "not manifest"-	+			 	 -- | Ensure an array's structure is fully evaluated. --	This evaluates the extent and outer constructor, but does not `force` the elements.@@ -274,7 +271,6 @@   -- Instances --------------------------------------------------------------------------------------- -- Show instance (Shape sh, Elt a, Show a) => Show (Array sh a) where  	show arr = show $ toList arr@@ -496,6 +492,23 @@    in	Delayed sh' elemFn  +-- | Fold all the elements of an array.+foldAll :: (Shape sh, Elt a)+	=> (a -> a -> a)+	-> a+	-> Array sh a+	-> a+	+{-# INLINE foldAll #-}+foldAll f x arr+	= USeq.foldU f x+	$ USeq.mapU ((arr !:) . (S.fromIndex (extent arr)))+	$ USeq.enumFromToU+		0+		((S.size $ extent arr) - 1)+++ -- | Sum the innermost dimension of an array. sum	:: (Shape sh, Elt a, Num a) 	=> Array (sh :. Int) a@@ -559,6 +572,151 @@ 		(transExtent (extent arrA) (extent arrB))  		(newElem     ((!:) arrA) ((!:) arrB)) ++-- | Unstructured traversal over three arrays at once.+traverse3+	:: forall sh1 sh2 sh3 sh4+	          a   b   c   d +	.  ( Shape sh1, Shape sh2, Shape sh3, Shape sh4+	   , Elt a,     Elt b,     Elt c,     Elt d)+        => Array sh1 a 		+	-> Array sh2 b			+	-> Array sh3 c			+        -> (sh1 -> sh2 -> sh3 -> sh4)	+        -> (  (sh1 -> a) -> (sh2 -> b) +           -> (sh3 -> c)+           ->  sh4 -> d )		+        -> Array sh4 d++{-# INLINE traverse3 #-}+traverse3 arrA arrB arrC transExtent newElem+	= arrA `deepSeqArray` arrB `deepSeqArray` arrC `deepSeqArray`+   	  Delayed +		(transExtent (extent arrA) (extent arrB) (extent arrC)) +		(newElem     (arrA !:) (arrB !:) (arrC !:))+++-- | Unstructured traversal over four arrays at once.+traverse4+	:: forall sh1 sh2 sh3 sh4 sh5 +	          a   b   c   d   e+	.  ( Shape sh1, Shape sh2, Shape sh3, Shape sh4, Shape sh5+	   , Elt a,     Elt b,     Elt c,     Elt d,     Elt e)+        => Array sh1 a 			+	-> Array sh2 b			+	-> Array sh3 c			+	-> Array sh4 d				+        -> (sh1 -> sh2 -> sh3 -> sh4 -> sh5 )	+        -> (  (sh1 -> a) -> (sh2 -> b) +           -> (sh3 -> c) -> (sh4 -> d)+           ->  sh5 -> e )		+        -> Array sh5 e ++{-# INLINE traverse4 #-}+traverse4 arrA arrB arrC arrD transExtent newElem+	= arrA `deepSeqArray` arrB `deepSeqArray` arrC `deepSeqArray` arrD `deepSeqArray` +   	  Delayed +		(transExtent (extent arrA) (extent arrB) (extent arrC) (extent arrD)) +		(newElem     (arrA !:) (arrB !:) (arrC !:) (arrD !:))+++-- Interleaving -----------------------------------------------------------------------------------+-- | Interleave the elments of two arrays. +--   All the input arrays must have the same extent, else `error`.+--   The lowest dimenion of the result array is twice the size of the inputs.+--+-- @+--  interleave2 a1 a2   b1 b2  =>  a1 b1 a2 b2+--              a3 a4   b3 b4      a3 b3 a4 b4+-- @+--+interleave2+	:: (Shape sh, Elt a)+	=> Array (sh :. Int) a+	-> Array (sh :. Int) a+	-> Array (sh :. Int) a+	+{-# INLINE interleave2 #-}+interleave2 arr1 arr2+ = arr1 `deepSeqArray` arr2 `deepSeqArray`+   traverse2 arr1 arr2 shapeFn elemFn+ where+	shapeFn dim1 dim2+	 | dim1 == dim2+	 , sh :. len	<- dim1+	 = sh :. (len * 2)+	+	 | otherwise+	 = error "Data.Array.Repa.interleave2: arrays must have same extent"+		+	elemFn get1 get2 (sh :. ix)+	 = case ix `mod` 3 of+		0	-> get1 (sh :. ix `div` 2)+		1	-> get2 (sh :. ix `div` 2)+		_	-> error "Data.Array.Repa.interleave2: this never happens :-P"+++-- | Interleave the elments of three arrays. +interleave3+	:: (Shape sh, Elt a)+	=> Array (sh :. Int) a+	-> Array (sh :. Int) a+	-> Array (sh :. Int) a+	-> Array (sh :. Int) a+	+{-# INLINE interleave3 #-}+interleave3 arr1 arr2 arr3+ = arr1 `deepSeqArray` arr2 `deepSeqArray` arr3 `deepSeqArray`+   traverse3 arr1 arr2 arr3 shapeFn elemFn+ where+	shapeFn dim1 dim2 dim3+	 | dim1 == dim2+	 , dim1 == dim3+	 , sh :. len	<- dim1+	 = sh :. (len * 3)+	+	 | otherwise+	 = error "Data.Array.Repa.interleave3: arrays must have same extent"+		+	elemFn get1 get2 get3 (sh :. ix)+	 = case ix `mod` 3 of+		0	-> get1 (sh :. ix `div` 3)+		1	-> get2 (sh :. ix `div` 3)+		2	-> get3 (sh :. ix `div` 3)+		_	-> error "Data.Array.Repa.interleave3: this never happens :-P"+++-- | Interleave the elments of four arrays. +interleave4+	:: (Shape sh, Elt a)+	=> Array (sh :. Int) a+	-> Array (sh :. Int) a+	-> Array (sh :. Int) a+	-> Array (sh :. Int) a+	-> Array (sh :. Int) a+	+{-# INLINE interleave4 #-}+interleave4 arr1 arr2 arr3 arr4+ = arr1 `deepSeqArray` arr2 `deepSeqArray` arr3 `deepSeqArray` arr4 `deepSeqArray`+   traverse4 arr1 arr2 arr3 arr4 shapeFn elemFn+ where+	shapeFn dim1 dim2 dim3 dim4+	 | dim1 == dim2+	 , dim1 == dim3+	 , dim1 == dim4+	 , sh :. len	<- dim1+	 = sh :. (len * 4)+	+	 | otherwise+	 = error "Data.Array.Repa.interleave4: arrays must have same extent"+		+	elemFn get1 get2 get3 get4 (sh :. ix)+	 = case ix `mod` 4 of+		0	-> get1 (sh :. ix `div` 4)+		1	-> get2 (sh :. ix `div` 4)+		2	-> get3 (sh :. ix `div` 4)+		3	-> get4 (sh :. ix `div` 4)+		_	-> error "Data.Array.Repa.interleave4: this never happens :-P"   -- Arbitrary --------------------------------------------------------------------------------------
LICENSE view
@@ -1,13 +1,24 @@-Copyright (c) 2010 The DPH Team+Copyright (c) 2010, University of New South Wales.+All rights reserved. - Permission is hereby granted, free of charge, to any person- obtaining a copy of this software and associated documentation- files (the "Software"), to deal in the Software without- restriction, including without limitation the rights to use,- copy, modify, merge, publish, distribute, sublicense, and/or sell- copies of the Software, and to permit persons to whom the- Software is furnished to do so, subject to the following- condition:+Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:+    * Redistributions of source code must retain the above copyright+      notice, this list of conditions and the following disclaimer.+    * Redistributions in binary form must reproduce the above copyright+      notice, this list of conditions and the following disclaimer in the+      documentation and/or other materials provided with the distribution.+    * Neither the name of the University of New South Wales nor the+      names of its contributors may be used to endorse or promote products+      derived from this software without specific prior written permission. - The above copyright notice and this permission notice shall be- included in all copies or substantial portions of the Software.+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE+DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS BE LIABLE FOR ANY+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
repa.cabal view
@@ -1,6 +1,6 @@ Name:                repa-Version:             1.0.0.0-License:             MIT+Version:             1.1.0.0+License:             BSD3 License-file:        LICENSE Author:              The DPH Team Maintainer:          Ben Lippmeier <benl@ouroborus.net>@@ -24,10 +24,10 @@  Library   Build-Depends: -        base                 >= 4       && < 5,-        dph-prim-par         >= 0.4.0   && < 0.5.0,-        dph-prim-seq         >= 0.4.0   && < 0.5.0,-        QuickCheck           >= 2.1.0.3 && < 2.2.0.0+        base                 == 4.*,+        dph-prim-par         == 0.4.*,+        dph-prim-seq         == 0.4.*,+        QuickCheck           == 2.1.*    ghc-options:         -Odph -Wall -fno-warn-missing-signatures