Safe Haskell | None |
---|---|
Language | Haskell98 |
Synopsis
- data T a
- coeffs :: T a -> [a]
- fromCoeffs :: [a] -> T a
- fromPolynomial :: C a => T a -> T a
- toPolynomial :: C a => T a -> Maybe (T a)
- toPolynomialFast :: C a => T a -> Maybe (T a)
- refinePolynomial :: C a => T a -> T a -> T a
- convolvePolynomial :: C a => T a -> T a -> T a
- convolveTruncatedPowerPolynomials :: C a => T a -> T a -> T a
Documentation
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])
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]