Basic functions
Functions for terms
LinearCombinations.deg
— Methoddeg(x)
Return the degree of x
. The default value of deg(x)
is 0
. (More precisely, it is LinearCombinations.Zero()
, which behaves like 0
.)
See also deg(::AbstractTensor)
, LinearCombinations.Zero
.
Traits and functions for rings
LinearCombinations.has_char2
— Functionhas_char2(::Type{R}) where R -> Bool
Return true
if the ring R
is known to have characteristic 2
and false
otherwise.
By default, has_char2
returns false
for all arguments. Changing it to true
for a ring R
avoids (possibly expensive) sign computations.
See also is_domain
.
LinearCombinations.is_domain
— Functionis_domain(::Type{R}) where R -> Bool
Return true
if the ring R
is known to be integral domain and false
otherwise. An integral domain is a commutative ring without zero divisors.
By default, is_domain
returns true
only for subtypes of Real
and Complex
. If is_domain(R) == true
, then sometimes more efficient algorithms can be chosen.
See also has_char2
.
LinearCombinations.signed
— FunctionLinearCombinations.signed(k, x)
Return a value representing (-1)^k*x
. The default definition is
signed(k, x::R) where R = has_char2(R) || iseven(k) ? x : -x
Additional methods may be needed to support more exotic coefficient types.