Package edu.jas.arith
Class ProductRing<C extends RingElem<C>>
java.lang.Object
edu.jas.arith.ProductRing<C>
- All Implemented Interfaces:
AbelianGroupFactory<Product<C>>
,ElemFactory<Product<C>>
,MonoidFactory<Product<C>>
,RingFactory<Product<C>>
,Serializable
Direct product ring factory based on RingElem and RingFactory module. Objects
of this class are mutable.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final org.apache.logging.log4j.Logger
protected int
Ring factory is n copies.protected static final Random
A default random sequence generator.protected final RingFactory
<C> One Ring factory.protected final List
<RingFactory<C>> Ring factory list. -
Constructor Summary
ConstructorsConstructorDescriptionProductRing
(RingFactory<C> r, int n) The constructor creates a ProductRing object from an ring factory and a modul.ProductRing
(List<RingFactory<C>> l) The constructor creates a ProductRing object from an ring factory and a modul. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addFactory
(RingFactory<C> rf) Add a ring factory.Characteristic of this ring.boolean
containsFactory
(RingFactory<C> rf) Contains a ring factory.Copy Product element c.boolean
Comparison with any other object.fromInteger
(long a) Get a Product element from a long value.Get a Product element from a BigInteger value.Get a list of the generating elements.getAtomic
(int i) Get an atomic element.getFactory
(int i) Get ring factory at index i.getONE()
Get the one element.getZERO()
Get the zero element.int
hashCode()
Hash code for this product ring.boolean
Query if this ring is associative.boolean
Query if this ring is commutative.boolean
isField()
Query if this ring is a field.boolean
isFinite()
Is this structure finite or infinite.int
length()
Get the number of factors of this ring.boolean
Query if this ring consists only of fields.Parse Product from Reader.Parse Product from String.random
(int n) Product random.random
(int n, float q) Product random.Product random.Product random.toScript()
Get a scripting compatible string representation.toString()
Get the String representation as RingFactory.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface edu.jas.structure.ElemFactory
valueOf
-
Field Details
-
logger
private static final org.apache.logging.log4j.Logger logger -
nCopies
protected int nCopiesRing factory is n copies. -
ring
One Ring factory. -
ringList
Ring factory list. -
random
A default random sequence generator.
-
-
Constructor Details
-
ProductRing
The constructor creates a ProductRing object from an ring factory and a modul.- Parameters:
r
- ring factory.n
- number of copies.
-
ProductRing
The constructor creates a ProductRing object from an ring factory and a modul.- Parameters:
l
- list of ring factories.
-
-
Method Details
-
getFactory
Get ring factory at index i.- Parameters:
i
- index.- Returns:
- RingFactory_i.
-
addFactory
Add a ring factory.- Parameters:
rf
- new ring factory.
-
containsFactory
Contains a ring factory.- Parameters:
rf
- ring factory.- Returns:
- true, if rf is contained in this, else false.
-
isFinite
public boolean isFinite()Is this structure finite or infinite.- Specified by:
isFinite
in interfaceElemFactory<C extends RingElem<C>>
- Returns:
- true if this structure is finite, else false.
- See Also:
-
copy
Copy Product element c.- Specified by:
copy
in interfaceElemFactory<C extends RingElem<C>>
- Parameters:
c
-- Returns:
- a copy of c.
-
getZERO
Get the zero element.- Specified by:
getZERO
in interfaceAbelianGroupFactory<C extends RingElem<C>>
- Returns:
- 0 as Product.
-
getONE
Get the one element.- Specified by:
getONE
in interfaceMonoidFactory<C extends RingElem<C>>
- Returns:
- 1 as Product.
-
generators
Get a list of the generating elements.- Specified by:
generators
in interfaceElemFactory<C extends RingElem<C>>
- Returns:
- list of generators for the algebraic structure.
- See Also:
-
getAtomic
Get an atomic element.- Parameters:
i
- index.- Returns:
- e_i as Product.
-
length
public int length()Get the number of factors of this ring.- Returns:
- nCopies or ringList.size().
-
isCommutative
public boolean isCommutative()Query if this ring is commutative.- Specified by:
isCommutative
in interfaceMonoidFactory<C extends RingElem<C>>
- Returns:
- true if this ring is commutative, else false.
-
isAssociative
public boolean isAssociative()Query if this ring is associative.- Specified by:
isAssociative
in interfaceMonoidFactory<C extends RingElem<C>>
- Returns:
- true if this ring is associative, else false.
-
isField
public boolean isField()Query if this ring is a field.- Specified by:
isField
in interfaceRingFactory<C extends RingElem<C>>
- Returns:
- true or false.
-
onlyFields
public boolean onlyFields()Query if this ring consists only of fields.- Returns:
- true or false.
-
characteristic
Characteristic of this ring.- Specified by:
characteristic
in interfaceRingFactory<C extends RingElem<C>>
- Returns:
- minimal characteristic of ring component.
-
fromInteger
Get a Product element from a BigInteger value.- Specified by:
fromInteger
in interfaceElemFactory<C extends RingElem<C>>
- Parameters:
a
- BigInteger.- Returns:
- a Product.
-
fromInteger
Get a Product element from a long value.- Specified by:
fromInteger
in interfaceElemFactory<C extends RingElem<C>>
- Parameters:
a
- long.- Returns:
- a Product.
-
toString
Get the String representation as RingFactory. -
toScript
Get a scripting compatible string representation.- Specified by:
toScript
in interfaceElemFactory<C extends RingElem<C>>
- Returns:
- script compatible representation for this ElemFactory.
- See Also:
-
equals
Comparison with any other object. -
hashCode
public int hashCode()Hash code for this product ring. -
random
Product random.- Specified by:
random
in interfaceElemFactory<C extends RingElem<C>>
- Parameters:
n
- such that 0 ≤ v ≤ (2n-1).- Returns:
- a random product element v.
-
random
Product random.- Parameters:
n
- such that 0 ≤ v ≤ (2n-1).q
- density of nozero entries.- Returns:
- a random product element v.
-
random
Product random.- Specified by:
random
in interfaceElemFactory<C extends RingElem<C>>
- Parameters:
n
- such that 0 ≤ v ≤ (2n-1).rnd
- is a source for random bits.- Returns:
- a random product element v.
-
random
Product random.- Parameters:
n
- such that 0 ≤ v ≤ (2n-1).q
- density of nozero entries.rnd
- is a source for random bits.- Returns:
- a random product element v.
-
parse
Parse Product from String.- Specified by:
parse
in interfaceElemFactory<C extends RingElem<C>>
- Parameters:
s
- String.- Returns:
- Product from s.
-
parse
Parse Product from Reader. Syntax: p1 ... pn (no commas)- Specified by:
parse
in interfaceElemFactory<C extends RingElem<C>>
- Parameters:
r
- Reader.- Returns:
- next Product from r.
-