numeric-prelude-0.4.3.3: An experimental alternative hierarchy of numeric type classes
Safe HaskellNone
LanguageHaskell98

MathObj.RefinementMask2

Synopsis

Documentation

data T a Source #

Instances

Instances details
Functor T Source # 
Instance details

Defined in MathObj.RefinementMask2

Methods

fmap :: (a -> b) -> T a -> T b #

(<$) :: a -> T b -> T a #

Show a => Show (T a) Source # 
Instance details

Defined in MathObj.RefinementMask2

Methods

showsPrec :: Int -> T a -> ShowS #

show :: T a -> String #

showList :: [T a] -> ShowS #

(Arbitrary a, C a) => Arbitrary (T a) Source # 
Instance details

Defined in MathObj.RefinementMask2

Methods

arbitrary :: Gen (T a) #

shrink :: T a -> [T a] #

coeffs :: T a -> [a] Source #

fromCoeffs :: [a] -> T a Source #

fromPolynomial :: C a => T a -> T a Source #

Determine mask by Gauss elimination.

R - alternating binomial coefficients L - differences of translated polynomials in columns

p2 = L * R^(-1) * m

R * L^(-1) * p2 = m

genAdmissibleMask /\ \(mask,poly) -> hasMultipleZero (fromMaybe 0 $ Poly.degree poly) 1 (polyFromMask (Mask.fromPolynomial poly) - polyFromMask mask)
genShortPolynomial 5 /\ \poly -> maybe False (Poly.collinear poly) $ Mask.toPolynomial $ Mask.fromPolynomial poly

toPolynomial :: C a => T a -> Maybe (T a) Source #

If the mask does not sum up to a power of 1/2 then the function returns Nothing.

>>> fmap ((6::Rational) *>) $ Mask.toPolynomial (Mask.fromCoeffs [0.1, 0.02, 0.005::Rational])
Just (Polynomial.fromCoeffs [-12732 % 109375,272 % 625,-18 % 25,1 % 1])

toPolynomialFast :: C a => T a -> Maybe (T a) Source #

refinePolynomial :: C a => T a -> T a -> T a Source #

genShortPolynomial 5 /\ \poly -> poly == Mask.refinePolynomial (Mask.fromPolynomial poly) poly
>>> fmap (round :: Double -> Integer) $ fmap (1000000*) $ nest 50 (Mask.refinePolynomial (Mask.fromCoeffs [0.1, 0.02, 0.005])) (Poly.fromCoeffs [0,0,0,1])
Polynomial.fromCoeffs [-116407,435200,-720000,1000000]

convolvePolynomial :: C a => T a -> T a -> T a Source #

Convolve polynomials via refinement mask.

(mask x + ux*(-1,1)^degree x) * (mask y + uy*(-1,1)^degree y)