Safe Haskell | Safe |
---|---|

Language | Haskell2010 |

Algebra

- class Magma a where
- class Magma a => Unital a where
- class Magma a => Associative a
- class Magma a => Commutative a
- class Magma a => Invertible a where
- class Magma a => Idempotent a
- class (Magma a, Magma b) => Homomorphic a b where
- class (Associative a, Unital a) => Monoidal a
- class (Commutative a, Associative a, Unital a) => CMonoidal a
- class (Unital a, Invertible a) => Loop a
- class (Associative a, Unital a, Invertible a) => Group a
- class (Associative a, Unital a, Invertible a, Commutative a) => Abelian a
- class AdditiveMagma a where
- class AdditiveMagma a => AdditiveUnital a where
- class AdditiveMagma a => AdditiveAssociative a
- class AdditiveMagma a => AdditiveCommutative a
- class AdditiveMagma a => AdditiveInvertible a where
- class (AdditiveMagma a, AdditiveMagma b) => AdditiveHomomorphic a b where
- class (AdditiveUnital a, AdditiveAssociative a) => AdditiveMonoidal a
- class (AdditiveCommutative a, AdditiveUnital a, AdditiveAssociative a) => Additive a where
- class (Additive a, AdditiveInvertible a) => AdditiveGroup a where
- class MultiplicativeMagma a where
- class MultiplicativeMagma a => MultiplicativeUnital a where
- class MultiplicativeMagma a => MultiplicativeAssociative a
- class MultiplicativeMagma a => MultiplicativeCommutative a
- class MultiplicativeMagma a => MultiplicativeInvertible a where
- class (MultiplicativeMagma a, MultiplicativeMagma b) => MultiplicativeHomomorphic a b where
- class (MultiplicativeUnital a, MultiplicativeAssociative a) => MultiplicativeMonoidal a
- class (MultiplicativeCommutative a, MultiplicativeUnital a, MultiplicativeAssociative a) => Multiplicative a where
- class (Multiplicative a, MultiplicativeInvertible a) => MultiplicativeGroup a where
- class (Additive a, MultiplicativeMagma a) => Distributive a
- class (Additive a, MultiplicativeAssociative a, MultiplicativeUnital a, Distributive a) => Semiring a
- class (AdditiveGroup a, MultiplicativeAssociative a, MultiplicativeUnital a, Distributive a) => Ring a
- class (AdditiveGroup a, MultiplicativeGroup a, Distributive a) => Field a
- class (Additive a, AdditiveHomomorphic a a) => AdditiveBasis a where
- class (AdditiveGroup a, AdditiveHomomorphic a a) => AdditiveGroupBasis a where
- class (Additive a, Additive s, AdditiveHomomorphic s a) => AdditiveModule s a where
- class (AdditiveModule s a, AdditiveGroup a) => AdditiveGroupModule s a where
- class (Multiplicative a, MultiplicativeHomomorphic a a) => MultiplicativeBasis a where
- class (MultiplicativeGroup a, MultiplicativeHomomorphic a a) => MultiplicativeGroupBasis a where
- class (Multiplicative a, Multiplicative s, MultiplicativeHomomorphic s a) => MultiplicativeModule s a where
- class (MultiplicativeModule s a, MultiplicativeGroup a) => MultiplicativeGroupModule s a where
- class (Additive a, Multiplicative a) => Integral a where
- class Metric r m where
- class Normed a where
- abs :: Normed a => a -> a
- class (MultiplicativeGroup a, MultiplicativeModule a a, MultiplicativeGroupModule a a, MultiplicativeInvertible a, Normed a) => Banach a where
- class (Field a, Bounded a) => BoundedField a where
- infinity :: BoundedField a => a
- class Ring a => ExpRing a where
- (^) :: ExpRing a => a -> a -> a
- class (Field a, ExpRing a) => ExpField a where
- class (Banach a, TensorAlgebra a, ExpField r, AdditiveGroup a) => Hilbert a r where
- class TensorAlgebra a where
- squaredInnerProductNorm :: Hilbert v r => v -> r
- innerProductNorm :: Hilbert v r => v -> r
- innerProductDistance :: Hilbert v r => v -> v -> r

# general group structure

A Magma is a tuple (T,⊕) consisting of

