NZMATH
1.2.0
About: NZMATH is a Python based number theory oriented calculation system.
![]() ![]() |
Public Member Functions | |
def | __init__ (self) |
def | __divmod__ (self, other) |
def | __floordiv__ (self, other) |
def | __mod__ (self, other) |
def | mod (self, dividend) |
def | mod_pow (self, polynom, index) |
def | __truediv__ (self, other) |
def | scalar_exact_division (self, scale) |
def | gcd (self, other) |
def | extgcd (self, other) |
Private Member Functions | |
def | _populate_reduced (self, degree, lc, upperbound) |
def | _populate_reduced_more (self, degrees) |
Private Attributes | |
_reduced | |
DivisionProvider provides all kind of divisions for univariate polynomials. It is assumed that the coefficient ring of the polynomials is a field. The class should be used as a mix-in. REQUIRE: OrderProvider
Definition at line 78 of file uniutil.py.
def nzmath.poly.uniutil.DivisionProvider.__init__ | ( | self | ) |
Do not instantiate DivisionProvider. This initializer should be called from descendant.
Definition at line 88 of file uniutil.py.
References nzmath.matrix.Matrix.__class__, nzmath.matrix.RingMatrix.__class__, nzmath.matrix.RingSquareMatrix.__class__, nzmath.matrix.FieldMatrix.__class__, nzmath.matrix.MatrixRing.__class__, and nzmath.matrix.Subspace.__class__.
def nzmath.poly.uniutil.DivisionProvider.__divmod__ | ( | self, | |
other | |||
) |
divmod(self, other) The method does, as the built-in divmod, return a tuple of (self // other, self % other).
Definition at line 97 of file uniutil.py.
References nzmath.poly.univar.PolynomialInterface.construct_with_default(), nzmath.poly.formalsum.FormalSumContainerInterface.construct_with_default(), nzmath.poly.formalsum.DictFormalSum.construct_with_default(), nzmath.poly.multivar.BasicPolynomial.construct_with_default(), nzmath.poly.formalsum.ListFormalSum.construct_with_default(), nzmath.poly.multiutil.OrderProvider.order, nzmath.poly.uniutil.OrderProvider.order, nzmath.finitefield.FiniteField.order(), nzmath.finitefield.FinitePrimeFieldElement.order(), nzmath.permute.Permute.order(), nzmath.group.GroupElement.order(), nzmath.permute.ExPermute.order(), and nzmath.elliptic.ECoverGF.order().
def nzmath.poly.uniutil.DivisionProvider.__floordiv__ | ( | self, | |
other | |||
) |
self // other
Definition at line 114 of file uniutil.py.
References nzmath.poly.univar.PolynomialInterface.construct_with_default(), nzmath.poly.formalsum.FormalSumContainerInterface.construct_with_default(), nzmath.poly.formalsum.DictFormalSum.construct_with_default(), nzmath.poly.multivar.BasicPolynomial.construct_with_default(), nzmath.poly.formalsum.ListFormalSum.construct_with_default(), nzmath.poly.multiutil.OrderProvider.order, nzmath.poly.uniutil.OrderProvider.order, nzmath.finitefield.FiniteField.order(), nzmath.finitefield.FinitePrimeFieldElement.order(), nzmath.permute.Permute.order(), nzmath.group.GroupElement.order(), nzmath.permute.ExPermute.order(), and nzmath.elliptic.ECoverGF.order().
def nzmath.poly.uniutil.DivisionProvider.__mod__ | ( | self, | |
other | |||
) |
self % other
Definition at line 127 of file uniutil.py.
References nzmath.poly.multiutil.OrderProvider.order, nzmath.poly.uniutil.OrderProvider.order, nzmath.finitefield.FiniteField.order(), nzmath.finitefield.FinitePrimeFieldElement.order(), nzmath.permute.Permute.order(), nzmath.group.GroupElement.order(), nzmath.permute.ExPermute.order(), and nzmath.elliptic.ECoverGF.order().
def nzmath.poly.uniutil.DivisionProvider.__truediv__ | ( | self, | |
other | |||
) |
self / other The result is a rational function.
Definition at line 285 of file uniutil.py.
|
private |
Populate self._reduced. degree, lc is of self, and self._reduced is populated up to the given upperbound.
Definition at line 202 of file uniutil.py.
References nzmath.poly.uniutil.DivisionProvider._reduced, nzmath.poly.univar.PolynomialInterface.construct_with_default(), nzmath.poly.formalsum.FormalSumContainerInterface.construct_with_default(), nzmath.poly.formalsum.DictFormalSum.construct_with_default(), nzmath.poly.multivar.BasicPolynomial.construct_with_default(), nzmath.poly.formalsum.ListFormalSum.construct_with_default(), nzmath.poly.formalsum.FormalSumContainerInterface.itercoefficients(), nzmath.poly.univar.BasicPolynomial.itercoefficients(), nzmath.poly.formalsum.DictFormalSum.itercoefficients(), nzmath.poly.multivar.BasicPolynomial.itercoefficients(), nzmath.poly.formalsum.ListFormalSum.itercoefficients(), nzmath.poly.univar.SortedPolynomial.itercoefficients(), nzmath.poly.multiutil.OrderProvider.order, nzmath.poly.uniutil.OrderProvider.order, nzmath.finitefield.FiniteField.order(), nzmath.finitefield.FinitePrimeFieldElement.order(), nzmath.permute.Permute.order(), nzmath.group.GroupElement.order(), nzmath.permute.ExPermute.order(), nzmath.elliptic.ECoverGF.order(), nzmath.bigrange.range(), nzmath.poly.univar.PolynomialInterface.scalar_mul(), nzmath.poly.array.ArrayPoly.scalar_mul(), nzmath.poly.multivar.BasicPolynomial.scalar_mul(), nzmath.poly.array.ArrayPolyMod.scalar_mul(), nzmath.poly.formalsum.DictFormalSum.scalar_mul(), nzmath.poly.formalsum.ListFormalSum.scalar_mul(), and nzmath.poly.univar.SortedPolynomial.scalar_mul().
Referenced by nzmath.poly.uniutil.DivisionProvider.mod().
|
private |
Populate self._reduced more for much higher degree dividend. This method has to be called after _populate_reduced. self._reduced is populated so that it will include all of degrees > degree * 2. The degrees are recommended to be sorted in descending order.
Definition at line 223 of file uniutil.py.
References nzmath.poly.uniutil.DivisionProvider._populate_reduced_more(), nzmath.poly.uniutil.DivisionProvider._reduced, nzmath.poly.uniutil.DivisionProvider.mod(), nzmath.poly.array.ArrayPolyMod.mod, nzmath.poly.multiutil.OrderProvider.order, nzmath.poly.uniutil.OrderProvider.order, nzmath.finitefield.FiniteField.order(), nzmath.finitefield.FinitePrimeFieldElement.order(), nzmath.permute.Permute.order(), nzmath.group.GroupElement.order(), nzmath.permute.ExPermute.order(), and nzmath.elliptic.ECoverGF.order().
Referenced by nzmath.poly.uniutil.DivisionProvider._populate_reduced_more(), and nzmath.poly.uniutil.DivisionProvider.mod().
def nzmath.poly.uniutil.DivisionProvider.extgcd | ( | self, | |
other | |||
) |
Return a tuple (u, v, d); they are the greatest common divisor d of two polynomials self and other and u, v such that d = self * u + other * v. see nzmath.gcd.extgcd
Definition at line 316 of file uniutil.py.
References nzmath.poly.ratfunc.RationalFunction.getRing(), nzmath.poly.multiutil.RingElementProvider.getRing(), nzmath.real.Real.getRing(), nzmath.finitefield.FinitePrimeFieldElement.getRing(), nzmath.imaginary.Complex.getRing(), nzmath.intresidue.IntegerResidueClass.getRing(), nzmath.ring.RingElement.getRing(), nzmath.poly.multiutil.RingPolynomial.getRing(), nzmath.finitefield.ExtendedFieldElement.getRing(), nzmath.rational.Rational.getRing(), nzmath.algfield.BasicAlgNumber.getRing(), nzmath.ring.ResidueClass.getRing(), nzmath.algfield.MatAlgNumber.getRing(), nzmath.rational.Integer.getRing(), nzmath.matrix.RingSquareMatrix.getRing(), nzmath.poly.uniutil.RingElementProvider.getRing(), nzmath.poly.uniutil.RingPolynomial.getRing(), nzmath.poly.multiutil.OrderProvider.order, nzmath.poly.uniutil.OrderProvider.order, nzmath.finitefield.FiniteField.order(), nzmath.finitefield.FinitePrimeFieldElement.order(), nzmath.permute.Permute.order(), nzmath.group.GroupElement.order(), nzmath.permute.ExPermute.order(), and nzmath.elliptic.ECoverGF.order().
def nzmath.poly.uniutil.DivisionProvider.gcd | ( | self, | |
other | |||
) |
Return a greatest common divisor of self and other. Returned polynomial is always monic.
Definition at line 300 of file uniutil.py.
References nzmath.poly.multiutil.OrderProvider.order, nzmath.poly.uniutil.OrderProvider.order, nzmath.finitefield.FiniteField.order(), nzmath.finitefield.FinitePrimeFieldElement.order(), nzmath.permute.Permute.order(), nzmath.group.GroupElement.order(), nzmath.permute.ExPermute.order(), and nzmath.elliptic.ECoverGF.order().
Referenced by nzmath.rational.IntegerRing.lcm().
def nzmath.poly.uniutil.DivisionProvider.mod | ( | self, | |
dividend | |||
) |
Return dividend % self. self should have attribute _reduced to cache reduced monomials.
Definition at line 143 of file uniutil.py.
References nzmath.poly.uniutil.DivisionProvider._populate_reduced(), nzmath.poly.uniutil.DivisionProvider._populate_reduced_more(), nzmath.poly.uniutil.DivisionProvider._reduced, nzmath.poly.univar.PolynomialInterface.construct_with_default(), nzmath.poly.formalsum.FormalSumContainerInterface.construct_with_default(), nzmath.poly.formalsum.DictFormalSum.construct_with_default(), nzmath.poly.multivar.BasicPolynomial.construct_with_default(), nzmath.poly.formalsum.ListFormalSum.construct_with_default(), nzmath.poly.multiutil.OrderProvider.order, nzmath.poly.uniutil.OrderProvider.order, nzmath.finitefield.FiniteField.order(), nzmath.finitefield.FinitePrimeFieldElement.order(), nzmath.permute.Permute.order(), nzmath.group.GroupElement.order(), nzmath.permute.ExPermute.order(), and nzmath.elliptic.ECoverGF.order().
Referenced by nzmath.poly.uniutil.DivisionProvider._populate_reduced_more(), nzmath.poly.uniutil.PrimeCharacteristicFunctionsProvider._small_index_mod_pow(), nzmath.poly.uniutil.DivisionProvider.mod_pow(), nzmath.poly.uniutil.PrimeCharacteristicFunctionsProvider.mod_pow(), and nzmath.poly.uniutil.PrimeCharacteristicFunctionsProvider.split_same_degrees().
def nzmath.poly.uniutil.DivisionProvider.mod_pow | ( | self, | |
polynom, | |||
index | |||
) |
Return polynom ** index % self.
Definition at line 179 of file uniutil.py.
References nzmath.poly.univar.PolynomialInterface.construct_with_default(), nzmath.poly.formalsum.FormalSumContainerInterface.construct_with_default(), nzmath.poly.formalsum.DictFormalSum.construct_with_default(), nzmath.poly.multivar.BasicPolynomial.construct_with_default(), nzmath.poly.formalsum.ListFormalSum.construct_with_default(), nzmath.poly.ratfunc.RationalFunction.getRing(), nzmath.poly.multiutil.RingElementProvider.getRing(), nzmath.real.Real.getRing(), nzmath.finitefield.FinitePrimeFieldElement.getRing(), nzmath.imaginary.Complex.getRing(), nzmath.intresidue.IntegerResidueClass.getRing(), nzmath.ring.RingElement.getRing(), nzmath.poly.multiutil.RingPolynomial.getRing(), nzmath.finitefield.ExtendedFieldElement.getRing(), nzmath.rational.Rational.getRing(), nzmath.algfield.BasicAlgNumber.getRing(), nzmath.ring.ResidueClass.getRing(), nzmath.algfield.MatAlgNumber.getRing(), nzmath.rational.Integer.getRing(), nzmath.matrix.RingSquareMatrix.getRing(), nzmath.poly.uniutil.RingElementProvider.getRing(), nzmath.poly.uniutil.RingPolynomial.getRing(), nzmath.poly.uniutil.DivisionProvider.mod(), and nzmath.poly.array.ArrayPolyMod.mod.
def nzmath.poly.uniutil.DivisionProvider.scalar_exact_division | ( | self, | |
scale | |||
) |
Return quotient by a scalar which can divide each coefficient exactly.
Definition at line 293 of file uniutil.py.
References nzmath.poly.formalsum.FormalSumContainerInterface.coefficients_map().
Referenced by nzmath.poly.uniutil.PrimeCharacteristicFunctionsProvider.factor(), and nzmath.poly.uniutil.ContentProvider.primitive_part().
|
private |
Definition at line 95 of file uniutil.py.
Referenced by nzmath.poly.uniutil.DivisionProvider._populate_reduced(), nzmath.poly.uniutil.DivisionProvider._populate_reduced_more(), and nzmath.poly.uniutil.DivisionProvider.mod().