storablevector-carray (empty) → 0.0
raw patch · 4 files changed
+105/−0 lines, 4 filesdep +basedep +carraydep +storablevectorsetup-changed
Dependencies added: base, carray, storablevector, utility-ht
Files
- LICENSE +27/−0
- Setup.lhs +3/−0
- src/Data/StorableVector/CArray.hs +36/−0
- storablevector-carray.cabal +39/−0
+ LICENSE view
@@ -0,0 +1,27 @@+Copyright (c) Henning Thielemann 2012++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions+are met:+1. Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.+2. 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.+3. Neither the name of the author nor the names of his contributors+ may be used to endorse or promote products derived from this software+ without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 THE AUTHORS OR CONTRIBUTORS 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.
+ Setup.lhs view
@@ -0,0 +1,3 @@+#!/usr/bin/env runhaskell+> import Distribution.Simple+> main = defaultMain
+ src/Data/StorableVector/CArray.hs view
@@ -0,0 +1,36 @@+{-# LANGUAGE Trustworthy #-}+module Data.StorableVector.CArray where++import qualified Data.StorableVector.Base as SV+import qualified Data.StorableVector as V++import qualified Data.Array.CArray.Base as CArray++import Foreign.Storable (Storable, )++import Data.Tuple.HT (swap, snd3, )++++to :: (Storable e) =>+ SV.Vector e -> CArray.CArray Int e+to v =+ let checkZeroBase vf else_ =+ let vo = SV.toForeignPtr vf+ in if snd3 vo == 0+ then vo+ else else_+ (ptr, _s, l) =+ checkZeroBase v $+ checkZeroBase (V.copy v) $+ error "StorableVectorCArray.to: we expect that StorableVector.copy generates a 0-based vector"+ in CArray.CArray 0 (l-1) l ptr+{-+ CArray.unsafeForeignPtrToCArray+ (advancePtr s ptr) (0,l-1)+-}++from :: (Storable e) =>+ CArray.CArray Int e -> SV.Vector e+from =+ uncurry SV.fromForeignPtr . swap . CArray.toForeignPtr
+ storablevector-carray.cabal view
@@ -0,0 +1,39 @@+Name: storablevector-carray+Version: 0.0+Category: Data+Synopsis: Conversion between storablevector and carray+Description:+ Conversion from and to strict storable vectors and c-arrays.+ This allows you to apply Fast Fourier Transform from the @fft@ package+ to storablevectors.+License: BSD3+License-file: LICENSE+Author: Henning Thielemann <storablevector@henning-thielemann.de>+Maintainer: Henning Thielemann <storablevector@henning-thielemann.de>+Homepage: http://www.haskell.org/haskellwiki/Storable_Vector+Stability: Experimental+Build-Type: Simple+Tested-With: GHC==7.4.1+Cabal-Version: >=1.6++Source-Repository this+ Tag: 0.0+ Type: darcs+ Location: http://code.haskell.org/~thielema/storablevector-carray/++Source-Repository head+ Type: darcs+ Location: http://code.haskell.org/~thielema/storablevector-carray/++Library+ Build-Depends:+ storablevector >=0.2 && <0.3,+ carray >=0.1.5 && <0.2,+ utility-ht >=0.0.1 && <0.1,+ base >= 3 && <5++ GHC-Options: -Wall -funbox-strict-fields+ Hs-Source-Dirs: src++ Exposed-Modules:+ Data.StorableVector.CArray