FieldOfFractionsGCD

trait FieldOfFractionsGCD[A, R] extends Field[A]

Field defined as a field of fractions with a default implementation of GCD/LCM such that

 - gcd(a/b, c/d) = gcd(a, c) / lcm(b, d)
 - lcm(a/b, c/d) = lcm(a, c) / gcd(b, d)

which corresponds to the convention of the GCD domains of SageMath; on rational numbers, it "yields the unique extension of gcd from integers to rationals presuming the natural extension of the divisibility relation from integers to rationals", see http://math.stackexchange.com/a/151431

trait Field[A]
trait EuclideanRing[A]
trait GCDRing[A]
trait Field[A]
trait MultiplicativeCommutativeGroup[A]
trait MultiplicativeGroup[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 denominator(a: A): R
def fraction(num: R, den: R): A
def numerator(a: A): R

Concrete methods

override
def gcd(x: A, y: A)(implicit ev: Eq[A]): A
Definition Classes
override
def lcm(x: A, y: A)(implicit ev: Eq[A]): A
Definition Classes

Inherited methods

override
def additive: CommutativeGroup[A]
Definition Classes
AdditiveCommutativeGroup -> AdditiveCommutativeMonoid -> AdditiveCommutativeSemigroup -> AdditiveGroup -> AdditiveMonoid -> AdditiveSemigroup
Inherited from
AdditiveCommutativeGroup
def div(x: A, y: A): A
Inherited from
MultiplicativeGroup
def emod(a: A, b: A): A
Inherited from
Field
def equot(a: A, b: A): A
Inherited from
Field
override
def equotmod(a: A, b: A): (A, A)
Definition Classes
Inherited from
Field
def euclideanFunction(a: A): BigInt
Inherited from
Field
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 fromDouble(a: Double): A

This is implemented in terms of basic Field ops. However, this is probably significantly less efficient than can be done with a specific type. So, it is recommended that this method be overriden.

This is implemented in terms of basic Field ops. However, this is probably significantly less efficient than can be done with a specific type. So, it is recommended that this method be overriden.

This is possible because a Double is a rational number.

Inherited from
Field
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 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 minus(x: A, y: A): A
Inherited from
AdditiveGroup
override
def multiplicative: CommutativeGroup[A]
Definition Classes
MultiplicativeCommutativeGroup -> MultiplicativeCommutativeMonoid -> MultiplicativeCommutativeSemigroup -> MultiplicativeGroup -> MultiplicativeMonoid -> MultiplicativeSemigroup
Inherited from
MultiplicativeCommutativeGroup
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
MultiplicativeGroup -> MultiplicativeMonoid -> MultiplicativeSemigroup
Inherited from
MultiplicativeGroup
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 reciprocal(x: A): A
Inherited from
MultiplicativeGroup
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

Implicits

Implicits

implicit
def eqR: Eq[R]
implicit
def ringR: GCDRing[R]