Documentation
¶
Index ¶
- Variables
- type FlintRandT
- type Fmpq
- func (q *Fmpq) Cmp(y *Fmpq) int
- func (q *Fmpq) CmpRational(y *Fmpq) (r int)
- func (q *Fmpq) DenRef() int
- func (q *Fmpq) GetFmpqFraction() (int, int)
- func (q *Fmpq) MulRational(o *Fmpq, x *Fmpz) *Fmpq
- func (q *Fmpq) NumRef() int
- func (q *Fmpq) SetFmpqFraction(num, den *Fmpz) *Fmpq
- func (q *Fmpq) String() string
- type Fmpz
- func (z *Fmpz) Abs(x *Fmpz) *Fmpz
- func (z *Fmpz) Add(x, y *Fmpz) *Fmpz
- func (z *Fmpz) AddI(x int) *Fmpz
- func (z *Fmpz) AddZ(x *Fmpz) *Fmpz
- func (z *Fmpz) And(x, y *Fmpz) *Fmpz
- func (z *Fmpz) BitLen() int
- func (z *Fmpz) Bits() int
- func (z *Fmpz) Bytes() []byte
- func (z *Fmpz) CRT(r1, m1, r2, m2 *Fmpz, sign int) *Fmpz
- func (z *Fmpz) Cmp(y *Fmpz) (r int)
- func (z *Fmpz) Cube() *Fmpz
- func (z *Fmpz) DLog() float64
- func (z *Fmpz) Div(x, y *Fmpz) *Fmpz
- func (z *Fmpz) DivMod(x, y, m *Fmpz) (*Fmpz, *Fmpz)
- func (z *Fmpz) DivR(y, n *Fmpz) *Fmpz
- func (z *Fmpz) Equals(y *Fmpz) bool
- func (z *Fmpz) Exp(x, y, m *Fmpz) *Fmpz
- func (z *Fmpz) ExpI(x int) *Fmpz
- func (z *Fmpz) ExpXI(x *Fmpz, y int) *Fmpz
- func (z *Fmpz) ExpXIM(x *Fmpz, i int, m *Fmpz) *Fmpz
- func (z *Fmpz) ExpXY(x, y *Fmpz) *Fmpz
- func (z *Fmpz) ExpZ(x *Fmpz) *Fmpz
- func (z *Fmpz) GCD(g, h *Fmpz) *Fmpz
- func (z *Fmpz) GCDInv(g *Fmpz) (*Fmpz, *Fmpz)
- func (z *Fmpz) GetInt() int
- func (z *Fmpz) GetUInt() uint
- func (z *Fmpz) Int64() (y int64)
- func (z *Fmpz) IsProbabPrime() int
- func (z *Fmpz) IsProbabPrimeBPSW() int
- func (z *Fmpz) IsProbabPrimeLucas() int
- func (z *Fmpz) IsProbabPrimePseudosquare() int
- func (z *Fmpz) IsStrongProbabPrime(a *Fmpz) int
- func (z *Fmpz) IsZero() bool
- func (z *Fmpz) Jacobi(p *Fmpz) int
- func (z *Fmpz) Lcm(g, h *Fmpz) *Fmpz
- func (z *Fmpz) Lsh(bits int) *Fmpz
- func (z *Fmpz) LucasChain(v2, a, m, n *Fmpz)
- func (z *Fmpz) Max(a, b *Fmpz) *Fmpz
- func (z *Fmpz) Min(a, b *Fmpz) *Fmpz
- func (z *Fmpz) Mod(x, y *Fmpz) *Fmpz
- func (z *Fmpz) ModInverse(x, y *Fmpz) *Fmpz
- func (z *Fmpz) ModRational(x *Fmpq, n *Fmpz) int
- func (z *Fmpz) ModZ(y *Fmpz) *Fmpz
- func (z *Fmpz) Mul(x, y *Fmpz) *Fmpz
- func (z *Fmpz) MulI(x int) *Fmpz
- func (z *Fmpz) MulZ(x *Fmpz) *Fmpz
- func (z *Fmpz) Neg(x *Fmpz) *Fmpz
- func (z *Fmpz) NegMod(x, y *Fmpz) *Fmpz
- func (z *Fmpz) Pow(x, y, m *Fmpz) *Fmpz
- func (z *Fmpz) Quo(x, y *Fmpz) *Fmpz
- func (z *Fmpz) QuoRem(x, y, r *Fmpz) (*Fmpz, *Fmpz)
- func (z *Fmpz) Randm(state *FlintRandT, m *Fmpz) *Fmpz
- func (z *Fmpz) Root(x *Fmpz, y int32) *Fmpz
- func (z *Fmpz) Rsh(bits int) *Fmpz
- func (z *Fmpz) Set(x *Fmpz) *Fmpz
- func (z *Fmpz) SetBytes(buf []byte) *Fmpz
- func (z *Fmpz) SetInt64(x int64) *Fmpz
- func (z *Fmpz) SetInt64NF(x int64) *Fmpz
- func (z *Fmpz) SetMpz(x *Mpz)
- func (z *Fmpz) SetString(s string, base int) (*Fmpz, bool)
- func (z *Fmpz) SetUint64(x uint64) *Fmpz
- func (z *Fmpz) Sign() int
- func (z *Fmpz) Sqrt(x *Fmpz) *Fmpz
- func (z *Fmpz) Square() *Fmpz
- func (z *Fmpz) String() string
- func (z *Fmpz) Sub(x, y *Fmpz) *Fmpz
- func (z *Fmpz) SubI(x int) *Fmpz
- func (z *Fmpz) SubZ(x *Fmpz) *Fmpz
- func (z *Fmpz) TstBit(i int) int
- func (z *Fmpz) Uint64() (y uint64)
- func (z *Fmpz) Xor(a, b *Fmpz) *Fmpz
- type FmpzLLL
- type FmpzMat
- func (m *FmpzMat) Entry(x, y int) *Fmpz
- func (m *FmpzMat) LLL() *FmpzMat
- func (m *FmpzMat) NumCols() int
- func (m *FmpzMat) NumRows() int
- func (m *FmpzMat) One() *FmpzMat
- func (m *FmpzMat) SetPosVal(val *Fmpz, pos int) *FmpzMat
- func (m *FmpzMat) SetVal(val *Fmpz, x, y int) *FmpzMat
- func (m *FmpzMat) String() string
- func (m *FmpzMat) Zero() *FmpzMat
- type FmpzModCtx
- type FmpzModPoly
- func (z *FmpzModPoly) Add(a, b *FmpzModPoly) *FmpzModPoly
- func (z *FmpzModPoly) DivRem(m *FmpzModPoly) (*FmpzModPoly, *FmpzModPoly)
- func (z *FmpzModPoly) DivScalar(a *FmpzModPoly, x *Fmpz) *FmpzModPoly
- func (z *FmpzModPoly) Equal(p *FmpzModPoly) bool
- func (z *FmpzModPoly) FitLength(l int)
- func (z *FmpzModPoly) GCD(a, b *FmpzModPoly) *FmpzModPoly
- func (z *FmpzModPoly) GetCoeff(c int) *Fmpz
- func (z *FmpzModPoly) GetCoeffs() []*Fmpz
- func (z *FmpzModPoly) GetMod() *Fmpz
- func (z *FmpzModPoly) Len() int
- func (z *FmpzModPoly) Mul(a, b *FmpzModPoly) *FmpzModPoly
- func (z *FmpzModPoly) MulScalar(a *FmpzModPoly, x *Fmpz) *FmpzModPoly
- func (z *FmpzModPoly) Neg(p *FmpzModPoly) *FmpzModPoly
- func (z *FmpzModPoly) Pow(m *FmpzModPoly, e int) *FmpzModPoly
- func (z *FmpzModPoly) Set(poly *FmpzModPoly) *FmpzModPoly
- func (z *FmpzModPoly) SetCoeff(c int, x *Fmpz) *FmpzModPoly
- func (z *FmpzModPoly) SetCoeffUI(c int, x uint) *FmpzModPoly
- func (z *FmpzModPoly) String() string
- func (z *FmpzModPoly) StringSimple() string
- func (z *FmpzModPoly) Sub(a, b *FmpzModPoly) *FmpzModPoly
- func (z *FmpzModPoly) Zero() *FmpzModPoly
- type FmpzPoly
- func (z *FmpzPoly) Add(a, b *FmpzPoly) *FmpzPoly
- func (z *FmpzPoly) DivRem(m *FmpzPoly) (*FmpzPoly, *FmpzPoly)
- func (z *FmpzPoly) DivScalar(a *FmpzPoly, x *Fmpz) *FmpzPoly
- func (z *FmpzPoly) Equal(p *FmpzPoly) bool
- func (z *FmpzPoly) Factor() *FmpzPolyFactor
- func (z *FmpzPoly) FitLength(l int)
- func (z *FmpzPoly) GCD(a, b *FmpzPoly) *FmpzPoly
- func (z *FmpzPoly) GetCoeff(c int) *Fmpz
- func (z *FmpzPoly) GetCoeffs() []*Fmpz
- func (z *FmpzPoly) Len() int
- func (z *FmpzPoly) Mul(a, b *FmpzPoly) *FmpzPoly
- func (z *FmpzPoly) MulScalar(a *FmpzPoly, x *Fmpz) *FmpzPoly
- func (z *FmpzPoly) Neg(p *FmpzPoly) *FmpzPoly
- func (z *FmpzPoly) Pow(m *FmpzPoly, e int) *FmpzPoly
- func (z *FmpzPoly) Set(poly *FmpzPoly) *FmpzPoly
- func (z *FmpzPoly) SetCoeff(c int, x *Fmpz) *FmpzPoly
- func (z *FmpzPoly) SetCoeffUI(c int, x uint) *FmpzPoly
- func (z *FmpzPoly) String() string
- func (z *FmpzPoly) StringSimple() string
- func (z *FmpzPoly) Sub(a, b *FmpzPoly) *FmpzPoly
- func (z *FmpzPoly) Zero() *FmpzPoly
- type FmpzPolyFactor
- func (f *FmpzPolyFactor) GetCoeff() *Fmpz
- func (f *FmpzPolyFactor) GetExp(n int) int
- func (f *FmpzPolyFactor) GetPoly(n int) *FmpzPoly
- func (f *FmpzPolyFactor) GetPolyNF(n int) *FmpzPoly
- func (f *FmpzPolyFactor) Len() int
- func (f *FmpzPolyFactor) Print()
- func (f *FmpzPolyFactor) Set(fac *FmpzPolyFactor) *FmpzPolyFactor
- type MpLimb
- type Mpz
- type NmodPoly
Constants ¶
This section is empty.
Variables ¶
var ( // Zero is an Fmpz of value 0. Zero = NewFmpz(0) )
Functions ¶
This section is empty.
Types ¶
type FlintRandT ¶
type FlintRandT struct {
// contains filtered or unexported fields
}
FlintRandT keeps state for Fmpz random number generation.
type Fmpq ¶
type Fmpq struct {
// contains filtered or unexported fields
}
Fmpq is an arbitrary precision rational type.
func NewFmpqFmpz ¶
NewFmpqFmpz allocates and returns a new Fmpq set to p / q where p and q are Fmpz types.
func (*Fmpq) CmpRational ¶
CmpRational compares rationals z and y and returns:
-1 if z < y 0 if z == y +1 if z > y
func (*Fmpq) GetFmpqFraction ¶
GetFmpqFraction gets the integer numerator and denomenator of the rational Fmpq q.
func (*Fmpq) MulRational ¶
MulRational sets q to the product of rational x and integer y and returns q.
func (*Fmpq) SetFmpqFraction ¶
SetFmpqFraction sets the value of q to the canonical form of the fraction num / den and returns q.
type Fmpz ¶
type Fmpz struct {
// contains filtered or unexported fields
}
Fmpz is a arbitrary size integer type.
func (*Fmpz) BitLen ¶
BitLen returns the length of the absolute value of z in bits. The bit length of 0 is 0.
func (*Fmpz) Bits ¶
Bits returns the number of bits required to store the absolute value of z. If z is 0 then 0 is returned.
func (*Fmpz) CRT ¶
CRT uses the Chinese Remainder Theorem to set out to the unique value 0≤x<M (if sign = 0) or −M/2<x≤M/2 (if sign = 1) congruent to r1 modulo m1 and r2 modulo m2, where where M=m1×m2. It is assumed that m1 and m2 are positive integers greater than 1 and coprime. If sign = 0, it is assumed that 0≤r1<m1 and 0≤r2<m2. Otherwise, it is assumed that −m1≤r1<m1 and 0≤r2<m2.
func (*Fmpz) Div ¶
Div sets z to the quotient x/y for y != 0 and returns z. If y == 0, a division-by-zero run-time panic occurs. Div implements Euclidean division (unlike Go); see DivMod for more details.
func (*Fmpz) DivMod ¶
DivMod sets z to the quotient x div y and m to the modulus x mod y and returns the pair (z, m) for y != 0. If y == 0, a division-by-zero run-time panic occurs.
DivMod implements Euclidean division and modulus (unlike Go):
q = x div y such that m = x - y*q with 0 <= m < |q|
(See Raymond T. Boute, “The Euclidean definition of the functions div and mod”. ACM Transactions on Programming Languages and Systems (TOPLAS), 14(2):127-144, New York, NY, USA, 4/1992. ACM press.) See QuoRem for T-division and modulus (like Go).
func (*Fmpz) DivR ¶
DivR sets z to the result of z/y in the ring of integers(n). Currently this only works if y fits into the int type supported by the Fmpq type.
func (*Fmpz) Exp ¶
Exp sets z = x**y mod |m| (i.e. the sign of m is ignored), and returns z. If y <= 0, the result is 1; if m == nil or m == 0, z = x**y. See Knuth, volume 2, section 4.6.3.
func (*Fmpz) GCD ¶
GCD sets f to the greatest common divisor of g and h. The result is always positive, even if one of g and h is negative
func (*Fmpz) GCDInv ¶
GCDInv given integers f, g with 0 ≤ f < g, computes the greatest common divisor d = gcd(f, g) and the modular inverse a = f^-1 (mod g), whenever f != 0 void fmpz_gcdinv (fmpz_t d , fmpz_t a , const fmpz_t f , const fmpz_t g )
func (*Fmpz) Int64 ¶
Int64 returns the int64 representation of z. If z cannot be represented in an int64, the result is undefined.
func (*Fmpz) IsProbabPrime ¶
IsProbabPrime performs some trial division and then some probabilistic primality tests. If z is definitely composite, the function returns 0, otherwise it is declared probably prime, i.e. prime for most practical purposes, and the function returns 1. The chance of declaring a composite prime is very small.
func (*Fmpz) IsProbabPrimeBPSW ¶
IsProbabPrimeBPSW performs a Baillie-PSW probable prime test with parameters chosen by Selfridge's method A as per [4]. Return 1 if z is a Lucas probable prime, otherwise return 0. There are no known composites passed as prime by this test, though infinitely many probably exist. The test will declare no primes composite.
func (*Fmpz) IsProbabPrimeLucas ¶
IsProbabPrimeLucas performs a Lucas probable prime test with parameters chosen by Selfridge's method A as per [4]. Return 1 if z is a Lucas probable prime, otherwise return 0. This function declares some composites probably prime, but no primes composite.
func (*Fmpz) IsProbabPrimePseudosquare ¶
IsProbabPrimePseudosquare returns 0 is z is composite. If z is too large (greater than about 94 bits) the function fails silently and returns −1, otherwise, if z is proven prime by the pseudosquares method, return 1. Tests if z is a prime according to [28, Theorem 2.7]. We first factor N using trial division up to some limit B. In fact, the number of primes used in the trial factoring is at most FLINT_PSEUDOSQUARES_CUTOFF. Next we compute N/B and find the next pseudosquare Lp above this value, using a static table as per http://research.att.com/~njas/sequences/b002189.txt. As noted in the text, if p is prime then Step 3 will pass. This test rejects many composites, and so by this time we suspect that p is prime. If N is 3 or 7 modulo 8, we are done, and N is prime. We now run a probable prime test, for which no known counterexamples are known, to reject any composites. We then proceed to prove N prime by executing Step 4. In the case that N is 1 modulo 8, if Step 4 fails, we extend the number of primes pi at Step 3 and hope to find one which passes Step 4. We take the test one past the largest p for which we have pseudosquares Lp tabulated, as this already corresponds to the next Lp which is bigger than 264 and hence larger than any prime we might be testing. As explained in the text, Condition 4 cannot fail if N is prime. The possibility exists that the probable prime test declares a composite prime. However in that case an error is printed, as that would be of independent interest.
func (*Fmpz) IsStrongProbabPrime ¶
IsStrongProbabPrime returns 1 if z is a strong probable prime to base a, otherwise it returns 0
func (*Fmpz) Jacobi ¶
Jacobi computes the Jacobi symbol of a modulo p, where p is a prime and a is reduced modulo p
func (*Fmpz) Lcm ¶
Lcm sets f to the least common multiple of g and h. The result is always nonnegative, even if one of g and h is negative.
func (*Fmpz) LucasChain ¶
LucasChain Given V0 = 2, V1 = A compute Vm, Vm+1 (mod n) from the recurrences Vj = AVj−1 − Vj−2 (mod n).
func (*Fmpz) ModInverse ¶
ModInverse sets z to the inverse of x modulo y and returns z. The value of y may not be 0 otherwise an exception results. If the inverse exists the return value will be non-zero, otherwise the return value will be 0 and the value of f undefined.
func (*Fmpz) ModRational ¶
ModRational sets z to the residue of x = n/d (num, den) modulo n and returns 1 if such a residue exists otherwise 0.
func (*Fmpz) Quo ¶
Quo sets z to the quotient x/y for y != 0 and returns z. If y == 0, a division-by-zero run-time panic occurs. Quo implements truncated division (like Go); see QuoRem for more details.
func (*Fmpz) QuoRem ¶
QuoRem sets z to the quotient x/y and r to the remainder x%y and returns the pair (z, r) for y != 0. If y == 0, a division-by-zero run-time panic occurs.
QuoRem implements T-division and modulus (like Go):
q = x/y with the result truncated to zero r = x - y*q
(See Daan Leijen, “Division and Modulus for Computer Scientists”.) See DivMod for Euclidean division and modulus (unlike Go).
func (*Fmpz) Randm ¶
func (z *Fmpz) Randm(state *FlintRandT, m *Fmpz) *Fmpz
Randm sets z to a random integer between 0 and m-1 inclusive.
func (*Fmpz) SetBytes ¶
SetBytes interprets buf as the bytes of a big-endian unsigned integer, sets z to that value, and returns z.
func (*Fmpz) SetInt64NF ¶
SetInt64NF sets z to x and returns z without setting a Finalizer. This is a hack to help debug double frees in Flint.
func (*Fmpz) SetString ¶
SetString sets z to the value of s, interpreted in the given base, and returns z and a boolean indicating success. If SetString fails, the value of z is undefined but the returned value is nil.
The base argument must be 0 or a value from 2 through MaxBase. If the base is 0, the string prefix determines the actual conversion base. A prefix of “0x” or “0X” selects base 16; the “0” prefix selects base 8, and a “0b” or “0B” prefix selects base 2. Otherwise the selected base is 10.
type FmpzLLL ¶
type FmpzLLL struct {
// contains filtered or unexported fields
}
FmpzLLL stores a LLL matrix reduction context including delta, eta, rt and gt values.
func NewFmpzLLL ¶
func NewFmpzLLL() *FmpzLLL
type FmpzMat ¶
type FmpzMat struct {
// contains filtered or unexported fields
}
FmpzMat is a matrix of Fmpz.
func NewFmpzMat ¶
NewFmpzMat allocates a rows * cols matrix and returns a new FmpzMat.
func NewFmpzMatNF ¶
NewFmpzMatNF allocates a rows * cols matrix and returns a new FmpzMat.
func (*FmpzMat) LLL ¶
LLL reduces m in place according to the parameters specified by the default LLL context of fl->delta, fl->eta, fl->rt and fl->gt set to 0.99, 0.51, ZBASIS and APPROX respectively. u is the matrix used to capture the unimodular transformations if it is not NULL.
type FmpzModCtx ¶
type FmpzModCtx struct {
// contains filtered or unexported fields
}
func NewFmpzModCtx ¶
func NewFmpzModCtx(n *Fmpz) *FmpzModCtx
NewFmpzModCtx allocates a new FmpzModCtx with modulus n and returns it.
func NewFmpzModCtxNF ¶
func NewFmpzModCtxNF(n *Fmpz) *FmpzModCtx
NewFmpzModCtxNF allocates a new FmpzModCtx with modulus n and returns it.
type FmpzModPoly ¶
type FmpzModPoly struct {
// contains filtered or unexported fields
}
FmpzModPoly type represents elements of Z/nZ[x] for a fixed modulus n.
func NewFmpzModPoly ¶
func NewFmpzModPoly(n *FmpzModCtx) *FmpzModPoly
NewFmpzModPoly allocates a new FmpzModPoly mod n and returns it.
func NewFmpzModPoly2 ¶
func NewFmpzModPoly2(n *FmpzModCtx, a int) *FmpzModPoly
NewFmpzModPoly2 allocates a new FmpzModPoly mod n with at least a coefficients and returns it.
func NewFmpzModPolyNF ¶
func NewFmpzModPolyNF(n *FmpzModCtx) *FmpzModPoly
NewFmpzModPolyNF allocates a new FmpzModPoly mod n and returns it.
func SetString ¶
func SetString(poly string) (*FmpzModPoly, error)
SetString returns a polynomial in mod n using the string representation as the definition. e.g. "4 6 1 2 0 5" produces 5x3+2x+1 in (Z/6Z)[x].
func (*FmpzModPoly) Add ¶
func (z *FmpzModPoly) Add(a, b *FmpzModPoly) *FmpzModPoly
Add sets z = a + b and returns z.
func (*FmpzModPoly) DivRem ¶
func (z *FmpzModPoly) DivRem(m *FmpzModPoly) (*FmpzModPoly, *FmpzModPoly)
DivRem computes q, r such that z=mq+r and 0 ≤ len(r) < len(m).
func (*FmpzModPoly) DivScalar ¶
func (z *FmpzModPoly) DivScalar(a *FmpzModPoly, x *Fmpz) *FmpzModPoly
DivScalar sets z = a / x where x is an Fmpz.
func (*FmpzModPoly) Equal ¶
func (z *FmpzModPoly) Equal(p *FmpzModPoly) bool
Equal returns true if z is equal to p otherwise false.
func (*FmpzModPoly) FitLength ¶
func (z *FmpzModPoly) FitLength(l int)
FitLength sets the number of coefficiets in z to l.
func (*FmpzModPoly) GCD ¶
func (z *FmpzModPoly) GCD(a, b *FmpzModPoly) *FmpzModPoly
GCD sets z = gcd(a, b) and returns
func (*FmpzModPoly) GetCoeff ¶
func (z *FmpzModPoly) GetCoeff(c int) *Fmpz
GetCoeff gets the c'th coefficient of z and returns an Fmpz.
func (*FmpzModPoly) GetCoeffs ¶
func (z *FmpzModPoly) GetCoeffs() []*Fmpz
GetCoeffs gets all of the coefficient of z and returns a slice of Fmpz.
func (*FmpzModPoly) GetMod ¶
func (z *FmpzModPoly) GetMod() *Fmpz
GetMod gets the modulus of z and returns an Fmpz.
func (*FmpzModPoly) Mul ¶
func (z *FmpzModPoly) Mul(a, b *FmpzModPoly) *FmpzModPoly
Mul sets z = a * b and returns z.
func (*FmpzModPoly) MulScalar ¶
func (z *FmpzModPoly) MulScalar(a *FmpzModPoly, x *Fmpz) *FmpzModPoly
MulScalar sets z = a * x where x is an Fmpz.
func (*FmpzModPoly) Neg ¶
func (z *FmpzModPoly) Neg(p *FmpzModPoly) *FmpzModPoly
Neg sets z to the negative of p and returns z.
func (*FmpzModPoly) Pow ¶
func (z *FmpzModPoly) Pow(m *FmpzModPoly, e int) *FmpzModPoly
Pow sets z to m^e and returns z.
func (*FmpzModPoly) Set ¶
func (z *FmpzModPoly) Set(poly *FmpzModPoly) *FmpzModPoly
Set sets z to poly and returns z.
func (*FmpzModPoly) SetCoeff ¶
func (z *FmpzModPoly) SetCoeff(c int, x *Fmpz) *FmpzModPoly
SetCoeff sets the c'th coefficient of z to x where x is an Fmpz and returns z.
func (*FmpzModPoly) SetCoeffUI ¶
func (z *FmpzModPoly) SetCoeffUI(c int, x uint) *FmpzModPoly
SetCoeffUI sets the c'th coefficient of z to x where x is an uint and returns z.
func (*FmpzModPoly) String ¶
func (z *FmpzModPoly) String() string
String returns a string representation of the polynomial.
func (*FmpzModPoly) StringSimple ¶
func (z *FmpzModPoly) StringSimple() string
StringSimple returns a simple string representation of the polynomials length, modulus and coefficients. e.g. f(x)=5x^3+2x+1 in (Z/6Z)[x] is "4 6 1 2 0 5"
func (*FmpzModPoly) Sub ¶
func (z *FmpzModPoly) Sub(a, b *FmpzModPoly) *FmpzModPoly
Sub sets z = a - b and returns z.
func (*FmpzModPoly) Zero ¶
func (z *FmpzModPoly) Zero() *FmpzModPoly
Zero sets z to the zero polynomial and returns z.
type FmpzPoly ¶
type FmpzPoly struct {
// contains filtered or unexported fields
}
FmpzPoly type represents a univariate polynomial over the integers.
func FmpzPolySetString ¶
FmpzPolySetString returns a polynomial using the string representation as the definition. e.g. "4 1 2 0 5" produces 5x3+2x+1.
func NewFmpzPoly ¶
func NewFmpzPoly() *FmpzPoly
NewFmpzPoly allocates a new FmpzPoly and returns it.
func NewFmpzPoly2 ¶
NewFmpzPoly2 allocates a new FmpzPoly with at least a coefficients and returns it.
func NewFmpzPolyNF ¶
func NewFmpzPolyNF() *FmpzPoly
NewFmpzPolyNF allocates a new FmpzPoly and returns it.
func (*FmpzPoly) DivScalar ¶
DivScalar sets z = a / x where x is an Fmpz. Rounding coefficients down toward -infinity.
func (*FmpzPoly) Factor ¶
func (z *FmpzPoly) Factor() *FmpzPolyFactor
Factor uses the Zassenhaus factoring algorithm, which takes as input any FmpzPoly z, and returns a factorization in an FmpzPolyFac type.
func (*FmpzPoly) GetCoeffs ¶
GetCoeffs gets all of the coefficient of z and returns a slice of Fmpz.
func (*FmpzPoly) SetCoeff ¶
SetCoeff sets the c'th coefficient of z to x where x is an Fmpz and returns z.
func (*FmpzPoly) SetCoeffUI ¶
SetCoeffUI sets the c'th coefficient of z to x where x is an uint and returns z.
func (*FmpzPoly) StringSimple ¶
StringSimple returns a simple string representation of the polynomials length and coefficients. e.g. f(x)=5x^3+2x+1 is "4 1 2 0 5"
type FmpzPolyFactor ¶
type FmpzPolyFactor struct {
// contains filtered or unexported fields
}
FmpzPolyFactor type represents the factors univariate polynomial over the integers.
func NewFmpzPolyFactor ¶
func NewFmpzPolyFactor() *FmpzPolyFactor
NewFmpzPolyFactor allocates a new FmpzPolyFactor and returns it.
func (*FmpzPolyFactor) GetCoeff ¶
func (f *FmpzPolyFactor) GetCoeff() *Fmpz
GetCoeff gets the coefficient from the FmpzPolyFactor.
func (*FmpzPolyFactor) GetExp ¶
func (f *FmpzPolyFactor) GetExp(n int) int
GetExp gets the exponent of the nth polynomial from the FmpzPolyFactor.
func (*FmpzPolyFactor) GetPoly ¶
func (f *FmpzPolyFactor) GetPoly(n int) *FmpzPoly
GetPoly gets the nth polynomial factor from a FmpzPolyFactor and returns it.
func (*FmpzPolyFactor) GetPolyNF ¶
func (f *FmpzPolyFactor) GetPolyNF(n int) *FmpzPoly
GetPoly gets the nth polynomial factor from a FmpzPolyFactor and returns it.
func (*FmpzPolyFactor) Len ¶
func (f *FmpzPolyFactor) Len() int
Len gets the length of the FmpzPolyFactors list. i.e. the number of factors found.
func (*FmpzPolyFactor) Print ¶
func (f *FmpzPolyFactor) Print()
Print prints the FmpzPolyFactor to stdout.
func (*FmpzPolyFactor) Set ¶
func (f *FmpzPolyFactor) Set(fac *FmpzPolyFactor) *FmpzPolyFactor
Set sets f to FmpzPolyFactor fac and returns f.
type MpLimb ¶
type MpLimb struct {
// contains filtered or unexported fields
}
MpLimb type is a mp_limb_t which is a type alias for ulong which in go is a uint64.
type Mpz ¶
type Mpz struct {
// contains filtered or unexported fields
}
Mpz is an abitrary size integer type from the Gnu Multiprecision Library.
func (*Mpz) DivMod ¶
DivMod sets z to the quotient x div y and m to the modulus x mod y and returns the pair (z, m) for y != 0.
func (*Mpz) MulRMpz ¶
MulRMpz sets z to the product of z and y modulo n and returns z using Mpz types.
func (*Mpz) SetMpzInt64 ¶
SetMpzInt64 sets z to x and returns z.