final class GenericGFPoly extends Object
Represents a polynomial whose coefficients are elements of a GF. Instances of this class are immutable.
Much credit is due to William Rucklidge since portions of this code are an indirect port of his C++ Reed-Solomon implementation.
Constructor and Description |
---|
GenericGFPoly(GenericGF field,
int[] coefficients) |
Modifier and Type | Method and Description |
---|---|
(package private) GenericGFPoly |
addOrSubtract(GenericGFPoly other) |
(package private) GenericGFPoly[] |
divide(GenericGFPoly other) |
(package private) int |
evaluateAt(int a) |
(package private) int |
getCoefficient(int degree) |
(package private) int[] |
getCoefficients() |
(package private) int |
getDegree() |
(package private) boolean |
isZero() |
(package private) GenericGFPoly |
multiply(GenericGFPoly other) |
(package private) GenericGFPoly |
multiply(int scalar) |
(package private) GenericGFPoly |
multiplyByMonomial(int degree,
int coefficient) |
String |
toString() |
GenericGFPoly(GenericGF field, int[] coefficients)
field
- the GenericGF
instance representing the field to use
to perform computationscoefficients
- coefficients as ints representing elements of GF(size), arranged
from most significant (highest-power term) coefficient to least significantIllegalArgumentException
- if argument is null or empty,
or if leading coefficient is 0 and this is not a
constant polynomial (that is, it is not the monomial "0")int[] getCoefficients()
int getDegree()
boolean isZero()
int getCoefficient(int degree)
int evaluateAt(int a)
GenericGFPoly addOrSubtract(GenericGFPoly other)
GenericGFPoly multiply(GenericGFPoly other)
GenericGFPoly multiply(int scalar)
GenericGFPoly multiplyByMonomial(int degree, int coefficient)
GenericGFPoly[] divide(GenericGFPoly other)