Safe Haskell | None |
---|---|
Language | Haskell2010 |
Multivariate compact polynomials where the variable set
looks like {x_1, x_2, ... , x_N}
.
This is very similar to the "Indexed" version, but should have much more compact in-memory representation (which is useful in case of large or many polynomials; and should be in theory also faster, because of cache-friendlyness)
Synopsis
- newtype Poly (coeff :: *) (var :: Symbol) (n :: Nat) = Poly (FreeMod coeff (Compact var n))
- unPoly :: Poly c v n -> FreeMod c (Compact v n)
- polyVar :: KnownSymbol var => Poly c var n -> String
- nOfPoly :: KnownNat n => Poly c var n -> Int
- renamePolyVar :: Poly c var1 n -> Poly c var2 n
- type ZPoly = Poly Integer
- type QPoly = Poly Rational
- fromZPoly :: (Ring c, KnownSymbol v, KnownNat n) => Poly Integer v n -> Poly c v n
- fromQPoly :: (Field c, KnownSymbol v, KnownNat n) => Poly Rational v n -> Poly c v n
- data Compact (var :: Symbol) (n :: Nat)
Documentation
newtype Poly (coeff :: *) (var :: Symbol) (n :: Nat) Source #
A multivariate polynomial in with a given coefficient ring.
It is also indexed by the (shared) name of the variables and the number of
variable. For example Polyn Rational "x" 3
the type of polynomials in the
variables x1, x2, x3
with rational coefficients.
Instances
renamePolyVar :: Poly c var1 n -> Poly c var2 n Source #
Rename the variables (zero cost)
fromZPoly :: (Ring c, KnownSymbol v, KnownNat n) => Poly Integer v n -> Poly c v n Source #
Change the coefficient ring (from integers)
fromQPoly :: (Field c, KnownSymbol v, KnownNat n) => Poly Rational v n -> Poly c v n Source #
Change the coefficient field (from rationals)
data Compact (var :: Symbol) (n :: Nat) Source #
Monomials of the variables x1,x2,...,xn
. The internal representation is a
compact vector of the exponents.
The type is indexed by the name of the variables, and then the number of variables.
Note that we assume here that the internal vector has length n
.