trait Semiring[@specialized(Int, Long, Float, Double) A] extends AdditiveCommutativeMonoid[A] with MultiplicativeSemigroup[A]
Semiring consists of:
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.
- Companion
- object
trait MultiplicativeSemigroup[A]
trait AdditiveCommutativeMonoid[A]
trait AdditiveCommutativeSemigroup[A]
trait AdditiveMonoid[A]
trait AdditiveSemigroup[A]
trait Serializable
class Any
class SetSemiring[A]
trait CommutativeSemiring[A]
trait CommutativeRig[A]
class BooleanAlgebra
trait CommutativeRing[A]
class BigIntAlgebra
class ByteAlgebra
class IntAlgebra
class LongAlgebra
class ShortAlgebra
class UnitAlgebra
trait BoolRing[A]
trait Field[A]
class BigDecimalAlgebra
class DoubleAlgebra
class FloatAlgebra
trait CommutativeRng[A]
trait BoolRng[A]
class SetBoolRng[A]
trait Rig[A]
trait Ring[A]
trait Rng[A]
Value members
Inherited methods
Given a sequence of as
, compute the sum.
Given a sequence of as
, compute the sum.
- Inherited from
- AdditiveMonoid
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).
- Inherited from
- MultiplicativeSemigroup