public class GF2nPolynomial
extends java.lang.Object
GF2nElement| Constructor and Description |
|---|
GF2nPolynomial(GF2nPolynomial a)
Creates a new PolynomialGF2n by cloning the given PolynomialGF2n a.
|
GF2nPolynomial(GF2Polynomial polynomial,
GF2nField B1)
Creates a new PolynomialGF2n from the given Bitstring polynomial
over the GF2nField B1.
|
GF2nPolynomial(int deg,
GF2nElement elem)
Creates a new PolynomialGF2n of size deg and elem as
coefficients.
|
| Modifier and Type | Method and Description |
|---|---|
GF2nPolynomial |
add(GF2nPolynomial b)
Adds the PolynomialGF2n b to this and returns the
result in a new PolynomialGF2n.
|
void |
assignZeroToElements() |
GF2nElement |
at(int index)
Returns the coefficient at index.
|
GF2nPolynomial[] |
divide(GF2nPolynomial b)
Divides this by b and stores the result in a new
PolynomialGF2n[2], quotient in result[0] and remainder in result[1].
|
void |
enlarge(int k)
Enlarges the size of this PolynomialGF2n to k + 1.
|
boolean |
equals(java.lang.Object other) |
GF2nPolynomial |
gcd(GF2nPolynomial g)
Computes the greatest common divisor of this and g and
returns the result in a new PolynomialGF2n.
|
int |
getDegree()
Returns the degree of this PolynomialGF2n.
|
int |
hashCode() |
boolean |
isZero()
Returns true if all coefficients equal zero.
|
GF2nPolynomial |
multiply(GF2nPolynomial b)
Multiplies this by b and returns the result in a new
PolynomialGF2n.
|
GF2nPolynomial |
multiplyAndReduce(GF2nPolynomial b,
GF2nPolynomial g)
Multiplies this by b, reduces the result by g and
returns it in a new PolynomialGF2n.
|
GF2nPolynomial |
quotient(GF2nPolynomial b)
Divides this by b and stores the quotient in a new
PolynomialGF2n.
|
GF2nPolynomial |
reduce(GF2nPolynomial g)
Reduces this by g and returns the result in a new
PolynomialGF2n.
|
GF2nPolynomial |
remainder(GF2nPolynomial b)
Divides this by b and stores the remainder in a new
PolynomialGF2n.
|
GF2nPolynomial |
scalarMultiply(GF2nElement s)
Multiplies the scalar s to each coefficient of this
PolynomialGF2n and returns the result in a new PolynomialGF2n.
|
void |
set(int index,
GF2nElement elem)
Sets the coefficient at index to elem.
|
GF2nPolynomial |
shiftLeft(int amount) |
void |
shiftThisLeft(int amount)
Shifts left this by amount and stores the result in
this PolynomialGF2n.
|
void |
shrink() |
int |
size()
Returns the size (=maximum degree + 1) of this PolynomialGF2n.
|
public GF2nPolynomial(int deg,
GF2nElement elem)
deg - -
the maximum degree + 1elem - -
a GF2nElementpublic GF2nPolynomial(GF2nPolynomial a)
a - the PolynomialGF2n to clonepublic GF2nPolynomial(GF2Polynomial polynomial, GF2nField B1)
polynomial - the Bitstring to useB1 - the fieldpublic final void assignZeroToElements()
public final int size()
public final int getDegree()
public final void enlarge(int k)
k - the new maximum degreepublic final void shrink()
public final void set(int index,
GF2nElement elem)
index - the indexelem - the GF2nElement to store as coefficient indexpublic final GF2nElement at(int index)
index - the indexpublic final boolean isZero()
public final boolean equals(java.lang.Object other)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic final GF2nPolynomial add(GF2nPolynomial b)
b - -
the PolynomialGF2n to addpublic final GF2nPolynomial scalarMultiply(GF2nElement s)
s - the scalar to multiplypublic final GF2nPolynomial multiply(GF2nPolynomial b)
b - the PolynomialGF2n to multiplypublic final GF2nPolynomial multiplyAndReduce(GF2nPolynomial b, GF2nPolynomial g)
b - the PolynomialGF2n to multiplyg - the modulpublic final GF2nPolynomial reduce(GF2nPolynomial g) throws java.lang.RuntimeException, java.lang.ArithmeticException
g - -
the modulusjava.lang.RuntimeExceptionjava.lang.ArithmeticExceptionpublic final void shiftThisLeft(int amount)
amount - the amount to shift the coefficientspublic final GF2nPolynomial shiftLeft(int amount)
public final GF2nPolynomial[] divide(GF2nPolynomial b)
b - the divisorpublic final GF2nPolynomial remainder(GF2nPolynomial b) throws java.lang.RuntimeException, java.lang.ArithmeticException
b - the divisorjava.lang.RuntimeExceptionjava.lang.ArithmeticExceptionpublic final GF2nPolynomial quotient(GF2nPolynomial b) throws java.lang.RuntimeException, java.lang.ArithmeticException
b - the divisorjava.lang.RuntimeExceptionjava.lang.ArithmeticExceptionpublic final GF2nPolynomial gcd(GF2nPolynomial g)
g - -
a GF2nPolynomial