Package

spire

algebra

Permalink

package algebra

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. algebra
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. type AbGroup[A] = CommutativeGroup[A]

    Permalink
  2. trait Action[P, G] extends LeftAction[P, G] with RightAction[P, G]

    Permalink

    A semigroup/monoid/group action of G on P is the combination of compatible left and right actions, providing:

    A semigroup/monoid/group action of G on P is the combination of compatible left and right actions, providing:

    • the implementation of a method actl(g, p), or g |+|> p, such that:

    1. (g |+| h) |+|> p === g |+|> (h |+|> p) for all g, h in G and p in P.

    2. id |+|> p === p for all p in P (if id is defined)

    • the implementation of a method actr(p, g), or p <|+| g, such that:

    3. p <|+| (g |+| h) === (p <|+| g) <|+| h for all g, h in G and p in P.

    4. p <|+| id === p for all p in P (if id is defined)

    In addition, if G is a group, left and right actions are compatible:

    5. g |+|> p === p <|+| g.inverse.

  3. type AdditiveAbGroup[A] = AdditiveCommutativeGroup[A]

    Permalink
  4. trait AdditiveAction[P, G] extends Any

    Permalink
  5. type AdditiveCMonoid[A] = AdditiveCommutativeMonoid[A]

    Permalink
  6. type AdditiveCSemigroup[A] = AdditiveCommutativeSemigroup[A]

    Permalink
  7. type AdditiveGroup[A] = algebra.ring.AdditiveGroup[A]

    Permalink
  8. type AdditiveMonoid[A] = algebra.ring.AdditiveMonoid[A]

    Permalink
  9. type AdditiveSemigroup[A] = algebra.ring.AdditiveSemigroup[A]

    Permalink
  10. trait AdditiveTorsor[V, R] extends AdditiveAction[V, R]

    Permalink
  11. type AlgebraField[A] = algebra.ring.Field[A]

    Permalink
  12. type Bool[A] = algebra.lattice.Bool[A]

    Permalink
  13. type CMonoid[A] = CommutativeMonoid[A]

    Permalink
  14. type CRig[A] = CommutativeRig[A]

    Permalink
  15. type CRing[A] = CommutativeRing[A]

    Permalink
  16. type CRng[A] = CommutativeRng[A]

    Permalink
  17. type CSemigroup[A] = CommutativeSemigroup[A]

    Permalink
  18. type CSemiring[A] = CommutativeSemiring[A]

    Permalink
  19. trait CoordinateSpace[V, F] extends InnerProductSpace[V, F]

    Permalink
  20. trait DivisionRing[A] extends Ring[A] with MultiplicativeGroup[A]

    Permalink
  21. type Eq[A] = cats.kernel.Eq[A]

    Permalink
  22. trait EuclideanRing[A] extends GCDRing[A]

    Permalink

    EuclideanRing implements a Euclidean domain.

    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

  23. trait EuclideanRingFunctions[R[T] <: EuclideanRing[T]] extends GCDRingFunctions[R]

    Permalink
  24. trait Field[A] extends AlgebraField[A] with EuclideanRing[A]

    Permalink

    Field type class.

    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.

  25. trait FieldAlgebra[V, F] extends RingAlgebra[V, F] with VectorSpace[V, F]

    Permalink

    A FieldAlgebra is a vector space that is also a Ring.

    A FieldAlgebra is a vector space that is also a Ring. An example is the complex numbers.

  26. trait GCDRing[A] extends CRing[A]

    Permalink

    GCDRing implements a GCD ring.

    GCDRing implements a GCD ring.

    For two elements x and y in a GCD ring, we can choose two elements d and m such that:

    d = gcd(x, y) m = lcm(x, y)

    d * m = x * y

    Additionally, we require:

    gcd(0, 0) = 0 lcm(x, 0) = lcm(0, x) = 0

    and commutativity:

    gcd(x, y) = gcd(y, x) lcm(x, y) = lcm(y, x)

  27. trait GCDRingFunctions[R[T] <: GCDRing[T]] extends RingFunctions[R]

    Permalink
  28. type Group[A] = cats.kernel.Group[A]

    Permalink
  29. trait InnerProductSpace[V, F] extends VectorSpace[V, F]

    Permalink
  30. trait IsAlgebraic[A] extends IsReal[A]

    Permalink
  31. trait IsIntegral[A] extends IsRational[A]

    Permalink
  32. trait IsRational[A] extends IsAlgebraic[A]

    Permalink
  33. trait IsReal[A] extends Signed[A]

    Permalink

    A simple type class for numeric types that are a subset of the reals.

  34. trait LeftAction[P, G] extends Any

    Permalink

    A (left) semigroup/monoid/group action of G on P is simply the implementation of a method actl(g, p), or g |+|> p, such that:

    A (left) semigroup/monoid/group action of G on P is simply the implementation of a method actl(g, p), or g |+|> p, such that:

    1. (g |+| h) |+|> p === g |+|> (h |+|> p) for all g, h in G and p in P.

    2. id |+|> p === p for all p in P (if id is defined)

  35. trait MetricSpace[V, R] extends Any

    Permalink

    This type class models a metric space V.

    This type class models a metric space V. The distance between 2 points in V is measured in R, which should be real (ie. IsReal[R] exists).

  36. trait Module[V, R] extends AdditiveAbGroup[V]

    Permalink

    A module generalizes a vector space by requiring its scalar need only form a ring, rather than a field.

  37. type Monoid[A] = cats.kernel.Monoid[A]

    Permalink
  38. type MultiplicativeAbGroup[A] = MultiplicativeCommutativeGroup[A]

    Permalink
  39. trait MultiplicativeAction[P, G] extends Any

    Permalink
  40. type MultiplicativeCMonoid[A] = MultiplicativeCommutativeMonoid[A]

    Permalink
  41. type MultiplicativeCSemigroup[A] = MultiplicativeCommutativeSemigroup[A]

    Permalink
  42. type MultiplicativeGroup[A] = algebra.ring.MultiplicativeGroup[A]

    Permalink
  43. type MultiplicativeMonoid[A] = algebra.ring.MultiplicativeMonoid[A]

    Permalink
  44. type MultiplicativeSemigroup[A] = algebra.ring.MultiplicativeSemigroup[A]

    Permalink
  45. trait MultiplicativeTorsor[V, R] extends MultiplicativeAction[V, R]

    Permalink
  46. trait NRoot[A] extends Any

    Permalink

    This is a type class for types with n-roots.

    This is a type class for types with n-roots. The value returned by nroot and sqrt are only guaranteed to be approximate answers (except in the case of Real).

    Also, generally nroots where n is 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 on ArithmeticExceptions to save you from bad arithmetic!

  47. trait NormedVectorSpace[V, F] extends VectorSpace[V, F] with MetricSpace[V, F]

    Permalink

    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 is norm(k *: v) == k.abs * norm(v). Additionally, a normed vector space is also a MetricSpace, where distance(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.

  48. type Order[A] = cats.kernel.Order[A]

    Permalink
  49. type PartialOrder[A] = cats.kernel.PartialOrder[A]

    Permalink
  50. type Rig[A] = algebra.ring.Rig[A]

    Permalink
  51. trait RightAction[P, G] extends Any

    Permalink

    A (right) semigroup/monoid/group action of G on P is simply the implementation of a method actr(p, g), or p <|+| g, such that:

    A (right) semigroup/monoid/group action of G on P is simply the implementation of a method actr(p, g), or p <|+| g, such that:

    1. p <|+| (g |+| h) === (p <|+| g) <|+| h for all g, h in G and p in P.

    2. p <|+| id === p for all p in P (if id is defined)

  52. type Ring[A] = algebra.ring.Ring[A]

    Permalink
  53. trait RingAlgebra[V, R] extends Module[V, R] with Rng[V]

    Permalink

    A RingAlgebra is a module that is also a Rng.

    A RingAlgebra is a module that is also a Rng. An example is the Gaussian numbers.

  54. type Rng[A] = algebra.ring.Rng[A]

    Permalink
  55. type Semigroup[A] = cats.kernel.Semigroup[A]

    Permalink
  56. type Semiring[A] = algebra.ring.Semiring[A]

    Permalink
  57. sealed abstract class Sign extends AnyRef

    Permalink

    A simple ADT representing the Sign of an object.

  58. trait Signed[A] extends Order[A]

    Permalink

    A trait for linearly ordered additive commutative monoid.

    A trait for linearly ordered additive commutative monoid. The following laws holds:

    (1) if a <= b then a + c <= b + c (linear order), (2) signum(x) = -1 if x < 0, signum(x) = 1 if x > 0, signum(x) = 0 otherwise,

    Negative elements only appear when scalar is a additive abelian group, and then (3) abs(x) = -x if x < 0, or x otherwise,

    Laws (1) and (2) lead to the triange inequality:

    (4) abs(a + b) <= abs(a) + abs(b)

    Signed should never be extended in implementations, rather the AdditiveCMonoid and AdditiveAbGroup subtraits. We cannot use self-types to express the constraint self: AdditiveCMonoid => (interaction with specialization?).

  59. trait SignedAdditiveAbGroup[A] extends SignedAdditiveCMonoid[A] with AdditiveAbGroup[A]

    Permalink
  60. trait SignedAdditiveCMonoid[A] extends Signed[A] with AdditiveCMonoid[A]

    Permalink
  61. trait Torsor[V, R] extends Action[V, R]

    Permalink

    A Torsor[V, R] requires an AbGroup[R] and provides Action[V, R], plus a diff operator, <-> in additive notation, such that:

    A Torsor[V, R] requires an AbGroup[R] and provides Action[V, R], plus a diff operator, <-> in additive notation, such that:

    1. (g <-> g) === scalar.id for all g in G.

    2. (g <-> h) +> h === g for all g, h in G.

    3. (g <-> h) +> i === (i <-> h) +> g for all g, h in G.

    4. (g <-> h) === -(h <-> g) for all g, h in G.

  62. trait Trig[A] extends Any

    Permalink
  63. trait VectorSpace[V, F] extends Module[V, F]

    Permalink

    A vector space is a group V that can be multiplied by scalars in F that lie in a field.

    A vector space is a group V that can be multiplied by scalars in F that 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 in F is an identity function (1 *: v === v). Scalar multiplication is "associative" (x *: y *: v === (x * y) *: v).

  64. trait ZAlgebra[V] extends RingAlgebra[V, Int] with Ring[V]

    Permalink

    Given any Ring[A] we can construct a RingAlgebra[A, Int].

    Given any Ring[A] we can construct a RingAlgebra[A, Int]. This is possible since we can define fromInt on Ring generally.

  65. final case class ZModule[V](vector: Group[V]) extends Module[V, Int] with Product with Serializable

    Permalink

Value Members

  1. val AbGroup: CommutativeGroup.type

    Permalink
  2. object Action

    Permalink
  3. object Additive

    Permalink
  4. val AdditiveAbGroup: AdditiveCommutativeGroup.type

    Permalink
  5. val AdditiveCMonoid: AdditiveCommutativeMonoid.type

    Permalink
  6. val AdditiveCSemigroup: AdditiveCommutativeSemigroup.type

    Permalink
  7. val AdditiveGroup: algebra.ring.AdditiveGroup.type

    Permalink
  8. val AdditiveMonoid: algebra.ring.AdditiveMonoid.type

    Permalink
  9. val AdditiveSemigroup: algebra.ring.AdditiveSemigroup.type

    Permalink
  10. object AdditiveTorsor

    Permalink
  11. val AlgebraField: algebra.ring.Field.type

    Permalink
  12. val Bool: algebra.lattice.Bool.type

    Permalink
  13. val CMonoid: CommutativeMonoid.type

    Permalink
  14. val CRig: CommutativeRig.type

    Permalink
  15. val CRing: CommutativeRing.type

    Permalink
  16. val CRng: CommutativeRng.type

    Permalink
  17. val CSemigroup: CommutativeSemigroup.type

    Permalink
  18. val CSemiring: CommutativeSemiring.type

    Permalink
  19. object CoordinateSpace extends Serializable

    Permalink
  20. object DivisionRing extends Serializable

    Permalink
  21. val Eq: cats.kernel.Eq.type

    Permalink
  22. object EuclideanRing extends EuclideanRingFunctions[EuclideanRing] with Serializable

    Permalink
  23. object Field extends FieldFunctions[Field] with EuclideanRingFunctions[Field] with Serializable

    Permalink
  24. object GCDRing extends GCDRingFunctions[GCDRing] with Serializable

    Permalink
  25. val Group: cats.kernel.Group.type

    Permalink
  26. object InnerProductSpace extends Serializable

    Permalink
  27. object IsAlgebraic extends Serializable

    Permalink
  28. object IsIntegral extends Serializable

    Permalink
  29. object IsRational extends Serializable

    Permalink
  30. object IsReal extends Serializable

    Permalink
  31. object LeftAction

    Permalink
  32. object MetricSpace extends MetricSpace0

    Permalink
  33. object Module extends Serializable

    Permalink
  34. val Monoid: cats.kernel.Monoid.type

    Permalink
  35. object Multiplicative

    Permalink
  36. val MultiplicativeAbGroup: MultiplicativeCommutativeGroup.type

    Permalink
  37. val MultiplicativeCMonoid: MultiplicativeCommutativeMonoid.type

    Permalink
  38. val MultiplicativeCSemigroup: MultiplicativeCommutativeSemigroup.type

    Permalink
  39. val MultiplicativeGroup: algebra.ring.MultiplicativeGroup.type

    Permalink
  40. val MultiplicativeMonoid: algebra.ring.MultiplicativeMonoid.type

    Permalink
  41. val MultiplicativeSemigroup: algebra.ring.MultiplicativeSemigroup.type

    Permalink
  42. object MultiplicativeTorsor

    Permalink
  43. object NRoot

    Permalink
  44. object NormedVectorSpace extends NormedVectorSpace0 with NormedVectorSpaceFunctions with Serializable

    Permalink
  45. val Order: cats.kernel.Order.type

    Permalink
  46. val PartialOrder: cats.kernel.PartialOrder.type

    Permalink
  47. val Rig: algebra.ring.Rig.type

    Permalink
  48. object RightAction

    Permalink
  49. val Ring: algebra.ring.Ring.type

    Permalink
  50. object RingAlgebra extends Serializable

    Permalink
  51. val Rng: algebra.ring.Rng.type

    Permalink
  52. val Semigroup: cats.kernel.Semigroup.type

    Permalink
  53. val Semiring: algebra.ring.Semiring.type

    Permalink
  54. object Sign

    Permalink
  55. object Signed extends Serializable

    Permalink
  56. object Torsor

    Permalink
  57. object Trig

    Permalink
  58. object VectorSpace extends Serializable

    Permalink
  59. package free

    Permalink
  60. package partial

    Permalink

Inherited from AnyRef

Inherited from Any

Ungrouped