Package edu.jas.arith
Class Product<C extends RingElem<C>>
- java.lang.Object
-
- edu.jas.arith.Product<C>
-
- All Implemented Interfaces:
AbelianGroupElem<Product<C>>
,Element<Product<C>>
,GcdRingElem<Product<C>>
,MonoidElem<Product<C>>
,RegularRingElem<Product<C>>
,RingElem<Product<C>>
,java.io.Serializable
,java.lang.Comparable<Product<C>>
public class Product<C extends RingElem<C>> extends java.lang.Object implements RegularRingElem<Product<C>>
Direct product element based on RingElem. Objects of this class are (nearly) immutable.- Author:
- Heinz Kredel
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected int
isunit
Flag to remember if this product element is a unit in each cmponent. -1 is unknown, 1 is unit, 0 not a unit.ProductRing<C>
ring
Product class factory data structure.java.util.SortedMap<java.lang.Integer,C>
val
Value part of the element data structure.
-
Constructor Summary
Constructors Constructor Description Product(ProductRing<C> r)
The constructor creates a Product object from a ring factory.Product(ProductRing<C> r, java.util.SortedMap<java.lang.Integer,C> a)
The constructor creates a Product object from a ring factory and a ring element.Product(ProductRing<C> r, java.util.SortedMap<java.lang.Integer,C> a, int u)
The constructor creates a Product object from a ring factory, a ring element and an indicator if a is a unit.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Product<C>
abs()
Product absolute value.int
compareTo(Product<C> b)
Product comparison.Product<C>
copy()
Clone this.Product<C>
divide(Product<C> S)
Product quasi-division.Product<C>[]
egcd(Product<C> S)
Extended greatest common divisor.boolean
equals(java.lang.Object b)
Comparison with any other object.Product<C>
extend(int i, int j)
Product extend.ProductRing<C>
factory()
Get the corresponding element factory.Product<C>
fillIdempotent(Product<C> S)
Product fill with idempotent.Product<C>
fillOne()
Product fill with one.Product<C>
gcd(Product<C> S)
Greatest common divisor.C
get(int i)
Get component.int
hashCode()
Hash code for this local.Product<C>
idemComplement()
Product idempotent complement.Product<C>
idempotent()
Product idempotent.Product<C>
idempotentAnd(Product<C> S)
Product idempotent and.Product<C>
idempotentOr(Product<C> S)
Product idempotent or.Product<C>
inverse()
Product quasi-inverse.boolean
isFull()
Is Product full.boolean
isIdempotent()
Is Product idempotent.boolean
isONE()
Is Product one.boolean
isUnit()
Is Product unit.boolean
isZERO()
Is Product zero.Product<C>
multiply(C c)
Product multiply by coefficient.Product<C>
multiply(Product<C> S)
Product multiplication.Product<C>
negate()
Product negate.Product<C>[]
quotientRemainder(Product<C> S)
Quotient and remainder by division of this by S.Product<C>
remainder(Product<C> S)
Product quasi-remainder.int
signum()
Product signum.Product<C>
subtract(Product<C> S)
Product subtraction.Product<C>
sum(Product<C> S)
Product summation.java.lang.String
toScript()
Get a scripting compatible string representation.java.lang.String
toScriptFactory()
Get a scripting compatible string representation of the factory.java.lang.String
toString()
Get the String representation as RingElem.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface edu.jas.structure.MonoidElem
leftDivide, leftRemainder, power, rightDivide, rightRemainder, twosidedDivide, twosidedRemainder
-
-
-
-
Field Detail
-
ring
public final ProductRing<C extends RingElem<C>> ring
Product class factory data structure.
-
val
public final java.util.SortedMap<java.lang.Integer,C extends RingElem<C>> val
Value part of the element data structure.
-
isunit
protected int isunit
Flag to remember if this product element is a unit in each cmponent. -1 is unknown, 1 is unit, 0 not a unit.
-
-
Constructor Detail
-
Product
public Product(ProductRing<C> r)
The constructor creates a Product object from a ring factory.- Parameters:
r
- ring factory.
-
Product
public Product(ProductRing<C> r, java.util.SortedMap<java.lang.Integer,C> a)
The constructor creates a Product object from a ring factory and a ring element.- Parameters:
r
- ring factory.a
- ring element.
-
Product
public Product(ProductRing<C> r, java.util.SortedMap<java.lang.Integer,C> a, int u)
The constructor creates a Product object from a ring factory, a ring element and an indicator if a is a unit.- Parameters:
r
- ring factory.a
- ring element.u
- isunit indicator, -1, 0, 1.
-
-
Method Detail
-
factory
public ProductRing<C> factory()
Get the corresponding element factory.
-
isZERO
public boolean isZERO()
Is Product zero.- Specified by:
isZERO
in interfaceAbelianGroupElem<C extends RingElem<C>>
- Returns:
- If this is 0 then true is returned, else false.
- See Also:
AbelianGroupElem.isZERO()
-
isONE
public boolean isONE()
Is Product one.- Specified by:
isONE
in interfaceMonoidElem<C extends RingElem<C>>
- Returns:
- If this is 1 then true is returned, else false.
- See Also:
MonoidElem.isONE()
-
isFull
public boolean isFull()
Is Product full.- Specified by:
isFull
in interfaceRegularRingElem<C extends RingElem<C>>
- Returns:
- If every component is non-zero, then true is returned, else false.
-
isUnit
public boolean isUnit()
Is Product unit.- Specified by:
isUnit
in interfaceMonoidElem<C extends RingElem<C>>
- Returns:
- If this is a unit then true is returned, else false.
- See Also:
MonoidElem.isUnit()
-
isIdempotent
public boolean isIdempotent()
Is Product idempotent.- Specified by:
isIdempotent
in interfaceRegularRingElem<C extends RingElem<C>>
- Returns:
- If this is a idempotent element then true is returned, else false.
-
toString
public java.lang.String toString()
Get the String representation as RingElem.- Overrides:
toString
in classjava.lang.Object
- See Also:
Object.toString()
-
toScript
public java.lang.String toScript()
Get a scripting compatible string representation.
-
toScriptFactory
public java.lang.String toScriptFactory()
Get a scripting compatible string representation of the factory.- Specified by:
toScriptFactory
in interfaceElement<C extends RingElem<C>>
- Returns:
- script compatible representation for this ElemFactory.
- See Also:
Element.toScriptFactory()
-
equals
public boolean equals(java.lang.Object b)
Comparison with any other object.
-
hashCode
public int hashCode()
Hash code for this local.
-
extend
public Product<C> extend(int i, int j)
Product extend. Add new component j with value of component i.- Parameters:
i
- from index.j
- to index.- Returns:
- the extended value of this.
-
abs
public Product<C> abs()
Product absolute value.- Specified by:
abs
in interfaceAbelianGroupElem<C extends RingElem<C>>
- Returns:
- the absolute value of this.
- See Also:
AbelianGroupElem.abs()
-
sum
public Product<C> sum(Product<C> S)
Product summation.- Specified by:
sum
in interfaceAbelianGroupElem<C extends RingElem<C>>
- Parameters:
S
- Product.- Returns:
- this+S.
-
negate
public Product<C> negate()
Product negate.- Specified by:
negate
in interfaceAbelianGroupElem<C extends RingElem<C>>
- Returns:
- -this.
- See Also:
AbelianGroupElem.negate()
-
signum
public int signum()
Product signum.- Specified by:
signum
in interfaceAbelianGroupElem<C extends RingElem<C>>
- Returns:
- signum of first non-zero component.
- See Also:
AbelianGroupElem.signum()
-
subtract
public Product<C> subtract(Product<C> S)
Product subtraction.- Specified by:
subtract
in interfaceAbelianGroupElem<C extends RingElem<C>>
- Parameters:
S
- Product.- Returns:
- this-S.
-
inverse
public Product<C> inverse()
Product quasi-inverse.- Specified by:
inverse
in interfaceMonoidElem<C extends RingElem<C>>
- Returns:
- S with S = 1/this if defined.
- See Also:
MonoidElem.inverse()
-
idempotent
public Product<C> idempotent()
Product idempotent.- Specified by:
idempotent
in interfaceRegularRingElem<C extends RingElem<C>>
- Returns:
- smallest S with this*S = this.
-
idemComplement
public Product<C> idemComplement()
Product idempotent complement.- Specified by:
idemComplement
in interfaceRegularRingElem<C extends RingElem<C>>
- Returns:
- 1-this.idempotent().
-
idempotentAnd
public Product<C> idempotentAnd(Product<C> S)
Product idempotent and.- Specified by:
idempotentAnd
in interfaceRegularRingElem<C extends RingElem<C>>
- Parameters:
S
- Product.- Returns:
- this.idempotent() and S.idempotent().
-
idempotentOr
public Product<C> idempotentOr(Product<C> S)
Product idempotent or.- Specified by:
idempotentOr
in interfaceRegularRingElem<C extends RingElem<C>>
- Parameters:
S
- Product.- Returns:
- this.idempotent() or S.idempotent().
-
fillIdempotent
public Product<C> fillIdempotent(Product<C> S)
Product fill with idempotent.- Specified by:
fillIdempotent
in interfaceRegularRingElem<C extends RingElem<C>>
- Parameters:
S
- Product.- Returns:
- fill this with S.idempotent().
-
fillOne
public Product<C> fillOne()
Product fill with one.- Specified by:
fillOne
in interfaceRegularRingElem<C extends RingElem<C>>
- Returns:
- fill this with one.
-
divide
public Product<C> divide(Product<C> S)
Product quasi-division.- Specified by:
divide
in interfaceMonoidElem<C extends RingElem<C>>
- Parameters:
S
- Product.- Returns:
- this/S.
-
remainder
public Product<C> remainder(Product<C> S)
Product quasi-remainder.- Specified by:
remainder
in interfaceMonoidElem<C extends RingElem<C>>
- Parameters:
S
- Product.- Returns:
- this - (this/S)*S.
-
quotientRemainder
public Product<C>[] quotientRemainder(Product<C> S)
Quotient and remainder by division of this by S.- Specified by:
quotientRemainder
in interfaceMonoidElem<C extends RingElem<C>>
- Parameters:
S
- a product- Returns:
- [this/S, this - (this/S)*S].
-
multiply
public Product<C> multiply(Product<C> S)
Product multiplication.- Specified by:
multiply
in interfaceMonoidElem<C extends RingElem<C>>
- Parameters:
S
- Product.- Returns:
- this*S.
-
multiply
public Product<C> multiply(C c)
Product multiply by coefficient.- Parameters:
c
- coefficient.- Returns:
- this*c.
-
-