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
Experimental
true
Graph
Supertypes
trait EuclideanMonoid[X]
trait Semiring[X]
trait AdditiveMonoid[X]
trait AdditiveIdentity[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
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