yap-examples-0.1: examples of the algebraic classes in the yap package
Copyright(c) Ross Paterson 2021
LicenseBSD-style (see the file LICENSE)
Maintainer[email protected]
Stabilityprovisional
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Data.YAP.Polynomial.Z2

Description

An example instance of the algebraic classes: formal polynomials specialized to \({\Bbb Z}_2\), which can be represented as bit sequences.

Synopsis

Polynomials

data PolynomialZ2 a Source #

Polynomial over \({\Bbb Z}_2\), with coefficients represented by the bits of a value of type a.

Instances

Instances details
Show a => Show (PolynomialZ2 a) Source # 
Instance details

Defined in Data.YAP.Polynomial.Z2

Eq a => Eq (PolynomialZ2 a) Source # 
Instance details

Defined in Data.YAP.Polynomial.Z2

Ord a => Ord (PolynomialZ2 a) Source # 
Instance details

Defined in Data.YAP.Polynomial.Z2

Bits a => AbelianGroup (PolynomialZ2 a) Source #

Negation is the identity.

Instance details

Defined in Data.YAP.Polynomial.Z2

Bits a => AdditiveMonoid (PolynomialZ2 a) Source #

Addition without carrying, i.e. exclusive or.

Instance details

Defined in Data.YAP.Polynomial.Z2

Bits a => Euclidean (PolynomialZ2 a) Source # 
Instance details

Defined in Data.YAP.Polynomial.Z2

Bits a => Ring (PolynomialZ2 a) Source #

fromInteger n is 0 if n is even and 1 if it is odd.

Instance details

Defined in Data.YAP.Polynomial.Z2

Bits a => Semiring (PolynomialZ2 a) Source #

Multiplication without carrying. fromNatural n is 0 if n is even and 1 if it is odd.

Instance details

Defined in Data.YAP.Polynomial.Z2

Bits a => StandardAssociate (PolynomialZ2 a) Source #

The only unit is 1. stdAssociate is the identity.

Instance details

Defined in Data.YAP.Polynomial.Z2

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

degree :: Bits a => PolynomialZ2 a -> Int Source #

The degree of a polynomial.

bits :: PolynomialZ2 a -> a Source #

Bit representation of a polynomial

indices :: Bits a => PolynomialZ2 a -> [Int] Source #

Indices of non-zero coefficients

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.