Copyright | (c) Ross Paterson 2021 |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | [email protected] |
Stability | provisional |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Data.YAP.Polynomial.Z2
Contents
Description
An example instance of the algebraic classes: formal polynomials specialized to \({\Bbb Z}_2\), which can be represented as bit sequences.
Synopsis
- data PolynomialZ2 a
- fromBits :: a -> PolynomialZ2 a
- fromIndices :: Bits a => [Int] -> PolynomialZ2 a
- degree :: Bits a => PolynomialZ2 a -> Int
- bits :: PolynomialZ2 a -> a
- indices :: Bits a => PolynomialZ2 a -> [Int]
- evaluate :: (Bits a, Semiring b) => PolynomialZ2 a -> b -> b
- identity :: Bits a => PolynomialZ2 a
- compose :: Bits a => PolynomialZ2 a -> PolynomialZ2 a -> PolynomialZ2 a
Polynomials
data PolynomialZ2 a Source #
Polynomial over \({\Bbb Z}_2\), with coefficients represented by
the bits of
a value of type a
.
Instances
fromBits :: a -> PolynomialZ2 a Source #
Polynomial with the given bit representation
fromIndices :: Bits a => [Int] -> PolynomialZ2 a Source #
Polynomial with non-zero coefficients at the listed indices
Queries
bits :: PolynomialZ2 a -> a Source #
Bit representation of a polynomial
evaluate :: (Bits a, Semiring b) => PolynomialZ2 a -> b -> b Source #
Evaluate a polynomial for a given value of x
.
Composition
identity :: Bits a => PolynomialZ2 a Source #
Identity polynomial, i.e. x
compose :: Bits a => PolynomialZ2 a -> PolynomialZ2 a -> PolynomialZ2 a Source #
Composition of polynomials.