public final class Integers extends ARing<BigInteger>
Modifier and Type | Field and Description |
---|---|
static Integers |
Integers
The ring of integers (Z)
|
Modifier and Type | Method and Description |
---|---|
BigInteger |
abs(BigInteger el)
Returns the abs value of element (no copy)
|
BigInteger |
add(BigInteger a,
BigInteger b)
Add two elements
|
BigInteger |
binomial(long n,
long k)
Gives a binomial coefficient C(n, k)
|
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(BigInteger o1,
BigInteger o2) |
BigInteger |
copy(BigInteger element)
Makes a deep copy of the specified element (for immutable instances the same reference returned).
|
BigInteger[] |
createArray(int length)
Creates generic array of ring elements of specified length
|
BigInteger[][] |
createArray2d(int length)
Creates 2d array of ring elements of specified length
|
BigInteger[][] |
createArray2d(int m,
int n)
Creates 2d array of ring elements of specified shape
|
BigInteger[] |
divideAndRemainder(BigInteger a,
BigInteger b)
Returns quotient and remainder of
dividend / divider |
FactorDecomposition<BigInteger> |
factor(BigInteger element)
Factor specified element
|
FactorDecomposition<BigInteger> |
factorSquareFree(BigInteger element)
Square-free factorization of specified element
|
BigInteger |
gcd(BigInteger a,
BigInteger b)
Returns the greatest common divisor of two elements
|
BigInteger |
getNegativeOne()
Returns negative unit element of this ring (minus one)
|
BigInteger |
getOne()
Returns unit element of this ring (one)
|
BigInteger |
getZero()
Returns zero element of this ring
|
boolean |
isEuclideanRing()
Returns whether this ring is a Euclidean ring
|
boolean |
isField()
Returns whether this ring is a field
|
boolean |
isMinusOne(BigInteger bigInteger)
Tests whether specified element is minus one
|
boolean |
isOne(BigInteger element)
Tests whether specified element is one (exactly)
|
boolean |
isUnit(BigInteger element)
Tests whether specified element is a ring unit
|
boolean |
isZero(BigInteger element)
Tests whether specified element is zero
|
Iterator<BigInteger> |
iterator()
Returns iterator over ring elements (for finite rings, otherwise throws exception)
|
BigInteger |
multiply(BigInteger a,
BigInteger b)
Multiplies two elements
|
BigInteger |
negate(BigInteger element)
Negates the given element
|
BigInteger |
parse(String string)
Parse string into ring element
|
BigInteger |
pow(BigInteger base,
BigInteger exponent)
Returns
base in a power of exponent (non negative) |
BigInteger |
pow(BigInteger base,
int exponent)
Returns
base in a power of exponent (non negative) |
BigInteger |
pow(BigInteger base,
long exponent)
Returns
base in a power of exponent (non negative) |
BigInteger |
reciprocal(BigInteger element)
Gives the inverse element
element ^ (-1) |
BigInteger |
remainder(BigInteger a,
BigInteger b)
Returns the remainder of
dividend / divider |
int |
signum(BigInteger element)
Returns -1 if
element < 0 , 0 if element == 0 and 1 if element > 0 , where comparison is
specified by Comparator.compare(Object, Object) |
BigInteger |
subtract(BigInteger a,
BigInteger b)
Subtracts
b from a |
String |
toString() |
BigInteger |
valueOf(BigInteger val)
Converts a value from other ring to this ring.
|
BigInteger |
valueOf(long val)
Returns ring element associated with specified
long |
BigInteger |
valueOfBigInteger(BigInteger val)
Returns ring element associated with specified integer
|
isPerfectPower, perfectPowerBase, perfectPowerExponent
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
add, addMutable, createArray, createArray, createArray, createZeroesArray, createZeroesArray2d, decrement, divideExact, divideExactMutable, divideOrNull, extendedGCD, factorial, fillZeros, firstBezoutCoefficient, gcd, gcd, increment, isFinite, isFiniteField, isUnitOrZero, lcm, lcm, lcm, max, min, multiply, multiply, multiply, multiplyMutable, negateMutable, quotient, randomElement, randomElement, randomElementTree, randomElementTree, randomNonZeroElement, setToValueOf, subtractMutable, valueOf
comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
forEach, spliterator
toString
public static final Integers Integers
public boolean isField()
Ring
public boolean isEuclideanRing()
Ring
public BigInteger cardinality()
Ring
public BigInteger characteristic()
Ring
public boolean isUnit(BigInteger element)
Ring
element
- the ring elementRing.isOne(Object)
public BigInteger add(BigInteger a, BigInteger b)
Ring
a
- the first elementb
- the second elementpublic BigInteger subtract(BigInteger a, BigInteger b)
Ring
b
from a
a
- the first elementb
- the second elementpublic BigInteger negate(BigInteger element)
Ring
element
- the ring elementpublic BigInteger multiply(BigInteger a, BigInteger b)
Ring
a
- the first elementb
- the second elementpublic BigInteger[] divideAndRemainder(BigInteger a, BigInteger b)
Ring
dividend / divider
a
- the dividendb
- the divider{quotient, remainder}
public BigInteger remainder(BigInteger a, BigInteger b)
Ring
dividend / divider
a
- the dividendb
- the dividerdividend / divider
public BigInteger reciprocal(BigInteger element)
Ring
element ^ (-1)
element
- the elementelement ^ (-1)
public BigInteger pow(BigInteger base, int exponent)
Ring
base
in a power of exponent
(non negative)base
- baseexponent
- exponent (non negative)base
in a power of exponent
public BigInteger pow(BigInteger base, long exponent)
Ring
base
in a power of exponent
(non negative)base
- baseexponent
- exponent (non negative)base
in a power of exponent
public BigInteger pow(BigInteger base, BigInteger exponent)
Ring
base
in a power of exponent
(non negative)base
- baseexponent
- exponent (non negative)base
in a power of exponent
public final BigInteger gcd(BigInteger a, BigInteger b)
Ring
a
- the first elementb
- the second elementpublic FactorDecomposition<BigInteger> factorSquareFree(BigInteger element)
Ring
public FactorDecomposition<BigInteger> factor(BigInteger element)
Ring
public BigInteger valueOf(BigInteger val)
Ring
val
== valueOf(val)
is possible).val
- some element from any ringval
public BigInteger valueOf(long val)
Ring
long
val
- machine integerlong
public BigInteger getNegativeOne()
Ring
public boolean isMinusOne(BigInteger bigInteger)
Ring
bigInteger
- the ring elementpublic final int signum(BigInteger element)
Ring
element < 0
, 0 if element == 0
and 1 if element > 0
, where comparison is
specified by Comparator.compare(Object, Object)
element
- the elementelement < 0
, 0 if element == 0
and 1 otherwisepublic BigInteger abs(BigInteger el)
Ring
public Iterator<BigInteger> iterator()
Ring
public BigInteger binomial(long n, long k)
public final BigInteger getZero()
Ring
public final BigInteger getOne()
Ring
public final boolean isZero(BigInteger element)
Ring
element
- the ring elementpublic final boolean isOne(BigInteger element)
Ring
element
- the ring elementRing.isUnit(Object)
public final BigInteger parse(String string)
Ring
string
- stringCoder
public final int compare(BigInteger o1, BigInteger o2)
public final BigInteger[] createArray(int length)
Ring
length
- array lengthlength
public final BigInteger[][] createArray2d(int length)
Ring
length
- array lengthlength
public final BigInteger[][] createArray2d(int m, int n)
Ring
m
- result lengthn
- length of each array in the resultpublic final BigInteger valueOfBigInteger(BigInteger val)
Ring
val
- integerpublic BigInteger copy(BigInteger element)
Ring
element
- the elementCopyright © 2018. All rights reserved.