Safe Haskell | None |
---|---|
Language | Haskell98 |
Synopsis
- fourier :: (Integral n, Real a) => Sign -> Array (Cyclic n) (Complex a) -> Array (Cyclic n) (Complex a)
- data Sign
- flipSign :: Sign -> Sign
- fourierRC :: (Integral n, Real a) => Array (Cyclic n) a -> Array (Half n) (Complex a)
- fourierCR :: (Integral n, Real a) => Array (Half n) (Complex a) -> Array (Cyclic n) a
- cosine :: (Shift shiftTime, Shift shiftSpectrum, Integral n, Real a) => Array (Symmetric Even shiftTime shiftSpectrum n) a -> Array (Symmetric Even shiftSpectrum shiftTime n) a
- sine :: (Shift shiftTime, Shift shiftSpectrum, Integral n, Real a) => Array (Symmetric Odd shiftTime shiftSpectrum n) a -> Array (Symmetric Odd shiftSpectrum shiftTime n) a
- hartley :: (Integral n, Real a) => Array (Cyclic n) a -> Array (Cyclic n) a
Documentation
fourier :: (Integral n, Real a) => Sign -> Array (Cyclic n) (Complex a) -> Array (Cyclic n) (Complex a) Source #
>>>
complexFloatList $ Trafo1.fourier Trafo1.Forward $ Array.fromList (Shape.Cyclic (5::Int)) [1,0,0,0,0]
[1.00:+0.00,1.00:+0.00,1.00:+0.00,1.00:+0.00,1.00:+0.00]>>>
complexFloatList $ Trafo1.fourier Trafo1.Forward $ Array.fromList (Shape.Cyclic (5::Int)) [0,1,0,0,0]
[1.00:+0.00,0.31:+(-0.95),(-0.81):+(-0.59),(-0.81):+0.59,0.31:+0.95]>>>
complexFloatList $ Trafo1.fourier Trafo1.Backward $ Array.fromList (Shape.Cyclic (5::Int)) [0,1,0,0,0]
[1.00:+0.00,0.31:+0.95,(-0.81):+0.59,(-0.81):+(-0.59),0.31:+(-0.95)]
QC.forAll genCyclicArray1 $ \xs sign-> approxComplex floatTol (adjust xs) (Trafo1.fourier sign (Trafo1.fourier (flipSign sign) xs))
QC.forAll genCyclicArray1 $ \xs sign -> approxComplex doubleTol (adjust xs) (Trafo1.fourier sign (Trafo1.fourier (flipSign sign) xs))
QC.forAll genCyclicArray1 $ \xs sign -> approxComplex floatTol (Trafo1.fourier sign (Array.map Complex.conjugate xs)) (Array.map Complex.conjugate (Trafo1.fourier (flipSign sign) xs))
QC.forAll genCyclicArray1 $ \xs sign -> approxComplex doubleTol (Trafo1.fourier sign (Array.map Complex.conjugate xs)) (Array.map Complex.conjugate (Trafo1.fourier (flipSign sign) xs))
QC.forAll genCyclicArray1 $ \xys sign -> let (xs,ys) = split xys in approxComplex floatTol (Trafo1.fourier sign $ Array.zipWith (+) xs ys) (Array.zipWith (+) (Trafo1.fourier sign xs) (Trafo1.fourier sign ys))
QC.forAll genCyclicArray1 $ \xys sign -> let (xs,ys) = split xys in approxComplex doubleTol (Trafo1.fourier sign $ Array.zipWith (+) xs ys) (Array.zipWith (+) (Trafo1.fourier sign xs) (Trafo1.fourier sign ys))
QC.forAll genCyclicArray1 $ \xys sign -> let (xs,ys) = split xys in Complex.magnitude (scalarProduct (adjust xs) ys - scalarProduct (Trafo1.fourier sign xs) (Trafo1.fourier sign ys)) <= floatTol * normInf Complex.magnitude (adjust xs) * normInf Complex.magnitude ys
QC.forAll genCyclicArray1 $ \xys sign -> let (xs,ys) = split xys in Complex.magnitude (scalarProduct (adjust xs) ys - scalarProduct (Trafo1.fourier sign xs) (Trafo1.fourier sign ys)) <= doubleTol * normInf Complex.magnitude (adjust xs) * normInf Complex.magnitude ys
\sign -> QC.forAll genCyclicArray1 $ immutable (Trafo1.fourier sign) . arrayComplexFloat
\sign -> QC.forAll genCyclicArray1 $ immutable (Trafo1.fourier sign) . arrayComplexDouble
Order is chosen such that the numeric sign is (-1) ^ fromEnum sign
.
fourierRC :: (Integral n, Real a) => Array (Cyclic n) a -> Array (Half n) (Complex a) Source #
QC.forAll genCyclicArray1 $ \xs -> approxReal floatTol (adjust xs) (Trafo1.fourierCR (Trafo1.fourierRC xs))
QC.forAll genCyclicArray1 $ \xs -> approxReal doubleTol (adjust xs) (Trafo1.fourierCR (Trafo1.fourierRC xs))
QC.forAll genCyclicArray1 $ immutable Trafo1.fourierRC . arrayFloat
QC.forAll genCyclicArray1 $ immutable Trafo1.fourierRC . arrayDouble
fourierCR :: (Integral n, Real a) => Array (Half n) (Complex a) -> Array (Cyclic n) a Source #
>>>
floatList $ Trafo1.fourierCR $ Array.fromList (Spectrum.Half (5::Int)) [0,1,0]
[2.00,0.62,-1.62,-1.62,0.62]
QC.forAll (fmap Trafo1.fourierRC genCyclicArray1) $ immutable Trafo1.fourierCR . arrayComplexFloat
QC.forAll (fmap Trafo1.fourierRC genCyclicArray1) $ immutable Trafo1.fourierCR . arrayComplexDouble
cosine :: (Shift shiftTime, Shift shiftSpectrum, Integral n, Real a) => Array (Symmetric Even shiftTime shiftSpectrum n) a -> Array (Symmetric Even shiftSpectrum shiftTime n) a Source #
Symmetric Even Halfway Exact
yields _the_ DCT,
Symmetric Even Exact Halfway
yields _the_ inverse DCT.
QC.forAll (genSymmetric Even Exact Exact `QC.suchThat` ((>=2) . Shape.size . Array.shape)) $ \xs -> approxReal floatTol (adjustSymmetric xs) (Trafo1.cosine (Trafo1.cosine xs))
QC.forAll (genSymmetric Even Exact Exact `QC.suchThat` ((>=2) . Shape.size . Array.shape)) $ \xs -> approxReal doubleTol (adjustSymmetric xs) (Trafo1.cosine (Trafo1.cosine xs))
QC.forAll (genSymmetric Even Halfway Exact) $ \xs -> approxReal floatTol (adjustSymmetric xs) (Trafo1.cosine (Trafo1.cosine xs))
QC.forAll (genSymmetric Even Halfway Exact) $ \xs -> approxReal doubleTol (adjustSymmetric xs) (Trafo1.cosine (Trafo1.cosine xs))
QC.forAll (genSymmetric Even Exact Halfway) $ \xs -> approxReal floatTol (adjustSymmetric xs) (Trafo1.cosine (Trafo1.cosine xs))
QC.forAll (genSymmetric Even Exact Halfway) $ \xs -> approxReal doubleTol (adjustSymmetric xs) (Trafo1.cosine (Trafo1.cosine xs))
QC.forAll (genSymmetric Even Halfway Halfway) $ \xs -> approxReal floatTol (adjustSymmetric xs) (Trafo1.cosine (Trafo1.cosine xs))
QC.forAll (genSymmetric Even Halfway Halfway) $ \xs -> approxReal doubleTol (adjustSymmetric xs) (Trafo1.cosine (Trafo1.cosine xs))
QC.forAll (genSymmetric Even Exact Exact `QC.suchThat` ((>=2) . Shape.size . Array.shape)) $ immutable Trafo1.cosine . arrayFloat
QC.forAll (genSymmetric Even Exact Exact `QC.suchThat` ((>=2) . Shape.size . Array.shape)) $ immutable Trafo1.cosine . arrayDouble
QC.forAll (genSymmetric Even Halfway Exact) $ immutable Trafo1.cosine . arrayFloat
QC.forAll (genSymmetric Even Halfway Exact) $ immutable Trafo1.cosine . arrayDouble
QC.forAll (genSymmetric Even Exact Halfway) $ immutable Trafo1.cosine . arrayFloat
QC.forAll (genSymmetric Even Exact Halfway) $ immutable Trafo1.cosine . arrayDouble
QC.forAll (genSymmetric Even Halfway Halfway) $ immutable Trafo1.cosine . arrayFloat
QC.forAll (genSymmetric Even Halfway Halfway) $ immutable Trafo1.cosine . arrayDouble
sine :: (Shift shiftTime, Shift shiftSpectrum, Integral n, Real a) => Array (Symmetric Odd shiftTime shiftSpectrum n) a -> Array (Symmetric Odd shiftSpectrum shiftTime n) a Source #
QC.forAll (genSymmetric Odd Exact Exact) $ \xs -> approxReal floatTol (adjustSymmetric xs) (Trafo1.sine (Trafo1.sine xs))
QC.forAll (genSymmetric Odd Exact Exact) $ \xs -> approxReal doubleTol (adjustSymmetric xs) (Trafo1.sine (Trafo1.sine xs))
QC.forAll (genSymmetric Odd Halfway Exact) $ \xs -> approxReal floatTol (adjustSymmetric xs) (Trafo1.sine (Trafo1.sine xs))
QC.forAll (genSymmetric Odd Halfway Exact) $ \xs -> approxReal doubleTol (adjustSymmetric xs) (Trafo1.sine (Trafo1.sine xs))
QC.forAll (genSymmetric Odd Exact Halfway) $ \xs -> approxReal floatTol (adjustSymmetric xs) (Trafo1.sine (Trafo1.sine xs))
QC.forAll (genSymmetric Odd Exact Halfway) $ \xs -> approxReal doubleTol (adjustSymmetric xs) (Trafo1.sine (Trafo1.sine xs))
QC.forAll (genSymmetric Odd Halfway Halfway) $ \xs -> approxReal floatTol (adjustSymmetric xs) (Trafo1.sine (Trafo1.sine xs))
QC.forAll (genSymmetric Odd Halfway Halfway) $ \xs -> approxReal doubleTol (adjustSymmetric xs) (Trafo1.sine (Trafo1.sine xs))
QC.forAll (genSymmetric Odd Exact Exact) $ immutable Trafo1.sine . arrayFloat
QC.forAll (genSymmetric Odd Exact Exact) $ immutable Trafo1.sine . arrayDouble
QC.forAll (genSymmetric Odd Halfway Exact) $ immutable Trafo1.sine . arrayFloat
QC.forAll (genSymmetric Odd Halfway Exact) $ immutable Trafo1.sine . arrayDouble
QC.forAll (genSymmetric Odd Exact Halfway) $ immutable Trafo1.sine . arrayFloat
QC.forAll (genSymmetric Odd Exact Halfway) $ immutable Trafo1.sine . arrayDouble
QC.forAll (genSymmetric Odd Halfway Halfway) $ immutable Trafo1.sine . arrayFloat
QC.forAll (genSymmetric Odd Halfway Halfway) $ immutable Trafo1.sine . arrayDouble
hartley :: (Integral n, Real a) => Array (Cyclic n) a -> Array (Cyclic n) a Source #
QC.forAll genCyclicArray1 $ \xs -> approxReal floatTol (adjust xs) (Trafo1.hartley (Trafo1.hartley xs))
QC.forAll genCyclicArray1 $ \xs -> approxReal doubleTol (adjust xs) (Trafo1.hartley (Trafo1.hartley xs))
QC.forAll genCyclicArray1 $ immutable Trafo1.hartley . arrayFloat
QC.forAll genCyclicArray1 $ immutable Trafo1.hartley . arrayDouble