Documentation
¶
Index ¶
- func AreEqual(f *Element, g *Element) bool
- func CmpLeadingMonomial(f *Element, g *Element) (int, error)
- func CoefficientRing(R *Parent) *rational.Parent
- func ExponentMonoid(R *Parent) *integervector.Parent
- type Element
- func Add(f *Element, g *Element) (*Element, error)
- func FromInt64Slice(R *Parent, initial int64, step int64, cs []int64) (*Element, error)
- func FromIntSlice(R *Parent, initial int64, step int64, cs []int) (*Element, error)
- func FromIntegerSlice(R *Parent, initial int64, step int64, cs []*integer.Element) (*Element, error)
- func FromParallelInt64Slices(R *Parent, cs []int64, es []int64) (*Element, error)
- func FromParallelIntSlices(R *Parent, cs []int, es []int) (*Element, error)
- func FromParallelIntegerSlices(R *Parent, cs []*integer.Element, es []*integer.Element) (*Element, error)
- func FromParallelRationalSlices(R *Parent, cs []*rational.Element, es []*integer.Element) (*Element, error)
- func FromParallelSlices(R *Parent, cs []*rational.Element, es []*integervector.Element) (*Element, error)
- func FromRationalSlice(R *Parent, initial int64, step int64, cs []*rational.Element) (*Element, error)
- func GobDecode(dec *gob.Decoder) (*Element, error)
- func GobDecodeSlice(dec *gob.Decoder) ([]*Element, error)
- func Multiply(f *Element, g *Element) (*Element, error)
- func Negate(f *Element) *Element
- func NthVariable(R *Parent, n int) (*Element, error)
- func One(R *Parent) *Element
- func Power(f *Element, k *integer.Element) (*Element, error)
- func PowerInt64(f *Element, k int64) (*Element, error)
- func Subtract(f *Element, g *Element) (*Element, error)
- func Sum(R *Parent, S ...*Element) (*Element, error)
- func ToElement(R *Parent, f object.Element) (*Element, error)
- func ToMonomial(R *Parent, m *integervector.Element) (*Element, error)
- func ToTerm(R *Parent, c *rational.Element, m *integervector.Element) (*Element, error)
- func Variables(R *Parent) []*Element
- func Zero(R *Parent) *Element
- func (f *Element) Coefficient(m *integervector.Element) (*rational.Element, error)
- func (f *Element) Coefficients() []*rational.Element
- func (f *Element) CoefficientsAndExponents() (cs []*rational.Element, es []*integervector.Element)
- func (f *Element) ConstantCoefficient() *rational.Element
- func (f *Element) Degree() (*integervector.Element, error)
- func (f *Element) Derivative(k int) (*Element, error)
- func (f *Element) Exponents() []*integervector.Element
- func (f *Element) GobDecode(buf []byte) error
- func (f *Element) GobEncode() ([]byte, error)
- func (f *Element) Hash() hash.Value
- func (f *Element) IsConstant() (bool, *rational.Element)
- func (f *Element) IsEqualTo(g *Element) bool
- func (f *Element) IsMonic() bool
- func (f *Element) IsMonomial() bool
- func (f *Element) IsNthVariable(n int) (bool, error)
- func (f *Element) IsOne() bool
- func (f *Element) IsTerm() bool
- func (f *Element) IsZero() bool
- func (f *Element) LeadingCoefficient() *rational.Element
- func (f *Element) LeadingMonomial() (*Element, error)
- func (f *Element) LeadingTerm() *Element
- func (f *Element) Negate() *Element
- func (f *Element) NthDerivative(k int, n int) (*Element, error)
- func (f *Element) Parent() object.Parent
- func (f *Element) Power(k *integer.Element) (*Element, error)
- func (f *Element) PowerInt64(k int64) (*Element, error)
- func (f *Element) ScalarMultiplyByCoefficient(a *rational.Element) (*Element, error)
- func (f *Element) ScalarMultiplyByInt64(n int64) *Element
- func (f *Element) ScalarMultiplyByInteger(n *integer.Element) *Element
- func (f *Element) String() string
- func (f *Element) Terms() []*Element
- func (f *Element) Valuation() (*integervector.Element, error)
- type Parent
- func (R *Parent) Add(f object.Element, g object.Element) (object.Element, error)
- func (R *Parent) AreEqual(f object.Element, g object.Element) (bool, error)
- func (R *Parent) AssignName(name string)
- func (R *Parent) AssignVariableName(name string, i int) error
- func (R *Parent) CmpLeadingMonomial(f object.Element, g object.Element) (int, error)
- func (R *Parent) Coefficient(f object.Element, m object.Element) (object.Element, error)
- func (R *Parent) CoefficientRing() ring.Interface
- func (R *Parent) Coefficients(f object.Element) ([]object.Element, error)
- func (R *Parent) CoefficientsAndExponents(f object.Element) (cs []object.Element, es []object.Element, err error)
- func (R *Parent) ConstantCoefficient(f object.Element) (object.Element, error)
- func (R *Parent) Contains(f object.Element) bool
- func (R *Parent) Degree(f object.Element) (object.Element, error)
- func (R *Parent) Derivative(f object.Element, k int) (object.Element, error)
- func (R *Parent) ExponentMonoid() polynomial.ExponentMonoid
- func (R *Parent) Exponents(f object.Element) ([]object.Element, error)
- func (R *Parent) FromParallelSlices(cs []object.Element, es []object.Element) (*Element, error)
- func (R *Parent) IsConstant(f object.Element) (bool, object.Element, error)
- func (R *Parent) IsMonic(f object.Element) (bool, error)
- func (R *Parent) IsMonomial(f object.Element) (bool, error)
- func (R *Parent) IsNthVariable(f object.Element, n int) (bool, error)
- func (R *Parent) IsOne(f object.Element) (bool, error)
- func (R *Parent) IsTerm(f object.Element) (bool, error)
- func (R *Parent) IsZero(f object.Element) (bool, error)
- func (R *Parent) LeadingCoefficient(f object.Element) (object.Element, error)
- func (R *Parent) LeadingMonomial(f object.Element) (object.Element, error)
- func (R *Parent) LeadingTerm(f object.Element) (object.Element, error)
- func (R *Parent) Multiply(f object.Element, g object.Element) (object.Element, error)
- func (R *Parent) Negate(f object.Element) (object.Element, error)
- func (R *Parent) NthDerivative(f object.Element, k int, n int) (object.Element, error)
- func (R *Parent) NthVariable(n int) (*Element, error)
- func (R *Parent) One() object.Element
- func (R *Parent) Power(f object.Element, k *integer.Element) (object.Element, error)
- func (R *Parent) ScalarMultiplyByCoefficient(c object.Element, f object.Element) (object.Element, error)
- func (R *Parent) ScalarMultiplyByInteger(c *integer.Element, f object.Element) (object.Element, error)
- func (R *Parent) String() string
- func (R *Parent) Subtract(f object.Element, g object.Element) (object.Element, error)
- func (R *Parent) Sum(S ...object.Element) (object.Element, error)
- func (R *Parent) Terms(f object.Element) ([]object.Element, error)
- func (R *Parent) ToElement(f object.Element) (object.Element, error)
- func (R *Parent) ToMonomial(m object.Element) (object.Element, error)
- func (R *Parent) ToTerm(c object.Element, m object.Element) (object.Element, error)
- func (R *Parent) Valuation(f object.Element) (object.Element, error)
- func (R *Parent) VariableName(i int) (string, error)
- func (R *Parent) Variables() []object.Element
- func (R *Parent) Zero() object.Element
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CmpLeadingMonomial ¶
CmpLeadingMonomial returns -1 if LM(f) < LM(g), 0 if LM(f) = LM(g), and +1 if LM(f) > LM(g), were LM denotes the leading monomial. Here f and g are non-zero polynomials with the same parent.
func CoefficientRing ¶
CoefficientRing returns the coefficient ring of the polynomial ring R.
func ExponentMonoid ¶
func ExponentMonoid(R *Parent) *integervector.Parent
ExponentMonoid returns the exponent monoid of the polynomial ring R.
Types ¶
type Element ¶
type Element struct {
// contains filtered or unexported fields
}
Element describes a polynomial with rational coefficients.
func Add ¶
Add returns the sum f + g of two polynomials f and g. This will return an error if f and g do not have the same parent.
func FromInt64Slice ¶
FromInt64Slice returns a univariate polynomial in R with coefficients from the slice cs. The exponents, which must all be non-negative, begin at degree "initial" and increase in degree by "step" (which can be positive or negative).
func FromIntSlice ¶
FromIntSlice returns a univariate polynomial in R with coefficients from the slice cs. The exponents, which must all be non-negative, begin at degree "initial" and increase in degree by "step" (which can be positive or negative).
func FromIntegerSlice ¶
func FromIntegerSlice(R *Parent, initial int64, step int64, cs []*integer.Element) (*Element, error)
FromIntegerSlice returns a univariate polynomial in R with coefficients from the slice cs. The exponents, which must all be non-negative, begin at degree "initial" and increase in degree by "step" (which can be positive or negative).
func FromParallelInt64Slices ¶
FromParallelInt64Slices returns a polynomial in the univariate polynomial ring R, with parallel slices of coefficients cs and exponents es.
func FromParallelIntSlices ¶
FromParallelIntSlices returns a polynomial in the univariate polynomial ring R, with parallel slices of coefficients cs and exponents es.
func FromParallelIntegerSlices ¶
func FromParallelIntegerSlices(R *Parent, cs []*integer.Element, es []*integer.Element) (*Element, error)
FromParallelIntegerSlices returns a polynomial in the univariate polynomial ring R, with parallel slices of coefficients cs and exponents es.
func FromParallelRationalSlices ¶
func FromParallelRationalSlices(R *Parent, cs []*rational.Element, es []*integer.Element) (*Element, error)
FromParallelRationalSlices returns a polynomial in the univariate polynomial ring R, with parallel slices of coefficients cs and exponents es.
func FromParallelSlices ¶
func FromParallelSlices(R *Parent, cs []*rational.Element, es []*integervector.Element) (*Element, error)
FromParallelSlices returns a polynomial in the polynomial ring R, with parallel slices of coefficients cs and exponents es. The exponents should lie in the monoid of exponents of R.
func FromRationalSlice ¶
func FromRationalSlice(R *Parent, initial int64, step int64, cs []*rational.Element) (*Element, error)
FromRationalSlice returns a univariate polynomial in R with coefficients from the slice cs. The exponents, which must all be non-negative, begin at degree "initial" and increase in degree by "step" (which can be positive or negative).
func GobDecode ¶
GobDecode reads the next value from the given gob.Decoder and decodes it as a polynomial.
func GobDecodeSlice ¶
GobDecodeSlice reads the next value from the given gob.Decoder and decodes it as a slice of polynomials.
func Multiply ¶
Multiply returns the product f * g of two polynomials f and g. This will return an error if f and g do not have the same parent.
func NthVariable ¶
NthVariable returns the n-th variable x_n in the polynomial ring R. Here variables are indexed from 0 to rk-1 (inclusive), where rk is the rank of R.
func PowerInt64 ¶
PowerInt64 returns the power f^k of the polynomial f.
func Subtract ¶
Subtract returns the difference f - g of two polynomials f and g. This will return an error if f and g do not have the same parent.
func Sum ¶
Sum returns the sum of the polynomials in the slice S. All polynomials must have the same parent R. If S is empty, the zero element in R is returned.
func ToElement ¶
ToElement returns f as an element in the polynomial ring R with rational coefficients, if f can naturally be regarded as belonging there.
func ToMonomial ¶
func ToMonomial(R *Parent, m *integervector.Element) (*Element, error)
ToMonomial returns the monomial x^m in the polynomial ring R, where m is an element in the exponent monoid of R.
func ToTerm ¶
ToTerm returns the term c * x^m in the polynomial ring R, where c is an element in the coefficient ring of R and m is an element in the exponent monoid of R.
func Variables ¶
Variables returns the variables x_0,...,x_k of the polynomial ring R, where k+1 is equal to the rank of R.
func (*Element) Coefficient ¶
Coefficient returns the coefficient of the degree m term of the polynomial f, where m is an element of the exponent monoid. The returned coefficient will live in the coefficient ring of the parent polynomial ring.
func (*Element) Coefficients ¶
Coefficients returns a slice of coefficient of the polynomial f. Only the non-zero coefficient will be returned, hence the zero polynomial returns an empty slice. The returned coefficients will live in the coefficient ring of the parent polynomial ring.
func (*Element) CoefficientsAndExponents ¶
func (f *Element) CoefficientsAndExponents() (cs []*rational.Element, es []*integervector.Element)
CoefficientsAndExponents returns parallel slices of coefficient cs and exponents es of the polynomial f. Only the terms with non-zero coefficient will be returned, hence the zero polynomial returns a pair of empty slices. The returned coefficients will live in the coefficient ring of the parent polynomial ring. The returned exponents will live in the exponent monoid of the parent polynomial ring, and are sorted in increasing order.
func (*Element) ConstantCoefficient ¶
ConstantCoefficient returns the constant coefficient of the polynomial f. The returned coefficient will live in the coefficient ring of the parent polynomial ring.
func (*Element) Degree ¶
func (f *Element) Degree() (*integervector.Element, error)
Degree returns the degree of the non-zero polynomial f. The degree is an element of the exponent monoid of the parent polynomial ring.
func (*Element) Derivative ¶
Derivative returns the formal partial derivative df/dx_k of the polynomial f. Here the variables x_i are indexed from 0 to rk-1 (inclusive), where rk is the rank of the parent.
func (*Element) Exponents ¶
func (f *Element) Exponents() []*integervector.Element
Exponents returns a slice of exponents of the polynomial f. Only the exponents corresponding to terms with non-zero coefficient will be returned, hence the zero polynomial returns an empty slice. The returned exponents will live in the exponent monoid of the parent polynomial ring, and are sorted in increasing order.
func (*Element) GobDecode ¶
GobDecode implements the gob.GobDecoder interface. Important: Take great care that you are decoding into a new *Element; the safe way to do this is to use the GobDecode(dec *gob.Decode) function. The decoded polynomial will lie in the default parent.
func (*Element) IsConstant ¶
IsConstant returns true iff the polynomial f is a constant polynomial. If true, also returns the constant (as an element in the coefficient ring of the parent polynomial ring).
func (*Element) IsEqualTo ¶
IsEqualTo returns true iff the polynomials f and g have the same parent, and f = g.
func (*Element) IsMonic ¶
IsMonic returns true iff the polynomial f is monic (that is, if the leading coefficient of f is 1).
func (*Element) IsMonomial ¶
IsMonomial returns true iff the polynomial f is a monomial (that is, if f is of the form x^m for some m in the monoid of exponents).
func (*Element) IsNthVariable ¶
IsNthVariable returns true iff the polynomial f is the n-th variable x_n in the parent polynomial ring. Here variables are indexed from 0 to rk-1 (inclusive), where rk is the rank of the parent.
func (*Element) IsTerm ¶
IsTerm returns true iff the polynomial f is a term (that is, if f is of the form c * x^m for some c in the coefficient ring, and m in the monoid of exponents).
func (*Element) LeadingCoefficient ¶
LeadingCoefficient returns the leading coefficient of the polynomial f. The returned coefficient will live in the coefficient ring of the parent polynomial ring.
func (*Element) LeadingMonomial ¶
LeadingMonomial returns the leading monomial of the non-zero polynomial f as an element of the polynomial ring.
func (*Element) LeadingTerm ¶
LeadingTerm returns the leading term of the polynomial f.
func (*Element) NthDerivative ¶
NthDerivative returns the n-th formal partial derivative d^nf/dx_k^n of the polynomial f, where n is a non-negative integer. Here the variables x_i are indexed from 0 to rk-1 (inclusive), where rk is the rank of the parent.
func (*Element) PowerInt64 ¶
PowerInt64 returns the power f^k of the polynomial f.
func (*Element) ScalarMultiplyByCoefficient ¶
ScalarMultiplyByCoefficient returns the product a * f of the polynomial f with a, where a is an element in the coefficient ring of the parent of f.
func (*Element) ScalarMultiplyByInt64 ¶
ScalarMultiplyByInt64 returns the scalar multiple n * f of the polynomial f with the integer n, where this is defined to be f + ... + f (n times) if n is positive, -f - ... - f (|n| times) if n is negative, and 0 if n is zero.
func (*Element) ScalarMultiplyByInteger ¶
ScalarMultiplyByInteger returns the scalar multiple n * f of the polynomial f with the integer n, where this is defined to be f + ... + f (n times) if n is positive, -f - ... - f (|n| times) if n is negative, and 0 if n is zero.
type Parent ¶
type Parent struct {
// contains filtered or unexported fields
}
Parent describes a polynomial ring with rational coefficients.
func DefaultRing ¶
func DefaultRing(rk int, order monomialorder.Type) (*Parent, error)
DefaultRing returns the default polynomial ring over QQ of given rank and monomial order.
func DefaultUnivariateRing ¶
func DefaultUnivariateRing() *Parent
DefaultUnivariateRing returns the default univariate polynomial ring over QQ.
func NewRing ¶
func NewRing(rk int, order monomialorder.Type) (*Parent, error)
NewRing returns a new polynomial ring over QQ of given rank and monomial order.
func NewUnivariateRing ¶
func NewUnivariateRing() *Parent
NewUnivariateRing returns a new univariate polynomial ring over QQ.
func (*Parent) AreEqual ¶
AreEqual returns true iff f and g are both contained in the polynomial ring R, and f = g.
func (*Parent) AssignName ¶
AssignName assigns a name to the polynomial ring R to be used in printing.
func (*Parent) AssignVariableName ¶
AssignVariableName assigns a name to the i-th variable of the polynomial ring R to be used in printing. The variables are indexed from 0 up to rank - 1 (inclusive).
func (*Parent) CmpLeadingMonomial ¶
CmpLeadingMonomial returns -1 if LM(f) < LM(g), 0 if LM(f) = LM(g), and +1 if LM(f) > LM(g), were LM denotes the leading monomial, and f and g are non-zero {{polynomials}}s in the ring R.
func (*Parent) Coefficient ¶
Coefficient returns the coefficient of the degree m term of the polynomial f, where m is an element of the exponent monoid of R. The returned coefficient will live in the coefficient ring of R.
func (*Parent) CoefficientRing ¶
CoefficientRing returns the ring of coefficients of the polynomial ring R.
func (*Parent) Coefficients ¶
Coefficients returns a slice of coefficient of the polynomial f. Only the non-zero coefficient will be returned, hence the zero polynomial returns an empty slice. The returned coefficients will live in the coefficient ring of R.
func (*Parent) CoefficientsAndExponents ¶
func (R *Parent) CoefficientsAndExponents(f object.Element) (cs []object.Element, es []object.Element, err error)
CoefficientsAndExponents returns two parallel slices of coefficients cs and exponents es of the polynomial f. Only the non-zero coefficient will be returned, hence the zero polynomial returns as pair of empty slice. The returned coefficients cs will live in the coefficient ring of R. The returned exponents es will live in the exponent monoid of R, and are sorted in increasing order.
func (*Parent) ConstantCoefficient ¶
ConstantCoefficient returns the constant coefficient of the polynomial f. The returned coefficient will live in the coefficient ring of R.
func (*Parent) Contains ¶
Contains returns true iff f is a polynomial in the ring R, or can naturally be regarded as such. Note that we do not allow a natural isomorphism between two different polynomial rings.
func (*Parent) Degree ¶
Degree returns the degree of the non-zero polynomial f. The returned exponent will live in the exponent monoid of R.
func (*Parent) Derivative ¶
Derivative returns the formal partial derivative df/dx_k of the polynomial f. Here the variables x_i are indexed from 0 to rk-1 (inclusive), where rk is the rank of the exponent monoid of R.
func (*Parent) ExponentMonoid ¶
func (R *Parent) ExponentMonoid() polynomial.ExponentMonoid
ExponentMonoid returns the monoid of exponents of the polynomial ring R.
func (*Parent) Exponents ¶
Exponents returns a slice of exponents of the polynomial f. Only the exponents corresponding to terms with non-zero coefficient will be returned, hence the zero polynomial returns an empty slice. The returned exponents will live in the exponent monoid of R, and are sorted in increasing order.
func (*Parent) FromParallelSlices ¶
FromParallelSlices returns a polynomial in the polynomial ring R, with parallel slices of coefficients cs and exponents es. The coefficients should lie in the coefficient ring of R, and the exponents should lie in the exponents ring of R.
func (*Parent) IsConstant ¶
IsConstant returns true iff f is a constant polynomial in the polynomial ring R. If true, also returns the constant (as an element in the coefficient ring of R).
func (*Parent) IsMonic ¶
IsMonic returns true iff f is a monic polynomial (that is, if the leading coefficient of f is 1).
func (*Parent) IsMonomial ¶
IsMonomial returns true iff the polynomial f is a monomial (that is, if f is of the form x^m for some m in the exponent monoid of R).
func (*Parent) IsNthVariable ¶
IsNthVariable returns true iff the polynomial f is the n-th variable x_n in the polynomial ring R. Here variables are indexed from 0 to rk-1 (inclusive), where rk is the rank of R.
func (*Parent) IsOne ¶
IsOne returns true iff f is the constant polynomial 1 in the polynomial ring R.
func (*Parent) IsTerm ¶
IsTerm returns true iff the polynomial f is a term (that is, if f is of the form c * x^n for some c in the coefficient ring of R and m in the exponent monoid of R).
func (*Parent) LeadingCoefficient ¶
LeadingCoefficient returns the leading coefficient of the polynomial f. The returned coefficient will live in the coefficient ring of R.
func (*Parent) LeadingMonomial ¶
LeadingMonomial returns the leading monomial of the non-zero polynomial f.
func (*Parent) LeadingTerm ¶
LeadingTerm returns the leading term of the polynomial f.
func (*Parent) Multiply ¶
Multiply returns the product f * g of the polynomials f and g in the polynomial ring R.
func (*Parent) NthDerivative ¶
NthDerivative returns the n-th formal partial derivative d^nf/dx_k^n of the polynomial f, where n is a non-negative integer. Here the variables x_i are indexed from 0 to rk-1 (inclusive), where rk is the rank of the exponent monoid of R.
func (*Parent) NthVariable ¶
NthVariable returns the n-th variable x_n in the polynomial ring R. Here variables are indexed from 0 to rk-1 (inclusive), where rk is the rank of R.
func (*Parent) Power ¶
Power returns f^k, where k is a non-negative integer and f is a polynomial in the ring R.
func (*Parent) ScalarMultiplyByCoefficient ¶
func (R *Parent) ScalarMultiplyByCoefficient(c object.Element, f object.Element) (object.Element, error)
ScalarMultiplyByCoefficient returns the product c * f, where c is an element in the coefficient ring of R, and f is an element of the polynomial ring R.
func (*Parent) ScalarMultiplyByInteger ¶
func (R *Parent) ScalarMultiplyByInteger(c *integer.Element, f object.Element) (object.Element, error)
ScalarMultiplyByInteger returns c * f, where this is defined to be f + ... + f (c times) if c is positive, -f - ... - f (|c| times) if c is negative, and 0 if c is zero. Here f is an element of the polynomial ring R.
func (*Parent) Subtract ¶
Subtract returns the difference f - g of the polynomials f and g in the ring R.
func (*Parent) Sum ¶
Sum returns the sum of the polynomials in the slice S. All polynomials must have the same parent R. If S is empty, the zero element in the polynomial ring R is returned.
func (*Parent) Terms ¶
Terms returns the non-zero terms of the polynomial f, sorted in increasing exponent order.
func (*Parent) ToElement ¶
ToElement returns f as an element in the polynomial ring R, or an error if f cannot naturally be regarded as an element of R.
func (*Parent) ToMonomial ¶
ToMonomial returns the monomial x^m in the polynomial ring R, where m lies in the exponent monoid of R.
func (*Parent) ToTerm ¶
ToTerm returns the term c * x^m in the polynomial ring R, where c lies in the coefficient ring of R and m lies in the exponent monoid of R.
func (*Parent) Valuation ¶
Valuation returns the exponent of the smallest non-zero term of the non-zero polynomial f. This is returned as an element of the exponent monoid of R.
func (*Parent) VariableName ¶
VariableName returns the name to be used in printing of the i-th variable of the polynomial ring R. The variables are indexed from 0 up to rank - 1 (inclusive).