FuzzyEq

com.phasmidsoftware.number.algebra.core.FuzzyEq
See theFuzzyEq companion trait
object FuzzyEq

Attributes

Companion
trait
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
FuzzyEq.type

Members list

Value members

Concrete methods

def apply[A](using fe: FuzzyEq[A]): FuzzyEq[A]

Retrieves the implicit FuzzyEq instance for the type A.

Retrieves the implicit FuzzyEq instance for the type A.

Value parameters

fe

The implicit FuzzyEq instance for the type A.

Attributes

Returns

The FuzzyEq instance for the type A.

def instance[A](f: (A, A, Double) => Boolean): FuzzyEq[A]

Creates a new FuzzyEq instance for the type A using the provided comparison function.

Creates a new FuzzyEq instance for the type A using the provided comparison function.

Value parameters

f

A function that defines the fuzzy equality logic for values of type A. The function takes two values of type A and a probability threshold of type Double, returning true if the values are considered approximately equal within the given threshold, otherwise false.

Attributes

Returns

A FuzzyEq[A] instance that uses the provided function for fuzzy equality checks.

Extensions

Extensions

extension [A](x: A)(using fe: FuzzyEq[A])
def fuzzyEqv(y: A, p: Double = ...): Boolean

Compares the current value with another value using fuzzy equality logic. The comparison allows for an approximate equality check with a specified probability threshold.

Compares the current value with another value using fuzzy equality logic. The comparison allows for an approximate equality check with a specified probability threshold.

Value parameters

p

The probability threshold for determining approximate equality. Defaults to 0.5. A higher value makes the comparison stricter, while a lower value allows more flexibility.

y

The value of type A to compare with the current value.

Attributes

Returns

true if the values are considered approximately equal within the specified threshold, otherwise false.

infix def ~=(y: A): Boolean

Compares the current value with another value using fuzzy equality logic. The comparison allows for an approximate equality check with a default probability threshold.

Compares the current value with another value using fuzzy equality logic. The comparison allows for an approximate equality check with a default probability threshold.

Value parameters

y

The value of type A to compare with the current value.

Attributes

Returns

true if the values are considered approximately equal within the default threshold, otherwise false.

def ~=(y: A, p: Double): Boolean

Compares the current value with another value using fuzzy equality logic. The comparison allows for an approximate equality check with a specified probability threshold.

Compares the current value with another value using fuzzy equality logic. The comparison allows for an approximate equality check with a specified probability threshold.

Value parameters

p

The probability threshold for determining approximate equality. A higher value makes the comparison stricter, while a lower value allows more flexibility.

y

The value of type A to compare with the current value.

Attributes

Returns

true if the values are considered approximately equal within the specified threshold, otherwise false.