mnist-idx 0.1.3.0 → 0.1.3.1
raw patch · 2 files changed
+10/−5 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- mnist-idx.cabal +1/−1
- src/Data/IDX/Internal.hs +9/−4
mnist-idx.cabal view
@@ -1,6 +1,6 @@ name: mnist-idx -version: 0.1.3.0+version: 0.1.3.1 -- A short (one-line) description of the package. synopsis: Read and write IDX data that is used in e.g. the MNIST database.
src/Data/IDX/Internal.hs view
@@ -20,6 +20,11 @@ import Control.Monad (replicateM) import Data.Binary import Data.Int+import GHC.Float ( castFloatToWord32+ , castDoubleToWord64+ , castWord64ToDouble+ , castWord32ToFloat+ ) import qualified Data.Vector.Unboxed as V import Data.Vector.Unboxed ((!))@@ -191,10 +196,10 @@ getInt32 = get getFloat :: Get Float-getFloat = get+getFloat = castWord32ToFloat <$> get getDouble :: Get Double-getDouble = get+getDouble = castWord64ToDouble <$> get -- | Helper function for parsing integer data from the -- IDX content. Returns a full IDX result.@@ -234,8 +239,8 @@ -- | Put real values that are saved as Double putReal :: IDXContentType -> Double -> Put-putReal IDXDouble n = put n-putReal IDXFloat n = put $! (realToFrac n :: Float )+putReal IDXDouble n = put $ castDoubleToWord64 n+putReal IDXFloat n = put $! castFloatToWord32 (realToFrac n :: Float ) -- | Split data by the first dimension of the C-Array. This would e.g. split a -- data-set of images into a list of data representing an individual image