Semiring

algebra.ring.Semiring
See theSemiring companion object

Semiring consists of:

  • a commutative monoid for addition (+)
  • a semigroup for multiplication (*)

Alternately, a Semiring can be thought of as a ring without a multiplicative identity or an additive inverse.

A Semiring with an additive inverse (-) is a Rng. A Semiring with a multiplicative identity (1) is a Rig. A Semiring with both of those is a Ring.

Attributes

Companion:
object
Source:
Semiring.scala
Graph
Supertypes
Known subtypes
class MapSemiring[K, V]
class SetSemiring[A]
trait BoolRing[A]
trait GCDRing[A]
trait EuclideanRing[A]
trait Field[A]
trait BoolRng[A]
class SetBoolRng[A]
trait Rig[A]
trait Ring[A]
trait DivisionRing[A]
trait Semifield[A]
trait Rng[A]

Members list

Concise view

Value members

Inherited methods

def isZero(a: A)(implicit ev: Eq[A]): Boolean

Tests if a is zero.

Tests if a is zero.

Attributes

Inherited from:
AdditiveMonoid
Source:
Additive.scala
def plus(x: A, y: A): A

Attributes

Inherited from:
AdditiveSemigroup
Source:
Additive.scala
def pow(a: A, n: Int): A

Attributes

Inherited from:
MultiplicativeSemigroup
Source:
Multiplicative.scala
def sum(as: IterableOnce[A]): A

Given a sequence of as, compute the sum.

Given a sequence of as, compute the sum.

Attributes

Inherited from:
AdditiveMonoid
Source:
Additive.scala
override def sumN(a: A, n: Int): A

Attributes

Definition Classes
Inherited from:
AdditiveMonoid
Source:
Additive.scala
def times(x: A, y: A): A

Attributes

Inherited from:
MultiplicativeSemigroup
Source:
Multiplicative.scala

Given a sequence of as, combine them and return the total.

Given a sequence of as, combine them and return the total.

If the sequence is empty, returns None. Otherwise, returns Some(total).

Attributes

Inherited from:
MultiplicativeSemigroup
Source:
Multiplicative.scala
override def trySum(as: IterableOnce[A]): Option[A]

Given a sequence of as, combine them and return the total.

Given a sequence of as, combine them and return the total.

If the sequence is empty, returns None. Otherwise, returns Some(total).

Attributes

Definition Classes
Inherited from:
AdditiveMonoid
Source:
Additive.scala
def zero: A

Attributes

Inherited from:
AdditiveMonoid
Source:
Additive.scala