Documentation
¶
Index ¶
- type Polynomial
- func (p *Polynomial) Add(_a, _b *Polynomial) *Polynomial
- func (p *Polynomial) Get(i int) *big.Int
- func (p *Polynomial) Mod(_a *Polynomial, _mod *big.Int) *Polynomial
- func (p *Polynomial) Mul(_a, _b *Polynomial) *Polynomial
- func (p *Polynomial) QuoRem(a, b *Polynomial) (quo, rem *Polynomial)
- func (p *Polynomial) Set(coefficients []*big.Int) *Polynomial
- func (p *Polynomial) SetPolynomial(other *Polynomial) *Polynomial
- func (p *Polynomial) String() string
- func (p *Polynomial) StringCoefficients() string
- func (p *Polynomial) Sub(_a, _b *Polynomial) *Polynomial
- func (p *Polynomial) Value(_x *big.Int) *big.Int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Polynomial ¶
type Polynomial struct {
// contains filtered or unexported fields
}
Polynomial - structure for a polynomial. The zero position of the coefficients array corresponds to the coefficient of the free term of the polynomial.
func NewPolynomial ¶
func NewPolynomial(coefficients []*big.Int) *Polynomial
NewPolynomial - creates a polynomial and sets it an array of values when creating.
func (*Polynomial) Add ¶
func (p *Polynomial) Add(_a, _b *Polynomial) *Polynomial
Add - adds two polynomials a and b and writes to c. Returns c.
func (*Polynomial) Get ¶
func (p *Polynomial) Get(i int) *big.Int
Get - returns the coefficient of the polynomial.
func (*Polynomial) Mod ¶
func (p *Polynomial) Mod(_a *Polynomial, _mod *big.Int) *Polynomial
Mod - takes the modulus for each coefficient of the polynomial a and writes the coefficients in c. Returns c.
func (*Polynomial) Mul ¶
func (p *Polynomial) Mul(_a, _b *Polynomial) *Polynomial
Mul - multiplies two polynomials a and b and writes to c. Returns c.
func (*Polynomial) QuoRem ¶
func (p *Polynomial) QuoRem(a, b *Polynomial) (quo, rem *Polynomial)
QuoRem - division with remainder of polynomial a by polynomial b. Sets the quotient of division to c. Returns the quotient and remainder.
func (*Polynomial) Set ¶
func (p *Polynomial) Set(coefficients []*big.Int) *Polynomial
Set - sets an array of coefficients in c, and returns c. The zero position of the coefficients array corresponds to the coefficient of the free term of the polynomial.
func (*Polynomial) SetPolynomial ¶
func (p *Polynomial) SetPolynomial(other *Polynomial) *Polynomial
SetPolynomial - sets an array of coefficients of the polynomial c based on the polynomial p. Returns c.
func (*Polynomial) String ¶
func (p *Polynomial) String() string
String - returns a polynomial in the form of a string of the form x^3 + 2x - 1.
func (*Polynomial) StringCoefficients ¶
func (p *Polynomial) StringCoefficients() string
StringCoefficients - returns a polynomial as a string of vector X(3 3 2).
func (*Polynomial) Sub ¶
func (p *Polynomial) Sub(_a, _b *Polynomial) *Polynomial
Sub - subtracts the polynomial b from the polynomial a and writes it to c. Returns c.