HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulenumeric-prelude-0.4.4Haskell98

MathObj.Polynomial.Core

This module implements polynomial functions on plain lists. We use such functions in order to implement methods of other datatypes.

The module organization differs from that of ResidueClass: Here the Polynomial module exports the type that fits to the NumericPrelude type classes, whereas in ResidueClass the sub-modules export various flavors of them.

  • 28 values
valuehorner :: C a => a -> [a] -> a
#

Horner's scheme for evaluating a polynomial in a ring.

valuehornerCoeffVector :: C a v => a -> [v] -> v
#

Horner's scheme for evaluating a polynomial in a module.

valuenormalize :: C a => [a] -> [a]
#

It's also helpful to put a polynomial in canonical form. normalize strips leading coefficients that are zero.

valueshift :: C a => [a] -> [a]
#

Multiply by the variable, used internally.

valueadd :: C a => [a] -> [a] -> [a]
#
valuesub :: C a => [a] -> [a] -> [a]
#
valuescale :: C a => a -> [a] -> [a]
#
valuetensorProduct :: C a => [a] -> [a] -> [[a]]
#
Property
\(QC.NonEmpty xs) (QC.NonEmpty ys) -> PolyCore.tensorProduct xs ys == List.transpose (PolyCore.tensorProduct ys (intPoly xs))
valuemul :: C a => [a] -> [a] -> [a]
#

mul is fast if the second argument is a short polynomial, MathObj.PowerSeries.** relies on that fact.

valuemulShear :: C a => [a] -> [a] -> [a]
#
Property
\xs ys  ->  PolyCore.equal (intPoly $ PolyCore.mul xs ys) (PolyCore.mulShear xs ys)
valuedivMod :: (C a, C a) => [a] -> [a] -> ([a], [a])
#
Property
\x y -> case (PolyCore.normalize x, PolyCore.normalize y) of (nx, ny) -> not (null (ratioPoly ny)) ==> mapSnd PolyCore.normalize (PolyCore.divMod nx ny) == mapPair (PolyCore.normalize, PolyCore.normalize) (PolyCore.divMod x y)
Property
\x y -> not (isZero (ratioPoly y)) ==> let z = fst $ PolyCore.divMod (Poly.coeffs x) y in  PolyCore.normalize z == z
Property
\x y -> case PolyCore.normalize $ ratioPoly y of ny -> not (null ny) ==> List.length (snd $ PolyCore.divMod x y) < List.length ny
valuedivModRev :: (C a, C a) => [a] -> [a] -> ([a], [a])
#

The modulus will always have one element less than the divisor. This means that the modulus will be denormalized in some cases, e.g. mod [2,1,1] [1,1,1] == [1,0] instead of [1].

valueintegrateInt :: (C a, C a) => a -> [a] -> [a]
#

Integrates if it is possible to represent the integrated polynomial in the given ring. Otherwise undefined coefficients occur.

valuedilate :: C a => a -> [a] -> [a]
#
valueshrink :: C a => a -> [a] -> [a]
#