- a type a, and
- a function (⊕) :: T -> T -> T

The mathematical laws for a magma are:

- ⊕ is defined for all possible pairs of type T, and
- ⊕ is closed in the set of all possible values of type T

or, more tersly,

∀ a, b ∈ T: a ⊕ b ∈ T

These laws are true by construction in haskell: the type signature of `magma`

and the above mathematical laws are synonyms.

class Magma a => Associative a Source #

An Associative Magma

(a ⊕ b) ⊕ c = a ⊕ (b ⊕ c)

class Magma a => Commutative a Source #

A Commutative Magma

a ⊕ b = b ⊕ a

class Magma a => Invertible a where Source #

An Invertible Magma

∀ a ∈ T: inv a ∈ T

law is true by construction in Haskell

class Magma a => Idempotent a Source #

An Idempotent Magma

a ⊕ a = a

class (Magma a, Magma b) => Homomorphic a b where Source #

A Homomorphic between two Magmas

∀ a ∈ A: hom a ∈ B

law is true by construction in Haskell

Magma a => Homomorphic a a Source # | |

class (Associative a, Unital a) => Monoidal a Source #

A Monoidal Magma is associative and unital.

class (Commutative a, Associative a, Unital a) => CMonoidal a Source #

A CMonoidal Magma is commutative, associative and unital.

class (Unital a, Invertible a) => Loop a Source #

A Loop is unital and invertible

class (Associative a, Unital a, Invertible a) => Group a Source #

A Group is associative, unital and invertible

class (Associative a, Unital a, Invertible a, Commutative a) => Abelian a Source #

An Abelian Group is associative, unital, invertible and commutative

## Additive Structure

class AdditiveMagma a where Source #

`plus`

is used for the additive magma to distinguish from `+`

which, by convention, implies commutativity

AdditiveMagma Double Source # | |

AdditiveMagma Float Source # | |

AdditiveMagma Int Source # | |

(Unbox a, AdditiveMagma a) => AdditiveMagma (VectorU n a) Source # | |

AdditiveMagma a => AdditiveMagma (VectorA n f a) Source # | |

class AdditiveMagma a => AdditiveUnital a where Source #

AdditiveUnital

zero `plus` a == a a `plus` zero == a

AdditiveUnital Double Source # | |

AdditiveUnital Float Source # | |

AdditiveUnital Int Source # | |

(KnownNat n, Unbox a, AdditiveUnital a) => AdditiveUnital (VectorU n a) Source # | |

(AdditiveUnital a, KnownNat n) => AdditiveUnital (VectorA n [] a) Source # | |

class AdditiveMagma a => AdditiveAssociative a Source #

AdditiveAssociative

(a `plus` b) `plus` c == a `plus` (b `plus` c)

AdditiveAssociative Double Source # | |

AdditiveAssociative Float Source # | |

AdditiveAssociative Int Source # | |

(Unbox a, AdditiveAssociative a) => AdditiveAssociative (VectorU n a) Source # | |

AdditiveAssociative a => AdditiveAssociative (VectorA n f a) Source # | |

class AdditiveMagma a => AdditiveCommutative a Source #

AdditiveCommutative

a `plus` b == b `plus` a

AdditiveCommutative Double Source # | |

AdditiveCommutative Float Source # | |

AdditiveCommutative Int Source # | |

(Unbox a, AdditiveCommutative a) => AdditiveCommutative (VectorU n a) Source # | |

AdditiveCommutative a => AdditiveCommutative (VectorA n f a) Source # | |

class AdditiveMagma a => AdditiveInvertible a where Source #

AdditiveInvertible

∀ a ∈ A: negate a ∈ A

law is true by construction in Haskell

AdditiveInvertible Double Source # | |

AdditiveInvertible Float Source # | |

AdditiveInvertible Int Source # | |

(Unbox a, AdditiveInvertible a) => AdditiveInvertible (VectorU n a) Source # | |

AdditiveInvertible a => AdditiveInvertible (VectorA n f a) Source # | |

class (AdditiveMagma a, AdditiveMagma b) => AdditiveHomomorphic a b where Source #

AdditiveHomomorphic

∀ a ∈ A: plushom a ∈ B

law is true by construction in Haskell

AdditiveMagma a => AdditiveHomomorphic a a Source # | |

