spire.math

Interval

sealed abstract class Interval[A] extends AnyRef

Interval represents a set of values, usually numbers.

Intervals have upper and lower bounds. Each bound can be one of three kinds:

* Closed: The boundary value is included in the interval. * Open: The boundary value is excluded from the interval. * Unbound: There is no boundary value.

When the underlying type of the interval supports it, intervals may be used in arithmetic. There are several possible interpretations of interval arithmetic: the interval can represent uncertainty about a single value (for instance, a quantity +/- tolerance in engineering) or it can represent all values in the interval simultaneously. In this implementation we have chosen to use the probabillistic interpretation.

One common pitfall with interval arithmetic is that many familiar algebraic relations do not hold. For instance, given two intervals a and b:

a == b does not imply a * a == a * b

Consider a = b = [-1, 1]. Since any number times itself is non-negative, a * a = [0, 1]. However, a * b = [-1, 1], since we may actually have a=1 and b=-1.

These situations will result in loss of precision (in the form of wider intervals). The result is not wrong per se, but less acccurate than it could be.

Self Type
Interval[A]
Linear Supertypes
AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Interval
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Interval()(implicit order: Order[A])

Value Members

  1. final def !=(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Definition Classes
    AnyRef → Any
  3. def &(rhs: Interval[A])(implicit r: AdditiveMonoid[A]): Interval[A]

  4. def *(rhs: A)(implicit ev: Semiring[A]): Interval[A]

  5. def *(rhs: Interval[A])(implicit ev: Semiring[A]): Interval[A]

  6. def +(rhs: A)(implicit ev: AdditiveSemigroup[A]): Interval[A]

  7. def +(rhs: Interval[A])(implicit ev: AdditiveSemigroup[A]): Interval[A]

  8. def -(rhs: A)(implicit ev: AdditiveGroup[A]): Interval[A]

  9. def -(rhs: Interval[A])(implicit ev: AdditiveGroup[A]): Interval[A]

  10. def --(rhs: Interval[A])(implicit r: AdditiveMonoid[A]): List[Interval[A]]

  11. def /(rhs: Interval[A])(implicit ev: Field[A]): Interval[A]

  12. final def ==(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  13. def abs(implicit m: AdditiveGroup[A]): Interval[A]

  14. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  15. def bottom(min: A, epsilon: A)(implicit r: AdditiveGroup[A]): Option[A]

  16. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  17. def combine(rhs: Interval[A])(f: (A, A) ⇒ A): Interval[A]

  18. def contains(t: A): Boolean

  19. def crosses(t: A): Boolean

  20. def crossesZero(implicit ev: AdditiveMonoid[A]): Boolean

  21. def dist(min: A, max: A, epsilon: A)(implicit u: Uniform[A], r: AdditiveGroup[A]): Dist[A]

  22. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  23. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  24. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  25. def fold[B](f: (Bound[A], Bound[A]) ⇒ B): B

  26. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  27. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  28. def intersect(rhs: Interval[A])(implicit r: AdditiveMonoid[A]): Interval[A]

  29. def intersects(rhs: Interval[A])(implicit r: AdditiveMonoid[A]): Boolean

  30. def isAbove(t: A): Boolean

  31. def isAt(t: A): Boolean

  32. def isAtOrAbove(t: A): Boolean

  33. def isAtOrBelow(t: A): Boolean

  34. def isBelow(t: A): Boolean

  35. def isEmpty: Boolean

  36. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  37. def isPoint: Boolean

  38. def isProperSubsetOf(rhs: Interval[A]): Boolean

  39. def isProperSupersetOf(rhs: Interval[A]): Boolean

  40. def isSubsetOf(rhs: Interval[A]): Boolean

  41. def isSupersetOf(rhs: Interval[A]): Boolean

  42. def lowerBound: Bound[A]

  43. def mapAroundZero[B](f: (Interval[A]) ⇒ B)(implicit ev: AdditiveMonoid[A]): (B, B)

  44. def mapBounds[B](f: (A) ⇒ B)(implicit arg0: Order[B], arg1: AdditiveMonoid[B]): Interval[B]

  45. def max(rhs: Interval[A])(implicit m: AdditiveMonoid[A]): Interval[A]

  46. def min(rhs: Interval[A])(implicit m: AdditiveMonoid[A]): Interval[A]

  47. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  48. def nonEmpty: Boolean

  49. final def notify(): Unit

    Definition Classes
    AnyRef
  50. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  51. def nroot(k: Int)(implicit r: Ring[A], n: NRoot[A]): Interval[A]

  52. def pow(k: Int)(implicit r: Ring[A]): Interval[A]

  53. def reciprocal(implicit ev: Field[A]): Interval[A]

  54. def split(t: A)(implicit r: AdditiveMonoid[A]): (Interval[A], Interval[A])

  55. def splitAtZero(implicit ev: AdditiveMonoid[A]): (Interval[A], Interval[A])

  56. def sqrt(implicit r: Ring[A], n: NRoot[A]): Interval[A]

  57. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  58. def toString(): String

    Definition Classes
    Interval → AnyRef → Any
  59. def top(epsilon: A)(implicit r: AdditiveGroup[A]): Option[A]

  60. def translate(p: Polynomial[A])(implicit ev: Field[A]): Interval[A]

  61. def unary_-()(implicit ev: AdditiveGroup[A]): Interval[A]

  62. def unary_~(implicit r: AdditiveMonoid[A]): List[Interval[A]]

  63. def union(rhs: Interval[A])(implicit r: AdditiveMonoid[A]): Interval[A]

  64. def upperBound: Bound[A]

  65. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  66. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  67. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  68. def |(rhs: Interval[A])(implicit r: AdditiveMonoid[A]): Interval[A]

Inherited from AnyRef

Inherited from Any

Ungrouped