qs

package
v1.2.33 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UNSMOOTH = iota
	TRIVIAL
	INSERTED
	SOLVED
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FactorBase

type FactorBase interface {
	// Prepare factor base.<p>
	// @param m BigInteger - number to be factorized
	Init(m *math.Int) bool

	// Get number of primes in the factor base.<P>
	// @return int - number of primes in factor base
	GetNumPrimes() int

	// Get the i.th primes in the factor base.<p>
	// @param i int - prime index
	// @return BigInteger - prime value
	GetPrime(i int) *math.Int

	// Solve the equation x^2 = m (mod p)
	// @param i
	// @return
	GetSqrt(i int) *math.Int
}

Factor base: contains a given number of suitable primes.<p> An integer x is smooth if all the prime factors of x are contained in the factor base.<p>

type FactorBaseImpl

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

func NewFactorBaseImpl

func NewFactorBaseImpl(m *math.Int) *FactorBaseImpl

func (*FactorBaseImpl) GetNumPrimes

func (fb *FactorBaseImpl) GetNumPrimes() int

func (*FactorBaseImpl) GetPrime

func (fb *FactorBaseImpl) GetPrime(i int) *math.Int

func (*FactorBaseImpl) GetSqrt

func (fb *FactorBaseImpl) GetSqrt(i int) *math.Int

func (*FactorBaseImpl) Init

func (fb *FactorBaseImpl) Init(m *math.Int) bool

type Function

type Function interface {

	// Instanciate function (and compute/initialize helpers).<p>
	// @param n BigInteger - number to be decomposed
	Init(n *math.Int) bool

	F(x *math.Int) *math.Int

	SqrArg(x *math.Int) *math.Int

	ModP(a, p *math.Int) *math.Int
}

type FunctionImpl

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

func NewFunctionImpl

func NewFunctionImpl(n *math.Int) *FunctionImpl

Instanciate function (and compute/initialize helpers).<p> @param n BigInteger - number to be decomposed

func (*FunctionImpl) F

func (f *FunctionImpl) F(x *math.Int) *math.Int

func (*FunctionImpl) Init

func (f *FunctionImpl) Init(n *math.Int) bool

Prepare function for given integer.<p> @param n BigInteger - number to be decomposed

func (*FunctionImpl) ModP

func (f *FunctionImpl) ModP(x, p *math.Int) *math.Int

func (*FunctionImpl) SqrArg

func (f *FunctionImpl) SqrArg(x *math.Int) *math.Int

type Relation

type Relation struct {
	Rel_maxBits int
	// contains filtered or unexported fields
}

func (*Relation) Multiply

func (r *Relation) Multiply(r2 *Relation)

func (*Relation) Set

func (r *Relation) Set(x, y *math.Int) bool

type Siever

type Siever interface {
	Init(f Function, fb FactorBase, size int) bool

	SieveInterval(x0 *math.Int, solver Solver) *math.Int
}

Interface for (quadratic) sieve implementations.<p>

type SieverImpl

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

func NewSieverImpl

func NewSieverImpl(f Function, fb FactorBase, size int) *SieverImpl

func (*SieverImpl) Init

func (si *SieverImpl) Init(f Function, fb FactorBase, size int) bool

func (*SieverImpl) SieveInterval

func (si *SieverImpl) SieveInterval(x0 *math.Int, solver Solver) *math.Int

type Solver

type Solver interface {
	Init(n *math.Int, f Function, fb FactorBase) bool

	Process(x *math.Int) int

	Done() bool

	Optimize()

	GetSolution() *math.Int
}

type SolverImpl

type SolverImpl struct {
	Relation
	// contains filtered or unexported fields
}

func NewSolverImpl

func NewSolverImpl(m *math.Int, f Function, fb FactorBase) *SolverImpl

func (*SolverImpl) Done

func (si *SolverImpl) Done() bool

func (*SolverImpl) GetSolution

func (si *SolverImpl) GetSolution() *math.Int

func (*SolverImpl) Init

func (si *SolverImpl) Init(m *math.Int, f Function, fb FactorBase) bool

func (*SolverImpl) Optimize

func (si *SolverImpl) Optimize()

func (*SolverImpl) Process

func (si *SolverImpl) Process(x *math.Int) int

Jump to

Keyboard shortcuts

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