netlib-comfort-array (empty) → 0.0
raw patch · 4 files changed
+171/−0 lines, 4 filesdep +basedep +comfort-arraydep +netlib-ffisetup-changed
Dependencies added: base, comfort-array, netlib-ffi, transformers
Files
- LICENSE +27/−0
- Setup.lhs +3/−0
- netlib-comfort-array.cabal +42/−0
- src/Numeric/Netlib/ComfortArray/Utility.hs +99/−0
+ LICENSE view
@@ -0,0 +1,27 @@+Copyright (c) Henning Thielemann 2019++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
+ netlib-comfort-array.cabal view
@@ -0,0 +1,42 @@+Name: netlib-comfort-array+Version: 0.0+License: BSD3+License-File: LICENSE+Author: Henning Thielemann <haskell@henning-thielemann.de>+Maintainer: Henning Thielemann <haskell@henning-thielemann.de>+Homepage: http://hub.darcs.net/thielema/netlib-comfort-array/+Category: Math+Synopsis: Helper modules for comfort-array wrappers to BLAS and LAPACK+Description:+ Netlib is a collection of packages for efficient numeric linear algebra.+ Most prominent parts of Netlib are BLAS and LAPACK.+ These packages contain functions for matrix computations,+ solution of simultaneous linear equations and eigenvalue problems.+ .+ This package provides definitions shared by+ the packages @blas-comfort-array@ and @lapack-comfort-array@.+Tested-With: GHC==7.4.2, GHC==7.8.4+Cabal-Version: 1.14+Build-Type: Simple++Source-Repository this+ Tag: 0.0+ Type: darcs+ Location: http://hub.darcs.net/thielema/netlib-comfort-array/++Source-Repository head+ Type: darcs+ Location: http://hub.darcs.net/thielema/netlib-comfort-array/++Library+ Build-Depends:+ netlib-ffi >=0.0.1 && <0.2,+ comfort-array >=0.3 && <0.4,+ transformers >=0.4 && <0.6,+ base >=4.5 && <5++ GHC-Options: -Wall -fwarn-missing-import-lists+ Hs-Source-Dirs: src+ Default-Language: Haskell98+ Exposed-Modules:+ Numeric.Netlib.ComfortArray.Utility
+ src/Numeric/Netlib/ComfortArray/Utility.hs view
@@ -0,0 +1,99 @@+module Numeric.Netlib.ComfortArray.Utility (+ FortranIO,+ Util.run,+ Util.runChecked,+ Util.check,+ Util.assert,+ Util.ignore,+ Util.cint,+ Util.alloca,+ Util.allocaArray,+ Util.bool,+ Util.char,+ Util.string,+ Util.float,+ Util.double,+ Util.complexFloat,+ Util.complexDouble,+ Util.real,+ Util.complex,+ Util.number,++ ZeroInt,+ newArray,+ newArray1,+ newArray2,+ newArray3,+ freezeArray,+ sizes1,+ sizes2,+ sizes3,++ shapeSize,+ array,+ ioarray,+ (^!),+ ) where++import qualified Numeric.Netlib.Utility as Util+import Numeric.Netlib.Utility (FortranIO)++import qualified Data.Array.Comfort.Storable.Mutable.Unchecked as MutArray+import qualified Data.Array.Comfort.Storable.Unchecked as Array+import qualified Data.Array.Comfort.Shape as Shape+import Data.Array.Comfort.Storable.Mutable (IOArray)+import Data.Array.Comfort.Storable (Array)++import qualified Foreign.C.Types as C+import Foreign.Storable (Storable)+import Foreign.ForeignPtr (withForeignPtr)+import Foreign.Ptr (Ptr)++import Control.Monad.Trans.Cont (ContT(ContT))++++type ZeroInt = Shape.ZeroBased Int++newArray :: (Shape.C sh, Storable e) => sh -> IO (IOArray sh e)+newArray sh = MutArray.unsafeCreate sh (\_ -> return ())++newArray1 :: (Storable e) => Int -> IO (IOArray ZeroInt e)+newArray1 m = newArray (Shape.ZeroBased m)++newArray2 :: (Storable e) => Int -> Int -> IO (IOArray (ZeroInt,ZeroInt) e)+newArray2 m n = newArray (Shape.ZeroBased m, Shape.ZeroBased n)++newArray3 ::+ (Storable e) => Int -> Int -> Int -> IO (IOArray (ZeroInt,ZeroInt,ZeroInt) e)+newArray3 m n k =+ newArray (Shape.ZeroBased m, Shape.ZeroBased n, Shape.ZeroBased k)+++freezeArray :: (Shape.C sh, Storable e) => IOArray sh e -> IO (Array sh e)+freezeArray = MutArray.unsafeFreeze+++sizes1 :: (Shape.C sh0) => sh0 -> Int+sizes1 = Shape.size++sizes2 :: (Shape.C sh0, Shape.C sh1) => (sh0,sh1) -> (Int,Int)+sizes2 (sh0,sh1) = (Shape.size sh0, Shape.size sh1)++sizes3 ::+ (Shape.C sh0, Shape.C sh1, Shape.C sh2) => (sh0,sh1,sh2) -> (Int,Int,Int)+sizes3 (sh0,sh1,sh2) = (Shape.size sh0, Shape.size sh1, Shape.size sh2)+++shapeSize :: (Shape.C sh) => sh -> FortranIO r (Ptr C.CInt)+shapeSize = Util.cint . Shape.size++array :: (Storable a) => Array i a -> FortranIO r (Ptr a)+array (Array.Array _sh fptr) = ContT $ withForeignPtr fptr++ioarray :: (Storable a) => IOArray i a -> FortranIO r (Ptr a)+ioarray = ContT . MutArray.withPtr+++(^!) :: (Num a) => a -> Int -> a+x^!n = x^n