Rig

trait Rig[@specialized(Int, Long, Float, Double) A] extends Semiring[A] with MultiplicativeMonoid[A]

Rig consists of:

Rig consists of:

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

Alternately, a Rig can be thought of as a ring without multiplicative or additive inverses (or as a semiring with a multiplicative identity).

Mnemonic: "Rig is a Ring without 'N'egation."

Companion
object
trait Semiring[A]
trait Serializable
class Any

Value members

Inherited methods

override def additive: CommutativeMonoid[A]
def isOne(a: A)(ev: Eq[A]): Boolean

Tests if a is one.

Tests if a is one.

Inherited from
MultiplicativeMonoid
def isZero(a: A)(ev: Eq[A]): Boolean

Tests if a is zero.

Tests if a is zero.

Inherited from
AdditiveMonoid
override def multiplicative: Monoid[A]
def one: A
Inherited from
MultiplicativeMonoid
def plus(x: A, y: A): A
Inherited from
AdditiveSemigroup
override def pow(a: A, n: Int): A
def product(as: IterableOnce[A]): A

Given a sequence of as, compute the product.

Given a sequence of as, compute the product.

Inherited from
MultiplicativeMonoid
def sum(as: IterableOnce[A]): A

Given a sequence of as, compute the sum.

Given a sequence of as, compute the sum.

Inherited from
AdditiveMonoid
override def sumN(a: A, n: Int): A
Definition Classes
Inherited from
AdditiveMonoid
def times(x: A, y: A): A
override def tryProduct(as: IterableOnce[A]): Option[A]
override def trySum(as: IterableOnce[A]): Option[A]
Definition Classes
Inherited from
AdditiveMonoid
def zero: A
Inherited from
AdditiveMonoid