NZMATH  1.2.0
About: NZMATH is a Python based number theory oriented calculation system.
  Fossies Dox: NZMATH-1.2.0.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

nzmath.factor.util.FactoringInteger Class Reference
Inheritance diagram for nzmath.factor.util.FactoringInteger:
[legend]
Collaboration diagram for nzmath.factor.util.FactoringInteger:
[legend]

Public Member Functions

def __init__ (self, number)
 
def register (self, divisor, isprime=Unknown)
 
def replace (self, number, factors)
 
def getMatchingFactor (self, number)
 
def getCompositeFactor (self)
 
def getNextTarget (self, cond=None)
 
def getResult (self)
 
def setPrimality (self, number, isprime)
 
def sortFactors (self)
 

Public Attributes

 number
 
 factors
 
 primality
 

Detailed Description

A class for keeping track of factorization.

Definition at line 141 of file util.py.

Constructor & Destructor Documentation

◆ __init__()

def nzmath.factor.util.FactoringInteger.__init__ (   self,
  number 
)
The given number must be a composite.

Definition at line 145 of file util.py.

Member Function Documentation

◆ getCompositeFactor()

def nzmath.factor.util.FactoringInteger.getCompositeFactor (   self)
Return a composite (or unknown primality) factor from factors
in a form (base, index), whose base's primality is non-True.

If there is no such factor, LookupError will be raised.

Definition at line 218 of file util.py.

References nzmath.factor.misc.FactoredInteger.factors, nzmath.factor.util.FactoringInteger.factors, and nzmath.factor.util.FactoringInteger.primality.

◆ getMatchingFactor()

def nzmath.factor.util.FactoringInteger.getMatchingFactor (   self,
  number 
)
Find a factor matching to number.

Definition at line 208 of file util.py.

References nzmath.factor.misc.FactoredInteger.factors, and nzmath.factor.util.FactoringInteger.factors.

Referenced by nzmath.factor.util.FactoringInteger.replace().

◆ getNextTarget()

def nzmath.factor.util.FactoringInteger.getNextTarget (   self,
  cond = None 
)
Return the next target which meets 'cond'.  if 'cond' is not
specified, then the next target is a composite (or unknown
primality) factor of self.number.  'cond' can be a binary
(arguments are base and index) predicate.

If there is no such factor, LookupError will be raised.

Definition at line 231 of file util.py.

References nzmath.factor.misc.FactoredInteger.factors, nzmath.factor.util.FactoringInteger.factors, and nzmath.factor.util.FactoringInteger.primality.

◆ getResult()

def nzmath.factor.util.FactoringInteger.getResult (   self)
Return the factors in the form of [(base, index), ...].

Definition at line 248 of file util.py.

References nzmath.factor.misc.FactoredInteger.factors, and nzmath.factor.util.FactoringInteger.factors.

◆ register()

def nzmath.factor.util.FactoringInteger.register (   self,
  divisor,
  isprime = Unknown 
)
Register a divisor of the number, if the divisor is a true
divisor of the number.  The number is divided by the divisor
as many times as possible.

Definition at line 153 of file util.py.

References nzmath.factor.misc.FactoredInteger.factors, nzmath.factor.util.FactoringInteger.factors, nzmath.factor.util.FactoringInteger.primality, nzmath.factor.util.FactoringInteger.register(), nzmath.factor.util.FactoringInteger.replace(), and nzmath.factor.util.FactoringInteger.setPrimality().

Referenced by nzmath.factor.util.FactoringInteger.register().

◆ replace()

def nzmath.factor.util.FactoringInteger.replace (   self,
  number,
  factors 
)
Replace a number with factors.
The number is a one of known factors of tracked number.
factors is a list of (base, index) pairs.
It is assumed that number = product of factors.

Definition at line 185 of file util.py.

References nzmath.factor.misc.FactoredInteger.factors, nzmath.factor.util.FactoringInteger.factors, nzmath.factor.util.FactoringInteger.getMatchingFactor(), nzmath.factor.util.FactoringInteger.primality, and nzmath.factor.util.FactoringInteger.setPrimality().

Referenced by nzmath.factor.util.FactoringInteger.register().

◆ setPrimality()

def nzmath.factor.util.FactoringInteger.setPrimality (   self,
  number,
  isprime 
)
Set primality for number to isprime.

Definition at line 254 of file util.py.

References nzmath.factor.util.FactoringInteger.primality.

Referenced by nzmath.factor.util.FactoringInteger.register(), and nzmath.factor.util.FactoringInteger.replace().

◆ sortFactors()

def nzmath.factor.util.FactoringInteger.sortFactors (   self)
Sort factors list. Return nothing.

Definition at line 260 of file util.py.

References nzmath.factor.misc.FactoredInteger.factors, and nzmath.factor.util.FactoringInteger.factors.

Member Data Documentation

◆ factors

◆ number

nzmath.factor.util.FactoringInteger.number

Definition at line 149 of file util.py.

◆ primality


The documentation for this class was generated from the following file: