|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
ObjectSparseElt
SparseEltEuc
SparseEltZ
Elements of a sparse vector over the ring of
integers Z, in arbitrary precision. The subclass
SparseEltZBig directly uses arbitrary-precision integers
(BigIntegers). Other subclasses use primitive types like
int, but the code automatically upgrades to more
precise types when necessary. The user should never have to know
which subclass of SparseEltZ is behind any given instance.
The implementation of Comparable compares by <
on the values. Use SparseElt.INDEX_SORTER to compare on
the indices.
The methods in this class assume that all their SparseElt
arguments are from SparseEltZ. Expect ClassCastExceptions
if this rule isn't followed.
| Field Summary | |
static SparseEltZ |
NEG_ONE
A constant with value -1 and unspecified index. |
static SparseEltZ |
ONE
A constant with value 1 and unspecified index. |
static SparseEltZ |
ZERO
A constant with value 0 and unspecified index. |
| Fields inherited from class SparseElt |
INDEX_SORTER |
| Constructor Summary | |
SparseEltZ()
|
|
| Method Summary | |
abstract SparseEltZ |
abs()
Returns a SparseEltZ whose value is the absolute value of the value of this, and whose index is that of
this. |
abstract int |
compareTo(Object o)
Compares SparseEltZs by < on the values. |
abstract SparseEltField |
copyMod(int p,
BigInteger pBig)
Returns this mod p, preserving the
index. |
abstract SparseEltZ[] |
divideAndRemainder(SparseEltZ y)
Computes this/y and returns a
two-element array with values quotient and remainder. |
Comparator |
getEucNormComparator()
Returns a Comparator C that compares by Euclidean
norm. |
SparseElt |
getNegOne()
Returns a SparseElt from the same integral domain as this, with value -1 and unspecified index. |
SparseElt |
getOne()
Returns a SparseElt from the same integral domain as this, with value 1 and unspecified index. |
abstract BigInteger |
getValueAsBigInteger()
Returns the value as a BigInteger. |
abstract double |
getValueAsDouble()
Returns the value as a double. |
abstract int |
getValueAsInt()
Coerces the value into an int and returns it. |
SparseElt |
getZero()
Returns a SparseElt from the same integral domain as this, with value 0 and unspecified index. |
int |
hashCode()
Is consistent with SparseElt.equals(java.lang.Object). |
boolean |
isEqualValue(SparseElt y)
Tests whether the values are equal, ignoring the indices. |
static SparseEltZ |
makeInstance(int index,
BigInteger value)
Makes a new instance of SparseEltZ, using the specified arguments. |
static SparseEltZ |
makeInstance(int index,
int value)
Makes a new instance of SparseEltZ, using the specified arguments. |
abstract int |
signum()
Returns -1, 0, or 1 as the value is negative, zero, or positive. |
| Methods inherited from class SparseEltEuc |
eucNorm, negClosestQuotient |
| Methods inherited from class SparseElt |
add, bitLength, copy, divides, equals, getIndex, getPrintValue, isNegOne, isOne, isZero, multiply, multiply, negate, subtract, toString |
| Methods inherited from class Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final SparseEltZ ZERO
SparseElt.ZERO if you are working
over Z.
public static final SparseEltZ ONE
SparseElt.ONE if you are working
over Z.
public static final SparseEltZ NEG_ONE
SparseElt.NEG_ONE if you are working
over Z.
| Constructor Detail |
public SparseEltZ()
| Method Detail |
public abstract SparseEltZ abs()
this, and whose index is that of
this.
public abstract int compareTo(Object o)
SparseEltZs by < on the values. Use
SparseElt.INDEX_SORTER to compare on the indices.
compareTo in interface Comparable
public abstract SparseEltField copyMod(int p,
BigInteger pBig)
this mod p, preserving the
index. Returns null if the value mod p is 0.
p - A prime. The user should check it with SparseEltModp.checkP(int).pBig - p as a BigInteger.public abstract SparseEltZ[] divideAndRemainder(SparseEltZ y)
this/y and returns a
two-element array with values quotient and remainder. Each
index is the index of this.
ArithmeticException - If y is zero.public Comparator getEucNormComparator()
SparseEltEucC that compares by Euclidean
norm. C.compare(a,b) should give the same results
as
a.eucNorm().compareTo(b.eucNorm()),
where compareTo is the usual <, but
C.compare might be more efficient.
getEucNormComparator in class SparseEltEucpublic SparseElt getNegOne()
SparseEltthis, with value -1 and unspecified index.
getNegOne in class SparseEltpublic SparseElt getOne()
SparseEltthis, with value 1 and unspecified index.
getOne in class SparseEltpublic abstract double getValueAsDouble()
double.
public abstract int getValueAsInt()
int and returns it. In
other words, returns the value modulo 232.
public abstract BigInteger getValueAsBigInteger()
BigInteger. In principle, this
is the only accurate way to get the value, but it may consume
memory unnecessarily if this is not a SparseEltZBig. Compare getValueAsInt().
public SparseElt getZero()
SparseEltthis, with value 0 and unspecified index.
getZero in class SparseEltpublic final int hashCode()
SparseElt.equals(java.lang.Object).
hashCode in class SparseEltpublic boolean isEqualValue(SparseElt y)
SparseElt
isEqualValue in class SparseElt
public static SparseEltZ makeInstance(int index,
BigInteger value)
SparseEltZInt instead of SparseEltZBig whenever value is small enough.
public static SparseEltZ makeInstance(int index,
int value)
public abstract int signum()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||