Field type class. While algebra already provides one, we provide one in Spire that integrates with the commutative
ring hierarchy, in particular GCDRing
and EuclideanRing
.
On a field, all nonzero elements are invertible, so the remainder of the division is always 0. The Euclidean function can take an arbitrary value on nonzero elements (it is undefined for zero); for compatibility with the degree of polynomials, we use the constant 0.
The GCD and LCM are defined up to a unit; on a field, it means that either the GCD or LCM can be fixed arbitrarily. Some conventions with consistent defaults are provided in the spire.algebra.Field companion object.
- Companion
- object
Value members
Concrete methods
Inherited methods
- Definition Classes
- AdditiveCommutativeGroup -> AdditiveCommutativeMonoid -> AdditiveCommutativeSemigroup -> AdditiveGroup -> AdditiveMonoid -> AdditiveSemigroup
- Inherited from
- AdditiveCommutativeGroup
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
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
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
- Definition Classes
- MultiplicativeCommutativeGroup -> MultiplicativeCommutativeMonoid -> MultiplicativeCommutativeSemigroup -> MultiplicativeGroup -> MultiplicativeMonoid -> MultiplicativeSemigroup
- Inherited from
- MultiplicativeCommutativeGroup
- Definition Classes
- MultiplicativeGroup -> MultiplicativeMonoid -> MultiplicativeSemigroup
- Inherited from
- MultiplicativeGroup
Given a sequence of as
, compute the product.
Given a sequence of as
, compute the product.
- Inherited from
- MultiplicativeMonoid
Given a sequence of as
, compute the sum.
Given a sequence of as
, compute the sum.
- Inherited from
- AdditiveMonoid
- Definition Classes
- AdditiveGroup -> AdditiveMonoid -> AdditiveSemigroup
- Inherited from
- AdditiveGroup
- Definition Classes
- MultiplicativeMonoid -> MultiplicativeSemigroup
- Inherited from
- MultiplicativeMonoid