polynom

package
v0.0.0-...-e0eefac Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 3, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Interpolate

func Interpolate(x0 *big.Int, x []*big.Int, y []*big.Int, modulus *big.Int) (y0 *big.Int)

Interpolate returns the y value at x0 of a polynom that lies on points (x[i], y[i]), with modulus arithmetics for the given modulus.

Types

type Polynom

type Polynom struct {
	// contains filtered or unexported fields
}

Polynom represents a big integer polynom.

func NewRandom

func NewRandom(degree int64, modulus *big.Int) Polynom

NewRandom returns a new random polynom of the given degree, which is subjected to arithmetics of the given modulus.

func (Polynom) Coeff

func (p Polynom) Coeff(i int) *big.Int

Coeff returns the i'th coefficient.

Can panic with index out of range when i >= p.Deg().

func (Polynom) Deg

func (p Polynom) Deg() int

Deg returns the degree of the polynom.

func (Polynom) SetCoeff

func (p Polynom) SetCoeff(i int, v *big.Int)

SetCoeff sets the i'th coefficient.

Can panic with index out of range when i >= p.Deg().

func (Polynom) ValueAt

func (p Polynom) ValueAt(x0 *big.Int) *big.Int

ValueAt returns the y value of the polynom on a given x0 value.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL