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.FactoringMethod Class Reference
Inheritance diagram for nzmath.factor.util.FactoringMethod:
[legend]
Collaboration diagram for nzmath.factor.util.FactoringMethod:
[legend]

Public Member Functions

def __init__ (self)
 
def factor (self, number, **options)
 
def continue_factor (self, tracker, **options)
 
def find (self, target, **options)
 
def generate (self, target, **options)
 

Properties

 verbose = property(_getVerbose, _setVerbose, None, "Verbosity: boolean")
 

Private Member Functions

def _getVerbose (self)
 
def _setVerbose (self, boolean)
 

Static Private Member Functions

def _validate_input_number (number)
 

Private Attributes

 _verbose
 

Detailed Description

Base class of factoring methods.

Definition at line 11 of file util.py.

Constructor & Destructor Documentation

◆ __init__()

Member Function Documentation

◆ _getVerbose()

def nzmath.factor.util.FactoringMethod._getVerbose (   self)
private

Definition at line 130 of file util.py.

References nzmath.factor.util.FactoringMethod._verbose.

◆ _setVerbose()

def nzmath.factor.util.FactoringMethod._setVerbose (   self,
  boolean 
)
private

Definition at line 134 of file util.py.

References nzmath.factor.util.FactoringMethod._verbose.

◆ _validate_input_number()

def nzmath.factor.util.FactoringMethod._validate_input_number (   number)
staticprivate
Return True if the given number is an integer greater than one.
Return False if the given number is equal to one.
Otherwise, raise ValueError.

Definition at line 86 of file util.py.

Referenced by nzmath.factor.util.FactoringMethod.factor(), and nzmath.factor.methods.DefaultMethod.factor().

◆ continue_factor()

def nzmath.factor.util.FactoringMethod.continue_factor (   self,
  tracker,
**  options 
)
Continue factoring and return the result of factorization.

The argument 'tracker' should be an instance of FactoringInteger.

The default returned type is FactoringInteger, but if
'return_type' is specified as 'list' then it returns
list of tuples (prime, index).
The primes are judged by a function specified in 'primeq'
optional argument, default to nzmath.prime.primeq.

Reimplemented in nzmath.factor.methods.TrialDivision.

Definition at line 49 of file util.py.

References nzmath.factor.util.FactoringMethod.find(), nzmath.factor.methods.PMinusOneMethod.find(), nzmath.factor.methods.RhoMethod.find(), nzmath.factor.methods.MPQSMethod.find(), nzmath.factor.methods.EllipticCurveMethod.find(), and nzmath.prime.primeq().

Referenced by nzmath.factor.util.FactoringMethod.generate().

◆ factor()

def nzmath.factor.util.FactoringMethod.factor (   self,
  number,
**  options 
)
Factor the given positive integer.

The default returned type is a list of tuples.  Each tuple has
a factor and its valuation, and the product is equal to the
given number.  It looks like:
  [(p1, e1), ..., (pn, en)].

an option 'return_type' is for the returned type, whose value can be:
1) 'list' for default type described above.
2) 'tracker' for FactoringInteger.

an option 'need_sort' is boolean: True to sort the result.
This should be specified with return_type='list'.

Reimplemented in nzmath.factor.methods.TrialDivision, and nzmath.factor.methods.DefaultMethod.

Definition at line 19 of file util.py.

References nzmath.factor.util.FactoringMethod._validate_input_number(), nzmath.factor.util.FactoringMethod.generate(), nzmath.factor.methods.TrialDivision.generate(), and nzmath.combinatorial.PartitionDriver.generate().

Referenced by nzmath.squarefree.SquarefreeDecompositionMethod.generate().

◆ find()

def nzmath.factor.util.FactoringMethod.find (   self,
  target,
**  options 
)
Find a factor from the target number.  The method may return 1
to indicate the factorization is incomplete.

This method must be overridden, or 'factor' method should be
overridden not to call this method.

Reimplemented in nzmath.factor.methods.EllipticCurveMethod, nzmath.factor.methods.MPQSMethod, nzmath.factor.methods.RhoMethod, and nzmath.factor.methods.PMinusOneMethod.

Definition at line 99 of file util.py.

References nzmath.factor.util.FactoringMethod.generate(), nzmath.factor.methods.TrialDivision.generate(), and nzmath.combinatorial.PartitionDriver.generate().

Referenced by nzmath.factor.util.FactoringMethod.continue_factor().

◆ generate()

def nzmath.factor.util.FactoringMethod.generate (   self,
  target,
**  options 
)
Generate prime factors of the target number with their
valuations.  The method may terminate with yielding (1, 1)
to indicate the factorization is incomplete.

This method must be overridden, or 'factor' method should be
overridden not to call this method.

Reimplemented in nzmath.factor.methods.TrialDivision.

Definition at line 110 of file util.py.

References nzmath.factor.util.FactoringMethod.continue_factor(), and nzmath.factor.methods.TrialDivision.continue_factor().

Referenced by nzmath.factor.util.FactoringMethod.factor(), nzmath.factor.util.FactoringMethod.find(), and nzmath.squarefree.SquarefreeDecompositionMethod.issquarefree().

Member Data Documentation

◆ _verbose

nzmath.factor.util.FactoringMethod._verbose
private

Property Documentation

◆ verbose

nzmath.factor.util.FactoringMethod.verbose = property(_getVerbose, _setVerbose, None, "Verbosity: boolean")
static

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