Rig

algebra.ring.Rig
See theRig companion object
trait Rig[A] extends Semiring[A] with MultiplicativeMonoid[A]

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."

Attributes

Companion:
object
Source:
Rig.scala
Graph
Supertypes
Known subtypes

Members list

Concise view

Value members

Inherited methods

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

Tests if a is one.

Tests if a is one.

Attributes

Inherited from:
MultiplicativeMonoid
Source:
Multiplicative.scala
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
override def multiplicative: Monoid[A]
def one: A

Attributes

Inherited from:
MultiplicativeMonoid
Source:
Multiplicative.scala
def plus(x: A, y: A): A

Attributes

Inherited from:
AdditiveSemigroup
Source:
Additive.scala
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.

Attributes

Inherited from:
MultiplicativeMonoid
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
override def tryProduct(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:
MultiplicativeMonoid
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