spire.math

algebraic

package algebraic

Visibility
  1. Public
  2. All

Type Members

  1. case class AddExpr[A](lhs: A, rhs: A) extends Expr[A] with Product with Serializable

  2. trait BMFSSBound[A <: BMFSSBound[A]] extends ScalaNumber with SeparationBound[A]

    A mixin for the SeparationBound that implements the BMFSS bound.

  3. trait BigDecimalApprox[A <: BigDecimalApprox[A]] extends ScalaNumber with RealLike[A] with SeparationBound[A]

  4. case class BigIntExpr[A](n: BigInt) extends Expr[A] with Product with Serializable

  5. case class BinaryTreeString(op: String, lhs: TreeString, rhs: TreeString) extends TreeString with Product with Serializable

  6. trait BubbleUpDivs[A <: RealLike[A]] extends ScalaNumber with RealTransform[A]

    A mixin that will move all divisions up to the top of the expression tree, ensuring there is, at most, one division in a Real.

    A mixin that will move all divisions up to the top of the expression tree, ensuring there is, at most, one division in a Real. This is needed for the BFMSS bound.

  7. trait Coexpr[A] extends AnyRef

    A type class that indicates that the type A has a structure that can be modelled by an Expr[A].

    A type class that indicates that the type A has a structure that can be modelled by an Expr[A]. The type class let's us switch between the 2 types, so that we can both traverse the type A as an Expr and also construct an A from an Expr[A].

    If ce is an instance of Coexpr[A], then ce.coexpr(ce.expr(a)) == a.

  8. case class ConstTreeString(a: Any) extends TreeString with Product with Serializable

  9. trait ConstantFolder[A <: RealLike[A]] extends ScalaNumber with RealTransform[A]

    This folds all ring ops (+, -, *) on constants to constants.

    This folds all ring ops (+, -, *) on constants to constants. This only works on IntLits for now, as BigInts may be slow.

    TODO: It may be worth it to fold BigIntLits for add/subtract, since the space requirement would approximately half.

  10. case class DivExpr[A](lhs: A, rhs: A) extends Expr[A] with Product with Serializable

  11. sealed trait Expr[A] extends AnyRef

    An Expr describes a simple structure for algebraic expressions.

    An Expr describes a simple structure for algebraic expressions. Generally, a type Expr[A] indicates that A has some structure that mirrors Expr. To get at this symmetry, you must use the type class Coexpr[A]. This let's us switch between types A and Expr[A], giving us the ability to extract structure from a type A, traverse, and construct the expression tree of A, without having to deal with A as a concrete type.

    Using Coexpr let's us provide further general constructors and pattern matchers. These are defined as the same name as the case class, but without the Expr appended. So, we can, for example, pattern match on an instance a of the generic type A. Suppose we wanted to map patterns like ab + ac to a(b + c), then we could do the following:

    a match { case Add(Mul(a, b), Mul(c, d)) if a == c => Mul(a, Add(b, d)) case _ => a }

  12. trait FPFilter[A <: FPFilter[A]] extends ScalaNumber with RealLike[A]

    A mix-in for RealLike that adds an internal floating pointer filter.

  13. case class IntExpr[A](n: Int) extends Expr[A] with Product with Serializable

  14. case class KRootExpr[A](sub: A, k: Int) extends Expr[A] with Product with Serializable

  15. case class MulExpr[A](lhs: A, rhs: A) extends Expr[A] with Product with Serializable

  16. case class NegExpr[A](sub: A) extends Expr[A] with Product with Serializable

  17. trait PrettyToString[A <: PrettyToString[A]] extends ScalaNumber with RealLike[A]

  18. trait RealLike[A <: RealLike[A]] extends ScalaNumber

  19. trait RealTransform[A <: RealLike[A]] extends ScalaNumber with RealLike[A]

    A mixin for a Real that let's us transform the tree as its being built.

    A mixin for a Real that let's us transform the tree as its being built. In your implementation of transform, you'll likely want to play nice and call super.transform(x) first.

  20. trait SeparationBound[A <: RealLike[A]] extends ScalaNumber with RealLike[A]

    A SeparationBound provides a way to bound a real number s.

    A SeparationBound provides a way to bound a real number s.t. if the number is not 0, then its absolute value is >= 2^lowerBound.

  21. case class SubExpr[A](lhs: A, rhs: A) extends Expr[A] with Product with Serializable

  22. sealed trait TreeString extends AnyRef

  23. case class UnaryTreeString(op: String, sub: TreeString) extends TreeString with Product with Serializable

Value Members

  1. object Add

  2. object BigDecimalApproximations

    Provides absolute and relative approximations to RealLike types that have mixed in a SeparationBound.

    Provides absolute and relative approximations to RealLike types that have mixed in a SeparationBound. The absolute approximations take BigDecimal for their context, returning a BigDecimal that is equal to the RealLike +/- the context (error). The relative approximations take a MathContext specifying how many digits to determine the value of the RealLike to.

    Note that a relative approximation of 0 is always 0.

    Here, we mostly work with java.math.BigDecimal as its operations let you provide a MathContext directly. However, I'm pretty sure that a.add(b, mc) is equivalent to (a + b).round(mc).

  3. object BigIntLit

  4. object Coexpr

  5. object Div

  6. object Expr

  7. object IntLit

  8. object KRoot

  9. object Mul

  10. object Neg

  11. object Sub

  12. object TreeString

Ungrouped