DyadicOps

com.phasmidsoftware.number.algebra.core.DyadicOps
trait DyadicOps

Represents a trait for performing dyadic operations on instances of the Eager type.

This trait provides methods for equality checks, fuzzy comparisons, ordering, and arithmetic operations.

NOTE that compare, fuzzyCompare, and sum are not defined in this trait, have two parameters where one would be sufficient (and probably better).

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait Eager
trait Nat
object NatZero
class Succ
trait Solution
trait Algebraic
class Complex
trait Structure
trait Functional
trait Radians
class Angle
trait Transformed
class Exponential
class InversePower
trait Scalar
object NoScalar
trait Number
trait ExactNumber
class WholeNumber
class Real
Show all

Members list

Value members

Abstract methods

def compare(x: Eager, y: Eager): Try[Int]

Compares two instances of the Eager type and returns the result of the comparison.

Compares two instances of the Eager type and returns the result of the comparison.

Value parameters

x

the first Eager instance to compare

y

the second Eager instance to compare

Attributes

Returns

a Try[Int] containing the result of the comparison, where a negative value indicates that x is less than y, zero indicates equality, and a positive value indicates that x is greater than y

def eqv(that: Eager): Try[Boolean]

Compares this Eager instance with another Eager instance for equality.

Compares this Eager instance with another Eager instance for equality.

Value parameters

that

the Eager instance to be compared against.

Attributes

Returns

a Try[Boolean] indicating whether the two Eager instances are equal. A successful result contains true if they are equal, or false if not. If the comparison cannot be performed, a failure with an appropriate exception is returned.

def fuzzyCompare(p: Double)(x: Eager, y: Eager): Try[Int]

Compares two instances of Eager using a fuzzy comparison approach with a specified tolerance. The comparison determines their relative ordering.

Compares two instances of Eager using a fuzzy comparison approach with a specified tolerance. The comparison determines their relative ordering.

Value parameters

p

the tolerance level as a Double; smaller values indicate stricter thresholds for comparison.

x

the first Eager instance to compare.

y

the second Eager instance to compare.

Attributes

Returns

a Try[Int] indicating the result of the comparison: - A negative integer if x is less than y. - Zero if x is approximately equal to y within the specified tolerance p. - A positive integer if x is greater than y. - A Failure containing an exception if the comparison cannot be performed.

def fuzzyEqv(confidence: Double)(that: Eager): Try[Boolean]

Determines if the current Eager instance is approximately equal to another Eager instance within a specified tolerance.

Determines if the current Eager instance is approximately equal to another Eager instance within a specified tolerance.

Value parameters

confidence

the tolerance level as a Double. A smaller value indicates stricter equality requirements.

that

the Eager instance to compare against.

Attributes

Returns

a Try[Boolean] indicating the result of the fuzzy equality comparison: - true if the two instances are approximately equal within the tolerance p. - false otherwise. If the comparison cannot be performed, the Try contains a failure with an appropriate exception.