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>>,java.io.Serializable
public class ProductRing<C extends RingElem<C>> extends java.lang.Object implements RingFactory<Product<C>>
Direct product ring factory based on RingElem and RingFactory module. Objects of this class are mutable.- Author:
- Heinz Kredel
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected intnCopiesRing factory is n copies.protected static java.util.RandomrandomA default random sequence generator.protected RingFactory<C>ringOne Ring factory.protected java.util.List<RingFactory<C>>ringListRing factory list.
-
Constructor Summary
Constructors Constructor Description ProductRing(RingFactory<C> r, int n)The constructor creates a ProductRing object from an ring factory and a modul.ProductRing(java.util.List<RingFactory<C>> l)The constructor creates a ProductRing object from an ring factory and a modul.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddFactory(RingFactory<C> rf)Add a ring factory.java.math.BigIntegercharacteristic()Characteristic of this ring.booleancontainsFactory(RingFactory<C> rf)Contains a ring factory.Product<C>copy(Product<C> c)Copy Product element c.booleanequals(java.lang.Object b)Comparison with any other object.Product<C>fromInteger(long a)Get a Product element from a long value.Product<C>fromInteger(java.math.BigInteger a)Get a Product element from a BigInteger value.java.util.List<Product<C>>generators()Get a list of the generating elements.Product<C>getAtomic(int i)Get an atomic element.RingFactory<C>getFactory(int i)Get ring factory at index i.Product<C>getONE()Get the one element.Product<C>getZERO()Get the zero element.inthashCode()Hash code for this product ring.booleanisAssociative()Query if this ring is associative.booleanisCommutative()Query if this ring is commutative.booleanisField()Query if this ring is a field.booleanisFinite()Is this structure finite or infinite.intlength()Get the number of factors of this ring.booleanonlyFields()Query if this ring consists only of fields.Product<C>parse(java.io.Reader r)Parse Product from Reader.Product<C>parse(java.lang.String s)Parse Product from String.Product<C>random(int n)Product random.Product<C>random(int n, float q)Product random.Product<C>random(int n, float q, java.util.Random rnd)Product random.Product<C>random(int n, java.util.Random rnd)Product random.java.lang.StringtoScript()Get a scripting compatible string representation.java.lang.StringtoString()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 Detail
-
nCopies
protected int nCopies
Ring factory is n copies.
-
ring
protected final RingFactory<C extends RingElem<C>> ring
One Ring factory.
-
ringList
protected final java.util.List<RingFactory<C extends RingElem<C>>> ringList
Ring factory list.
-
random
protected static final java.util.Random random
A default random sequence generator.
-
-
Constructor Detail
-
ProductRing
public ProductRing(RingFactory<C> r, int n)
The constructor creates a ProductRing object from an ring factory and a modul.- Parameters:
r- ring factory.n- number of copies.
-
ProductRing
public ProductRing(java.util.List<RingFactory<C>> l)
The constructor creates a ProductRing object from an ring factory and a modul.- Parameters:
l- list of ring factories.
-
-
Method Detail
-
getFactory
public RingFactory<C> getFactory(int i)
Get ring factory at index i.- Parameters:
i- index.- Returns:
- RingFactory_i.
-
addFactory
public void addFactory(RingFactory<C> rf)
Add a ring factory.- Parameters:
rf- new ring factory.
-
containsFactory
public boolean containsFactory(RingFactory<C> rf)
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:
isFinitein interfaceElemFactory<C extends RingElem<C>>- Returns:
- true if this structure is finite, else false.
- See Also:
ElemFactory.isFinite()
-
copy
public Product<C> copy(Product<C> c)
Copy Product element c.- Specified by:
copyin interfaceElemFactory<C extends RingElem<C>>- Parameters:
c-- Returns:
- a copy of c.
-
getZERO
public Product<C> getZERO()
Get the zero element.- Specified by:
getZEROin interfaceAbelianGroupFactory<C extends RingElem<C>>- Returns:
- 0 as Product.
-
getONE
public Product<C> getONE()
Get the one element.- Specified by:
getONEin interfaceMonoidFactory<C extends RingElem<C>>- Returns:
- 1 as Product.
-
generators
public java.util.List<Product<C>> generators()
Get a list of the generating elements.- Specified by:
generatorsin interfaceElemFactory<C extends RingElem<C>>- Returns:
- list of generators for the algebraic structure.
- See Also:
ElemFactory.generators()
-
getAtomic
public Product<C> getAtomic(int i)
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:
isCommutativein 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:
isAssociativein 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:
isFieldin 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
public java.math.BigInteger characteristic()
Characteristic of this ring.- Specified by:
characteristicin interfaceRingFactory<C extends RingElem<C>>- Returns:
- minimal characteristic of ring component.
-
fromInteger
public Product<C> fromInteger(java.math.BigInteger a)
Get a Product element from a BigInteger value.- Specified by:
fromIntegerin interfaceElemFactory<C extends RingElem<C>>- Parameters:
a- BigInteger.- Returns:
- a Product.
-
fromInteger
public Product<C> fromInteger(long a)
Get a Product element from a long value.- Specified by:
fromIntegerin interfaceElemFactory<C extends RingElem<C>>- Parameters:
a- long.- Returns:
- a Product.
-
toString
public java.lang.String toString()
Get the String representation as RingFactory.- Overrides:
toStringin classjava.lang.Object- See Also:
Object.toString()
-
toScript
public java.lang.String toScript()
Get a scripting compatible string representation.- Specified by:
toScriptin interfaceElemFactory<C extends RingElem<C>>- Returns:
- script compatible representation for this ElemFactory.
- See Also:
ElemFactory.toScript()
-
equals
public boolean equals(java.lang.Object b)
Comparison with any other object.- Overrides:
equalsin classjava.lang.Object- See Also:
Object.equals(java.lang.Object)
-
hashCode
public int hashCode()
Hash code for this product ring.- Overrides:
hashCodein classjava.lang.Object- See Also:
Object.hashCode()
-
random
public Product<C> random(int n)
Product random.- Specified by:
randomin interfaceElemFactory<C extends RingElem<C>>- Parameters:
n- such that 0 ≤ v ≤ (2n-1).- Returns:
- a random product element v.
-
random
public Product<C> random(int n, float q)
Product random.- Parameters:
n- such that 0 ≤ v ≤ (2n-1).q- density of nozero entries.- Returns:
- a random product element v.
-
random
public Product<C> random(int n, java.util.Random rnd)
Product random.- Specified by:
randomin 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
public Product<C> random(int n, float q, java.util.Random rnd)
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
public Product<C> parse(java.lang.String s)
Parse Product from String.- Specified by:
parsein interfaceElemFactory<C extends RingElem<C>>- Parameters:
s- String.- Returns:
- Product from s.
-
-