(KnownNat n, Unbox a, AdditiveUnital a, AdditiveMagma a) => AdditiveHomomorphic a (VectorU n a) Source # | |

(AdditiveMagma a, KnownNat n) => AdditiveHomomorphic a (VectorA n [] a) Source # | |

class (AdditiveUnital a, AdditiveAssociative a) => AdditiveMonoidal a Source #

AdditiveMonoidal

class (AdditiveCommutative a, AdditiveUnital a, AdditiveAssociative a) => Additive a where Source #

Additive is commutative, unital and associative under addition

a + b = b + a

(a + b) + c = a + (b + c)

zero + a = a

a + zero = a

class (Additive a, AdditiveInvertible a) => AdditiveGroup a where Source #

AdditiveGroup

a - a = zero

negate a = zero - a

negate a + a = zero

AdditiveGroup Double Source # | |

AdditiveGroup Float Source # | |

AdditiveGroup Int Source # | |

(KnownNat n, Unbox a, AdditiveGroup a) => AdditiveGroup (VectorU n a) Source # | |

(AdditiveGroup a, KnownNat n) => AdditiveGroup (VectorA n [] a) Source # | |

## Multiplicative Structure

class MultiplicativeMagma a where Source #

`times`

is used for the multiplicative magma to distinguish from `*`

which, by convention, implies commutativity

MultiplicativeMagma Double Source # | |

MultiplicativeMagma Float Source # | |

MultiplicativeMagma Int Source # | |

(Unbox a, MultiplicativeMagma a) => MultiplicativeMagma (VectorU n a) Source # | |

MultiplicativeMagma a => MultiplicativeMagma (VectorA n f a) Source # | |

class MultiplicativeMagma a => MultiplicativeUnital a where Source #

MultiplicativeUnital

one `times` a == a a `times` one == a

MultiplicativeUnital Double Source # | |

MultiplicativeUnital Float Source # | |

MultiplicativeUnital Int Source # | |

(KnownNat n, Unbox a, AdditiveUnital a, MultiplicativeUnital a) => MultiplicativeUnital (VectorU n a) Source # | |

(MultiplicativeUnital a, KnownNat n) => MultiplicativeUnital (VectorA n [] a) Source # | |

class MultiplicativeMagma a => MultiplicativeAssociative a Source #

MultiplicativeAssociative

(a `times` b) `times` c == a `times` (b `times` c)

class MultiplicativeMagma a => MultiplicativeCommutative a Source #

MultiplicativeCommutative

a `times` b == b `times` a

class MultiplicativeMagma a => MultiplicativeInvertible a where Source #

MultiplicativeInvertible

∀ a ∈ A: recip a ∈ A

law is true by construction in Haskell

class (MultiplicativeMagma a, MultiplicativeMagma b) => MultiplicativeHomomorphic a b where Source #

MultiplicativeHomomorphic

∀ a ∈ A: timeshom a ∈ B

law is true by construction in Haskell

MultiplicativeMagma a => MultiplicativeHomomorphic a a Source # | |

(KnownNat n, Unbox a, AdditiveUnital a, MultiplicativeUnital a, MultiplicativeMagma a) => MultiplicativeHomomorphic a (VectorU n a) Source # | |

MultiplicativeMagma a => MultiplicativeHomomorphic a (VectorA n f a) Source # | |

class (MultiplicativeUnital a, MultiplicativeAssociative a) => MultiplicativeMonoidal a Source #

MultiplicativeMonoidal

class (MultiplicativeCommutative a, MultiplicativeUnital a, MultiplicativeAssociative a) => Multiplicative a where Source #

Multiplicative is commutative, associative and unital under multiplication

a * b = b * a

(a * b) * c = a * (b * c)

one * a = a

a * one = a

Multiplicative Double Source # | |

Multiplicative Float Source # | |

Multiplicative Int Source # | |

(KnownNat n, Unbox a, AdditiveUnital a, Multiplicative a) => Multiplicative (VectorU n a) Source # | |

(Multiplicative a, KnownNat n) => Multiplicative (VectorA n [] a) Source # | |

class (Multiplicative a, MultiplicativeInvertible a) => MultiplicativeGroup a where Source #

MultiplicativeGroup

a / a = one

recip a = one / a

recip a * a = one

