Semifield

com.alecdorrington.scalgebra.Semifield
See theSemifield companion object
trait Semifield[X] extends Semiring[X], MultiplicativeGroup[X]

For algebraic structures with addition, multiplication, and reciprocation.

Attributes

Companion
object
Graph
Supertypes
trait EuclideanMonoid[X]
trait Euclidean[X]
trait Semiring[X]
trait AdditiveMonoid[X]
trait AdditiveIdentity[X]
trait Root[X]
class Object
trait Matchable
class Any
Show all
Known subtypes

Members list

Value members

Inherited methods

inline override def divide(x: X, y: X): X

Computes the quotient between two values x and y, i.e. x / y.

Computes the quotient between two values x and y, i.e. x / y.

Attributes

Definition Classes
Inherited from:
MultiplicativeGroup
inline def isOne(x: X): Boolean

Attributes

Returns

true if x equals one.

Inherited from:
MultiplicativeIdentity
inline def isZero(x: X): Boolean

Attributes

Returns

true if x equals zero.

Inherited from:
AdditiveIdentity
override def pow(x: X, n: Int): X

Computes x raised to the power n, for any integer n.

Computes x raised to the power n, for any integer n.

Attributes

Definition Classes
Inherited from:
MultiplicativeGroup
final inline def product(xs: Iterable[X]): X

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
final inline def product(x: X, xs: X*): X

Computes the product of x and all values in xss, i.e. x × xs₁ × xs₂ × ….

Computes the product of x and all values in xss, i.e. x × xs₁ × xs₂ × ….

Attributes

Inherited from:
MultiplicativeSemigroup
final inline def productOption(xs: Iterable[X]): Option[X]

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
override def scale(x: X, n: Int): X

Computes x multiplied by n, for any non-negative n.

Computes x multiplied by n, for any non-negative n.

Attributes

Throws
IllegalArgumentException

if n < 0.

Definition Classes
Inherited from:
AdditiveMonoid
final inline def sum(xs: Iterable[X]): X

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
final inline def sum(x: X, xs: X*): X

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
final def sumOption(xs: Iterable[X]): Option[X]

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
def two: X

The unique representation of 2 in this algebra system.

The unique representation of 2 in this algebra system.

Attributes

Inherited from:
Semiring

Inherited and Abstract methods

def add(x: X, y: X): X

Computes the sum of two values x and y, i.e. x + y.

Computes the sum of two values x and y, i.e. x + y.

Attributes

Note

All implementations must be associative, i.e. (x + y) + z == x + (y + z).

Inherited from:
AdditiveSemigroup
def multiply(x: X, y: X): X

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

Note

All implementations must be associative, i.e. (x × y) × z == x × (y × z).

Inherited from:
MultiplicativeSemigroup
def one: X

The unique representation of the multiplicative identity (1) in this algebra system. Typically corresponds to values such as 1 or 1.0F.

The unique representation of the multiplicative identity (1) in this algebra system. Typically corresponds to values such as 1 or 1.0F.

Attributes

Note

All implementations must obey the identity property, i.e. x × one == one × x == x.

Inherited from:
MultiplicativeIdentity
def reciprocate(x: X): X

Computes the multiplicative inverse (reciprocal) of a value x, i.e. 1 / x.

Computes the multiplicative inverse (reciprocal) of a value x, i.e. 1 / x.

Attributes

Note

All implementations must be involutions, i.e. reciprocate(reciprocate(x)) == x.

Inherited from:
MultiplicativeInverse
def zero: X

The unique representation of the additive identity (0) in this algebra system. Typically corresponds to values such as 0, 0.0F, or Seq.empty.

The unique representation of the additive identity (0) in this algebra system. Typically corresponds to values such as 0, 0.0F, or Seq.empty.

Attributes

Note

All implementations must obey the identity property, i.e. x + zero == zero + x == x.

Inherited from:
AdditiveIdentity

Extensions

Inherited extensions

extension (x: X)
infix inline def /(y: X): X

Computes the quotient between two values x and y, i.e. x / y.

Computes the quotient between two values x and y, i.e. x / y.

Attributes

Inherited from:
Euclidean
extension (x: X)
inline def reciprocal: X

Computes the multiplicative inverse (reciprocal) of this value.

Computes the multiplicative inverse (reciprocal) of this value.

Attributes

Inherited from:
MultiplicativeInverse
extension (x: X)
inline def isOne: Boolean

Attributes

Returns

true if x equals one.

Inherited from:
MultiplicativeIdentity
extension (x: X)
inline def isZero: Boolean

Attributes

Returns

true if x equals zero.

Inherited from:
AdditiveIdentity
extension (x: X)
infix inline def *:(n: Int): X

Alias of scale, with the factor on the left.

Alias of scale, with the factor on the left.

Attributes

Inherited from:
AdditiveSemigroup
infix inline def +(y: X): X

Computes the sum of two values x and y, i.e. x + y.

Computes the sum of two values x and y, i.e. x + y.

Attributes

Inherited from:
AdditiveSemigroup
infix inline def :*(n: Int): X

Alias of scale, with the factor on the right.

Alias of scale, with the factor on the right.

Attributes

Inherited from:
AdditiveSemigroup
extension (x: X)
infix inline def *(y: X): X

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:
MultiplicativeSemigroup
infix inline def **(n: Int): X

Alias of pow, with the exponent on the right.

Alias of pow, with the exponent on the right.

Attributes

Inherited from:
MultiplicativeSemigroup