numhask-0.1.4.0: A numeric prelude

Safe HaskellSafe
LanguageHaskell2010

NumHask.Algebra.Module

Description

Algebra for Representable numbers

Synopsis

Documentation

class Additive a => AdditiveModule r a where Source #

Additive Module Laws

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

Minimal complete definition

(.+), (+.)

Methods

(.+) :: r a -> a -> r a infixl 6 Source #

(+.) :: a -> r a -> r a infixl 6 Source #

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

Subtraction Module Laws

(a + b) .- c == a + (b .- c)
(a + b) .- c == (a .- c) + b
a .- zero == a
a .- b == negate b +. a

Minimal complete definition

(.-), (-.)

Methods

(.-) :: r a -> a -> r a infixl 6 Source #

(-.) :: a -> r a -> r a infixl 6 Source #

class Multiplicative a => MultiplicativeModule r a where Source #

Multiplicative Module Laws

a .* one == a
(a + b) .* c == (a .* c) + (b .* c)
c *. (a + b) == (c *. a) + (c *. b)
a .* zero == zero
a .* b == b *. a

Minimal complete definition

(.*), (*.)

Methods

(.*) :: r a -> a -> r a infixl 7 Source #

(*.) :: a -> r a -> r a infixl 7 Source #

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

Division Module Laws

nearZero a || a ./ one == a
b == zero || a ./ b == recip b *. a

Minimal complete definition

(./), (/.)

Methods

(./) :: r a -> a -> r a infixl 7 Source #

(/.) :: a -> r a -> r a infixl 7 Source #

class (ExpField a, Normed (r a) a, MultiplicativeGroupModule r a) => Banach r a where Source #

Banach (with Norm) laws form rules around size and direction of a number, with a potential crossing into another codomain.

a == singleton zero || normalize a *. size a == a

Methods

normalize :: r a -> r a Source #

class Semiring a => Hilbert r a where Source #

the inner product of a representable over a semiring

a <.> b == b <.> a
a <.> (b +c) == a <.> b + a <.> c
a <.> (s *. b + c) == s * (a <.> b) + a <.> c

(s0 *. a) . (s1 *. b) == s0 * s1 * (a . b)

Minimal complete definition

(<.>)

Methods

(<.>) :: r a -> r a -> a infix 8 Source #

type family (a :: k1) >< (b :: k2) :: * infix 8 Source #

tensorial type

Instances

type (><) * * (r a) b Source # 
type (><) * * (r a) b
type (><) * * Double Double Source # 
type (><) * * Float Float Source # 
type (><) * * Int Int Source # 
type (><) * * Int Int = Int
type (><) * * Integer Integer Source # 

class TensorProduct a where Source #

generalised outer product

a><b + c><b == (a+c) >< b
a><b + a><c == a >< (b+c)

todo: work out why these laws down't apply > a *. (b>== (a<b) .* c > (a>.* c == a *. (b<c)

Minimal complete definition

(><), timesleft, timesright

Methods

(><) :: a -> a -> a >< a infix 8 Source #

outer :: a -> a -> a >< a Source #

timesleft :: a -> (a >< a) -> a Source #

timesright :: (a >< a) -> a -> a Source #