In CoCoALib factorization
is a template class with all fields public.
Its purpose is to represent a (partial) factorization. The only operations
for a factorization
are the constructor and operator<<
for printing.
A factorization
contains three fields (currently they are all publicly accessible)
myFactors
contains a std::vector
of factors found (may be empty)
myMultiplicities
contains a std::vector
of the corresponding multiplicities (of type long
), one for each factor found
myRemainingFactor
contains a remaining factor (which may be just a unit)
In CoCoALib there are just two instantiations of this template:
factorization<BigInt>
for the fns factor
and SmoothFactor
in NumTheory
factorization<RingElem>
for the fns factor
and SqfreeFactor
and ContentFreeFactor
in PolyRing
(actually TmpFactor
)
The exact characteristics of the factors found depend on the function which
generated the factorization
. However the vectors in myFactors
and myMultiplicities
will be of the same length; the factors will be non-zero and non-invertible, and the
multiplicities will be strictly positive.
factorization(facs, mults, remfactor)
specifies initial values for the 3 fields
The 3 fields are currently public, so that a factorization can be modified easily by the user
(currently it is the user's responsibility to respect the conditions on the values).
Short and simple! It's all in the header file.
It would be safer to have pairs of factor-and-multiplicity rather than two separate vectors whose length must be the same. However it may be less convenient for the user.
Add member functions for adjoining or removing factor-multiplicity pairs?
2012