minst-idx-0.1.2.1: Read and write IDX data that is used in e.g. the MINST database.

CopyrightChristof Schramm
LicenseGPLv3
MaintainerChristof Schramm <christof.schramm@campus.lmu.de>
StabilityExperimental
PortabilityShoud work with all major haskell implementations
Safe HaskellNone
LanguageHaskell2010

Data.IDX.Internal

Description

An internal package, the API contained here should not be used and is subject to possibly breaking changes. Use these functions and types at your own risk.

The safe interface is in IDX

Synopsis

Documentation

data IDXData Source

Datatype for storing IDXData. Internally data is always stored either as Int or Double unboxed vectors. However when binary serialization is used, the data is serialized according to the IDXContentType.

newtype IDXLabels Source

Constructors

IDXLabels (Vector Int) 

Instances

idxType :: IDXData -> IDXContentType Source

Return the what type the data is stored in

idxDimensions :: IDXData -> Vector Int Source

Return an unboxed Vector of Int dimensions

isIDXIntegral :: IDXData -> Bool Source

Return wether the data in this IDXData value is stored as integral values

isIDXReal :: IDXData -> Bool Source

Return wether the data in this IDXData value is stored as double values

idxIntContent :: IDXData -> Vector Int Source

Return contained ints, if no ints are contained, convert content to ints by using round. Data is stored like in a C-array, i.e. the last index changes first.

idxDoubleContent :: IDXData -> Vector Double Source

Return contained doubles, if no doubles are contained convert the content to double by using fromIntegral. Data is stored like in a C-array, i.e. the last index changes first.

readContent Source

Arguments

:: Unbox a 
=> (Int -> Get (Vector a))

To Get a chunk of size n

-> Int

Chunk size

-> Int

Expected input

-> Get (Vector a) 

Helper function to read a (possibly big) vector of binary values as chunks. Strictly evaluates each chunk and then concatenates the chunks, does not leak space.