Copyright | Christof Schramm |
---|---|
License | GPLv3 |
Maintainer | Christof Schramm <christof.schramm@campus.lmu.de> |
Stability | Experimental |
Portability | Shoud work with all major haskell implementations |
Safe Haskell | None |
Language | Haskell2010 |
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
- data IDXContentType where
- data IDXData
- = IDXInts IDXContentType (Vector Int) (Vector Int)
- | IDXDoubles IDXContentType (Vector Int) (Vector Double)
- newtype IDXLabels = IDXLabels (Vector Int)
- idxType :: IDXData -> IDXContentType
- idxDimensions :: IDXData -> Vector Int
- isIDXIntegral :: IDXData -> Bool
- isIDXReal :: IDXData -> Bool
- idxIntContent :: IDXData -> Vector Int
- idxDoubleContent :: IDXData -> Vector Double
- readContent :: Unbox a => (Int -> Get (Vector a)) -> Int -> Int -> Get (Vector a)
- getInt8 :: Get Int8
- getInt16 :: Get Int16
- getInt32 :: Get Int32
- getFloat :: Get Float
- getDouble :: Get Double
- buildIntResult :: Integral a => Int -> IDXContentType -> Vector Int -> Get a -> Get IDXData
- buildDoubleResult :: Real a => Int -> IDXContentType -> Vector Int -> Get a -> Get IDXData
- putIntegral :: IDXContentType -> Int -> Put
- putReal :: IDXContentType -> Double -> Put
Documentation
data IDXContentType where Source
A type to describe the content, according to IDX spec
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
.
IDXInts IDXContentType (Vector Int) (Vector Int) | |
IDXDoubles IDXContentType (Vector Int) (Vector Double) |
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.
:: 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.
:: Integral a | |
=> Int | Expected number of entries |
-> IDXContentType | Description of content |
-> Vector Int | Dimension sizes |
-> Get a | Monadic action to get content element |
-> Get IDXData |
Helper function for parsing integer data from the IDX content. Returns a full IDX result.
:: Real a | |
=> Int | Expected number of entries |
-> IDXContentType | Description of content |
-> Vector Int | Dimension sizes |
-> Get a | Monadic action to get content element |
-> Get IDXData |
Helper function for parsing real number data from the IDX content.
putIntegral :: IDXContentType -> Int -> Put Source
Put values that are saved as Int
putReal :: IDXContentType -> Double -> Put Source
Put real values that are saved as Double