From 98b21c5ddcbc9fbfddd5dbec646916f016b43e6d Mon Sep 17 00:00:00 2001 From: Alberto Ruiz Date: Thu, 21 Oct 2010 07:53:59 +0000 Subject: option -f-binary (for testing ghc7) --- lib/Data/Packed/Matrix.hs | 16 ++++++++-------- lib/Data/Packed/Vector.hs | 15 ++++++++++----- 2 files changed, 18 insertions(+), 13 deletions(-) (limited to 'lib') diff --git a/lib/Data/Packed/Matrix.hs b/lib/Data/Packed/Matrix.hs index de2300a..2922cbe 100644 --- a/lib/Data/Packed/Matrix.hs +++ b/lib/Data/Packed/Matrix.hs @@ -2,16 +2,16 @@ {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE CPP #-} ----------------------------------------------------------------------------- -- | -- Module : Data.Packed.Matrix -- Copyright : (c) Alberto Ruiz 2007-10 --- License : GPL-style +-- License : GPL -- -- Maintainer : Alberto Ruiz -- Stability : provisional --- Portability : portable -- -- A Matrix representation suitable for numerical computations using LAPACK and GSL. -- @@ -43,16 +43,14 @@ import Data.Packed.Internal import qualified Data.Packed.ST as ST import Data.List(transpose,intersperse) import Data.Array +import Foreign.Storable + +------------------------------------------------------------------- +#ifdef BINARY import Data.Binary -import Foreign.Storable import Control.Monad(replicateM) ---import Control.Arrow((***)) ---import GHC.Float(double2Float,float2Double) - - -------------------------------------------------------------------- instance (Binary a, Element a, Storable a) => Binary (Matrix a) where put m = do @@ -67,6 +65,8 @@ instance (Binary a, Element a, Storable a) => Binary (Matrix a) where xs <- replicateM r $ replicateM c get return $ fromLists xs +#endif + ------------------------------------------------------------------- instance (Show a, Element a) => (Show (Matrix a)) where diff --git a/lib/Data/Packed/Vector.hs b/lib/Data/Packed/Vector.hs index 8b1e813..f90f8e4 100644 --- a/lib/Data/Packed/Vector.hs +++ b/lib/Data/Packed/Vector.hs @@ -1,13 +1,13 @@ {-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE CPP #-} ----------------------------------------------------------------------------- -- | -- Module : Data.Packed.Vector --- Copyright : (c) Alberto Ruiz 2007 --- License : GPL-style +-- Copyright : (c) Alberto Ruiz 2007-10 +-- License : GPL -- -- Maintainer : Alberto Ruiz -- Stability : provisional --- Portability : portable -- -- 1D arrays suitable for numeric computations using external libraries. -- @@ -26,12 +26,15 @@ module Data.Packed.Vector ( ) where import Data.Packed.Internal.Vector -import Data.Binary import Foreign.Storable -import Control.Monad(replicateM) ------------------------------------------------------------------- +#ifdef BINARY + +import Data.Binary +import Control.Monad(replicateM) + -- a 64K cache, with a Double taking 13 bytes in Bytestring, -- implies a chunk size of 5041 chunk :: Int @@ -60,6 +63,8 @@ instance (Binary a, Storable a) => Binary (Vector a) where vs <- mapM getVector $ chunks d return $! join vs +#endif + ------------------------------------------------------------------- {- | creates a Vector of the specified length using the supplied function to -- cgit v1.2.3