shh.csparse
Class SparseEltEuc

Object
  extended bySparseElt
      extended bySparseEltEuc
Direct Known Subclasses:
SparseEltField, SparseEltZ

public abstract class SparseEltEuc
extends SparseElt

A class of SparseElts should implement this interface if its underlying integral domain D is a Euclidean domain.

Author:
Mark McConnell

Field Summary
 
Fields inherited from class SparseElt
INDEX_SORTER, NEG_ONE, ONE, ZERO
 
Constructor Summary
SparseEltEuc()
           
 
Method Summary
abstract  Number eucNorm()
          Returns the Euclidean norm.
abstract  Comparator getEucNormComparator()
          Returns a Comparator C that compares by Euclidean norm.
abstract  SparseEltEuc negClosestQuotient(SparseEltEuc y)
          Negative of the closest quotient: returns q such that q * y + this is as small as possible for eucNorm().
 
Methods inherited from class SparseElt
add, bitLength, copy, divides, equals, getIndex, getNegOne, getOne, getPrintValue, getZero, hashCode, isEqualValue, isNegOne, isOne, isZero, multiply, multiply, negate, subtract, toString
 
Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SparseEltEuc

public SparseEltEuc()
Method Detail

eucNorm

public abstract Number eucNorm()
Returns the Euclidean norm. An implementing class may return BigInteger, Integer, etc., as long as it's consistent.


getEucNormComparator

public abstract Comparator getEucNormComparator()
Returns a Comparator C 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.


negClosestQuotient

public abstract SparseEltEuc negClosestQuotient(SparseEltEuc y)
Negative of the closest quotient: returns q such that q * y + this is as small as possible for eucNorm(). In other words, returns -this/y rounded off to the nearest element of D. The index is that of this.

Throws:
ArithmeticException - If y is zero.