|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
ObjectSparseElt
SparseEltEuc
SparseEltZ
SparseEltZInt
Elements of a sparse vector over Z, using
int to store the values. If an operation would cause
the ints to overflow, we automatically return a
larger type of SparseEltZ.
| Field Summary | |
protected int |
val
The value of this entry in a sparse vector. |
| Fields inherited from class SparseEltZ |
NEG_ONE, ONE, ZERO |
| Fields inherited from class SparseElt |
INDEX_SORTER |
| Method Summary | |
SparseEltZ |
abs()
Returns a SparseEltZ whose value is the absolute value of the value of this, and whose index is that of
this. |
SparseElt |
add(SparseElt y)
Returns a SparseElt whose value is the sum of the values in this and y, and whose index is that
of this. |
int |
bitLength()
If the value is a BigInteger, returns its BigInteger.bitLength(); if the value is stored in a primitive
type, returns the bit length of the type. |
int |
compareTo(Object o)
Compares SparseEltZs by < on the values. |
SparseElt |
copy(int indexOfCopy)
Returns a SparseElt with the same value as this,
and with index indexOfCopy. |
SparseEltField |
copyMod(int p,
BigInteger pBig)
Returns this mod p, preserving the
index. |
SparseEltZ[] |
divideAndRemainder(SparseEltZ y)
Computes this/y and returns a
two-element array with values quotient and remainder. |
boolean |
divides(SparseElt y)
Whether the value of this divides the value of
y; that is, whether there is an x
such that x * this = y. |
Number |
eucNorm()
Returns the absolute value of the value, as a BigInteger. |
String |
getPrintValue()
Returns the value in human-readable form. |
BigInteger |
getValueAsBigInteger()
Returns the value as a BigInteger. |
double |
getValueAsDouble()
Returns the value as a double. |
int |
getValueAsInt()
Coerces the value into an int and returns it. |
boolean |
isNegOne()
Whether the value is -1. |
boolean |
isOne()
Whether the value is one. |
boolean |
isZero()
Whether the value is zero. |
SparseElt |
multiply(int newIndex,
SparseElt y)
Returns a SparseElt with index newIndex and whose
value is the product of the values in this and
y. |
SparseElt |
negate()
Returns a SparseElt whose value is the negative of the value of this, and whose index is that of
this. |
SparseEltEuc |
negClosestQuotient(SparseEltEuc y)
Negative of the closest quotient: returns q such
that q * y + this is as small as possible for
eucNorm(). |
int |
signum()
Returns -1, 0, or 1 as the value is negative, zero, or positive. |
SparseElt |
subtract(SparseElt y)
Returns a SparseElt whose value is (value of this)
minus (value of y), and whose index is that of
this. |
| Methods inherited from class SparseEltZ |
getEucNormComparator, getNegOne, getOne, getZero, hashCode, isEqualValue, makeInstance, makeInstance |
| Methods inherited from class SparseElt |
equals, getIndex, multiply, toString |
| Methods inherited from class Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected int val
| Method Detail |
public SparseEltZ abs()
SparseEltZthis, and whose index is that of
this.
abs in class SparseEltZpublic SparseElt add(SparseElt y)
SparseEltthis and y, and whose index is that
of this.
add in class SparseEltpublic final int bitLength()
SparseEltBigInteger.bitLength(); if the value is stored in a primitive
type, returns the bit length of the type.
bitLength in class SparseEltpublic int compareTo(Object o)
SparseEltZSparseEltZs by < on the values. Use
SparseElt.INDEX_SORTER to compare on the indices.
compareTo in interface ComparablecompareTo in class SparseEltZpublic SparseElt copy(int indexOfCopy)
SparseEltthis,
and with index indexOfCopy.
copy in class SparseElt
public SparseEltField copyMod(int p,
BigInteger pBig)
SparseEltZthis mod p, preserving the
index. Returns null if the value mod p is 0.
copyMod in class SparseEltZp - A prime. The user should check it with SparseEltModp.checkP(int).pBig - p as a BigInteger.public SparseEltZ[] divideAndRemainder(SparseEltZ y)
SparseEltZthis/y and returns a
two-element array with values quotient and remainder. Each
index is the index of this.
divideAndRemainder in class SparseEltZpublic boolean divides(SparseElt y)
SparseEltthis divides the value of
y; that is, whether there is an x
such that x * this = y.
divides in class SparseEltpublic Number eucNorm()
eucNorm in class SparseEltEucpublic String getPrintValue()
SparseElt
getPrintValue in class SparseEltpublic double getValueAsDouble()
SparseEltZdouble.
getValueAsDouble in class SparseEltZpublic int getValueAsInt()
SparseEltZint and returns it. In
other words, returns the value modulo 232.
getValueAsInt in class SparseEltZpublic BigInteger getValueAsBigInteger()
SparseEltZBigInteger. 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 SparseEltZ.getValueAsInt().
getValueAsBigInteger in class SparseEltZpublic boolean isNegOne()
SparseElt
isNegOne in class SparseEltpublic boolean isOne()
SparseElt
isOne in class SparseEltpublic boolean isZero()
SparseElt
isZero in class SparseElt
public SparseElt multiply(int newIndex,
SparseElt y)
SparseEltnewIndex and whose
value is the product of the values in this and
y.
multiply in class SparseEltpublic SparseElt negate()
SparseEltthis, and whose index is that of
this.
negate in class SparseEltpublic SparseEltEuc negClosestQuotient(SparseEltEuc y)
SparseEltEucq such
that q * y + this is as small as possible for
SparseEltEuc.eucNorm(). In other words, returns -this/y
rounded off to the nearest element of D. The index is
that of this.
negClosestQuotient in class SparseEltEucpublic final int signum()
SparseEltZ
signum in class SparseEltZpublic SparseElt subtract(SparseElt y)
SparseEltthis)
minus (value of y), and whose index is that of
this.
subtract in class SparseElt
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||