Low-level interface for the `Poly`

type.

- data Endianness
- data Poly a
- zero :: Poly a
- poly :: (Num a, Eq a) => Endianness -> [a] -> Poly a
- polyN :: (Num a, Eq a) => Int -> Endianness -> [a] -> Poly a
- unboxedPoly :: (Unbox a, Num a, Eq a) => Endianness -> [a] -> Poly a
- unboxedPolyN :: (Unbox a, Num a, Eq a) => Int -> Endianness -> [a] -> Poly a
- mapPoly :: (a -> a) -> Poly a -> Poly a
- unboxPoly :: Unbox a => Poly a -> Poly a
- rawListPoly :: Endianness -> [a] -> Poly a
- rawListPolyN :: Int -> Endianness -> [a] -> Poly a
- rawVectorPoly :: Endianness -> Vector a -> Poly a
- rawUVectorPoly :: Unbox a => Endianness -> Vector a -> Poly a
- trim :: (a -> Bool) -> Poly a -> Poly a
- polyIsZero :: (Num a, Eq a) => Poly a -> Bool
- polyIsOne :: (Num a, Eq a) => Poly a -> Bool
- polyCoeffs :: (Num a, Eq a) => Endianness -> Poly a -> [a]
- rawCoeffsOrder :: Poly a -> Endianness
- rawPolyCoeffs :: Poly a -> [a]
- untrimmedPolyCoeffs :: Endianness -> Poly a -> [a]
- polyDegree :: (Num a, Eq a) => Poly a -> Int
- rawPolyDegree :: Poly a -> Int
- rawPolyLength :: Poly a -> Int

# Documentation

data Endianness Source

Functor Poly | |

(Num a, Eq a) => Eq (Poly a) | |

(Num a, Eq a) => Num (Poly a) | |

Show a => Show (Poly a) | |

NFData a => NFData (Poly a) | |

(Pretty a, Num a, Ord a) => Pretty (Poly a) | |

(RealFloat a, Pretty (Complex a)) => Pretty (Poly (Complex a)) | |

VectorSpace a => VectorSpace (Poly a) | |

AdditiveGroup a => AdditiveGroup (Poly a) |

poly :: (Num a, Eq a) => Endianness -> [a] -> Poly aSource

Make a `Poly`

from a list of coefficients using the specified coefficient order.

polyN :: (Num a, Eq a) => Int -> Endianness -> [a] -> Poly aSource

Make a `Poly`

from a list of coefficients, at most `n`

of which are significant.

unboxedPoly :: (Unbox a, Num a, Eq a) => Endianness -> [a] -> Poly aSource

unboxedPolyN :: (Unbox a, Num a, Eq a) => Int -> Endianness -> [a] -> Poly aSource

rawListPoly :: Endianness -> [a] -> Poly aSource

rawListPolyN :: Int -> Endianness -> [a] -> Poly aSource

rawVectorPoly :: Endianness -> Vector a -> Poly aSource

rawUVectorPoly :: Unbox a => Endianness -> Vector a -> Poly aSource

trim :: (a -> Bool) -> Poly a -> Poly aSource

Trim zeroes from a polynomial (given a predicate for identifying zero).
In particular, drops zeroes from the highest-order coefficients, so that
`0x^n + 0x^(n-1) + 0x^(n-2) + ... + ax^k + ...`

, `a /= 0`

is normalized to `ax^k + ...`

.

The `Eq`

instance for `Poly`

and all the standard constructors / destructors
are defined using `trim (0==)`

.

polyCoeffs :: (Num a, Eq a) => Endianness -> Poly a -> [a]Source

Get the coefficients of a a `Poly`

in the specified order.

rawCoeffsOrder :: Poly a -> EndiannessSource

rawPolyCoeffs :: Poly a -> [a]Source

untrimmedPolyCoeffs :: Endianness -> Poly a -> [a]Source

polyDegree :: (Num a, Eq a) => Poly a -> IntSource

Get the degree of a a `Poly`

(the highest exponent with nonzero coefficient)

rawPolyDegree :: Poly a -> IntSource

rawPolyLength :: Poly a -> IntSource