public class ImageRing<F,I> extends Object implements Ring<I>
image(Object)
and inverse(Object)
functions.Modifier and Type | Field and Description |
---|---|
Function<F,I> |
imageFunc |
Function<I,F> |
inverseFunc |
Ring<F> |
ring
the ring
|
Constructor and Description |
---|
ImageRing(Ring<F> ring,
Function<I,F> inverseFunc,
Function<F,I> imageFunc) |
Modifier and Type | Method and Description |
---|---|
I |
abs(I el)
Returns the abs value of element (no copy)
|
I |
add(I... elements)
Total of the array of elements
|
I |
add(I a,
I b)
Add two elements
|
BigInteger |
cardinality()
Returns the number of elements in this ring (cardinality) or null if ring is infinite
|
BigInteger |
characteristic()
Returns characteristic of this ring
|
int |
compare(I o1,
I o2) |
I |
copy(I element)
Makes a deep copy of the specified element (for immutable instances the same reference returned).
|
I |
decrement(I element)
Returns
element - 1 |
I[] |
divideAndRemainder(I dividend,
I divider)
Returns quotient and remainder of
dividend / divider |
boolean |
equals(Object o) |
I[] |
extendedGCD(I a,
I b)
Returns array of
[gcd(a,b), s, t] such that s * a + t * b = gcd(a, b) |
FactorDecomposition<I> |
factor(I element)
Factor specified element
|
I |
factorial(long num)
Gives a product of {@code valueOf(1) * valueOf(2) * ....
|
FactorDecomposition<I> |
factorSquareFree(I element)
Square-free factorization of specified element
|
I |
gcd(I... elements)
Returns greatest common divisor of specified elements
|
I |
gcd(I a,
I b)
Returns the greatest common divisor of two elements
|
I |
gcd(Iterable<I> elements)
Returns greatest common divisor of specified elements
|
I |
getOne()
Returns unit element of this ring (one)
|
I |
getZero()
Returns zero element of this ring
|
int |
hashCode() |
I |
image(F el) |
I[] |
image(F[] el) |
I |
increment(I element)
Returns
element + 1 |
F |
inverse(I el) |
F[] |
inverse(I[] el) |
boolean |
isEuclideanRing()
Returns whether this ring is a Euclidean ring
|
boolean |
isField()
Returns whether this ring is a field
|
boolean |
isOne(I element)
Tests whether specified element is one (exactly)
|
boolean |
isPerfectPower()
Returns whether the cardinality is a perfect power (p^k with k > 1)
|
boolean |
isUnit(I element)
Tests whether specified element is a ring unit
|
boolean |
isZero(I element)
Tests whether specified element is zero
|
Iterator<I> |
iterator()
Returns iterator over ring elements (for finite rings, otherwise throws exception)
|
I |
lcm(I a,
I b)
Returns the least common multiple of two elements
|
I |
multiply(I... elements)
Multiplies the array of elements
|
I |
multiply(I a,
I b)
Multiplies two elements
|
I |
negate(I element)
Negates the given element
|
I |
parse(String string)
Parse string into ring element
|
BigInteger |
perfectPowerBase()
Returns
base so that cardinality == base^exponent or null if cardinality is not finite |
BigInteger |
perfectPowerExponent()
Returns
exponent so that cardinality == base^exponent or null if cardinality is not finite |
I |
pow(I base,
BigInteger exponent)
Returns
base in a power of exponent (non negative) |
I |
pow(I base,
int exponent)
Returns
base in a power of exponent (non negative) |
I |
pow(I base,
long exponent)
Returns
base in a power of exponent (non negative) |
I |
quotient(I dividend,
I divider)
Returns the quotient of
dividend / divider |
I |
randomElement(org.apache.commons.math3.random.RandomGenerator rnd)
Returns a random element from this ring
|
I |
reciprocal(I element)
Gives the inverse element
element ^ (-1) |
I |
remainder(I dividend,
I divider)
Returns the remainder of
dividend / divider |
int |
signum(I element)
Returns -1 if
element < 0 , 0 if element == 0 and 1 if element > 0 , where comparison is
specified by Comparator.compare(Object, Object) |
I |
subtract(I a,
I b)
Subtracts
b from a |
I |
valueOf(I val)
Converts a value from other ring to this ring.
|
I |
valueOf(long val)
Returns ring element associated with specified
long |
I |
valueOfBigInteger(BigInteger val)
Returns ring element associated with specified integer
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
addMutable, createArray, createArray, createArray, createArray, createArray2d, createArray2d, createZeroesArray, createZeroesArray2d, divideExact, divideExactMutable, divideOrNull, fillZeros, firstBezoutCoefficient, getNegativeOne, isFinite, isFiniteField, isMinusOne, isUnitOrZero, lcm, lcm, max, min, multiply, multiply, multiplyMutable, negateMutable, randomElement, randomElementTree, randomElementTree, randomNonZeroElement, setToValueOf, subtractMutable, valueOf
comparing, comparing, comparingDouble, comparingInt, comparingLong, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
forEach, spliterator
toString
public boolean isField()
Ring
public boolean isEuclideanRing()
Ring
isEuclideanRing
in interface Ring<I>
public BigInteger cardinality()
Ring
cardinality
in interface Ring<I>
public BigInteger characteristic()
Ring
characteristic
in interface Ring<I>
public boolean isPerfectPower()
Ring
isPerfectPower
in interface Ring<I>
public BigInteger perfectPowerBase()
Ring
base
so that cardinality == base^exponent
or null if cardinality is not finiteperfectPowerBase
in interface Ring<I>
base
so that cardinality == base^exponent
or null if cardinality is not finitepublic BigInteger perfectPowerExponent()
Ring
exponent
so that cardinality == base^exponent
or null if cardinality is not finiteperfectPowerExponent
in interface Ring<I>
exponent
so that cardinality == base^exponent
or null if cardinality is not finitepublic I multiply(I a, I b)
Ring
public I add(I... elements)
Ring
public I multiply(I... elements)
Ring
public I abs(I el)
Ring
public I copy(I element)
Ring
public I[] divideAndRemainder(I dividend, I divider)
Ring
dividend / divider
divideAndRemainder
in interface Ring<I>
dividend
- the dividenddivider
- the divider{quotient, remainder}
public I quotient(I dividend, I divider)
Ring
dividend / divider
public I remainder(I dividend, I divider)
Ring
dividend / divider
public I reciprocal(I element)
Ring
element ^ (-1)
reciprocal
in interface Ring<I>
element
- the elementelement ^ (-1)
public I getZero()
Ring
public I getOne()
Ring
public boolean isZero(I element)
Ring
public boolean isOne(I element)
Ring
isOne
in interface Ring<I>
element
- the ring elementRing.isUnit(Object)
public boolean isUnit(I element)
Ring
isUnit
in interface Ring<I>
element
- the ring elementRing.isOne(Object)
public I valueOf(long val)
Ring
long
public I valueOfBigInteger(BigInteger val)
Ring
valueOfBigInteger
in interface Ring<I>
val
- integerpublic I valueOf(I val)
Ring
val
== valueOf(val)
is possible).public Iterator<I> iterator()
Ring
public I gcd(I a, I b)
Ring
public I[] extendedGCD(I a, I b)
Ring
[gcd(a,b), s, t]
such that s * a + t * b = gcd(a, b)
extendedGCD
in interface Ring<I>
public I lcm(I a, I b)
Ring
public I gcd(I... elements)
Ring
public I gcd(Iterable<I> elements)
Ring
public int signum(I element)
Ring
element < 0
, 0 if element == 0
and 1 if element > 0
, where comparison is
specified by Comparator.compare(Object, Object)
public FactorDecomposition<I> factorSquareFree(I element)
Ring
factorSquareFree
in interface Ring<I>
public FactorDecomposition<I> factor(I element)
Ring
public I parse(String string)
Ring
public I pow(I base, int exponent)
Ring
base
in a power of exponent
(non negative)public I pow(I base, long exponent)
Ring
base
in a power of exponent
(non negative)public I pow(I base, BigInteger exponent)
Ring
base
in a power of exponent
(non negative)public I factorial(long num)
Ring
valueOf(1) * valueOf(2) * .... * valueOf(num)
public I randomElement(org.apache.commons.math3.random.RandomGenerator rnd)
Ring
randomElement
in interface Ring<I>
rnd
- the source of randomnesspublic int compare(I o1, I o2)
compare
in interface Comparator<I>
public boolean equals(Object o)
equals
in interface Comparator<I>
equals
in class Object
Copyright © 2018. All rights reserved.