|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
ObjectSparseElt
SparseEltEuc
SparseEltField
SparseEltModp
Elements of a sparse vector over the finite field Fp = Z/(p) of p elements.
It is an error if the following don't hold:
SparseEltMod2 is more
efficient if p = 2.)
int. This means p ≤ 46337.
ClassCastExceptions.
We do support
this and the arguments. Otherwise, expect garbage.
| Field Summary | |
protected int |
p
|
protected int |
val
The value. |
| Fields inherited from class SparseElt |
INDEX_SORTER, NEG_ONE, ONE, ZERO |
| Constructor Summary | |
SparseEltModp(int index,
int val,
int p)
Constructs an element whose value is val
mod p. |
|
| Method Summary | |
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. |
static void |
checkP(int p)
Utility to check whether p is a positive prime small enough so that (p-1)2 fits in a positive int. |
SparseElt |
copy(int indexOfCopy)
Returns a SparseElt with the same value as this,
and with index indexOfCopy. |
SparseEltField |
dividedBy(SparseEltField y)
Returns this/y. |
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. |
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. |
String |
getPrintValue()
Returns the value in human-readable form. |
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. |
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 |
multiply(SparseElt y)
Returns a SparseElt whose value is the product of the values in this and y, and whose index is that
of this. |
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
SparseEltField.eucNorm(). |
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 SparseEltField |
eucNorm, getEucNormComparator |
| Methods inherited from class SparseElt |
equals, getIndex, toString |
| Methods inherited from class Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected int val
protected int p
| Constructor Detail |
public SparseEltModp(int index,
int val,
int p)
val
mod p.
| Method Detail |
public static void checkP(int p)
throws RuntimeException
int. This means 2 ≤ p ≤
46337.
RuntimeException - If the test fails. The method does
nothing if the test succeeds.public SparseElt add(SparseElt y)
SparseEltthis and y, and whose index is that
of this.
add in class SparseEltpublic int bitLength()
SparseEltBigInteger.bitLength(); if the value is stored in a primitive
type, returns the bit length of the type.
bitLength in class SparseEltpublic SparseElt copy(int indexOfCopy)
SparseEltthis,
and with index indexOfCopy.
copy in class SparseEltpublic SparseEltField dividedBy(SparseEltField y)
SparseEltFieldthis/y. The index is that of
this.
dividedBy in class SparseEltFieldpublic 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 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 String getPrintValue()
SparseElt
getPrintValue in class SparseEltpublic 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 final boolean isEqualValue(SparseElt y)
SparseElt
isEqualValue in class SparseEltpublic boolean isNegOne()
SparseElt
isNegOne in class SparseEltpublic boolean isOne()
SparseElt
isOne in class SparseEltpublic boolean isZero()
SparseElt
isZero in class SparseEltpublic SparseElt multiply(SparseElt y)
SparseEltthis and y, and whose index is that
of this.
multiply 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 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 | ||||||||||