Packages

  • package root
    Definition Classes
    root
  • package spire
    Definition Classes
    root
  • package math
    Definition Classes
    spire
  • package interval
    Definition Classes
    math
  • package poly
    Definition Classes
    math
  • BigDecimalRootRefinement
  • PolyDense
  • PolySparse
  • RootFinder
  • RootIsolator
  • Roots
  • SpecialPolynomials
  • Term
  • package prime

    Basic tools for prime factorization.

    Basic tools for prime factorization.

    This package is intended to provide tools for factoring numbers, checking primality, generating prime numbers, etc. For now, its main contributions are a method for factoring integers (spire.math.prime.factor) and a type for representing prime factors and their exponents (spire.math.prime.Factors).

    The factorization currently happens via an implementation of Pollard-Rho with Brent's optimization. This technique works very well for composites with small prime factors (up to 10 decimal digits or so) and can support semiprimes (products of two similarly-sized primes) of 20-40 digits.

    The implementation does cheat, using BigInteger.isProbablePrime(40) to test basic primality. This has a roughly 1-in-1,000,000,000,000 chance of being wrong.

    Since Pollard-Rho uses random primes, its performance is somewhat non-deterministic. On this machine, factoring 20-digit semiprimes seem to average about 1.5s and factoring 30-digit semiprimes seem to average about 20s. Much larger numbers can be factored provided they are either prime or composites with smallish factors.

    Definition Classes
    math

package poly

Ordering
  1. Alphabetic
Visibility
  1. Public
  2. All

Type Members

  1. case class BigDecimalRootRefinement (context: ApproximationContext, approximation: Approximation) extends Product with Serializable
  2. class PolyDense [C] extends Polynomial[C]
  3. case class PolySparse [C] extends Polynomial[C] with Product with Serializable
  4. trait RootFinder [A] extends AnyRef

    A type class that can find roots of a polynomial.

  5. sealed trait RootIsolator [A] extends AnyRef

    A type class for retreiving isolated roots.

  6. trait Roots [A] extends Iterable[A]

    A trait that can be used to retreive the (possibly approximated) real roots of the polynomial poly.

  7. case class Term [C](coeff: C, exp: Int) extends Product with Serializable

Value Members

  1. object BigDecimalRootRefinement extends Serializable
  2. object PolyDense
  3. object PolySparse extends Serializable
  4. object RootFinder
  5. object RootIsolator
  6. object Roots
  7. object SpecialPolynomials
  8. object Term extends Serializable

Ungrouped