OrderedRing
A typeclass for algebraic values with the following features:
- Associative addition
- Additive identity (
0) - Additive inverse (negation)
- Associative multiplication
- Multiplicative identity (
1) - Total order
Attributes
- Graph
-
- Supertypes
-
trait OrderedDifferenceSemiring[X]trait OrderedSemiring[X]trait OrderedMultiplicativeMonoid[X]trait OrderedMultiplicativeIdentity[X]trait OrderedPseudoring[X]trait OrderedMultiplicativeSemigroup[X]trait OrderedMultiplicativeMagma[X]trait OrderedAdditiveGroup[X]trait OrderedAdditiveInverse[X]trait OrderedDifferenceMonoid[X]trait OrderedAdditiveMonoid[X]trait OrderedAdditiveIdentity[X]trait OrderedDifferenceSemigroup[X]trait OrderedAdditiveSemigroup[X]trait OrderedAdditiveMagma[X]trait Ordered[X]trait Ordering[X]trait PartialOrdering[X]trait Equiv[X]trait Serializabletrait Comparator[X]trait Ring[X]trait DifferenceSemiring[X]trait Semiring[X]trait MultiplicativeMonoid[X]trait MultiplicativeIdentity[X]trait Pseudoring[X]trait MultiplicativeSemigroup[X]trait MultiplicativeMagma[X]trait AdditiveGroup[X]trait AdditiveInverse[X]trait DifferenceMonoid[X]trait AdditiveMonoid[X]trait AdditiveIdentity[X]trait DifferenceSemigroup[X]trait Difference[X]trait AdditiveSemigroup[X]trait AdditiveMagma[X]trait Algebra[X]class Objecttrait Matchableclass AnyShow all
- Known subtypes
-
trait ArchimedeanRing[X]trait ArchimedeanQuotientRing[X]trait ArchimedeanField[X]trait OrderedQuotientRing[X]trait OrderedField[X]Show all
Members list
Type members
Inherited classlikes
This inner class defines comparison operators available for T.
This inner class defines comparison operators available for T.
It can't extend AnyVal because it is not a top-level class or a member of a statically accessible object.
Attributes
- Inherited from:
- Ordering
- Supertypes
-
class Objecttrait Matchableclass Any
Value members
Inherited methods
Returns true if x == y in the ordering.
Returns true if x == y in the ordering.
Attributes
- Definition Classes
-
Ordering -> PartialOrdering -> Equiv
- Inherited from:
- Ordering
Computes the canonical representation of the integer n in this algebra, i.e. 1 + 1 + … + 1 (n times).
Computes the canonical representation of the integer n in this algebra, i.e. 1 + 1 + … + 1 (n times).
Attributes
- Throws
-
IllegalArgumentException
if
n < 0and this algebra has no additive inverse. - Inherited from:
- Semiring
Returns true if x > y in the ordering.
Returns true if x > y in the ordering.
Attributes
- Definition Classes
-
Ordering -> PartialOrdering
- Inherited from:
- Ordering
Returns true if x >= y in the ordering.
Returns true if x >= y in the ordering.
Attributes
- Definition Classes
-
Ordering -> PartialOrdering
- Inherited from:
- Ordering
Returns whether or not the other ordering is the opposite ordering of this one.
Returns whether or not the other ordering is the opposite ordering of this one.
Equivalent to other == this.reverse.
Implementations should only override this method if they are overriding reverse as well.
Attributes
- Inherited from:
- Ordering
Returns true if x < y in the ordering.
Returns true if x < y in the ordering.
Attributes
- Definition Classes
-
Ordering -> PartialOrdering
- Inherited from:
- Ordering
Returns true if x <= y in the ordering.
Returns true if x <= y in the ordering.
Attributes
- Definition Classes
-
Ordering -> PartialOrdering
- Inherited from:
- Ordering
Returns x if x >= y, otherwise y.
Returns x if x >= y, otherwise y.
Attributes
- Inherited from:
- Ordering
Returns x if x <= y, otherwise y.
Returns x if x <= y, otherwise y.
Attributes
- Inherited from:
- Ordering
Given f, a function from U into T, creates an Ordering[U] whose compare function is equivalent to:
Given f, a function from U into T, creates an Ordering[U] whose compare function is equivalent to:
def compare(x:U, y:U) = Ordering[T].compare(f(x), f(y))
Attributes
- Inherited from:
- Ordering
Creates an Ordering[T] whose compare function returns the result of this Ordering's compare function, if it is non-zero, or else the result of others compare function.
Creates an Ordering[T] whose compare function returns the result of this Ordering's compare function, if it is non-zero, or else the result of others compare function.
Value parameters
- other
-
an Ordering to use if this Ordering returns zero
Attributes
- Example
-
case class Pair(a: Int, b: Int) val pairOrdering = Ordering.by[Pair, Int](_.a) .orElse(Ordering.by[Pair, Int](_.b)) - Inherited from:
- Ordering
Given f, a function from T into S, creates an Ordering[T] whose compare function returns the result of this Ordering's compare function, if it is non-zero, or else a result equivalent to:
Given f, a function from T into S, creates an Ordering[T] whose compare function returns the result of this Ordering's compare function, if it is non-zero, or else a result equivalent to:
Ordering[S].compare(f(x), f(y))
This function is equivalent to passing the result of Ordering.by(f) to orElse.
Attributes
- Example
-
case class Pair(a: Int, b: Int) val pairOrdering = Ordering.by[Pair, Int](_.a) .orElseBy[Int](_.b) - Inherited from:
- Ordering
Returns the opposite ordering of this one.
Returns the opposite ordering of this one.
Implementations overriding this method MUST override isReverseOf as well if they change the behavior at all (for example, caching does not require overriding it).
Attributes
- Definition Classes
-
Ordering -> PartialOrdering
- Inherited from:
- Ordering
Attributes
- Inherited from:
- Comparator
Attributes
- Inherited from:
- Comparator
Attributes
- Inherited from:
- Comparator
Attributes
- Inherited from:
- Comparator
Attributes
- Inherited from:
- Comparator
Attributes
- Inherited from:
- Comparator
Attributes
- Inherited from:
- Comparator
Returns whether a comparison between x and y is defined, and if so the result of compare(x, y).
Returns whether a comparison between x and y is defined, and if so the result of compare(x, y).
Attributes
- Inherited from:
- Ordering
Inherited and Abstract methods
Returns an integer whose sign communicates how x compares to y.
Returns an integer whose sign communicates how x compares to y.
The result sign has the following meaning:
- negative if x < y
- positive if x > y
- zero otherwise (if x == y)
Attributes
- Inherited from:
- Ordering
The unique multiplicative identity in this algebra. Typically given by values such as 1 or 1.0F.
The unique multiplicative identity in this algebra. Typically given by values such as 1 or 1.0F.
Attributes
- Inherited from:
- MultiplicativeIdentity
The unique additive identity in this algebra. Typically given by values such as 0, 0.0F, or Seq.empty.
The unique additive identity in this algebra. Typically given by values such as 0, 0.0F, or Seq.empty.
Attributes
- Inherited from:
- AdditiveIdentity
Extensions
Extensions
Inherited extensions
An alias for subtract.
Attributes
- Returns
-
trueif and only if the left operand x is strictly smaller than the right y. - Inherited from:
- Ordered
Attributes
- Returns
-
trueif and only if the left operand x is not larger than the right y. - Inherited from:
- Ordered
Attributes
- Returns
-
trueif and only if the left operand x is strictly larger than the right y. - Inherited from:
- Ordered
Attributes
- Returns
-
trueif and only if the left operand x is not smaller than the right y. - Inherited from:
- Ordered
Clamps x to lie within the inclusive range [lb, ub].
Clamps x to lie within the inclusive range [lb, ub].
Attributes
- Returns
-
lb if
x < lb, ub ifx > ub, or x otherwise. If the range is degenerate, i.e.lb > ub, then x is returned unchanged. - Inherited from:
- Ordered
Attributes
- Returns
-
trueif and only if x is strictly negative, i.e.x < 0. - Inherited from:
- OrderedAdditiveIdentity
Attributes
- Returns
-
trueif and only if x is positive or zero, i.e.x ≥ 0. - Inherited from:
- OrderedAdditiveIdentity
Attributes
- Returns
-
trueif and only if x is negative or zero, i.e.x ≤ 0. - Inherited from:
- OrderedAdditiveIdentity
Attributes
- Returns
-
trueif and only if x is strictly positive, i.e.x > 0. - Inherited from:
- OrderedAdditiveIdentity
An alias for scale, with the factor on the left.
An alias for scale, with the factor on the right.
Attributes
- Returns
-
trueif and only if x equals zero. - Inherited from:
- AdditiveIdentity
Attributes
- Returns
-
trueif and only if x doesn't equal zero. - Inherited from:
- AdditiveIdentity
Attributes
- Returns
-
trueif and only if x equals one. - Inherited from:
- MultiplicativeIdentity
Attributes
- Returns
-
trueif and only if x doesn't equal one. - Inherited from:
- MultiplicativeIdentity
An alias for pow.
Computes x raised to the power of n, for any non-negative integer n.
Computes x raised to the power of n, for any non-negative integer n.
Attributes
- Throws
-
IllegalArgumentException
if
n < 0. - Definition Classes
- Inherited from:
- MultiplicativeMonoid
Computes x multiplied by n, for any integer n.
Computes x multiplied by n, for any integer n.
Attributes
- Definition Classes
- Inherited from:
- AdditiveGroup
Computes the difference between two values x and y, i.e. x - y.
Computes the difference between two values x and y, i.e. x - y.
Attributes
- Definition Classes
- Inherited from:
- AdditiveGroup
Computes the absolute value of a value x, i.e. |x| = x if x ≥ 0 or else -x if x < 0.
Computes the absolute value of a value x, i.e. |x| = x if x ≥ 0 or else -x if x < 0.
Attributes
- Inherited from:
- OrderedAdditiveGroup
Computes the sum of all values in xs, i.e. xs₁ + xs₂ + …, or else zero if xs is empty.
Computes the sum of all values in xs, i.e. xs₁ + xs₂ + …, or else zero if xs is empty.
Attributes
- Inherited from:
- AdditiveMonoid
Computes the product of all values in xs, i.e. xs₁ × xs₂ × …, or else one if xs is empty.
Computes the product of all values in xs, i.e. xs₁ × xs₂ × …, or else one if xs is empty.
Attributes
- Inherited from:
- MultiplicativeMonoid
Computes the product of x and all values in xs, i.e. x × xs₁ × xs₂ × ….
Computes the product of x and all values in xs, i.e. x × xs₁ × xs₂ × ….
Attributes
- Inherited from:
- MultiplicativeSemigroup
Computes the product of all values in xs, i.e. xs₁ × xs₂ × …, or else None if xs is empty.
Computes the product of all values in xs, i.e. xs₁ × xs₂ × …, or else None if xs is empty.
Attributes
- Inherited from:
- MultiplicativeSemigroup
Computes the product of all values in xs, i.e. xs₁ × xs₂ × …, or else default if xs is empty.
Computes the product of all values in xs, i.e. xs₁ × xs₂ × …, or else default if xs is empty.
Attributes
- Inherited from:
- MultiplicativeSemigroup
Computes the sum of x and all values in xs, i.e. x + xs₁ + xs₂ + ….
Computes the sum of x and all values in xs, i.e. x + xs₁ + xs₂ + ….
Attributes
- Inherited from:
- AdditiveSemigroup
Computes the sum of all values in xs, i.e. xs₁ + xs₂ + …, or else None if xs is empty.
Computes the sum of all values in xs, i.e. xs₁ + xs₂ + …, or else None if xs is empty.
Attributes
- Inherited from:
- AdditiveSemigroup
Computes the sum of all values in xs, i.e. xs₁ + xs₂ + …, or else default if xs is empty.
Computes the sum of all values in xs, i.e. xs₁ + xs₂ + …, or else default if xs is empty.
Attributes
- Inherited from:
- AdditiveSemigroup
Inherited and Abstract extensions
An alias for mul.
Computes the product of two values x and y, i.e. x × y.
Computes the product of two values x and y, i.e. x × y.
Attributes
- Inherited from:
- MultiplicativeMagma
Computes the additive inverse (negative) of a value x, i.e. -x.
Computes the additive inverse (negative) of a value x, i.e. -x.
Attributes
- Inherited from:
- AdditiveInverse
An alias for negate.
Implicits
Inherited implicits
This implicit method augments T with the comparison operators defined in scala.math.Ordering.Ops.
This implicit method augments T with the comparison operators defined in scala.math.Ordering.Ops.
Attributes
- Inherited from:
- Ordering