final class FpFilter[A] extends AnyRef
A Floating-point Filter [1] provides a Numeric type that wraps another
Numeric type, but defers its computation, instead providing a floating
point (Double) approximation. For some operations, like signum,
comparisons, equality checks, toFloat, etc, the Double approximation may
be used to compute the result, rather than having to compute the exact value.
An FpFilter can generally be used with any Ring numeric type (also
supports EuclideanRing, Field, and NRoot). However, it should be
kept in mind that FpFilter knows nothing about the type its wrapping and
assumes that, generally, it is more accurate than it is. When an FpFilter
cannot determine an answer to some predicate exactly, it will defer to the
wrapped value, so it probably doesn't make sense to wrap Ints, when an
Int will overflow before a Double!
Good candidates to wrap in FpFilter are BigInts, Rationals,
BigDecimals, and Algebraic. Note that while Algebraic has an
internal floating-point filter, this still provides benefits. Namely, the
operator-fusion and allocation removal provided by the macros can make for
much faster hot paths.
Note: Both equals and hashCode will generally force the exact computation.
They should be avoided (prefer === for equals)... otherwise why use
bother?
[1] Burnikel, Funke, Seel. Exact Geometric Computation Using Cascading. SoCG 1998.
- Alphabetic
- By Inheritance
- FpFilter
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new FpFilter(apx: Double, mes: Double, ind: Int, exact0: ⇒ A)
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
- macro def *(rhs: FpFilter[A])(implicit ev: Semiring[A]): FpFilter[A]
- macro def +(rhs: FpFilter[A])(implicit ev: Semiring[A]): FpFilter[A]
- macro def -(rhs: FpFilter[A])(implicit ev: Rng[A]): FpFilter[A]
- macro def /(rhs: FpFilter[A])(implicit ev: Field[A]): FpFilter[A]
- macro def <(rhs: FpFilter[A])(implicit ev0: Signed[A], ev1: Rng[A]): Boolean
- macro def <=(rhs: FpFilter[A])(implicit ev0: Signed[A], ev1: Rng[A]): Boolean
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- macro def ===(rhs: FpFilter[A])(implicit ev0: Signed[A], ev1: Rng[A]): Boolean
- macro def >(rhs: FpFilter[A])(implicit ev0: Signed[A], ev1: Rng[A]): Boolean
- macro def >=(rhs: FpFilter[A])(implicit ev0: Signed[A], ev1: Rng[A]): Boolean
- macro def abs(implicit ev: Signed[A]): FpFilter[A]
- val apx: Double
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(that: Any): Boolean
- Definition Classes
- FpFilter → AnyRef → Any
- def error: Double
- lazy val exact: A
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
hashCode(): Int
- Definition Classes
- FpFilter → AnyRef → Any
- val ind: Int
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- val mes: Double
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- macro def signum(implicit ev: Signed[A]): Int
- macro def sqrt(implicit ev: NRoot[A]): FpFilter[A]
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
- macro def unary_-(implicit ev: Rng[A]): FpFilter[A]
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )