{-# LANGUAGE DeriveGeneric #-}
module Numeric.EMD.Internal (
EMDOpts(..)
, BoundaryHandler(..)
, Sifter(..)
, SM
, SingleSift(..)
) where
import Control.Monad.Trans.Reader
import Data.Conduino
import Data.Void
import GHC.Generics
import Numeric.EMD.Internal.Spline
import qualified Data.Binary as Bi
import qualified Data.Vector.Generic.Sized as SVG
data EMDOpts v n a = EO
{ eoSifter :: Sifter v n a
, eoSplineEnd :: SplineEnd a
, eoBoundaryHandler :: Maybe BoundaryHandler
}
deriving (Generic)
data BoundaryHandler
= BHClamp
| BHSymmetric
deriving (Show, Eq, Ord, Generic)
instance Bi.Binary BoundaryHandler
data SingleSift v n a = SingleSift
{ ssResult :: !(SVG.Vector v n a)
, ssMinEnv :: !(SVG.Vector v n a)
, ssMaxEnv :: !(SVG.Vector v n a)
}
type SM v n a = Reader (SVG.Vector v n a)
newtype Sifter v n a = Sifter { sPipe :: Pipe (SingleSift v n a) Void Void (SM v n a) () }