Packages

  • package root
    Definition Classes
    root
  • package spire
    Definition Classes
    root
  • package math
    Definition Classes
    spire
  • package interval
    Definition Classes
    math
  • Bound
  • Closed
  • EmptyBound
  • Open
  • Overlap
  • Unbound
  • ValueBound
  • package poly
    Definition Classes
    math
  • 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
p

spire.math

interval

package interval

Ordering
  1. Alphabetic
Visibility
  1. Public
  2. All

Type Members

  1. sealed trait Bound [A] extends AnyRef
  2. case class Closed [A](a: A) extends ValueBound[A] with Product with Serializable
  3. case class EmptyBound [A]() extends Bound[A] with Product with Serializable
  4. case class Open [A](a: A) extends ValueBound[A] with Product with Serializable
  5. sealed abstract class Overlap [A] extends Product with Serializable

    An ADT that represents overlapping result for any two intervals.

  6. case class Unbound [A]() extends Bound[A] with Product with Serializable
  7. sealed trait ValueBound [A] extends Bound[A]

Value Members

  1. object Bound
  2. object Overlap extends Serializable
  3. object ValueBound

    Companion object for open/closed bounds, used to construct intervals from a set of bounds.

    Companion object for open/closed bounds, used to construct intervals from a set of bounds.

    In the comments, we write

    - [v, (v or ?v when the bound is interpreted as a lower bound, - v], v), v? when the bound is interpreted as an upper bound.

    The symbols [], (), ? correspond to closed, open or unknown bounds.

Ungrouped