package algebra
- Alphabetic
- Public
- All
Type Members
-
trait
AbGroup
[A] extends Group[A] with CMonoid[A]
An abelian group is a group whose operation is commutative.
-
trait
Action
[P, G] extends LeftAction[P, G] with RightAction[P, G]
A semigroup/monoid/group action of
GonPis the combination of compatible left and right actions, providing:A semigroup/monoid/group action of
GonPis the combination of compatible left and right actions, providing:- the implementation of a method
actl(g, p), org |+|> p, such that:
1.
(g |+| h) |+|> p === g |+|> (h |+|> p)for allg,hinGandpinP.2.
id |+|> p === pfor allpinP(ifidis defined)- the implementation of a method
actr(p, g), orp <|+| g, such that:
3.
p <|+| (g |+| h) === (p <|+| g) <|+| hfor allg,hinGandpinP.4.
p <|+| id === pfor allpinP(ifidis defined)In addition, if
Gis a group, left and right actions are compatible:5.
g |+|> p === p <|+| g.inverse. - the implementation of a method
- trait AdditiveAbGroup [A] extends AdditiveGroup[A] with AdditiveCMonoid[A]
- trait AdditiveAction [P, G] extends Any
- trait AdditiveCMonoid [A] extends AdditiveMonoid[A] with AdditiveCSemigroup[A]
- trait AdditiveCSemigroup [A] extends AdditiveSemigroup[A]
- trait AdditiveGroup [A] extends AdditiveMonoid[A]
- trait AdditiveMonoid [A] extends AdditiveSemigroup[A]
- trait AdditiveSemigroup [A] extends Any
- trait AdditiveTorsor [V, R] extends AdditiveAction[V, R]
-
trait
Bool
[A] extends Heyting[A]
A boolean algebra is a structure that defines a few basic operations, namely as conjunction (&), disjunction (|), and negation (~).
A boolean algebra is a structure that defines a few basic operations, namely as conjunction (&), disjunction (|), and negation (~). Both conjunction and disjunction must be associative, commutative and should distribute over each other. Also, both have an identity and they obey the absorption law; that is
x & (y | x) == xandx | (x & y) == x. -
trait
CMonoid
[A] extends Monoid[A] with CSemigroup[A]
CMonoid represents a commutative monoid.
CMonoid represents a commutative monoid.
A monoid is commutative if for all x and y, x |+| y === y |+| x.
-
trait
CRig
[A] extends Rig[A] with MultiplicativeCMonoid[A]
CRig is a Rig that is commutative under multiplication.
-
trait
CRing
[A] extends Ring[A] with MultiplicativeCMonoid[A]
CRing is a Ring that is commutative under multiplication.
-
trait
CSemigroup
[A] extends Semigroup[A]
CSemigroup represents a commutative semigroup.
CSemigroup represents a commutative semigroup.
A semigroup is commutative if for all x and y, x |+| y === y |+| x.
- trait CoordinateSpace [V, F] extends InnerProductSpace[V, F]
- class DualBool [A] extends Bool[A]
-
trait
Eq
[A] extends Any
A type class used to determine equality between 2 instances of the same type.
A type class used to determine equality between 2 instances of the same type. Any 2 instances
xandyare equal ifeqv(x, y)istrue. Moreover,eqvshould form an equivalence relation. - trait EuclideanRing [A] extends CRing[A]
- trait Field [A] extends EuclideanRing[A] with MultiplicativeAbGroup[A]
-
trait
FieldAlgebra
[V, F] extends RingAlgebra[V, F] with VectorSpace[V, F]
A
FieldAlgebrais a vector space that is also aRing.A
FieldAlgebrais a vector space that is also aRing. An example is the complex numbers. -
trait
Group
[A] extends Monoid[A]
A group is a monoid where each element has an inverse.
- trait InnerProductSpace [V, F] extends VectorSpace[V, F]
- trait IsAlgebraic [A] extends IsReal[A]
- trait IsIntegral [A] extends IsRational[A]
- trait IsRational [A] extends IsAlgebraic[A]
-
trait
IsReal
[A] extends Order[A] with Signed[A]
A simple type class for numeric types that are a subset of the reals.
-
trait
LeftAction
[P, G] extends Any
A (left) semigroup/monoid/group action of
GonPis simply the implementation of a methodactl(g, p), org |+|> p, such that:A (left) semigroup/monoid/group action of
GonPis simply the implementation of a methodactl(g, p), org |+|> p, such that:1.
(g |+| h) |+|> p === g |+|> (h |+|> p)for allg,hinGandpinP.2.
id |+|> p === pfor allpinP(ifidis defined) -
trait
MetricSpace
[V, R] extends Any
This type class models a metric space
V.This type class models a metric space
V. The distance between 2 points inVis measured inR, which should be real (ie.IsReal[R]exists). -
trait
Module
[V, R] extends AdditiveAbGroup[V]
A module generalizes a vector space by requiring its scalar need only form a ring, rather than a field.
-
trait
Monoid
[A] extends Semigroup[A]
A monoid is a semigroup with an identity.
A monoid is a semigroup with an identity. A monoid is a specialization of a semigroup, so its operation must be associative. Additionally,
op(x, id) == op(id, x) == x. For example, if we haveMonoid[String], withopas string concatenation, thenid = "". - trait MultiplicativeAbGroup [A] extends MultiplicativeGroup[A] with MultiplicativeCMonoid[A]
- trait MultiplicativeAction [P, G] extends Any
- trait MultiplicativeCMonoid [A] extends MultiplicativeMonoid[A] with MultiplicativeCSemigroup[A]
- trait MultiplicativeCSemigroup [A] extends MultiplicativeSemigroup[A]
- trait MultiplicativeGroup [A] extends MultiplicativeMonoid[A]
- trait MultiplicativeMonoid [A] extends MultiplicativeSemigroup[A]
- trait MultiplicativeSemigroup [A] extends Any
- trait MultiplicativeTorsor [V, R] extends MultiplicativeAction[V, R]
-
trait
NRoot
[A] extends Any
This is a type class for types with n-roots.
This is a type class for types with n-roots. The value returned by
nrootandsqrtare only guaranteed to be approximate answers (except in the case ofReal).Also, generally
nroots wherenis even are not defined for negative numbers. The behaviour is undefined if this is attempted. It would be nice to ensure an exception is raised, but some types may defer computation and testing if a value is negative may not be ideal. So, do not count onArithmeticExceptions to save you from bad arithmetic! -
trait
NormedVectorSpace
[V, F] extends VectorSpace[V, F] with MetricSpace[V, F]
A normed vector space is a vector space equipped with a function
norm: V => F.A normed vector space is a vector space equipped with a function
norm: V => F. The main constraint is that the norm of a vector must be scaled linearly when the vector is scaled; that isnorm(k *: v) == k.abs * norm(v). Additionally, a normed vector space is also aMetricSpace, wheredistance(v, w) = norm(v - w), and so must obey the triangle inequality.An example of a normed vector space is R^n equipped with the euclidean vector length as the norm.
-
trait
Order
[A] extends PartialOrder[A]
The
Ordertype class is used to define a total ordering on some typeA.The
Ordertype class is used to define a total ordering on some typeA. An order is defined by a relation <=, which obeys the following laws:- either x <= y or y <= x (totality) - if x <= y and y <= x, then x == y (antisymmetry) - if x <= y and y <= z, then x <= z (transitivity)
The truth table for compare is defined as follows:
x <= y x >= y Int true true = 0 (corresponds to x == y) true false < 0 (corresponds to x < y) false true > 0 (corresponds to x > y)
By the totality law, x <= y and y <= x cannot be both false.
-
trait
PartialOrder
[A] extends Eq[A]
The
PartialOrdertype class is used to define a partial ordering on some typeA.The
PartialOrdertype class is used to define a partial ordering on some typeA.A partial order is defined by a relation <=, which obeys the following laws:
- x <= x (reflexivity) - if x <= y and y <= x, then x === y (anti-symmetry) - if x <= y and y <= z, then x <= z (transitivity)
To compute both <= and >= at the same time, we use a Double number to encode the result of the comparisons x <= y and x >= y. The truth table is defined as follows:
x <= y x >= y Double true true = 0.0 (corresponds to x === y) false false = NaN (x and y cannot be compared) true false = -1.0 (corresponds to x < y) false true = 1.0 (corresponds to x > y)
-
trait
Rig
[A] extends Semiring[A] with AdditiveMonoid[A] with MultiplicativeMonoid[A]
Rig is a ring whose additive structure doesn't have an inverse (ie.
Rig is a ring whose additive structure doesn't have an inverse (ie. it is monoid, not a group). Put another way, a Rig is a Ring without a negative.
-
trait
RightAction
[P, G] extends Any
A (right) semigroup/monoid/group action of
GonPis simply the implementation of a methodactr(p, g), orp <|+| g, such that:A (right) semigroup/monoid/group action of
GonPis simply the implementation of a methodactr(p, g), orp <|+| g, such that:1.
p <|+| (g |+| h) === (p <|+| g) <|+| hfor allg,hinGandpinP.2.
p <|+| id === pfor allpinP(ifidis defined) -
trait
Ring
[A] extends Rig[A] with Rng[A]
Ring represents a set (A) that is a group over addition (+) and a monoid over multiplication (*).
Ring represents a set (A) that is a group over addition (+) and a monoid over multiplication (*). Aside from this, the multiplication must distribute over addition.
Ring implements some methods (for example fromInt) in terms of other more fundamental methods (zero, one and plus). Where possible, these methods should be overridden by more efficient implementations.
-
trait
RingAlgebra
[V, R] extends Module[V, R] with Rng[V]
A
RingAlgebrais a module that is also aRng.A
RingAlgebrais a module that is also aRng. An example is the Gaussian numbers. -
trait
Rng
[A] extends Semiring[A] with AdditiveAbGroup[A]
Rng is a ring whose multiplicative structure doesn't have an identity (i.e.
Rng is a ring whose multiplicative structure doesn't have an identity (i.e. it is semigroup, not a monoid). Put another way, a Rng is a Ring without an identity.
-
trait
Semigroup
[A] extends Any
A semigroup is any set
Awith an associative operation (op). -
trait
Semiring
[A] extends AdditiveMonoid[A] with MultiplicativeSemigroup[A]
Semiring is a ring without identities or an inverse.
Semiring is a ring without identities or an inverse. Thus, it has no negation, zero, or one.
A Semiring with an additive inverse (-) is a Rng. A Semiring with additive and multiplicative identities (0 and 1) is a Rig. A Semiring with all of the above is a Ring.
-
sealed abstract
class
Sign
extends AnyRef
A simple ADT representing the
Signof an object. -
trait
Signed
[A] extends Any
A trait for things that have some notion of sign and the ability to ensure something has a positive sign.
-
trait
Torsor
[V, R] extends Action[V, R]
A Torsor[V, R] requires an AbGroup[R] and provides Action[V, R], plus a
diffoperator,<->in additive notation, such that:A Torsor[V, R] requires an AbGroup[R] and provides Action[V, R], plus a
diffoperator,<->in additive notation, such that:1.
(g <-> g) === scalar.idfor allginG.2.
(g <-> h) +> h === gfor allg,hinG.3.
(g <-> h) +> i === (i <-> h) +> gfor allg,hinG.4.
(g <-> h) === -(h <-> g)for allg,hinG. - trait Trig [A] extends Any
-
trait
VectorSpace
[V, F] extends Module[V, F]
A vector space is a group
Vthat can be multiplied by scalars inFthat lie in a field.A vector space is a group
Vthat can be multiplied by scalars inFthat lie in a field. Scalar multiplication must distribute over vector addition (x *: (v + w) === x *: v + x *: w) and scalar addition ((x + y) *: v === x *: v + y *: v). Scalar multiplication by 1 inFis an identity function (1 *: v === v). Scalar multiplication is "associative" (x *: y *: v === (x * y) *: v). -
trait
ZAlgebra
[V] extends RingAlgebra[V, Int] with Ring[V]
Given any
Ring[A]we can construct aRingAlgebra[A, Int].Given any
Ring[A]we can construct aRingAlgebra[A, Int]. This is possible since we can definefromIntonRinggenerally. - final case class ZModule [V](vector: Group[V]) extends Module[V, Int] with Product with Serializable
Value Members
- object AbGroup
- object Action
- object Additive
- object AdditiveTorsor
- object Bool
- object CMonoid
- object CRig
- object CRing
- object CSemigroup
- object CoordinateSpace
- object Eq
- object EuclideanRing
- object Field
- object Group
- object InnerProductSpace
- object IsAlgebraic
- object IsIntegral
- object IsRational
- object IsReal
- object LeftAction
- object MetricSpace extends MetricSpace0
- object Module
- object Monoid
- object Multiplicative
- object MultiplicativeTorsor
- object NRoot
- object NormedVectorSpace extends NormedVectorSpace0 with NormedVectorSpaceFunctions
- object Order
- object PartialOrder
- object Rig
- object RightAction
- object Ring
- object RingAlgebra
- object Rng
- object Semigroup
- object Semiring
- object Sign
- object Signed
- object Torsor
- object Trig
- object VectorSpace