resampled _ e = [e]
instance Resamplable (Expression PsincE) where
- resampled ofl2 e = case getImplementationType ofl2 e of
- Right (PositionT (Psinc i)) -> e : upsampled ++ downsampled where
- upsampled = take (fromInteger $ maxPsincDensity - i) (tail $ iterate Upsample e)
- downsampled = take (fromInteger $ i - minPsincDensity) (tail $ iterate Downsample e)
- Right _ -> error $ "Expected expression " ++ prettyPrint e ++ " to be in a non-analytic basis."
- Left _ -> error $ "Cannot resample expression with invalid implementation type: " ++ prettyPrint e
+ resampled ofl2 e = e : upsampled e ++ downsampled e ++ bandlimited e where
+ upsampled x = take (fromInteger $ maxPsincDensity - density x) (tail $ iterate Upsample x)
+ downsampled x = take (fromInteger $ density x - minPsincDensity) (tail $ iterate Downsample x)
+ bandlimited x = concatMap upsampled $ downsampled x
+ density x = case getImplementationType ofl2 x of
+ Right (PositionT (Psinc i)) -> i
+ Right _ -> error $ "Expected xession " ++ prettyPrint x ++ " to be in a non-analytic basis."
+ Left _ -> error $ "Cannot resample xession with invalid implementation type: " ++ prettyPrint x
+
getImplementationType :: OFL2 -> Expression e -> Either String ValueType
getImplementationType ofl2 expr = case expr of