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.poly.formalsum.DictFormalSum Class Reference
Inheritance diagram for nzmath.poly.formalsum.DictFormalSum:
[legend]
Collaboration diagram for nzmath.poly.formalsum.DictFormalSum:
[legend]

Public Member Functions

def __init__ (self, args, defaultvalue=None)
 
def __mul__ (self, other)
 
def scalar_mul (self, scale)
 
def __rmul__ (self, other)
 
def rscalar_mul (self, scale)
 
def __neg__ (self)
 
def __pos__ (self)
 
def __eq__ (self, other)
 
def __hash__ (self)
 
def __getitem__ (self, base)
 
def iterterms (self)
 
def itercoefficients (self)
 
def iterbases (self)
 
def __len__ (self)
 
def __repr__ (self)
 
def construct_with_default (self, maindata)
 
- Public Member Functions inherited from nzmath.poly.formalsum.FormalSumContainerInterface
def __iter__ (self)
 
def __contains__ (self, base)
 
def __ne__ (self, other)
 
def __nonzero__ (self)
 
def __add__ (self, other)
 
def __sub__ (self, other)
 
def terms (self)
 
def coefficients (self)
 
def bases (self)
 
def terms_map (self, func)
 
def coefficients_map (self, func)
 
def bases_map (self, func)
 

Private Attributes

 _data
 
 _defaultvalue
 

Detailed Description

formalsum implementation based on dict.

Definition at line 246 of file formalsum.py.

Constructor & Destructor Documentation

◆ __init__()

def nzmath.poly.formalsum.DictFormalSum.__init__ (   self,
  args,
  defaultvalue = None 
)
DictFormalSum(args)

args can be any dict initial values.
It makes a mapping from bases to coefficients.

The optional argument defaultvalue is the default value for
__getitem__, i.e., if there is no term with the specified
base, a look up attempt returns the defaultvalue.

Definition at line 250 of file formalsum.py.

Member Function Documentation

◆ __eq__()

◆ __getitem__()

def nzmath.poly.formalsum.DictFormalSum.__getitem__ (   self,
  base 
)
self[base]

no KeyError will be raised. Insteads, it returns defaultvalue
specified on time of initialization.

Reimplemented from nzmath.poly.formalsum.FormalSumContainerInterface.

Definition at line 326 of file formalsum.py.

References nzmath.poly.formalsum.DictFormalSum._data, and nzmath.poly.formalsum.DictFormalSum._defaultvalue.

◆ __hash__()

def nzmath.poly.formalsum.DictFormalSum.__hash__ (   self)

◆ __len__()

def nzmath.poly.formalsum.DictFormalSum.__len__ (   self)
len(self)

Return the number of terms.

Reimplemented from nzmath.poly.formalsum.FormalSumContainerInterface.

Definition at line 353 of file formalsum.py.

References nzmath.poly.formalsum.DictFormalSum._data.

◆ __mul__()

def nzmath.poly.formalsum.DictFormalSum.__mul__ (   self,
  other 
)

◆ __neg__()

def nzmath.poly.formalsum.DictFormalSum.__neg__ (   self)

◆ __pos__()

def nzmath.poly.formalsum.DictFormalSum.__pos__ (   self)

◆ __repr__()

◆ __rmul__()

def nzmath.poly.formalsum.DictFormalSum.__rmul__ (   self,
  other 
)
other * self

This method is invoked only when type of other does not
support multiplication with FormalSumContainerInterface.

Reimplemented from nzmath.poly.formalsum.FormalSumContainerInterface.

Definition at line 280 of file formalsum.py.

References nzmath.poly.formalsum.DictFormalSum.rscalar_mul().

◆ construct_with_default()

def nzmath.poly.formalsum.DictFormalSum.construct_with_default (   self,
  maindata 
)
Create a new formal sum container of the same class with self,
with given only the maindata and use copy of self's data if
necessary.

Reimplemented from nzmath.poly.formalsum.FormalSumContainerInterface.

Definition at line 364 of file formalsum.py.

References nzmath.matrix.Matrix.__class__, nzmath.matrix.RingMatrix.__class__, nzmath.matrix.RingSquareMatrix.__class__, nzmath.matrix.FieldMatrix.__class__, nzmath.matrix.MatrixRing.__class__, nzmath.matrix.Subspace.__class__, and nzmath.poly.formalsum.DictFormalSum._defaultvalue.

Referenced by nzmath.poly.uniutil.DivisionProvider.__divmod__(), nzmath.poly.uniutil.DivisionProvider.__floordiv__(), nzmath.poly.uniutil.PrimeCharacteristicFunctionsProvider.__pow__(), nzmath.poly.uniutil.DivisionProvider._populate_reduced(), nzmath.poly.uniutil.DivisionProvider.mod(), nzmath.poly.uniutil.DivisionProvider.mod_pow(), nzmath.poly.uniutil.PseudoDivisionProvider.monic_divmod(), nzmath.poly.uniutil.PseudoDivisionProvider.monic_floordiv(), nzmath.poly.uniutil.PseudoDivisionProvider.monic_mod(), nzmath.poly.uniutil.PseudoDivisionProvider.pseudo_divmod(), nzmath.poly.uniutil.PseudoDivisionProvider.pseudo_floordiv(), nzmath.poly.uniutil.PseudoDivisionProvider.pseudo_mod(), nzmath.poly.uniutil.PrimeCharacteristicFunctionsProvider.pthroot(), nzmath.poly.uniutil.KaratsubaProvider.ring_mul_karatsuba(), nzmath.poly.uniutil.OrderProvider.shift_degree_to(), nzmath.poly.uniutil.OrderProvider.split_at(), nzmath.poly.uniutil.PrimeCharacteristicFunctionsProvider.split_same_degrees(), and nzmath.poly.uniutil.KaratsubaProvider.square_karatsuba().

◆ iterbases()

def nzmath.poly.formalsum.DictFormalSum.iterbases (   self)
iterator for bases.

Reimplemented from nzmath.poly.formalsum.FormalSumContainerInterface.

Definition at line 347 of file formalsum.py.

References nzmath.poly.formalsum.DictFormalSum._data.

◆ itercoefficients()

◆ iterterms()

def nzmath.poly.formalsum.DictFormalSum.iterterms (   self)
iterator for (base, coefficient) pairs.

Reimplemented from nzmath.poly.formalsum.FormalSumContainerInterface.

Definition at line 335 of file formalsum.py.

References nzmath.poly.formalsum.DictFormalSum._data.

◆ rscalar_mul()

def nzmath.poly.formalsum.DictFormalSum.rscalar_mul (   self,
  scale 
)
r-scalar multiplication (r- means as of r-methods of python
special methods, where self is the right operand.)

scale * self

Definition at line 289 of file formalsum.py.

References nzmath.poly.formalsum.FormalSumContainerInterface.coefficients_map().

Referenced by nzmath.poly.formalsum.DictFormalSum.__rmul__(), and nzmath.poly.formalsum.ListFormalSum.__rmul__().

◆ scalar_mul()

Member Data Documentation

◆ _data

◆ _defaultvalue


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