!2      !"#$%&'()*+,-./01 (c) 2019 Andrew LelechenkoBSD3/Andrew Lelechenko <andrew.lelechenko@gmail.com>None %=?HMVXgzpoly&Polynomials backed by unboxed vectors.poly$Polynomials backed by boxed vectors.poly3Polynomials of one variable with coefficients from a, backed by a 2 v" (boxed, unboxed, storable, etc.). Use pattern  for construction:"(X + 1) + (X - 1) :: VPoly Integer 2 * X + 0(X + 1) * (X - 1) :: UPoly Int1 * X^2 + 0 * X + (-1)NPolynomials are stored normalized, without leading zero coefficients, so 0 *  + 1 equals to 1.3W instance does not make much sense mathematically, it is defined only for the sake of ,  , etc.polyConvert M to a vector of coefficients (first element corresponds to a constant term).4polyCreate an identity polynomial.polyCreate an identity polynomial.polyMake M from a list of coefficients (first element corresponds to a constant term).:set -XOverloadedListstoPoly [1,2,3] :: VPoly Integer3 * X^2 + 2 * X + 1toPoly [0,0,0] :: UPoly Int0poly@Return a leading power and coefficient of a non-zero polynomial.2leading ((2 * X + 1) * (2 * X^2 - 1) :: UPoly Int) Just (3,4)leading (0 :: UPoly Int)Nothingpoly1Create a monomial from a power and a coefficient.polyLMultiply a polynomial by a monomial, expressed as a power and a coefficient. scale 2 3 (X^2 + 1) :: UPoly Int'3 * X^4 + 0 * X^3 + 3 * X^2 + 0 * X + 0 polyEvaluate at a given point.eval (X^2 + 1 :: UPoly Int) 310 poly)Substitute another polynomial instead of .1subst (X^2 + 1 :: UPoly Int) (X + 1 :: UPoly Int)1 * X^2 + 2 * X + 2 polyTake a derivative. deriv (X^3 + 3 * X) :: UPoly Int3 * X^2 + 0 * X + 3 polyOCompute an indefinite integral of a polynomial, setting constant term to zero.&integral (3 * X^2 + 3) :: UPoly Double%1.0 * X^3 + 0.0 * X^2 + 3.0 * X + 0.05poly Note that 6 = 7 and 8 = 9 1.:4;<=>? @ A B CD1 (c) 2019 Andrew LelechenkoBSD3/Andrew Lelechenko <andrew.lelechenko@gmail.com>None =?HVXg#iEpolyConsider using  ; wrapper, which provides a much faster implementation of F for polynomials over G. (c) 2019 Andrew LelechenkoBSD3/Andrew Lelechenko <andrew.lelechenko@gmail.com>None ,=?HVXg2 poly;Execute the extended Euclidean algorithm. For polynomials a and b/, compute their unique greatest common divisor g( and the unique coefficient polynomial s satisfying  as + bt = g, such that either g is monic, or g = 0 and s is monic, or  g = s = 0.>gcdExt (X^2 + 1 :: UPoly Double) (X^3 + 3 * X :: UPoly Double)#(1.0, 0.5 * X^2 + (-0.0) * X + 1.0)HgcdExt (X^3 + 3 * X :: UPoly Double) (3 * X^4 + 3 * X^2 :: UPoly Double)N(1.0 * X + 0.0,(-0.16666666666666666) * X^2 + (-0.0) * X + 0.3333333333333333)HpolyScale a non-zero polynomial such that its leading coefficient is one, returning the reciprocal of the leading coefficient in the scaling.(scaleMonic (X^3 + 3 * X :: UPoly Double)1Just (1.0, 1.0 * X^3 + 0.0 * X^2 + 3.0 * X + 0.0).scaleMonic (3 * X^4 + 3 * X^2 :: UPoly Double)LJust (0.3333333333333333, 1.0 * X^4 + 0.0 * X^3 + 1.0 * X^2 + 0.0 * X + 0.0)I  (c) 2019 Andrew LelechenkoBSD3/Andrew Lelechenko <andrew.lelechenko@gmail.com>None,=?Mg5polypolyWrapper for polynomials over G, providing a faster J instance.polypoly(c) 2019 Andrew LelechenkoBSD3/Andrew Lelechenko <andrew.lelechenko@gmail.com>Noneg7   (c) 2019 Andrew LelechenkoBSD3/Andrew Lelechenko <andrew.lelechenko@gmail.com>None %1>HMVXgTpoly&Polynomials backed by unboxed vectors.poly$Polynomials backed by boxed vectors.poly3Polynomials of one variable with coefficients from a, backed by a 2 v" (boxed, unboxed, storable, etc.). Use pattern  for construction:"(X + 1) + (X - 1) :: VPoly Integer2 * X(X + 1) * (X - 1) :: UPoly Int1 * X^2 + (-1)FPolynomials are stored normalized, without zero coefficients, so 0 *  + 1 equals to 1.3W instance does not make much sense mathematically, it is defined only for the sake of ,  , etc.polyConvert M to a vector of coefficients (first element corresponds to a constant term).KpolyCreate an identity polynomial.polyCreate an identity polynomial.polyMake \ from a list of (power, coefficient) pairs. (first element corresponds to a constant term).:set -XOverloadedLists+toPoly [(0,1),(1,2),(2,3)] :: VPoly Integer3 * X^2 + 2 * X + 1)S.toPoly [(0,0),(1,0),(2,0)] :: UPoly Int0poly@Return a leading power and coefficient of a non-zero polynomial.2leading ((2 * X + 1) * (2 * X^2 - 1) :: UPoly Int) Just (3,4)leading (0 :: UPoly Int)NothingpolyLMultiply a polynomial by a monomial, expressed as a power and a coefficient. scale 2 3 (X^2 + 1) :: UPoly Int3 * X^4 + 3 * X^2poly1Create a monomial from a power and a coefficient.polyEvaluate at a given point.eval (X^2 + 1 :: UPoly Int) 310poly)Substitute another polynomial instead of .1subst (X^2 + 1 :: UPoly Int) (X + 1 :: UPoly Int)1 * X^2 + 2 * X + 2polyTake a derivative. deriv (X^3 + 3 * X) :: UPoly Int 3 * X^2 + 3 polyOCompute an indefinite integral of a polynomial, setting constant term to zero.&integral (3 * X^2 + 3) :: UPoly Double1.0 * X^3 + 3.0 * XLpoly Note that 6 = 7 and 8 = 9 1.MKNOPQRS T(c) 2019 Andrew LelechenkoBSD3/Andrew Lelechenko <andrew.lelechenko@gmail.com>None =>?HVXgXUpolyConsider using  ; wrapper, which provides a much faster implementation of F for polynomials over G.(c) 2019 Andrew LelechenkoBSD3/Andrew Lelechenko <andrew.lelechenko@gmail.com>None ,=>?HVXgh!poly;Execute the extended Euclidean algorithm. For polynomials a and b/, compute their unique greatest common divisor g( and the unique coefficient polynomial s satisfying  as + bt = g, such that either g is monic, or g = 0 and s is monic, or  g = s = 0.>gcdExt (X^2 + 1 :: UPoly Double) (X^3 + 3 * X :: UPoly Double)#(1.0, 0.5 * X^2 + (-0.0) * X + 1.0)HgcdExt (X^3 + 3 * X :: UPoly Double) (3 * X^4 + 3 * X^2 :: UPoly Double)N(1.0 * X + 0.0,(-0.16666666666666666) * X^2 + (-0.0) * X + 0.3333333333333333)VpolyScale a non-zero polynomial such that its leading coefficient is one, returning the reciprocal of the leading coefficient in the scaling.(scaleMonic (X^3 + 3 * X :: UPoly Double)1Just (1.0, 1.0 * X^3 + 0.0 * X^2 + 3.0 * X + 0.0).scaleMonic (3 * X^4 + 3 * X^2 :: UPoly Double)LJust (0.3333333333333333, 1.0 * X^4 + 0.0 * X^3 + 1.0 * X^2 + 0.0 * X + 0.0)!(c) 2019 Andrew LelechenkoBSD3/Andrew Lelechenko <andrew.lelechenko@gmail.com>Nonegw$"polyCreate an identity polynomial.#polyMake O from a vector of coefficients (first element corresponds to a constant term).:set -XOverloadedListstoPoly [1,2,3] :: VPoly Integer3 * X^2 + 2 * X + 1toPoly [0,0,0] :: UPoly Int0$poly1Create a monomial from a power and a coefficient.%polyLMultiply a polynomial by a monomial, expressed as a power and a coefficient. scale 2 3 (X^2 + 1) :: UPoly Int'3 * X^4 + 0 * X^3 + 3 * X^2 + 0 * X + 0&polyEvaluate at a given point.eval (X^2 + 1 :: UPoly Int) 310'poly)Substitute another polynomial instead of ".1subst (X^2 + 1 :: UPoly Int) (X + 1 :: UPoly Int)1 * X^2 + 2 * X + 2(polyTake a derivative. deriv (X^3 + 3 * X) :: UPoly Int3 * X^2 + 0 * X + 3)polyOCompute an indefinite integral of a polynomial, setting constant term to zero.&integral (3 * X^2 + 3) :: UPoly Double%1.0 * X^3 + 0.0 * X^2 + 3.0 * X + 0.0 "#$%&'()#$%"&'() (c) 2019 Andrew LelechenkoBSD3/Andrew Lelechenko <andrew.lelechenko@gmail.com>NonegyA ! !(c) 2019 Andrew LelechenkoBSD3/Andrew Lelechenko <andrew.lelechenko@gmail.com>None>g*polyCreate an identity polynomial.+polyMake \ from a list of (power, coefficient) pairs. (first element corresponds to a constant term).:set -XOverloadedLists+toPoly [(0,1),(1,2),(2,3)] :: VPoly Integer3 * X^2 + 2 * X + 1)S.toPoly [(0,0),(1,0),(2,0)] :: UPoly Int0,poly1Create a monomial from a power and a coefficient.-polyLMultiply a polynomial by a monomial, expressed as a power and a coefficient. scale 2 3 (X^2 + 1) :: UPoly Int3 * X^4 + 3 * X^2.polyEvaluate at a given point.eval (X^2 + 1 :: UPoly Int) 310/poly)Substitute another polynomial instead of *.1subst (X^2 + 1 :: UPoly Int) (X + 1 :: UPoly Int)1 * X^2 + 2 * X + 20polyTake a derivative. deriv (X^3 + 3 * X) :: UPoly Int 3 * X^2 + 31polyOCompute an indefinite integral of a polynomial, setting constant term to zero.&integral (3 * X^2 + 3) :: UPoly Double1.0 * X^3 + 3.0 * X!*+,-./01+,-*./01!W      !"#$%&'()*+,*-.*+/*-0123456789: ;<=><=? @ A<=B()1436789;@C#poly-0.3.3.0-6q5ZcvIzPcqLxrqVkmgEko Data.PolyData.Poly.SparseData.Poly.SemiringData.Poly.Sparse.SemiringData.Poly.Internal.DenseData.SetSetData.MapMap"Data.Poly.Internal.Dense.GcdDomain PolyOverFieldData.Poly.Internal.Dense.Field Data.Poly.Internal.PolyOverFieldData.Poly.Internal.Sparse#Data.Poly.Internal.Sparse.GcdDomainData.Poly.Internal.Sparse.FieldUPolyVPolyPolyunPolyXtoPolyleadingmonomialscaleevalsubstderivintegralgcdExtPolyOverFractionalunPolyOverFieldunPolyOverFractional&vector-0.12.0.3-ChzWbiXyvuNAQj0dcU08SgData.Vector.Generic.BaseVectorghc-prim GHC.ClassesOrdX' $fNumPolybaseGHC.NumabsGHC.BaseidsignumconsttoPoly' dropWhileEndM monomial'scale'unscale'eval'subst'deriv' integral':*:$fGcdDomainPoly&semirings-0.5.2-FQEGaFCsp0VAgoIZGDI330Data.EuclideangcdField scaleMonicfieldGcd GcdDomain