MultiplicativeGroup Double Source # | |

MultiplicativeGroup Float Source # | |

(KnownNat n, Unbox a, AdditiveUnital a, MultiplicativeGroup a) => MultiplicativeGroup (VectorU n a) Source # | |

# Distributive

class (Additive a, MultiplicativeMagma a) => Distributive a Source #

Distributive

a . (b + c) == a . b + a . c

(a + b) . c == a . c + b . c

Distributive Double Source # | |

Distributive Float Source # | |

Distributive Int Source # | |

(KnownNat n, Unbox a, Distributive a) => Distributive (VectorU n a) Source # | |

(Distributive a, KnownNat n) => Distributive (VectorA n [] a) Source # | |

# Ring

class (Additive a, MultiplicativeAssociative a, MultiplicativeUnital a, Distributive a) => Semiring a Source #

a semiring

class (AdditiveGroup a, MultiplicativeAssociative a, MultiplicativeUnital a, Distributive a) => Ring a Source #

Ring

class (AdditiveGroup a, MultiplicativeGroup a, Distributive a) => Field a Source #

Field

# Module

class (Additive a, AdditiveHomomorphic a a) => AdditiveBasis a where Source #

AdditiveBasis element by element addition

class (AdditiveGroup a, AdditiveHomomorphic a a) => AdditiveGroupBasis a where Source #

AdditiveGroupBasis element by element subtraction

class (Additive a, Additive s, AdditiveHomomorphic s a) => AdditiveModule s a where Source #

AdditiveModule

(.+) :: AdditiveModule s a => s -> a -> a infixr 7 Source #

(+.) :: AdditiveModule s a => a -> s -> a infixr 7 Source #

class (AdditiveModule s a, AdditiveGroup a) => AdditiveGroupModule s a where Source #

AdditiveGroupModule

(.-) :: AdditiveModule s a => s -> a -> a infixr 7 Source #

(-.) :: AdditiveModule s a => a -> s -> a infixr 7 Source #

class (Multiplicative a, MultiplicativeHomomorphic a a) => MultiplicativeBasis a where Source #

MultiplicativeBasis element by element addition

class (MultiplicativeGroup a, MultiplicativeHomomorphic a a) => MultiplicativeGroupBasis a where Source #

MultiplicativeGroupBasis element by element subtraction

class (Multiplicative a, Multiplicative s, MultiplicativeHomomorphic s a) => MultiplicativeModule s a where Source #

MultiplicativeModule

(.*) :: MultiplicativeModule s a => s -> a -> a infixr 7 Source #

(*.) :: MultiplicativeModule s a => a -> s -> a infixr 7 Source #

(KnownNat n, Unbox a, AdditiveUnital a, Multiplicative a) => MultiplicativeModule a (VectorU n a) Source # | |

(Multiplicative a, KnownNat n) => MultiplicativeModule a (VectorA n [] a) Source # | |

class (MultiplicativeModule s a, MultiplicativeGroup a) => MultiplicativeGroupModule s a where Source #

MultiplicativeGroupModule

(./) :: MultiplicativeModule s a => s -> a -> a infixr 7 Source #

(/.) :: MultiplicativeModule s a => a -> s -> a infixr 7 Source #

# Integral

class (Additive a, Multiplicative a) => Integral a where Source #

Integral

b == zero || b * (a `div` b) + (a `mod` b) == a b == zero || b * (a `quot` b) + (a `rem` b) == a

# Metric

class (MultiplicativeGroup a, MultiplicativeModule a a, MultiplicativeGroupModule a a, MultiplicativeInvertible a, Normed a) => Banach a where Source #

Banach

class (Field a, Bounded a) => BoundedField a where Source #

BoundedField

infinity :: BoundedField a => a Source #

infinity

# Exponential

# Tensor Algebra

class (Banach a, TensorAlgebra a, ExpField r, AdditiveGroup a) => Hilbert a r where Source #

Hilbert

class TensorAlgebra a where Source #

TensorAlgebra

squaredInnerProductNorm :: Hilbert v r => v -> r Source #

squaredInnerProductNorm

innerProductNorm :: Hilbert v r => v -> r Source #

innerProductNorm

innerProductDistance :: Hilbert v r => v -> v -> r Source #

innerProductDistance