Documentation
¶
Overview ¶
Package lfs provides functionality to compute Lagrange four-square representations of positive integers using different algorithms. Both a basic method and a more complicated Fermat-Christmas Method (FCM) are provided. Settings are configurable via functional options.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CacheGaussianInt ¶
func CacheGaussianInt(e int)
CacheGaussianInt precomputes and caches (1+i)^n for n <= e.
func ResetCacheGaussianInt ¶
func ResetCacheGaussianInt()
ResetCacheGaussianInt resets the Gaussian integer cache.
Types ¶
type FourInt ¶
FourInt represents a group of four big.Int values.
func NewFourInt ¶
NewFourInt creates a new FourInt with its components sorted in descending order.
type Option ¶ added in v0.1.0
type Option func(*Solver)
Option defines a functional option for configuring the Solver.
func WithFCMThreshold ¶ added in v0.1.0
WithFCMThreshold configures the FCM threshold.
func WithNumRoutines ¶ added in v0.1.0
WithNumRoutines configures the number of goroutines used in random search.
type Solver ¶ added in v0.1.0
type Solver struct {
// FCMThreshold determines when to use the FCM-based algorithm.
// If the input n is greater than or equal to FCMThreshold, the FCM algorithm is used.
FCMThreshold *big.Int
// NumRoutines specifies the number of goroutines to use for parallel randomized search.
NumRoutines int
}
Solver encapsulates configuration for computing the four-square representation.
func NewSolver ¶ added in v0.1.0
NewSolver creates a new Solver with the provided options. By default, FCMThreshold is set to 2^500 and NumRoutines to the number of available CPUs.