Rng

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

Rng (pronounced "Rung") consists of:

Rng (pronounced "Rung") consists of:

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

Alternately, a Rng can be thought of as a ring without a multiplicative identity (or as a semiring with an additive inverse).

Mnemonic: "Rng is a Ring without multiplicative 'I'dentity."

Companion
object
trait BoolRng[A]
class SetBoolRng[A]
trait BoolRing[A]
trait Field[A]
trait Ring[A]

Value members

Inherited methods

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

Tests if a is zero.

Tests if a is zero.

Inherited from
AdditiveMonoid
def minus(x: A, y: A): A
Inherited from
AdditiveGroup
def multiplicative: Semigroup[A]
def negate(x: A): A
Inherited from
AdditiveGroup
def plus(x: A, y: A): A
Inherited from
AdditiveSemigroup
def pow(a: A, n: Int): A
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
AdditiveGroup
def times(x: A, y: A): A
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).

Inherited from
MultiplicativeSemigroup
override def trySum(as: IterableOnce[A]): Option[A]
Definition Classes
Inherited from
AdditiveMonoid
def zero: A
Inherited from
AdditiveMonoid