GenericGFPoly
in package
FinalYes
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.
Tags
Table of Contents
Properties
- $coefficients : array<string|int, int>
Methods
- __construct() : mixed
- addOrSubtract() : self
- divide() : array<string|int, GenericGFPoly>
- evaluateAt() : int
- getCoefficient() : int
- getCoefficients() : array<string|int, int>
- getDegree() : int
- isZero() : bool
- mod() : self
- multiply() : self
- multiplyByMonomial() : self
- multiplyInt() : self
Properties
$coefficients
private
array<string|int, int>
$coefficients
Methods
__construct()
public
__construct(array<string|int, int> $coefficients[, int|null $degree = null ]) : mixed
Parameters
- $coefficients : array<string|int, int>
-
array coefficients as ints representing elements of GF(size), arranged from most significant (highest-power term) coefficient to the least significant
- $degree : int|null = null
Tags
addOrSubtract()
public
addOrSubtract(GenericGFPoly $other) : self
Parameters
- $other : GenericGFPoly
Return values
selfdivide()
public
divide(GenericGFPoly $other) : array<string|int, GenericGFPoly>
Parameters
- $other : GenericGFPoly
Tags
Return values
array<string|int, GenericGFPoly> —[quotient, remainder]
evaluateAt()
public
evaluateAt(int $a) : int
Parameters
- $a : int
Return values
int —evaluation of this polynomial at a given point
getCoefficient()
public
getCoefficient(int $degree) : int
Parameters
- $degree : int
Return values
int —$coefficient of x^degree term in this polynomial
getCoefficients()
public
getCoefficients() : array<string|int, int>
Return values
array<string|int, int>getDegree()
public
getDegree() : int
Return values
int —$degree of this polynomial
isZero()
public
isZero() : bool
Return values
bool —true if this polynomial is the monomial "0"
mod()
public
mod(GenericGFPoly $other) : self
Parameters
- $other : GenericGFPoly
Return values
selfmultiply()
public
multiply(GenericGFPoly $other) : self
Parameters
- $other : GenericGFPoly
Return values
selfmultiplyByMonomial()
public
multiplyByMonomial(int $degree, int $coefficient) : self
Parameters
- $degree : int
- $coefficient : int
Tags
Return values
selfmultiplyInt()
public
multiplyInt(int $scalar) : self
Parameters
- $scalar : int