Documentation ¶
Index ¶
- Variables
- func BytesToNumber(src []byte) *fmp.Fmpz
- func Combinations(set []*fmp.Fmpz, n int) (subsets [][]*fmp.Fmpz)
- func ContfractToRational(frac []int) (*fmp.Fmpz, *fmp.Fmpz)
- func ConvergantsFromContfract(frac []int) [][2]*fmp.Fmpz
- func FindGcd(a, b *fmp.Fmpz) *fmp.Fmpz
- func FindPGivenD(d *fmp.Fmpz, e *fmp.Fmpz, n *fmp.Fmpz) *fmp.Fmpz
- func FmpFromIntSlice(is []int) []*fmp.Fmpz
- func FmpFromUInt64Slice(is []uint64) []*fmp.Fmpz
- func FmpString(s string) *fmp.Fmpz
- func FmpzMin(x, y *fmp.Fmpz) *fmp.Fmpz
- func FracPow(x *fmp.Fmpz, m, n int) *fmp.Fmpz
- func GetRand(state *fmp.FlintRandT, n *fmp.Fmpz) *fmp.Fmpz
- func ILog(x, b *fmp.Fmpz) *fmp.Fmpz
- func IsPerfectSquare(n *fmp.Fmpz) *fmp.Fmpz
- func IsPower(n *fmp.Fmpz) *fmp.Fmpz
- func MLucas(v, a, n *fmp.Fmpz) *fmp.Fmpz
- func NumberToBytes(src *fmp.Fmpz) []byte
- func RationalToContfract(x, y *fmp.Fmpz) []int
- func SegmentedSieveFmp(n int) []*fmp.Fmpz
- func SieveOfAtkin(n int) []int
- func SieveOfAtkinFmp(n int) []*fmp.Fmpz
- func SieveOfEratosthenes(n int) []int
- func SieveOfEratosthenesFmp(n int) []*fmp.Fmpz
- func SieveRangeOfAtkin(begin, n int) []int
- func SolveCRT(mrs [][]*fmp.Fmpz) *fmp.Fmpz
- func SolveforD(p *fmp.Fmpz, q *fmp.Fmpz, e *fmp.Fmpz) *fmp.Fmpz
- func XGCD(a, b *fmp.Fmpz) (*fmp.Fmpz, *fmp.Fmpz, *fmp.Fmpz)
Constants ¶
This section is empty.
Variables ¶
var ( // BigNOne is the Fmpz representation of -1 BigNOne = fmp.NewFmpz(-1) // BigZero is the Fmpz representation of 0 BigZero = fmp.NewFmpz(0) // BigOne is the Fmpz representation of 1 BigOne = fmp.NewFmpz(1) // BigTwo is the Fmpz representation of 2 BigTwo = fmp.NewFmpz(2) // BigThree is the Fmpz representation of 3 BigThree = fmp.NewFmpz(3) // BigFour is the Fmpz representation of 4 BigFour = fmp.NewFmpz(4) // BigFive is the Fmpz representation of 5 BigFive = fmp.NewFmpz(5) // BigSix is the Fmpz representation of 6 BigSix = fmp.NewFmpz(6) // BigSeven is the Fmpz representation of 7 BigSeven = fmp.NewFmpz(7) // BigEight is the Fmpz representation of 8 BigEight = fmp.NewFmpz(8) // BigNine is the Fmpz representation of 9 BigNine = fmp.NewFmpz(9) // BigEleven is the Fmpz representation of 11 BigEleven = fmp.NewFmpz(11) // BigSixteen is the Fmpz representation of 16 BigSixteen = fmp.NewFmpz(0xf) )
Functions ¶
func BytesToNumber ¶
BytesToNumber takes a slice of bytes and returns a Fmpz integer representation.
func Combinations ¶
Combinations returns combinations of n elements for a given Fmpz array.
func ContfractToRational ¶
ContfractToRational takes a slice of quotients and returns a rational x/y.
func ConvergantsFromContfract ¶
ConvergantsFromContfract takes a slice of quotients and returns the convergants.
func FindPGivenD ¶
FindPGivenD finds p and q given d, e, and n - uses an algorithm from pycrypto _slowmath.py [0] [0]: https://github.com/dlitz/pycrypto/blob/master/lib/Crypto/PublicKey/_slowmath.py
func FmpFromIntSlice ¶
FmpFromIntSlice returns a slice of Fmpz from a slice of int.
func FmpFromUInt64Slice ¶
FmpFromUInt64Slice returns a slice of Fmpz from a slice of int.
func FmpString ¶
FmpString returns a base 10 fmp.Fmpz integer from a string. It returns BigZero on error.
func GetRand ¶
GetRand takes a seed from the environment and iterates the state a random number of times to get a less deterministic random number from Flint.
func IsPerfectSquare ¶
IsPerfectSquare returns t if n is a perfect square -1 otherwise
func IsPower ¶
IsPower returns the largest integer that, when squared/cubed/etc, yields n, or 0 if no such integer exists.
func NumberToBytes ¶
NumberToBytes takes an Fmpz integer and returns the byte slice representation.
func RationalToContfract ¶
RationalToContfract takes a rational represented by x and y and returns a slice of quotients.
func SegmentedSieveFmp ¶
SegmentedSieveFmp is another prime sieve.
func SieveOfAtkin ¶
SieveOfAtkin finds primes from 0 to n using a SieveOfAtkin from primegen package.
func SieveOfAtkinFmp ¶
SieveOfAtkinFmp finds primes from 0 to n using a SieveOfAtkin from primegen package.
func SieveOfEratosthenes ¶
SieveOfEratosthenes returns primes from begin to n and this implementation comes from: https://stackoverflow.com/a/21923233.
func SieveOfEratosthenesFmp ¶
SieveOfEratosthenesFmp is a convenience function that simply returns []*fmp.Fmpz instead of []int. It does not support finding primes > max_int.
func SieveRangeOfAtkin ¶
SieveRangeOfAtkin finds primes from begin to the limit n using a SieveOfAtkin from primegen package.
Types ¶
This section is empty.