EuclideanRing

trait EuclideanRing[@specialized(Int, Long, Float, Double) A] extends GCDRing[A]

EuclideanRing implements a Euclidean domain.

The formal definition says that every euclidean domain A has (at least one) euclidean function f: A -> N (the natural numbers) where:

(for every x and non-zero y) x = yq + r, and r = 0 or f(r) < f(y).

This generalizes the Euclidean division of integers, where f represents a measure of length (or absolute value), and the previous equation represents finding the quotient and remainder of x and y. So:

 quot(x, y) = q
 mod(x, y) = r
Companion
object
trait GCDRing[A]
trait CommutativeRing[A]
trait CommutativeRng[A]
trait CommutativeRig[A]
trait MultiplicativeCommutativeMonoid[A]
trait CommutativeSemiring[A]
trait MultiplicativeCommutativeSemigroup[A]
trait Ring[A]
trait Rng[A]
trait AdditiveCommutativeGroup[A]
trait AdditiveGroup[A]
trait Rig[A]
trait MultiplicativeMonoid[A]
trait Semiring[A]
trait MultiplicativeSemigroup[A]
trait AdditiveCommutativeMonoid[A]
trait AdditiveCommutativeSemigroup[A]
trait AdditiveMonoid[A]
trait AdditiveSemigroup[A]
trait Serializable
class Any

Value members

Abstract methods

def emod(a: A, b: A): A
def equot(a: A, b: A): A
def euclideanFunction(a: A): BigInt

Concrete methods

def equotmod(a: A, b: A): (A, A)

Inherited methods

override
def additive: CommutativeGroup[A]
Definition Classes
AdditiveCommutativeGroup -> AdditiveCommutativeMonoid -> AdditiveCommutativeSemigroup -> AdditiveGroup -> AdditiveMonoid -> AdditiveSemigroup
Inherited from
AdditiveCommutativeGroup
def fromBigInt(n: BigInt): A

Convert the given BigInt to an instance of A.

Convert the given BigInt to an instance of A.

This is equivalent to n repeated summations of this ring's one, or -n summations of -one if n is negative.

Most type class instances should consider overriding this method for performance reasons.

Inherited from
Ring
def fromInt(n: Int): A

Convert the given integer to an instance of A.

Convert the given integer to an instance of A.

Defined to be equivalent to sumN(one, n).

That is, n repeated summations of this ring's one, or -n summations of -one if n is negative.

Most type class instances should consider overriding this method for performance reasons.

Inherited from
Ring
def gcd(a: A, b: A)(implicit ev: Eq[A]): A
Inherited from
GCDRing
def isOne(a: A)(implicit ev: Eq[A]): Boolean

Tests if a is one.

Tests if a is one.

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

Tests if a is zero.

Tests if a is zero.

Inherited from
AdditiveMonoid
def lcm(a: A, b: A)(implicit ev: Eq[A]): A
Inherited from
GCDRing
def minus(x: A, y: A): A
Inherited from
AdditiveGroup
override
def multiplicative: CommutativeMonoid[A]
Definition Classes
MultiplicativeCommutativeMonoid -> MultiplicativeCommutativeSemigroup -> MultiplicativeMonoid -> MultiplicativeSemigroup
Inherited from
MultiplicativeCommutativeMonoid
def negate(x: A): A
Inherited from
AdditiveGroup
def one: A
Inherited from
MultiplicativeMonoid
def plus(x: A, y: A): A
Inherited from
AdditiveSemigroup
override
def pow(a: A, n: Int): A
Definition Classes
MultiplicativeMonoid -> MultiplicativeSemigroup
Inherited from
MultiplicativeMonoid
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
AdditiveGroup -> AdditiveMonoid -> AdditiveSemigroup
Inherited from
AdditiveGroup
def times(x: A, y: A): A
Inherited from
MultiplicativeSemigroup
override
def tryProduct(as: IterableOnce[A]): Option[A]
Definition Classes
MultiplicativeMonoid -> MultiplicativeSemigroup
Inherited from
MultiplicativeMonoid
override
def trySum(as: IterableOnce[A]): Option[A]
Definition Classes
AdditiveMonoid -> AdditiveSemigroup
Inherited from
AdditiveMonoid
def zero: A
Inherited from
AdditiveMonoid