Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
One-dimensional lookup tables
Synopsis
- newtype LookupTable1 a b = LookupTable1 (Vector (a, b))
- lookupInterpolated :: LookupTable1 Double Double -> Double -> Double
- lookupBiasLower :: Ord a => LookupTable1 a b -> a -> (a, b)
Documentation
newtype LookupTable1 a b Source #
Vector-based lookup table. Functions assume that values must increase with vector index, enabling binary search.
LookupTable1 (Vector (a, b)) |
Instances
lookupInterpolated :: LookupTable1 Double Double -> Double -> Double Source #
Find a value in the lookup table using binary search, interpolating linearly around the search result. Clips for out-of-range values.
lookupBiasLower :: Ord a => LookupTable1 a b -> a -> (a, b) Source #
Lookup in the LUT, with bias towards the left, i.e. when searching a value not present in the LUT, return the closest one before.