Provides an implicit implementation of a commutative group for the WholeNumber type, supporting group operations such as identity, combination, and inversion.
This allows WholeNumber objects to adhere to the algebraic structure of a commutative group, where the combine operation is associative and commutative, an identity element exists, and each element has an additive inverse.
Attributes
- Companion
- trait
- Graph
-
- Supertypes
-
trait CommutativeRing[WholeNumber]trait CommutativeRng[WholeNumber]trait CommutativeRig[WholeNumber]trait MultiplicativeCommutativeMonoid[WholeNumber]trait CommutativeSemiring[WholeNumber]trait MultiplicativeCommutativeSemigroup[WholeNumber]trait Ring[WholeNumber]trait Rng[WholeNumber]trait AdditiveCommutativeGroup[WholeNumber]trait AdditiveGroup[WholeNumber]trait Rig[WholeNumber]trait MultiplicativeMonoid[WholeNumber]trait Semiring[WholeNumber]trait MultiplicativeSemigroup[WholeNumber]trait AdditiveCommutativeMonoid[WholeNumber]trait AdditiveCommutativeSemigroup[WholeNumber]trait AdditiveMonoid[WholeNumber]trait AdditiveSemigroup[WholeNumber]trait Serializableclass Objecttrait Matchableclass AnyShow all
- Self type
Members list
Value members
Inherited methods
Attributes
- Definition Classes
-
AdditiveCommutativeGroup -> AdditiveCommutativeMonoid -> AdditiveCommutativeSemigroup -> AdditiveGroup -> AdditiveMonoid -> AdditiveSemigroup
- Inherited from:
- AdditiveCommutativeGroup
Provides the identity element for the WholeNumber group, representing a WholeNumber of zero.
Provides the identity element for the WholeNumber group, representing a WholeNumber of zero.
Attributes
- Returns
-
the
WholeNumberinstance zero. - Inherited from:
- WholeNumberIsCommutativeRing
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.
Attributes
- Inherited from:
- Ring
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.
Attributes
- Inherited from:
- Ring
Tests if a is one.
Tests if a is one.
Attributes
- Inherited from:
- MultiplicativeMonoid
Tests if a is zero.
Tests if a is zero.
Attributes
- Inherited from:
- AdditiveMonoid
Attributes
- Inherited from:
- AdditiveGroup
Attributes
- Definition Classes
-
MultiplicativeCommutativeMonoid -> MultiplicativeCommutativeSemigroup -> MultiplicativeMonoid -> MultiplicativeSemigroup
- Inherited from:
- MultiplicativeCommutativeMonoid
Computes the additive inverse of the given WholeNumber.
Computes the additive inverse of the given WholeNumber.
This method negates the input WholeNumber, returning a WholeNumber instance that represents its additive inverse, relative to WholeNumber.zero.
Value parameters
- x
-
the
WholeNumberinstance to be inverted
Attributes
- Returns
-
a new
WholeNumberinstance representing the additive inverse of the input - Inherited from:
- WholeNumberIsCommutativeRing
Returns the constant representing the number one as a WholeNumber.
Returns the constant representing the number one as a WholeNumber.
Attributes
- Returns
-
a
WholeNumberinstance representing the numeric value of one. - Inherited from:
- WholeNumberIsCommutativeRing
Adds two WholeNumber instances together.
Adds two WholeNumber instances together.
This method computes the sum of the two provided WholeNumber objects and returns a new WholeNumber representing the result.
Value parameters
- x
-
the first
WholeNumberoperand - y
-
the second
WholeNumberoperand
Attributes
- Returns
-
a new
WholeNumberinstance representing the sum ofxandy - Inherited from:
- WholeNumberIsCommutativeRing
Attributes
- Definition Classes
-
MultiplicativeMonoid -> MultiplicativeSemigroup
- Inherited from:
- MultiplicativeMonoid
Given a sequence of as, compute the product.
Given a sequence of as, compute the product.
Attributes
- Inherited from:
- MultiplicativeMonoid
Given a sequence of as, compute the sum.
Given a sequence of as, compute the sum.
Attributes
- Inherited from:
- AdditiveMonoid
Attributes
- Definition Classes
-
AdditiveGroup -> AdditiveMonoid -> AdditiveSemigroup
- Inherited from:
- AdditiveGroup
Multiplies two WholeNumber instances.
Multiplies two WholeNumber instances.
This method computes the product of the two provided WholeNumber objects and returns a new WholeNumber representing the result.
Value parameters
- x
-
the first
WholeNumberoperand - y
-
the second
WholeNumberoperand
Attributes
- Returns
-
a new
WholeNumberinstance representing the product ofxandy - Inherited from:
- WholeNumberIsCommutativeRing
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
-
MultiplicativeMonoid -> MultiplicativeSemigroup
- Inherited from:
- MultiplicativeMonoid
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
-
AdditiveMonoid -> AdditiveSemigroup
- Inherited from:
- AdditiveMonoid
Returns the zero value of the WholeNumber type.
Returns the zero value of the WholeNumber type.
Attributes
- Returns
-
The zero value representing a
WholeNumberwith the value of 0. - Inherited from:
- WholeNumberIsCommutativeRing