linearmap-category-0.4.0.0: Native, complete, matrix-free linear algebra.

Copyright(c) Justus Sagemüller 2016
LicenseGPL v3
Maintainer(@) jsag $ hvl.no
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Math.LinearMap.Category

Contents

Description

 
Synopsis

Linear maps

This library deals with linear functions, i.e. functions f :: v -> w that fulfill

f $ μ ^* u ^+^ v ≡ μ ^* f u ^+^ f v    ∀ u,v :: v;  μ :: Scalar v

Such functions form a cartesian monoidal category (in maths called VectK). This is implemented by PreArrow, which is the preferred interface for dealing with these mappings. The basic “matrix operations” are then:

  • Identity matrix: id
  • Matrix addition: ^+^ (linear maps form an ordinary vector space)
  • Matrix-matrix multiplication: <<< (or >>> or .)
  • Matrix-vector multiplication: $
  • Vertical matrix concatenation: &&&
  • Horizontal matrix concatenation: (aka >+<)

But linear mappings need not necessarily be implemented as matrices:

Function implementation

newtype LinearFunction s v w Source #

A linear map, represented simply as a Haskell function tagged with the type of scalar with respect to which it is linear. Many (sparse) linear mappings can actually be calculated much more efficiently if you don't represent them with any kind of matrix, but just as a function (which is after all, mathematically speaking, what a linear map foremostly is).

However, if you sum up many LinearFunctions – which you can simply do with the VectorSpace instance – they will become ever slower to calculate, because the summand-functions are actually computed individually and only the results summed. That's where LinearMap is generally preferrable. You can always convert between these equivalent categories using arr.

Constructors

LinearFunction 

Fields

Instances
Num' s => Morphism (LinearFunction s) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Methods

first :: (ObjectPair (LinearFunction s) b d, ObjectPair (LinearFunction s) c d) => LinearFunction s b c -> LinearFunction s (b, d) (c, d) #

second :: (ObjectPair (LinearFunction s) d b, ObjectPair (LinearFunction s) d c) => LinearFunction s b c -> LinearFunction s (d, b) (d, c) #

(***) :: (ObjectPair (LinearFunction s) b b', ObjectPair (LinearFunction s) c c') => LinearFunction s b c -> LinearFunction s b' c' -> LinearFunction s (b, b') (c, c') #

Num' s => PreArrow (LinearFunction s) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Category (LinearFunction s) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Associated Types

type Object (LinearFunction s) o :: Constraint #

Num' s => Cartesian (LinearFunction s) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Associated Types

type PairObjects (LinearFunction s) a b :: Constraint #

type UnitObject (LinearFunction s) :: Type #

Methods

swap :: (ObjectPair (LinearFunction s) a b, ObjectPair (LinearFunction s) b a) => LinearFunction s (a, b) (b, a) #

attachUnit :: (unit ~ UnitObject (LinearFunction s), ObjectPair (LinearFunction s) a unit) => LinearFunction s a (a, unit) #

detachUnit :: (unit ~ UnitObject (LinearFunction s), ObjectPair (LinearFunction s) a unit) => LinearFunction s (a, unit) a #

regroup :: (ObjectPair (LinearFunction s) a b, ObjectPair (LinearFunction s) b c, ObjectPair (LinearFunction s) a (b, c), ObjectPair (LinearFunction s) (a, b) c) => LinearFunction s (a, (b, c)) ((a, b), c) #

regroup' :: (ObjectPair (LinearFunction s) a b, ObjectPair (LinearFunction s) b c, ObjectPair (LinearFunction s) a (b, c), ObjectPair (LinearFunction s) (a, b) c) => LinearFunction s ((a, b), c) (a, (b, c)) #

EnhancedCat (LinearFunction s) (Coercion :: Type -> Type -> Type) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Num' s => EnhancedCat (LinearFunction s) (LinearMap s) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Methods

arr :: (Object (LinearMap s) b, Object (LinearMap s) c, Object (LinearFunction s) b, Object (LinearFunction s) c) => LinearMap s b c -> LinearFunction s b c #

Num' s => EnhancedCat (LinearMap s) (LinearFunction s) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Methods

arr :: (Object (LinearFunction s) b, Object (LinearFunction s) c, Object (LinearMap s) b, Object (LinearMap s) c) => LinearFunction s b c -> LinearMap s b c #

EnhancedCat ((->) :: Type -> Type -> Type) (LinearFunction s) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Methods

arr :: (Object (LinearFunction s) b, Object (LinearFunction s) c, Object (->) b, Object (->) c) => LinearFunction s b c -> b -> c #

(Num' s, TensorSpace v, Scalar v ~ s) => Monoidal (Tensor s v) (LinearFunction s) (LinearFunction s) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

(Num' s, LinearSpace v, Scalar v ~ s) => Monoidal (LinearMap s v) (LinearFunction s) (LinearFunction s) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Functor (LinearFunction s v) (Coercion :: Type -> Type -> Type) (Coercion :: Type -> Type -> Type) Source # 
Instance details

Defined in Math.LinearMap.Asserted

(LinearSpace w, Num' s, Scalar w ~ s) => Functor (LinearFunction s w) (LinearFunction s) (LinearFunction s) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

(TensorSpace v, Num' s, Scalar v ~ s) => Functor (Tensor s v) (LinearFunction s) (LinearFunction s) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Methods

fmap :: (Object (LinearFunction s) a, Object (LinearFunction s) (Tensor s v a), Object (LinearFunction s) b, Object (LinearFunction s) (Tensor s v b)) => LinearFunction s a b -> LinearFunction s (Tensor s v a) (Tensor s v b) #

(LinearSpace v, Num' s, Scalar v ~ s) => Functor (LinearMap s v) (LinearFunction s) (LinearFunction s) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

(FiniteDimensional u, LSpace v, FiniteFreeSpace v, Scalar u ~ s, Scalar v ~ s) => FiniteFreeSpace (LinearFunction s u v) Source # 
Instance details

Defined in Math.VectorSpace.Docile

AdditiveGroup w => AdditiveGroup (LinearFunction s v w) Source # 
Instance details

Defined in Math.LinearMap.Asserted

VectorSpace w => VectorSpace (LinearFunction s v w) Source # 
Instance details

Defined in Math.LinearMap.Asserted

Associated Types

type Scalar (LinearFunction s v w) :: Type #

Methods

(*^) :: Scalar (LinearFunction s v w) -> LinearFunction s v w -> LinearFunction s v w #

(TensorSpace u, TensorSpace v, s ~ Scalar u, s ~ Scalar v) => AffineSpace (LinearFunction s u v) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Associated Types

type Diff (LinearFunction s u v) :: Type #

Methods

(.-.) :: LinearFunction s u v -> LinearFunction s u v -> Diff (LinearFunction s u v) #

(.+^) :: LinearFunction s u v -> Diff (LinearFunction s u v) -> LinearFunction s u v #

VectorSpace w => Semimanifold (LinearFunction s v w) Source # 
Instance details

Defined in Math.LinearMap.Asserted

Associated Types

type Needle (LinearFunction s v w) :: Type #

type Interior (LinearFunction s v w) :: Type #

VectorSpace w => PseudoAffine (LinearFunction s v w) Source # 
Instance details

Defined in Math.LinearMap.Asserted

(LinearSpace u, LinearSpace v, Scalar u ~ s, Scalar v ~ s) => LinearSpace (LinearFunction s u v) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Associated Types

type DualVector (LinearFunction s u v) :: Type Source #

Methods

dualSpaceWitness :: DualSpaceWitness (LinearFunction s u v) Source #

linearId :: LinearFunction s u v +> LinearFunction s u v Source #

idTensor :: LinearFunction s u v DualVector (LinearFunction s u v) Source #

sampleLinearFunction :: (TensorSpace w, Scalar (LinearFunction s u v) ~ Scalar w) => (LinearFunction s u v -+> w) -+> (LinearFunction s u v +> w) Source #

toLinearForm :: DualVector (LinearFunction s u v) -+> (LinearFunction s u v +> Scalar (LinearFunction s u v)) Source #

fromLinearForm :: (LinearFunction s u v +> Scalar (LinearFunction s u v)) -+> DualVector (LinearFunction s u v) Source #

coerceDoubleDual :: Coercion (LinearFunction s u v) (DualVector (DualVector (LinearFunction s u v))) Source #

trace :: (LinearFunction s u v +> LinearFunction s u v) -+> Scalar (LinearFunction s u v) Source #

contractTensorMap :: (TensorSpace w, Scalar w ~ Scalar (LinearFunction s u v)) => (LinearFunction s u v +> (LinearFunction s u v w)) -+> w Source #

contractMapTensor :: (TensorSpace w, Scalar w ~ Scalar (LinearFunction s u v)) => (LinearFunction s u v (LinearFunction s u v +> w)) -+> w Source #

contractTensorFn :: (TensorSpace w, Scalar w ~ Scalar (LinearFunction s u v)) => (LinearFunction s u v -+> (LinearFunction s u v w)) -+> w Source #

contractLinearMapAgainst :: (LinearSpace w, Scalar w ~ Scalar (LinearFunction s u v)) => Bilinear (LinearFunction s u v +> w) (w -+> LinearFunction s u v) (Scalar (LinearFunction s u v)) Source #

applyDualVector :: Bilinear (DualVector (LinearFunction s u v)) (LinearFunction s u v) (Scalar (LinearFunction s u v)) Source #

applyLinear :: (TensorSpace w, Scalar w ~ Scalar (LinearFunction s u v)) => Bilinear (LinearFunction s u v +> w) (LinearFunction s u v) w Source #

composeLinear :: (LinearSpace w, TensorSpace x, Scalar w ~ Scalar (LinearFunction s u v), Scalar x ~ Scalar (LinearFunction s u v)) => Bilinear (w +> x) (LinearFunction s u v +> w) (LinearFunction s u v +> x) Source #

tensorId :: (LinearSpace w, Scalar w ~ Scalar (LinearFunction s u v)) => (LinearFunction s u v w) +> (LinearFunction s u v w) Source #

applyTensorFunctional :: (LinearSpace u0, Scalar u0 ~ Scalar (LinearFunction s u v)) => Bilinear (DualVector (LinearFunction s u v u0)) (LinearFunction s u v u0) (Scalar (LinearFunction s u v)) Source #

applyTensorLinMap :: (LinearSpace u0, TensorSpace w, Scalar u0 ~ Scalar (LinearFunction s u v), Scalar w ~ Scalar (LinearFunction s u v)) => Bilinear ((LinearFunction s u v u0) +> w) (LinearFunction s u v u0) w Source #

(LinearSpace u, LinearSpace v, Scalar u ~ s, Scalar v ~ s) => TensorSpace (LinearFunction s u v) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Associated Types

type TensorProduct (LinearFunction s u v) w :: Type Source #

Methods

scalarSpaceWitness :: ScalarSpaceWitness (LinearFunction s u v) Source #

linearManifoldWitness :: LinearManifoldWitness (LinearFunction s u v) Source #

zeroTensor :: (TensorSpace w, Scalar w ~ Scalar (LinearFunction s u v)) => LinearFunction s u v w Source #

toFlatTensor :: LinearFunction s u v -+> (LinearFunction s u v Scalar (LinearFunction s u v)) Source #

fromFlatTensor :: (LinearFunction s u v Scalar (LinearFunction s u v)) -+> LinearFunction s u v Source #

addTensors :: (TensorSpace w, Scalar w ~ Scalar (LinearFunction s u v)) => (LinearFunction s u v w) -> (LinearFunction s u v w) -> LinearFunction s u v w Source #

subtractTensors :: (TensorSpace (LinearFunction s u v), TensorSpace w, Scalar w ~ Scalar (LinearFunction s u v)) => (LinearFunction s u v w) -> (LinearFunction s u v w) -> LinearFunction s u v w Source #

scaleTensor :: (TensorSpace w, Scalar w ~ Scalar (LinearFunction s u v)) => Bilinear (Scalar (LinearFunction s u v)) (LinearFunction s u v w) (LinearFunction s u v w) Source #

negateTensor :: (TensorSpace w, Scalar w ~ Scalar (LinearFunction s u v)) => (LinearFunction s u v w) -+> (LinearFunction s u v w) Source #

tensorProduct :: (TensorSpace w, Scalar w ~ Scalar (LinearFunction s u v)) => Bilinear (LinearFunction s u v) w (LinearFunction s u v w) Source #

tensorProducts :: (TensorSpace w, Scalar w ~ Scalar (LinearFunction s u v)) => [(LinearFunction s u v, w)] -> LinearFunction s u v w Source #

transposeTensor :: (TensorSpace w, Scalar w ~ Scalar (LinearFunction s u v)) => (LinearFunction s u v w) -+> (w LinearFunction s u v) Source #

fmapTensor :: (TensorSpace w, TensorSpace x, Scalar w ~ Scalar (LinearFunction s u v), Scalar x ~ Scalar (LinearFunction s u v)) => Bilinear (w -+> x) (LinearFunction s u v w) (LinearFunction s u v x) Source #

fzipTensorWith :: (TensorSpace u0, TensorSpace w, TensorSpace x, Scalar u0 ~ Scalar (LinearFunction s u v), Scalar w ~ Scalar (LinearFunction s u v), Scalar x ~ Scalar (LinearFunction s u v)) => Bilinear ((w, x) -+> u0) (LinearFunction s u v w, LinearFunction s u v x) (LinearFunction s u v u0) Source #

coerceFmapTensorProduct :: Functor p => p (LinearFunction s u v) -> Coercion a b -> Coercion (TensorProduct (LinearFunction s u v) a) (TensorProduct (LinearFunction s u v) b) Source #

wellDefinedVector :: LinearFunction s u v -> Maybe (LinearFunction s u v) Source #

wellDefinedTensor :: (TensorSpace w, Scalar w ~ Scalar (LinearFunction s u v)) => (LinearFunction s u v w) -> Maybe (LinearFunction s u v w) Source #

type UnitObject (LinearFunction s) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

type Object (LinearFunction s) v Source # 
Instance details

Defined in Math.LinearMap.Category.Class

type Object (LinearFunction s) v = (TensorSpace v, Scalar v ~ s)
type PairObjects (LinearFunction s) a b Source # 
Instance details

Defined in Math.LinearMap.Category.Class

type PairObjects (LinearFunction s) a b = ()
type Scalar (LinearFunction s v w) Source # 
Instance details

Defined in Math.LinearMap.Asserted

type Scalar (LinearFunction s v w) = Scalar w
type Diff (LinearFunction s u v) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

type Diff (LinearFunction s u v) = LinearFunction s u v
type Interior (LinearFunction s v w) Source # 
Instance details

Defined in Math.LinearMap.Asserted

type Needle (LinearFunction s v w) Source # 
Instance details

Defined in Math.LinearMap.Asserted

type Needle (LinearFunction s v w) = LinearFunction s v w
type DualVector (LinearFunction s u v) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

type TensorProduct (LinearFunction s u v) w Source # 
Instance details

Defined in Math.LinearMap.Category.Class

type (-+>) v w = LinearFunction (Scalar w) v w Source #

Infix synonym of LinearFunction, without explicit mention of the scalar type.

type Bilinear v w y = LinearFunction (Scalar v) v (LinearFunction (Scalar v) w y) Source #

A bilinear function is a linear function mapping to a linear function, or equivalently a 2-argument function that's linear in each argument independently. Note that this can not be uncurried to a linear function with a tuple argument (this would not be linear but quadratic).

lfun :: (EnhancedCat f (LinearFunction s), LinearSpace u, TensorSpace v, Scalar u ~ s, Scalar v ~ s, Object f u, Object f v) => (u -> v) -> f u v Source #

Use a function as a linear map. This is only well-defined if the function is linear (this condition is not checked).

Tensor implementation

newtype LinearMap s v w Source #

The tensor product between one space's dual space and another space is the space spanned by vector–dual-vector pairs, in bra-ket notation written as

m = ∑ |w⟩⟨v|

Any linear mapping can be written as such a (possibly infinite) sum. The TensorProduct data structure only stores the linear independent parts though; for simple finite-dimensional spaces this means e.g. LinearMap ℝ ℝ³ ℝ³ effectively boils down to an ordinary matrix type, namely an array of column-vectors |w⟩.

(The ⟨v| dual-vectors are then simply assumed to come from the canonical basis.)

For bigger spaces, the tensor product may be implemented in a more efficient sparse structure; this can be defined in the TensorSpace instance.

Constructors

LinearMap 
Instances
(Show (SubBasis (DualVector u)), Show (SubBasis v)) => Show (SubBasis (LinearMap s u v)) Source # 
Instance details

Defined in Math.VectorSpace.Docile

Methods

showsPrec :: Int -> SubBasis (LinearMap s u v) -> ShowS #

show :: SubBasis (LinearMap s u v) -> String #

showList :: [SubBasis (LinearMap s u v)] -> ShowS #

Num' s => Morphism (LinearMap s) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Methods

first :: (ObjectPair (LinearMap s) b d, ObjectPair (LinearMap s) c d) => LinearMap s b c -> LinearMap s (b, d) (c, d) #

second :: (ObjectPair (LinearMap s) d b, ObjectPair (LinearMap s) d c) => LinearMap s b c -> LinearMap s (d, b) (d, c) #

(***) :: (ObjectPair (LinearMap s) b b', ObjectPair (LinearMap s) c c') => LinearMap s b c -> LinearMap s b' c' -> LinearMap s (b, b') (c, c') #

Num' s => PreArrow (LinearMap s) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Methods

(&&&) :: (Object (LinearMap s) b, ObjectPair (LinearMap s) c c') => LinearMap s b c -> LinearMap s b c' -> LinearMap s b (c, c') #

terminal :: Object (LinearMap s) b => LinearMap s b (UnitObject (LinearMap s)) #

fst :: ObjectPair (LinearMap s) x y => LinearMap s (x, y) x #

snd :: ObjectPair (LinearMap s) x y => LinearMap s (x, y) y #

Category (LinearMap s) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Associated Types

type Object (LinearMap s) o :: Constraint #

Methods

id :: Object (LinearMap s) a => LinearMap s a a #

(.) :: (Object (LinearMap s) a, Object (LinearMap s) b, Object (LinearMap s) c) => LinearMap s b c -> LinearMap s a b -> LinearMap s a c #

Num' s => Cartesian (LinearMap s) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Associated Types

type PairObjects (LinearMap s) a b :: Constraint #

type UnitObject (LinearMap s) :: Type #

Methods

swap :: (ObjectPair (LinearMap s) a b, ObjectPair (LinearMap s) b a) => LinearMap s (a, b) (b, a) #

attachUnit :: (unit ~ UnitObject (LinearMap s), ObjectPair (LinearMap s) a unit) => LinearMap s a (a, unit) #

detachUnit :: (unit ~ UnitObject (LinearMap s), ObjectPair (LinearMap s) a unit) => LinearMap s (a, unit) a #

regroup :: (ObjectPair (LinearMap s) a b, ObjectPair (LinearMap s) b c, ObjectPair (LinearMap s) a (b, c), ObjectPair (LinearMap s) (a, b) c) => LinearMap s (a, (b, c)) ((a, b), c) #

regroup' :: (ObjectPair (LinearMap s) a b, ObjectPair (LinearMap s) b c, ObjectPair (LinearMap s) a (b, c), ObjectPair (LinearMap s) (a, b) c) => LinearMap s ((a, b), c) (a, (b, c)) #

Num' s => EnhancedCat (LinearFunction s) (LinearMap s) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Methods

arr :: (Object (LinearMap s) b, Object (LinearMap s) c, Object (LinearFunction s) b, Object (LinearFunction s) c) => LinearMap s b c -> LinearFunction s b c #

Num' s => EnhancedCat (LinearMap s) (LinearFunction s) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Methods

arr :: (Object (LinearFunction s) b, Object (LinearFunction s) c, Object (LinearMap s) b, Object (LinearMap s) c) => LinearFunction s b c -> LinearMap s b c #

Num' s => EnhancedCat ((->) :: Type -> Type -> Type) (LinearMap s) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Methods

arr :: (Object (LinearMap s) b, Object (LinearMap s) c, Object (->) b, Object (->) c) => LinearMap s b c -> b -> c #

(Num' s, LinearSpace v, Scalar v ~ s) => Monoidal (LinearMap s v) (LinearFunction s) (LinearFunction s) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

(LinearSpace v, Scalar v ~ s) => Functor (LinearMap s v) (Coercion :: Type -> Type -> Type) (Coercion :: Type -> Type -> Type) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Methods

fmap :: (Object Coercion a, Object Coercion (LinearMap s v a), Object Coercion b, Object Coercion (LinearMap s v b)) => Coercion a b -> Coercion (LinearMap s v a) (LinearMap s v b) #

(LinearSpace v, Num' s, Scalar v ~ s) => Functor (LinearMap s v) (LinearFunction s) (LinearFunction s) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

(Fractional' n, TensorProduct (DualVector n) n ~ n) => Fractional (LinearMap n n n) Source # 
Instance details

Defined in Math.LinearMap.Category.Instances

Methods

(/) :: LinearMap n n n -> LinearMap n n n -> LinearMap n n n #

recip :: LinearMap n n n -> LinearMap n n n #

fromRational :: Rational -> LinearMap n n n #

(Num' n, TensorProduct (DualVector n) n ~ n) => Num (LinearMap n n n) Source # 
Instance details

Defined in Math.LinearMap.Category.Instances

Methods

(+) :: LinearMap n n n -> LinearMap n n n -> LinearMap n n n #

(-) :: LinearMap n n n -> LinearMap n n n -> LinearMap n n n #

(*) :: LinearMap n n n -> LinearMap n n n -> LinearMap n n n #

negate :: LinearMap n n n -> LinearMap n n n #

abs :: LinearMap n n n -> LinearMap n n n #

signum :: LinearMap n n n -> LinearMap n n n #

fromInteger :: Integer -> LinearMap n n n #

(FiniteDimensional v, v ~ DualVector v, Show v, RieszDecomposable x, RieszDecomposable y, Scalar x ~ s, Scalar y ~ s, Scalar v ~ s, Scalar (DualVector x) ~ s, Scalar (DualVector y) ~ s) => Show (LinearMap s v (x, y)) Source # 
Instance details

Defined in Math.VectorSpace.Docile

Methods

showsPrec :: Int -> LinearMap s v (x, y) -> ShowS #

show :: LinearMap s v (x, y) -> String #

showList :: [LinearMap s v (x, y)] -> ShowS #

Show (LinearMap s v (V0 s)) Source # 
Instance details

Defined in Math.VectorSpace.Docile

Methods

showsPrec :: Int -> LinearMap s v (V0 s) -> ShowS #

show :: LinearMap s v (V0 s) -> String #

showList :: [LinearMap s v (V0 s)] -> ShowS #

Show (LinearMap s v (ZeroDim s)) Source # 
Instance details

Defined in Math.VectorSpace.Docile

Methods

showsPrec :: Int -> LinearMap s v (ZeroDim s) -> ShowS #

show :: LinearMap s v (ZeroDim s) -> String #

showList :: [LinearMap s v (ZeroDim s)] -> ShowS #

(FiniteDimensional v, InnerSpace v, Show v, FiniteDimensional w, InnerSpace w, Show w, Scalar v ~ s, Scalar w ~ s, HasBasis s, Basis s ~ ()) => Show (LinearMap s (v, w) s) Source # 
Instance details

Defined in Math.VectorSpace.Docile

Methods

showsPrec :: Int -> LinearMap s (v, w) s -> ShowS #

show :: LinearMap s (v, w) s -> String #

showList :: [LinearMap s (v, w) s] -> ShowS #

(FiniteDimensional u, LSpace v, FiniteFreeSpace v, Scalar u ~ s, Scalar v ~ s) => FiniteFreeSpace (LinearMap s u v) Source # 
Instance details

Defined in Math.VectorSpace.Docile

(LinearSpace v, TensorSpace w, Scalar v ~ s, Scalar w ~ s) => AdditiveGroup (LinearMap s v w) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Methods

zeroV :: LinearMap s v w #

(^+^) :: LinearMap s v w -> LinearMap s v w -> LinearMap s v w #

negateV :: LinearMap s v w -> LinearMap s v w #

(^-^) :: LinearMap s v w -> LinearMap s v w -> LinearMap s v w #

(LinearSpace v, TensorSpace w, Scalar v ~ s, Scalar w ~ s) => VectorSpace (LinearMap s v w) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Associated Types

type Scalar (LinearMap s v w) :: Type #

Methods

(*^) :: Scalar (LinearMap s v w) -> LinearMap s v w -> LinearMap s v w #

(LinearSpace u, TensorSpace v, s ~ Scalar u, s ~ Scalar v) => AffineSpace (LinearMap s u v) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Associated Types

type Diff (LinearMap s u v) :: Type #

Methods

(.-.) :: LinearMap s u v -> LinearMap s u v -> Diff (LinearMap s u v) #

(.+^) :: LinearMap s u v -> Diff (LinearMap s u v) -> LinearMap s u v #

(LinearSpace v, TensorSpace w, Scalar v ~ s, Scalar w ~ s) => Semimanifold (LinearMap s v w) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Associated Types

type Needle (LinearMap s v w) :: Type #

type Interior (LinearMap s v w) :: Type #

(LinearSpace v, TensorSpace w, Scalar v ~ s, Scalar w ~ s) => PseudoAffine (LinearMap s v w) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Methods

(.-~.) :: LinearMap s v w -> LinearMap s v w -> Maybe (Needle (LinearMap s v w)) #

(.-~!) :: LinearMap s v w -> LinearMap s v w -> Needle (LinearMap s v w) #

pseudoAffineWitness :: PseudoAffineWitness (LinearMap s v w) #

(LinearSpace u, LinearSpace v, Scalar u ~ s, Scalar v ~ s) => LinearSpace (LinearMap s u v) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Associated Types

type DualVector (LinearMap s u v) :: Type Source #

Methods

dualSpaceWitness :: DualSpaceWitness (LinearMap s u v) Source #

linearId :: LinearMap s u v +> LinearMap s u v Source #

idTensor :: LinearMap s u v DualVector (LinearMap s u v) Source #

sampleLinearFunction :: (TensorSpace w, Scalar (LinearMap s u v) ~ Scalar w) => (LinearMap s u v -+> w) -+> (LinearMap s u v +> w) Source #

toLinearForm :: DualVector (LinearMap s u v) -+> (LinearMap s u v +> Scalar (LinearMap s u v)) Source #

fromLinearForm :: (LinearMap s u v +> Scalar (LinearMap s u v)) -+> DualVector (LinearMap s u v) Source #

coerceDoubleDual :: Coercion (LinearMap s u v) (DualVector (DualVector (LinearMap s u v))) Source #

trace :: (LinearMap s u v +> LinearMap s u v) -+> Scalar (LinearMap s u v) Source #

contractTensorMap :: (TensorSpace w, Scalar w ~ Scalar (LinearMap s u v)) => (LinearMap s u v +> (LinearMap s u v w)) -+> w Source #

contractMapTensor :: (TensorSpace w, Scalar w ~ Scalar (LinearMap s u v)) => (LinearMap s u v (LinearMap s u v +> w)) -+> w Source #

contractTensorFn :: (TensorSpace w, Scalar w ~ Scalar (LinearMap s u v)) => (LinearMap s u v -+> (LinearMap s u v w)) -+> w Source #

contractLinearMapAgainst :: (LinearSpace w, Scalar w ~ Scalar (LinearMap s u v)) => Bilinear (LinearMap s u v +> w) (w -+> LinearMap s u v) (Scalar (LinearMap s u v)) Source #

applyDualVector :: Bilinear (DualVector (LinearMap s u v)) (LinearMap s u v) (Scalar (LinearMap s u v)) Source #

applyLinear :: (TensorSpace w, Scalar w ~ Scalar (LinearMap s u v)) => Bilinear (LinearMap s u v +> w) (LinearMap s u v) w Source #

composeLinear :: (LinearSpace w, TensorSpace x, Scalar w ~ Scalar (LinearMap s u v), Scalar x ~ Scalar (LinearMap s u v)) => Bilinear (w +> x) (LinearMap s u v +> w) (LinearMap s u v +> x) Source #

tensorId :: (LinearSpace w, Scalar w ~ Scalar (LinearMap s u v)) => (LinearMap s u v w) +> (LinearMap s u v w) Source #

applyTensorFunctional :: (LinearSpace u0, Scalar u0 ~ Scalar (LinearMap s u v)) => Bilinear (DualVector (LinearMap s u v u0)) (LinearMap s u v u0) (Scalar (LinearMap s u v)) Source #

applyTensorLinMap :: (LinearSpace u0, TensorSpace w, Scalar u0 ~ Scalar (LinearMap s u v), Scalar w ~ Scalar (LinearMap s u v)) => Bilinear ((LinearMap s u v u0) +> w) (LinearMap s u v u0) w Source #

(LinearSpace u, TensorSpace v, Scalar u ~ s, Scalar v ~ s) => TensorSpace (LinearMap s u v) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Associated Types

type TensorProduct (LinearMap s u v) w :: Type Source #

Methods

scalarSpaceWitness :: ScalarSpaceWitness (LinearMap s u v) Source #

linearManifoldWitness :: LinearManifoldWitness (LinearMap s u v) Source #

zeroTensor :: (TensorSpace w, Scalar w ~ Scalar (LinearMap s u v)) => LinearMap s u v w Source #

toFlatTensor :: LinearMap s u v -+> (LinearMap s u v Scalar (LinearMap s u v)) Source #

fromFlatTensor :: (LinearMap s u v Scalar (LinearMap s u v)) -+> LinearMap s u v Source #

addTensors :: (TensorSpace w, Scalar w ~ Scalar (LinearMap s u v)) => (LinearMap s u v w) -> (LinearMap s u v w) -> LinearMap s u v w Source #

subtractTensors :: (TensorSpace (LinearMap s u v), TensorSpace w, Scalar w ~ Scalar (LinearMap s u v)) => (LinearMap s u v w) -> (LinearMap s u v w) -> LinearMap s u v w Source #

scaleTensor :: (TensorSpace w, Scalar w ~ Scalar (LinearMap s u v)) => Bilinear (Scalar (LinearMap s u v)) (LinearMap s u v w) (LinearMap s u v w) Source #

negateTensor :: (TensorSpace w, Scalar w ~ Scalar (LinearMap s u v)) => (LinearMap s u v w) -+> (LinearMap s u v w) Source #

tensorProduct :: (TensorSpace w, Scalar w ~ Scalar (LinearMap s u v)) => Bilinear (LinearMap s u v) w (LinearMap s u v w) Source #

tensorProducts :: (TensorSpace w, Scalar w ~ Scalar (LinearMap s u v)) => [(LinearMap s u v, w)] -> LinearMap s u v w Source #

transposeTensor :: (TensorSpace w, Scalar w ~ Scalar (LinearMap s u v)) => (LinearMap s u v w) -+> (w LinearMap s u v) Source #

fmapTensor :: (TensorSpace w, TensorSpace x, Scalar w ~ Scalar (LinearMap s u v), Scalar x ~ Scalar (LinearMap s u v)) => Bilinear (w -+> x) (LinearMap s u v w) (LinearMap s u v x) Source #

fzipTensorWith :: (TensorSpace u0, TensorSpace w, TensorSpace x, Scalar u0 ~ Scalar (LinearMap s u v), Scalar w ~ Scalar (LinearMap s u v), Scalar x ~ Scalar (LinearMap s u v)) => Bilinear ((w, x) -+> u0) (LinearMap s u v w, LinearMap s u v x) (LinearMap s u v u0) Source #

coerceFmapTensorProduct :: Functor p => p (LinearMap s u v) -> Coercion a b -> Coercion (TensorProduct (LinearMap s u v) a) (TensorProduct (LinearMap s u v) b) Source #

wellDefinedVector :: LinearMap s u v -> Maybe (LinearMap s u v) Source #

wellDefinedTensor :: (TensorSpace w, Scalar w ~ Scalar (LinearMap s u v)) => (LinearMap s u v w) -> Maybe (LinearMap s u v w) Source #

(LSpace u, FiniteDimensional (DualVector u), FiniteDimensional v, Scalar u ~ s, Scalar v ~ s, Scalar (DualVector v) ~ s, Fractional' (Scalar v)) => FiniteDimensional (LinearMap s u v) Source # 
Instance details

Defined in Math.VectorSpace.Docile

Associated Types

data SubBasis (LinearMap s u v) :: Type Source #

Methods

entireBasis :: SubBasis (LinearMap s u v) Source #

enumerateSubBasis :: SubBasis (LinearMap s u v) -> [LinearMap s u v] Source #

subbasisDimension :: SubBasis (LinearMap s u v) -> Int Source #

decomposeLinMap :: (LSpace w, Scalar w ~ Scalar (LinearMap s u v)) => (LinearMap s u v +> w) -> (SubBasis (LinearMap s u v), DList w) Source #

decomposeLinMapWithin :: (LSpace w, Scalar w ~ Scalar (LinearMap s u v)) => SubBasis (LinearMap s u v) -> (LinearMap s u v +> w) -> Either (SubBasis (LinearMap s u v), DList w) (DList w) Source #

recomposeSB :: SubBasis (LinearMap s u v) -> [Scalar (LinearMap s u v)] -> (LinearMap s u v, [Scalar (LinearMap s u v)]) Source #

recomposeSBTensor :: (FiniteDimensional w, Scalar w ~ Scalar (LinearMap s u v)) => SubBasis (LinearMap s u v) -> SubBasis w -> [Scalar (LinearMap s u v)] -> (LinearMap s u v w, [Scalar (LinearMap s u v)]) Source #

recomposeLinMap :: (LSpace w, Scalar w ~ Scalar (LinearMap s u v)) => SubBasis (LinearMap s u v) -> [w] -> (LinearMap s u v +> w, [w]) Source #

recomposeContraLinMap :: (LinearSpace w, Scalar w ~ Scalar (LinearMap s u v), Functor f) => (f (Scalar w) -> w) -> f (DualVector (LinearMap s u v)) -> LinearMap s u v +> w Source #

recomposeContraLinMapTensor :: (FiniteDimensional u0, LinearSpace w, Scalar u0 ~ Scalar (LinearMap s u v), Scalar w ~ Scalar (LinearMap s u v), Functor f) => (f (Scalar w) -> w) -> f (LinearMap s u v +> DualVector u0) -> (LinearMap s u v u0) +> w Source #

uncanonicallyFromDual :: DualVector (LinearMap s u v) -+> LinearMap s u v Source #

uncanonicallyToDual :: LinearMap s u v -+> DualVector (LinearMap s u v) Source #

(LinearSpace u, SemiInner (DualVector u), SemiInner v, Scalar u ~ s, Scalar v ~ s) => SemiInner (LinearMap s u v) Source # 
Instance details

Defined in Math.VectorSpace.Docile

type UnitObject (LinearMap s) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

type Object (LinearMap s) v Source # 
Instance details

Defined in Math.LinearMap.Category.Class

type Object (LinearMap s) v = (LinearSpace v, Scalar v ~ s)
type PairObjects (LinearMap s) a b Source # 
Instance details

Defined in Math.LinearMap.Category.Class

type PairObjects (LinearMap s) a b = ()
type Scalar (LinearMap s v w) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

type Scalar (LinearMap s v w) = s
type Diff (LinearMap s u v) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

type Diff (LinearMap s u v) = LinearMap s u v
type Interior (LinearMap s v w) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

type Interior (LinearMap s v w) = LinearMap s v w
type Needle (LinearMap s v w) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

type Needle (LinearMap s v w) = LinearMap s v w
type DualVector (LinearMap s u v) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

type DualVector (LinearMap s u v) = Tensor s u (DualVector v)
data SubBasis (LinearMap s u v) Source # 
Instance details

Defined in Math.VectorSpace.Docile

type TensorProduct (LinearMap s u v) w Source # 
Instance details

Defined in Math.LinearMap.Category.Class

type (+>) v w = LinearMap (Scalar v) v w Source #

Infix synonym for LinearMap, without explicit mention of the scalar type.

(⊕) :: (u +> w) -> (v +> w) -> (u, v) +> w infixr 6 Source #

The dual operation to the tuple constructor, or rather to the &&& fanout operation: evaluate two (linear) functions in parallel and sum up the results. The typical use is to concatenate “row vectors” in a matrix definition.

(>+<) :: (u +> w) -> (v +> w) -> (u, v) +> w infixr 6 Source #

ASCII version of

adjoint :: forall v w. (LinearSpace v, LinearSpace w, Scalar v ~ Scalar w) => (v +> DualVector w) -+> (w +> DualVector v) Source #

For real matrices, this boils down to transpose. For free complex spaces it also incurs complex conjugation.

The signature can also be understood as

adjoint :: (v +> w) -> (DualVector w +> DualVector v)

Or

adjoint :: (DualVector v +> DualVector w) -> (w +> v)

But not (v+>w) -> (w+>v), in general (though in a Hilbert space, this too is equivalent, via riesz isomorphism).

Dual vectors

A DualVector v is a linear functional or linear form on the vector space v, i.e. it is a linear function from the vector space into its scalar field. However, these functions form themselves a vector space, known as the dual space. In particular, the dual space of any InnerSpace is isomorphic to the space itself.

(More precisely: the continuous dual space of a Hilbert space is isomorphic to that Hilbert space itself; see the riesz isomorphism.)

As a matter of fact, in many applications, no distinction is made between a space and its dual. Indeed, we have for the basic LinearSpace instances DualVector v ~ v, and <.>^ is simply defined as a scalar product. In this case, a general LinearMap is just a tensor product / matrix.

However, scalar products are often not as natural as they are made to look:

  • A scalar product is only preserved under orthogonal transformations. It is not preserved under scalings, and certainly not under general linear transformations. This is very important in applications such as relativity theory (here, people talk about covariant vs contravariant tensors), but also relevant for more mundane manifolds like sphere surfaces: on such a surface, the natural symmetry transformations do generally not preserve a scalar product you might define.
  • There may be more than one meaningful scalar product. For instance, the Sobolev space of weakly differentiable functions also permits the 𝐿² scalar product – each has different and useful properties.

Neither of this is a problem if we keep the dual space a separate type. Effectively, this enables the type system to prevent you from writing code that does not behave natural (i.e. that depends on a concrete choice of basis / scalar product).

For cases when you do have some given notion of orientation/scale in a vector space and need it for an algorithm, you can always provide a Norm, which is essentially a reified scalar product.

Note that DualVector (DualVector v) ~ v in any LSpace: the double-dual space is naturally isomorphic to the original space, by way of

v <.>^ dv  ≡  dv <.>^ v

(<.>^) :: LinearSpace v => DualVector v -> v -> Scalar v infixr 7 Source #

(-+|>) :: (EnhancedCat f (LinearFunction s), LSpace u, LSpace v, Scalar u ~ s, Scalar v ~ s, Object f u, Object f v) => DualVector u -> v -> f u v infixr 7 Source #

A linear map that simply projects from a dual vector in u to a vector in v.

(du -+|> v) u  ≡  v ^* (du <.>^ u)

Tensor spaces

newtype Tensor s v w Source #

Tensor products are most interesting because they can be used to implement linear mappings, but they also form a useful vector space on their own right.

Constructors

Tensor 
Instances
(Show (SubBasis u), Show (SubBasis v)) => Show (SubBasis (Tensor s u v)) Source # 
Instance details

Defined in Math.VectorSpace.Docile

Methods

showsPrec :: Int -> SubBasis (Tensor s u v) -> ShowS #

show :: SubBasis (Tensor s u v) -> String #

showList :: [SubBasis (Tensor s u v)] -> ShowS #

(Num' s, TensorSpace v, Scalar v ~ s) => Monoidal (Tensor s v) (LinearFunction s) (LinearFunction s) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

(TensorSpace v, Scalar v ~ s) => Functor (Tensor s v) (Coercion :: Type -> Type -> Type) (Coercion :: Type -> Type -> Type) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Methods

fmap :: (Object Coercion a, Object Coercion (Tensor s v a), Object Coercion b, Object Coercion (Tensor s v b)) => Coercion a b -> Coercion (Tensor s v a) (Tensor s v b) #

(TensorSpace v, Num' s, Scalar v ~ s) => Functor (Tensor s v) (LinearFunction s) (LinearFunction s) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Methods

fmap :: (Object (LinearFunction s) a, Object (LinearFunction s) (Tensor s v a), Object (LinearFunction s) b, Object (LinearFunction s) (Tensor s v b)) => LinearFunction s a b -> LinearFunction s (Tensor s v a) (Tensor s v b) #

IsList (Tensor s (FinSuppSeq s) v) Source # 
Instance details

Defined in Math.LinearMap.Category.Instances

Associated Types

type Item (Tensor s (FinSuppSeq s) v) :: Type #

Methods

fromList :: [Item (Tensor s (FinSuppSeq s) v)] -> Tensor s (FinSuppSeq s) v #

fromListN :: Int -> [Item (Tensor s (FinSuppSeq s) v)] -> Tensor s (FinSuppSeq s) v #

toList :: Tensor s (FinSuppSeq s) v -> [Item (Tensor s (FinSuppSeq s) v)] #

IsList (Tensor s (Sequence s) v) Source # 
Instance details

Defined in Math.LinearMap.Category.Instances

Associated Types

type Item (Tensor s (Sequence s) v) :: Type #

Methods

fromList :: [Item (Tensor s (Sequence s) v)] -> Tensor s (Sequence s) v #

fromListN :: Int -> [Item (Tensor s (Sequence s) v)] -> Tensor s (Sequence s) v #

toList :: Tensor s (Sequence s) v -> [Item (Tensor s (Sequence s) v)] #

(FiniteDimensional v, v ~ DualVector v, Show v, TensorDecomposable x, TensorDecomposable y, Scalar x ~ s, Scalar y ~ s, Scalar v ~ s) => Show (Tensor s (x, y) v) Source # 
Instance details

Defined in Math.VectorSpace.Docile

Methods

showsPrec :: Int -> Tensor s (x, y) v -> ShowS #

show :: Tensor s (x, y) v -> String #

showList :: [Tensor s (x, y) v] -> ShowS #

Show (Tensor s (V0 s) v) Source # 
Instance details

Defined in Math.VectorSpace.Docile

Methods

showsPrec :: Int -> Tensor s (V0 s) v -> ShowS #

show :: Tensor s (V0 s) v -> String #

showList :: [Tensor s (V0 s) v] -> ShowS #

(LSpace u, FiniteDimensional (DualVector u), LSpace v, FiniteFreeSpace v, Scalar u ~ s, Scalar v ~ s, Scalar (DualVector u) ~ s, Scalar (DualVector v) ~ s) => FiniteFreeSpace (Tensor s u v) Source # 
Instance details

Defined in Math.VectorSpace.Docile

Methods

freeDimension :: Functor p => p (Tensor s u v) -> Int #

toFullUnboxVect :: Tensor s u v -> Vector (Scalar (Tensor s u v)) #

unsafeFromFullUnboxVect :: Vector (Scalar (Tensor s u v)) -> Tensor s u v #

fromUnboxVect :: Vector (Scalar (Tensor s u v)) -> Tensor s u v #

(TensorSpace v, TensorSpace w, Scalar v ~ s, Scalar w ~ s) => AdditiveGroup (Tensor s v w) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Methods

zeroV :: Tensor s v w #

(^+^) :: Tensor s v w -> Tensor s v w -> Tensor s v w #

negateV :: Tensor s v w -> Tensor s v w #

(^-^) :: Tensor s v w -> Tensor s v w -> Tensor s v w #

(TensorSpace v, TensorSpace w, Scalar v ~ s, Scalar w ~ s) => VectorSpace (Tensor s v w) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Associated Types

type Scalar (Tensor s v w) :: Type #

Methods

(*^) :: Scalar (Tensor s v w) -> Tensor s v w -> Tensor s v w #

(TensorSpace u, TensorSpace v, s ~ Scalar u, s ~ Scalar v) => AffineSpace (Tensor s u v) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Associated Types

type Diff (Tensor s u v) :: Type #

Methods

(.-.) :: Tensor s u v -> Tensor s u v -> Diff (Tensor s u v) #

(.+^) :: Tensor s u v -> Diff (Tensor s u v) -> Tensor s u v #

(TensorSpace v, TensorSpace w, Scalar v ~ s, Scalar w ~ s) => Semimanifold (Tensor s v w) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Associated Types

type Needle (Tensor s v w) :: Type #

type Interior (Tensor s v w) :: Type #

Methods

(.+~^) :: Interior (Tensor s v w) -> Needle (Tensor s v w) -> Tensor s v w #

fromInterior :: Interior (Tensor s v w) -> Tensor s v w #

toInterior :: Tensor s v w -> Maybe (Interior (Tensor s v w)) #

translateP :: Tagged (Tensor s v w) (Interior (Tensor s v w) -> Needle (Tensor s v w) -> Interior (Tensor s v w)) #

(.-~^) :: Interior (Tensor s v w) -> Needle (Tensor s v w) -> Tensor s v w #

semimanifoldWitness :: SemimanifoldWitness (Tensor s v w) #

(TensorSpace v, TensorSpace w, Scalar v ~ s, Scalar w ~ s) => PseudoAffine (Tensor s v w) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Methods

(.-~.) :: Tensor s v w -> Tensor s v w -> Maybe (Needle (Tensor s v w)) #

(.-~!) :: Tensor s v w -> Tensor s v w -> Needle (Tensor s v w) #

pseudoAffineWitness :: PseudoAffineWitness (Tensor s v w) #

(LinearSpace u, LinearSpace v, Scalar u ~ s, Scalar v ~ s) => LinearSpace (Tensor s u v) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Associated Types

type DualVector (Tensor s u v) :: Type Source #

Methods

dualSpaceWitness :: DualSpaceWitness (Tensor s u v) Source #

linearId :: Tensor s u v +> Tensor s u v Source #

idTensor :: Tensor s u v DualVector (Tensor s u v) Source #

sampleLinearFunction :: (TensorSpace w, Scalar (Tensor s u v) ~ Scalar w) => (Tensor s u v -+> w) -+> (Tensor s u v +> w) Source #

toLinearForm :: DualVector (Tensor s u v) -+> (Tensor s u v +> Scalar (Tensor s u v)) Source #

fromLinearForm :: (Tensor s u v +> Scalar (Tensor s u v)) -+> DualVector (Tensor s u v) Source #

coerceDoubleDual :: Coercion (Tensor s u v) (DualVector (DualVector (Tensor s u v))) Source #

trace :: (Tensor s u v +> Tensor s u v) -+> Scalar (Tensor s u v) Source #

contractTensorMap :: (TensorSpace w, Scalar w ~ Scalar (Tensor s u v)) => (Tensor s u v +> (Tensor s u v w)) -+> w Source #

contractMapTensor :: (TensorSpace w, Scalar w ~ Scalar (Tensor s u v)) => (Tensor s u v (Tensor s u v +> w)) -+> w Source #

contractTensorFn :: (TensorSpace w, Scalar w ~ Scalar (Tensor s u v)) => (Tensor s u v -+> (Tensor s u v w)) -+> w Source #

contractLinearMapAgainst :: (LinearSpace w, Scalar w ~ Scalar (Tensor s u v)) => Bilinear (Tensor s u v +> w) (w -+> Tensor s u v) (Scalar (Tensor s u v)) Source #

applyDualVector :: Bilinear (DualVector (Tensor s u v)) (Tensor s u v) (Scalar (Tensor s u v)) Source #

applyLinear :: (TensorSpace w, Scalar w ~ Scalar (Tensor s u v)) => Bilinear (Tensor s u v +> w) (Tensor s u v) w Source #

composeLinear :: (LinearSpace w, TensorSpace x, Scalar w ~ Scalar (Tensor s u v), Scalar x ~ Scalar (Tensor s u v)) => Bilinear (w +> x) (Tensor s u v +> w) (Tensor s u v +> x) Source #

tensorId :: (LinearSpace w, Scalar w ~ Scalar (Tensor s u v)) => (Tensor s u v w) +> (Tensor s u v w) Source #

applyTensorFunctional :: (LinearSpace u0, Scalar u0 ~ Scalar (Tensor s u v)) => Bilinear (DualVector (Tensor s u v u0)) (Tensor s u v u0) (Scalar (Tensor s u v)) Source #

applyTensorLinMap :: (LinearSpace u0, TensorSpace w, Scalar u0 ~ Scalar (Tensor s u v), Scalar w ~ Scalar (Tensor s u v)) => Bilinear ((Tensor s u v u0) +> w) (Tensor s u v u0) w Source #

(TensorSpace u, TensorSpace v, Scalar u ~ s, Scalar v ~ s) => TensorSpace (Tensor s u v) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Associated Types

type TensorProduct (Tensor s u v) w :: Type Source #

Methods

scalarSpaceWitness :: ScalarSpaceWitness (Tensor s u v) Source #

linearManifoldWitness :: LinearManifoldWitness (Tensor s u v) Source #

zeroTensor :: (TensorSpace w, Scalar w ~ Scalar (Tensor s u v)) => Tensor s u v w Source #

toFlatTensor :: Tensor s u v -+> (Tensor s u v Scalar (Tensor s u v)) Source #

fromFlatTensor :: (Tensor s u v Scalar (Tensor s u v)) -+> Tensor s u v Source #

addTensors :: (TensorSpace w, Scalar w ~ Scalar (Tensor s u v)) => (Tensor s u v w) -> (Tensor s u v w) -> Tensor s u v w Source #

subtractTensors :: (TensorSpace (Tensor s u v), TensorSpace w, Scalar w ~ Scalar (Tensor s u v)) => (Tensor s u v w) -> (Tensor s u v w) -> Tensor s u v w Source #

scaleTensor :: (TensorSpace w, Scalar w ~ Scalar (Tensor s u v)) => Bilinear (Scalar (Tensor s u v)) (Tensor s u v w) (Tensor s u v w) Source #

negateTensor :: (TensorSpace w, Scalar w ~ Scalar (Tensor s u v)) => (Tensor s u v w) -+> (Tensor s u v w) Source #

tensorProduct :: (TensorSpace w, Scalar w ~ Scalar (Tensor s u v)) => Bilinear (Tensor s u v) w (Tensor s u v w) Source #

tensorProducts :: (TensorSpace w, Scalar w ~ Scalar (Tensor s u v)) => [(Tensor s u v, w)] -> Tensor s u v w Source #

transposeTensor :: (TensorSpace w, Scalar w ~ Scalar (Tensor s u v)) => (Tensor s u v w) -+> (w Tensor s u v) Source #

fmapTensor :: (TensorSpace w, TensorSpace x, Scalar w ~ Scalar (Tensor s u v), Scalar x ~ Scalar (Tensor s u v)) => Bilinear (w -+> x) (Tensor s u v w) (Tensor s u v x) Source #

fzipTensorWith :: (TensorSpace u0, TensorSpace w, TensorSpace x, Scalar u0 ~ Scalar (Tensor s u v), Scalar w ~ Scalar (Tensor s u v), Scalar x ~ Scalar (Tensor s u v)) => Bilinear ((w, x) -+> u0) (Tensor s u v w, Tensor s u v x) (Tensor s u v u0) Source #

coerceFmapTensorProduct :: Functor p => p (Tensor s u v) -> Coercion a b -> Coercion (TensorProduct (Tensor s u v) a) (TensorProduct (Tensor s u v) b) Source #

wellDefinedVector :: Tensor s u v -> Maybe (Tensor s u v) Source #

wellDefinedTensor :: (TensorSpace w, Scalar w ~ Scalar (Tensor s u v)) => (Tensor s u v w) -> Maybe (Tensor s u v w) Source #

(FiniteDimensional u, FiniteDimensional v, Scalar u ~ s, Scalar v ~ s, Scalar (DualVector u) ~ s, Scalar (DualVector v) ~ s, Fractional' (Scalar v)) => FiniteDimensional (Tensor s u v) Source # 
Instance details

Defined in Math.VectorSpace.Docile

Associated Types

data SubBasis (Tensor s u v) :: Type Source #

Methods

entireBasis :: SubBasis (Tensor s u v) Source #

enumerateSubBasis :: SubBasis (Tensor s u v) -> [Tensor s u v] Source #

subbasisDimension :: SubBasis (Tensor s u v) -> Int Source #

decomposeLinMap :: (LSpace w, Scalar w ~ Scalar (Tensor s u v)) => (Tensor s u v +> w) -> (SubBasis (Tensor s u v), DList w) Source #

decomposeLinMapWithin :: (LSpace w, Scalar w ~ Scalar (Tensor s u v)) => SubBasis (Tensor s u v) -> (Tensor s u v +> w) -> Either (SubBasis (Tensor s u v), DList w) (DList w) Source #

recomposeSB :: SubBasis (Tensor s u v) -> [Scalar (Tensor s u v)] -> (Tensor s u v, [Scalar (Tensor s u v)]) Source #

recomposeSBTensor :: (FiniteDimensional w, Scalar w ~ Scalar (Tensor s u v)) => SubBasis (Tensor s u v) -> SubBasis w -> [Scalar (Tensor s u v)] -> (Tensor s u v w, [Scalar (Tensor s u v)]) Source #

recomposeLinMap :: (LSpace w, Scalar w ~ Scalar (Tensor s u v)) => SubBasis (Tensor s u v) -> [w] -> (Tensor s u v +> w, [w]) Source #

recomposeContraLinMap :: (LinearSpace w, Scalar w ~ Scalar (Tensor s u v), Functor f) => (f (Scalar w) -> w) -> f (DualVector (Tensor s u v)) -> Tensor s u v +> w Source #

recomposeContraLinMapTensor :: (FiniteDimensional u0, LinearSpace w, Scalar u0 ~ Scalar (Tensor s u v), Scalar w ~ Scalar (Tensor s u v), Functor f) => (f (Scalar w) -> w) -> f (Tensor s u v +> DualVector u0) -> (Tensor s u v u0) +> w Source #

uncanonicallyFromDual :: DualVector (Tensor s u v) -+> Tensor s u v Source #

uncanonicallyToDual :: Tensor s u v -+> DualVector (Tensor s u v) Source #

(SemiInner u, SemiInner v, Scalar u ~ s, Scalar v ~ s) => SemiInner (Tensor s u v) Source # 
Instance details

Defined in Math.VectorSpace.Docile

type Item (Tensor s (FinSuppSeq s) v) Source # 
Instance details

Defined in Math.LinearMap.Category.Instances

type Item (Tensor s (FinSuppSeq s) v) = v
type Item (Tensor s (Sequence s) v) Source # 
Instance details

Defined in Math.LinearMap.Category.Instances

type Item (Tensor s (Sequence s) v) = v
type Scalar (Tensor s v w) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

type Scalar (Tensor s v w) = s
type Diff (Tensor s u v) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

type Diff (Tensor s u v) = Tensor s u v
type Interior (Tensor s v w) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

type Interior (Tensor s v w) = Tensor s v w
type Needle (Tensor s v w) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

type Needle (Tensor s v w) = Tensor s v w
type DualVector (Tensor s u v) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

type DualVector (Tensor s u v) = LinearMap s u (DualVector v)
data SubBasis (Tensor s u v) Source # 
Instance details

Defined in Math.VectorSpace.Docile

data SubBasis (Tensor s u v) = TensorBasis !(SubBasis u) !(SubBasis v)
type TensorProduct (Tensor s u v) w Source # 
Instance details

Defined in Math.LinearMap.Category.Class

type TensorProduct (Tensor s u v) w = TensorProduct u (Tensor s v w)

type (⊗) v w = Tensor (Scalar v) v w infixl 7 Source #

Infix synonym for Tensor, without explicit mention of the scalar type.

(⊗) :: forall v w. (TensorSpace v, TensorSpace w, Scalar w ~ Scalar v, Num' (Scalar v)) => v -> w -> v w infixl 7 Source #

Infix version of tensorProduct.

Symmetric

newtype SymmetricTensor s v Source #

Constructors

SymTensor 

Fields

Instances
Show (SubBasis v) => Show (SubBasis (SymmetricTensor s v)) Source # 
Instance details

Defined in Math.VectorSpace.Docile

Show (Tensor s v v) => Show (SymmetricTensor s v) Source # 
Instance details

Defined in Math.LinearMap.Category.Instances

(TensorSpace v, Scalar v ~ s) => AdditiveGroup (SymmetricTensor s v) Source # 
Instance details

Defined in Math.LinearMap.Category.Instances

(TensorSpace v, Scalar v ~ s) => VectorSpace (SymmetricTensor s v) Source # 
Instance details

Defined in Math.LinearMap.Category.Instances

Associated Types

type Scalar (SymmetricTensor s v) :: Type #

(TensorSpace v, Scalar v ~ s) => AffineSpace (SymmetricTensor s v) Source # 
Instance details

Defined in Math.LinearMap.Category.Instances

Associated Types

type Diff (SymmetricTensor s v) :: Type #

(TensorSpace v, Scalar v ~ s) => Semimanifold (SymmetricTensor s v) Source # 
Instance details

Defined in Math.LinearMap.Category.Instances

Associated Types

type Needle (SymmetricTensor s v) :: Type #

type Interior (SymmetricTensor s v) :: Type #

(TensorSpace v, Scalar v ~ s) => PseudoAffine (SymmetricTensor s v) Source # 
Instance details

Defined in Math.LinearMap.Category.Instances

(Num' s, LinearSpace v, Scalar v ~ s) => LinearSpace (SymmetricTensor s v) Source # 
Instance details

Defined in Math.LinearMap.Category.Instances

Associated Types

type DualVector (SymmetricTensor s v) :: Type Source #

Methods

dualSpaceWitness :: DualSpaceWitness (SymmetricTensor s v) Source #

linearId :: SymmetricTensor s v +> SymmetricTensor s v Source #

idTensor :: SymmetricTensor s v DualVector (SymmetricTensor s v) Source #

sampleLinearFunction :: (TensorSpace w, Scalar (SymmetricTensor s v) ~ Scalar w) => (SymmetricTensor s v -+> w) -+> (SymmetricTensor s v +> w) Source #

toLinearForm :: DualVector (SymmetricTensor s v) -+> (SymmetricTensor s v +> Scalar (SymmetricTensor s v)) Source #

fromLinearForm :: (SymmetricTensor s v +> Scalar (SymmetricTensor s v)) -+> DualVector (SymmetricTensor s v) Source #

coerceDoubleDual :: Coercion (SymmetricTensor s v) (DualVector (DualVector (SymmetricTensor s v))) Source #

trace :: (SymmetricTensor s v +> SymmetricTensor s v) -+> Scalar (SymmetricTensor s v) Source #

contractTensorMap :: (TensorSpace w, Scalar w ~ Scalar (SymmetricTensor s v)) => (SymmetricTensor s v +> (SymmetricTensor s v w)) -+> w Source #

contractMapTensor :: (TensorSpace w, Scalar w ~ Scalar (SymmetricTensor s v)) => (SymmetricTensor s v (SymmetricTensor s v +> w)) -+> w Source #

contractTensorFn :: (TensorSpace w, Scalar w ~ Scalar (SymmetricTensor s v)) => (SymmetricTensor s v -+> (SymmetricTensor s v w)) -+> w Source #

contractLinearMapAgainst :: (LinearSpace w, Scalar w ~ Scalar (SymmetricTensor s v)) => Bilinear (SymmetricTensor s v +> w) (w -+> SymmetricTensor s v) (Scalar (SymmetricTensor s v)) Source #

applyDualVector :: Bilinear (DualVector (SymmetricTensor s v)) (SymmetricTensor s v) (Scalar (SymmetricTensor s v)) Source #

applyLinear :: (TensorSpace w, Scalar w ~ Scalar (SymmetricTensor s v)) => Bilinear (SymmetricTensor s v +> w) (SymmetricTensor s v) w Source #

composeLinear :: (LinearSpace w, TensorSpace x, Scalar w ~ Scalar (SymmetricTensor s v), Scalar x ~ Scalar (SymmetricTensor s v)) => Bilinear (w +> x) (SymmetricTensor s v +> w) (SymmetricTensor s v +> x) Source #

tensorId :: (LinearSpace w, Scalar w ~ Scalar (SymmetricTensor s v)) => (SymmetricTensor s v w) +> (SymmetricTensor s v w) Source #

applyTensorFunctional :: (LinearSpace u, Scalar u ~ Scalar (SymmetricTensor s v)) => Bilinear (DualVector (SymmetricTensor s v u)) (SymmetricTensor s v u) (Scalar (SymmetricTensor s v)) Source #

applyTensorLinMap :: (LinearSpace u, TensorSpace w, Scalar u ~ Scalar (SymmetricTensor s v), Scalar w ~ Scalar (SymmetricTensor s v)) => Bilinear ((SymmetricTensor s v u) +> w) (SymmetricTensor s v u) w Source #

(Num' s, TensorSpace v, Scalar v ~ s) => TensorSpace (SymmetricTensor s v) Source # 
Instance details

Defined in Math.LinearMap.Category.Instances

Associated Types

type TensorProduct (SymmetricTensor s v) w :: Type Source #

Methods

scalarSpaceWitness :: ScalarSpaceWitness (SymmetricTensor s v) Source #

linearManifoldWitness :: LinearManifoldWitness (SymmetricTensor s v) Source #

zeroTensor :: (TensorSpace w, Scalar w ~ Scalar (SymmetricTensor s v)) => SymmetricTensor s v w Source #

toFlatTensor :: SymmetricTensor s v -+> (SymmetricTensor s v Scalar (SymmetricTensor s v)) Source #

fromFlatTensor :: (SymmetricTensor s v Scalar (SymmetricTensor s v)) -+> SymmetricTensor s v Source #

addTensors :: (TensorSpace w, Scalar w ~ Scalar (SymmetricTensor s v)) => (SymmetricTensor s v w) -> (SymmetricTensor s v w) -> SymmetricTensor s v w Source #

subtractTensors :: (TensorSpace (SymmetricTensor s v), TensorSpace w, Scalar w ~ Scalar (SymmetricTensor s v)) => (SymmetricTensor s v w) -> (SymmetricTensor s v w) -> SymmetricTensor s v w Source #

scaleTensor :: (TensorSpace w, Scalar w ~ Scalar (SymmetricTensor s v)) => Bilinear (Scalar (SymmetricTensor s v)) (SymmetricTensor s v w) (SymmetricTensor s v w) Source #

negateTensor :: (TensorSpace w, Scalar w ~ Scalar (SymmetricTensor s v)) => (SymmetricTensor s v w) -+> (SymmetricTensor s v w) Source #

tensorProduct :: (TensorSpace w, Scalar w ~ Scalar (SymmetricTensor s v)) => Bilinear (SymmetricTensor s v) w (SymmetricTensor s v w) Source #

tensorProducts :: (TensorSpace w, Scalar w ~ Scalar (SymmetricTensor s v)) => [(SymmetricTensor s v, w)] -> SymmetricTensor s v w Source #

transposeTensor :: (TensorSpace w, Scalar w ~ Scalar (SymmetricTensor s v)) => (SymmetricTensor s v w) -+> (w SymmetricTensor s v) Source #

fmapTensor :: (TensorSpace w, TensorSpace x, Scalar w ~ Scalar (SymmetricTensor s v), Scalar x ~ Scalar (SymmetricTensor s v)) => Bilinear (w -+> x) (SymmetricTensor s v w) (SymmetricTensor s v x) Source #

fzipTensorWith :: (TensorSpace u, TensorSpace w, TensorSpace x, Scalar u ~ Scalar (SymmetricTensor s v), Scalar w ~ Scalar (SymmetricTensor s v), Scalar x ~ Scalar (SymmetricTensor s v)) => Bilinear ((w, x) -+> u) (SymmetricTensor s v w, SymmetricTensor s v x) (SymmetricTensor s v u) Source #

coerceFmapTensorProduct :: Functor p => p (SymmetricTensor s v) -> Coercion a b -> Coercion (TensorProduct (SymmetricTensor s v) a) (TensorProduct (SymmetricTensor s v) b) Source #

wellDefinedVector :: SymmetricTensor s v -> Maybe (SymmetricTensor s v) Source #

wellDefinedTensor :: (TensorSpace w, Scalar w ~ Scalar (SymmetricTensor s v)) => (SymmetricTensor s v w) -> Maybe (SymmetricTensor s v w) Source #

(FiniteDimensional v, Scalar v ~ s, Scalar (DualVector v) ~ s, RealFloat' s) => FiniteDimensional (SymmetricTensor s v) Source # 
Instance details

Defined in Math.VectorSpace.Docile

Associated Types

data SubBasis (SymmetricTensor s v) :: Type Source #

Methods

entireBasis :: SubBasis (SymmetricTensor s v) Source #

enumerateSubBasis :: SubBasis (SymmetricTensor s v) -> [SymmetricTensor s v] Source #

subbasisDimension :: SubBasis (SymmetricTensor s v) -> Int Source #

decomposeLinMap :: (LSpace w, Scalar w ~ Scalar (SymmetricTensor s v)) => (SymmetricTensor s v +> w) -> (SubBasis (SymmetricTensor s v), DList w) Source #

decomposeLinMapWithin :: (LSpace w, Scalar w ~ Scalar (SymmetricTensor s v)) => SubBasis (SymmetricTensor s v) -> (SymmetricTensor s v +> w) -> Either (SubBasis (SymmetricTensor s v), DList w) (DList w) Source #

recomposeSB :: SubBasis (SymmetricTensor s v) -> [Scalar (SymmetricTensor s v)] -> (SymmetricTensor s v, [Scalar (SymmetricTensor s v)]) Source #

recomposeSBTensor :: (FiniteDimensional w, Scalar w ~ Scalar (SymmetricTensor s v)) => SubBasis (SymmetricTensor s v) -> SubBasis w -> [Scalar (SymmetricTensor s v)] -> (SymmetricTensor s v w, [Scalar (SymmetricTensor s v)]) Source #

recomposeLinMap :: (LSpace w, Scalar w ~ Scalar (SymmetricTensor s v)) => SubBasis (SymmetricTensor s v) -> [w] -> (SymmetricTensor s v +> w, [w]) Source #

recomposeContraLinMap :: (LinearSpace w, Scalar w ~ Scalar (SymmetricTensor s v), Functor f) => (f (Scalar w) -> w) -> f (DualVector (SymmetricTensor s v)) -> SymmetricTensor s v +> w Source #

recomposeContraLinMapTensor :: (FiniteDimensional u, LinearSpace w, Scalar u ~ Scalar (SymmetricTensor s v), Scalar w ~ Scalar (SymmetricTensor s v), Functor f) => (f (Scalar w) -> w) -> f (SymmetricTensor s v +> DualVector u) -> (SymmetricTensor s v u) +> w Source #

uncanonicallyFromDual :: DualVector (SymmetricTensor s v) -+> SymmetricTensor s v Source #

uncanonicallyToDual :: SymmetricTensor s v -+> DualVector (SymmetricTensor s v) Source #

(Num' s, SemiInner v, Scalar v ~ s) => SemiInner (SymmetricTensor s v) Source # 
Instance details

Defined in Math.VectorSpace.Docile

type Scalar (SymmetricTensor s v) Source # 
Instance details

Defined in Math.LinearMap.Category.Instances

type Scalar (SymmetricTensor s v) = s
type Diff (SymmetricTensor s v) Source # 
Instance details

Defined in Math.LinearMap.Category.Instances

type Interior (SymmetricTensor s v) Source # 
Instance details

Defined in Math.LinearMap.Category.Instances

type Needle (SymmetricTensor s v) Source # 
Instance details

Defined in Math.LinearMap.Category.Instances

type DualVector (SymmetricTensor s v) Source # 
Instance details

Defined in Math.LinearMap.Category.Instances

newtype SubBasis (SymmetricTensor s v) Source # 
Instance details

Defined in Math.VectorSpace.Docile

type TensorProduct (SymmetricTensor s v) x Source # 
Instance details

Defined in Math.LinearMap.Category.Instances

type TensorProduct (SymmetricTensor s v) x = Tensor s v (Tensor s v x)

squareV :: (Num' s, s ~ Scalar v) => TensorSpace v => v -> SymmetricTensor s v Source #

squareVs :: (Num' s, s ~ Scalar v) => TensorSpace v => [v] -> SymmetricTensor s v Source #

currySymBilin :: LinearSpace v => (v ⊗〃+> w) -+> (v +> (v +> w)) Source #

Norms

A norm is a way to quantify the magnitude/length of different vectors, even if they point in different directions.

In an InnerSpace, a norm is always given by the scalar product, but there are spaces without a canonical scalar product (or situations in which this scalar product does not give the metric you want). Hence, we let the functions like constructEigenSystem, which depend on a norm for orthonormalisation, accept a Norm as an extra argument instead of requiring InnerSpace.

newtype Norm v Source #

A positive (semi)definite symmetric bilinear form. This gives rise to a norm thus:

  Norm n |$| v = √(n v <.>^ v)
  

Strictly speaking, this type is neither strong enough nor general enough to deserve the name Norm: it includes proper Seminorms (i.e. m|$|v ≡ 0 does not guarantee v == zeroV), but not actual norms such as the ℓ₁-norm on ℝⁿ (Taxcab norm) or the supremum norm. However, 𝐿₂-like norms are the only ones that can really be formulated without any basis reference; and guaranteeing positive definiteness through the type system is scarcely practical.

Constructors

Norm 

Fields

Instances
(SimpleSpace v, Show (DualVector v)) => Show (Norm v) Source # 
Instance details

Defined in Math.LinearMap.Category

Methods

showsPrec :: Int -> Norm v -> ShowS #

show :: Norm v -> String #

showList :: [Norm v] -> ShowS #

LSpace v => Semigroup (Norm v) Source #
(m<>n|$|v)^2 ⩵ (m|$|v)^2 + (n|$|v)^2
Instance details

Defined in Math.LinearMap.Category

Methods

(<>) :: Norm v -> Norm v -> Norm v #

sconcat :: NonEmpty (Norm v) -> Norm v #

stimes :: Integral b => b -> Norm v -> Norm v #

LSpace v => Monoid (Seminorm v) Source #
mempty|$|v ≡ 0
Instance details

Defined in Math.LinearMap.Category

Methods

mempty :: Seminorm v #

mappend :: Seminorm v -> Seminorm v -> Seminorm v #

mconcat :: [Seminorm v] -> Seminorm v #

type Seminorm v = Norm v Source #

A “norm” that may explicitly be degenerate, with m|$|v ⩵ 0 for some v ≠ zeroV.

spanNorm :: forall v. LSpace v => [DualVector v] -> Seminorm v Source #

A seminorm defined by

‖v‖ = √(∑ᵢ ⟨dᵢ|v⟩²)

for some dual vectors dᵢ. If given a complete basis of the dual space, this generates a proper Norm.

If the dᵢ are a complete orthonormal system, you get the euclideanNorm (in an inefficient form).

euclideanNorm :: HilbertSpace v => Norm v Source #

The canonical standard norm (2-norm) on inner-product / Hilbert spaces.

(|$|) :: (LSpace v, Floating (Scalar v)) => Seminorm v -> v -> Scalar v infixr 0 Source #

Use a Norm to measure the length / norm of a vector.

euclideanNorm |$| v  ≡  √(v <.> v)

normSq :: LSpace v => Seminorm v -> v -> Scalar v Source #

The squared norm. More efficient than |$| because that needs to take the square root.

(<$|) :: LSpace v => Norm v -> v -> DualVector v infixr 0 Source #

“Partially apply” a norm, yielding a dual vector (i.e. a linear form that accepts the second argument of the scalar product).

(euclideanNorm <$| v) <.>^ w  ≡  v <.> w

See also |&>.

scaleNorm :: forall v. LSpace v => Scalar v -> Norm v -> Norm v Source #

Scale the result of a norm with the absolute of the given number.

scaleNorm μ n |$| v = abs μ * (n|$|v)

Equivalently, this scales the norm's unit ball by the reciprocal of that factor.

Variances

type Variance v = Norm (DualVector v) Source #

A multidimensional variance of points v with some distribution can be considered a norm on the dual space, quantifying for a dual vector dv the expectation value of (dv.^v)^2.

spanVariance :: forall v. LSpace v => [v] -> Variance v Source #

(|&>) :: LSpace v => DualVector v -> Variance v -> v infixl 1 Source #

Flipped, “ket” version of <$|.

v <.>^ (w |&> euclideanNorm)  ≡  v <.> w

varianceSpanningSystem :: forall v. SimpleSpace v => Variance v -> [v] Source #

Inverse of spanVariance. Equivalent to normSpanningSystem on the dual space.

dualNorm :: SimpleSpace v => Norm v -> Variance v Source #

A proper norm induces a norm on the dual space – the “reciprocal norm”. (The orthonormal systems of the norm and its dual are mutually conjugate.) The dual norm of a seminorm is undefined.

dualNorm' :: forall v. SimpleSpace v => Variance v -> Norm v Source #

dualNorm in the opposite direction. This is actually self-inverse; with dualSpaceWitness you can replace each with the other direction.

dependence :: forall u v. (SimpleSpace u, SimpleSpace v, Scalar u ~ Scalar v) => Variance (u, v) -> u +> v Source #

Interpret a variance as a covariance between two subspaces, and normalise it by the variance on u. The result is effectively the linear regression coefficient of a simple regression of the vectors spanning the variance.

Utility

densifyNorm :: forall v. LSpace v => Norm v -> Norm v Source #

spanNorm / spanVariance are inefficient if the number of vectors is similar to the dimension of the space, or even larger than it. Use this function to optimise the underlying operator to a dense matrix representation.

wellDefinedNorm :: forall v. LinearSpace v => Norm v -> Maybe (Norm v) Source #

Like densifyNorm, but also perform a “sanity check” to eliminate NaN etc. problems.

Solving linear equations

(\$) :: forall u v. (SimpleSpace u, SimpleSpace v, Scalar u ~ Scalar v) => (u +> v) -> v -> u infixr 0 Source #

Inverse function application, aka solving of a linear system:

f \$ f $ v  ≡  v

f $ f \$ u  ≡  u

If f does not have full rank, the behaviour is undefined. However, it does not need to be a proper isomorphism: the first of the above equations is still fulfilled if only f is injective (overdetermined system) and the second if it is surjective.

If you want to solve for multiple RHS vectors, be sure to partially apply this operator to the linear map, like

map (f \$) [v₁, v₂, ...]

Since most of the work is actually done in triangularising the operator, this may be much faster than

[f \$ v₁, f \$ v₂, ...]

pseudoInverse :: forall u v. (SimpleSpace u, SimpleSpace v, Scalar u ~ Scalar v) => (u +> v) -> v +> u Source #

roughDet :: (FiniteDimensional v, IEEE (Scalar v)) => (v +> v) -> Scalar v Source #

Approximation of the determinant.

linearRegressionW :: forall s x m y. (LinearSpace x, SimpleSpace y, SimpleSpace m, Scalar x ~ s, Scalar y ~ s, Scalar m ~ s, RealFrac' s) => Norm y -> (x -> m +> y) -> [(x, y)] -> m Source #

Simple wrapper of linearRegression.

linearRegression :: forall s x m y. (LinearSpace x, SimpleSpace y, SimpleSpace m, Scalar x ~ s, Scalar y ~ s, Scalar m ~ s, RealFrac' s) => (x -> m +> y) -> [(x, (y, Norm y))] -> LinearRegressionResult x y m Source #

linearFit_χν² :: LinearRegressionResult x y m -> Scalar m Source #

How well the data uncertainties match the deviations from the model's synthetic data. χν² = 1ν · ∑ δy² σy² Where ν is the number of degrees of freedom (data values minus model parameters), δy = m x - yd is the deviation from given data to the data the model would predict (for each sample point), and σy is the a-priori measurement uncertainty of the data points.

Values χν²>1 indicate that the data could not be described satisfyingly; χν²≪1 suggests overfitting or that the data uncertainties have been postulated too high.

http://adsabs.harvard.edu/abs/1997ieas.book.....T

If the model is exactly determined or even underdetermined (i.e. ν≤0) then χν² is undefined.

linearFit_bestModel :: LinearRegressionResult x y m -> m Source #

The model that best corresponds to the data, in a least-squares sense WRT the supplied norm on the data points. In other words, this is the model that minimises ∑ δy² / σy².

Eigenvalue problems

eigen :: (FiniteDimensional v, HilbertSpace v, IEEE (Scalar v)) => (v +> v) -> [(Scalar v, v)] Source #

Simple automatic finding of the eigenvalues and -vectors of a Hermitian operator, in reasonable approximation.

This works by spanning a QR-stabilised Krylov basis with constructEigenSystem until it is complete (roughEigenSystem), and then properly decoupling the system with finishEigenSystem (based on two iterations of shifted Givens rotations).

This function is a tradeoff in performance vs. accuracy. Use constructEigenSystem and finishEigenSystem directly for more quickly computing a (perhaps incomplete) approximation, or for more precise results.

constructEigenSystem Source #

Arguments

:: (LSpace v, RealFloat (Scalar v)) 
=> Norm v

The notion of orthonormality.

-> Scalar v

Error bound for deviations from eigen-ness.

-> (v -+> v)

Operator to calculate the eigensystem of. Must be Hermitian WRT the scalar product defined by the given metric.

-> [v]

Starting vector(s) for the power method.

-> [[Eigenvector v]]

Infinite sequence of ever more accurate approximations to the eigensystem of the operator.

Lazily compute the eigenbasis of a linear map. The algorithm is essentially a hybrid of Lanczos/Arnoldi style Krylov-spanning and QR-diagonalisation, which we don't do separately but interleave at each step.

The size of the eigen-subbasis increases with each step until the space's dimension is reached. (But the algorithm can also be used for infinite-dimensional spaces.)

roughEigenSystem :: (FiniteDimensional v, IEEE (Scalar v)) => Norm v -> (v +> v) -> [Eigenvector v] Source #

Find a system of vectors that approximate the eigensytem, in the sense that: each true eigenvalue is represented by an approximate one, and that is closer to the true value than all the other approximate EVs.

This function does not make any guarantees as to how well a single eigenvalue is approximated, though.

finishEigenSystem :: forall v. (LSpace v, RealFloat (Scalar v)) => Norm v -> [Eigenvector v] -> [Eigenvector v] Source #

data Eigenvector v Source #

Constructors

Eigenvector 

Fields

Instances
(Show v, Show (Scalar v)) => Show (Eigenvector v) Source # 
Instance details

Defined in Math.LinearMap.Category

The classes of suitable vector spaces

type LSpace v = (LinearSpace v, LinearSpace (Scalar v), LinearSpace (DualVector v), Num' (Scalar v)) Source #

The workhorse of this package: most functions here work on vector spaces that fulfill the LSpace v constraint.

In summary, this is a VectorSpace with an implementation for TensorProduct v w, for any other space w, and with a DualVector space. This fulfills DualVector (DualVector v) ~ v (this constraint is encapsulated in DualSpaceWitness).

To make a new space of yours an LSpace, you must define instances of TensorSpace and LinearSpace. In fact, LSpace is equivalent to LinearSpace, but makes the condition explicit that the scalar and dual vectors also form a linear space. LinearSpace only stores that constraint in dualSpaceWitness (to avoid UndecidableSuperclasses).

class (VectorSpace v, PseudoAffine v) => TensorSpace v where Source #

Associated Types

type TensorProduct v w :: * Source #

The internal representation of a Tensor product.

For Euclidean spaces, this is generally constructed by replacing each s scalar field in the v vector with an entire w vector. I.e., you have then a “nested vector” or, if v is a DualVector / “row vector”, a matrix.

Methods

scalarSpaceWitness :: ScalarSpaceWitness v Source #

linearManifoldWitness :: LinearManifoldWitness v Source #

zeroTensor :: (TensorSpace w, Scalar w ~ Scalar v) => v w Source #

toFlatTensor :: v -+> (v Scalar v) Source #

fromFlatTensor :: (v Scalar v) -+> v Source #

addTensors :: (TensorSpace w, Scalar w ~ Scalar v) => (v w) -> (v w) -> v w Source #

addTensors :: AdditiveGroup (TensorProduct v w) => (v w) -> (v w) -> v w Source #

subtractTensors :: (TensorSpace v, TensorSpace w, Scalar w ~ Scalar v) => (v w) -> (v w) -> v w Source #

subtractTensors :: AdditiveGroup (TensorProduct v w) => (v w) -> (v w) -> v w Source #

scaleTensor :: (TensorSpace w, Scalar w ~ Scalar v) => Bilinear (Scalar v) (v w) (v w) Source #

scaleTensor :: (VectorSpace (TensorProduct v w), Scalar (TensorProduct v w) ~ Scalar v) => Bilinear (Scalar v) (v w) (v w) Source #

negateTensor :: (TensorSpace w, Scalar w ~ Scalar v) => (v w) -+> (v w) Source #

negateTensor :: AdditiveGroup (TensorProduct v w) => (v w) -+> (v w) Source #

tensorProduct :: (TensorSpace w, Scalar w ~ Scalar v) => Bilinear v w (v w) Source #

tensorProducts :: (TensorSpace w, Scalar w ~ Scalar v) => [(v, w)] -> v w Source #

transposeTensor :: (TensorSpace w, Scalar w ~ Scalar v) => (v w) -+> (w v) Source #

fmapTensor :: (TensorSpace w, TensorSpace x, Scalar w ~ Scalar v, Scalar x ~ Scalar v) => Bilinear (w -+> x) (v w) (v x) Source #

fzipTensorWith :: (TensorSpace u, TensorSpace w, TensorSpace x, Scalar u ~ Scalar v, Scalar w ~ Scalar v, Scalar x ~ Scalar v) => Bilinear ((w, x) -+> u) (v w, v x) (v u) Source #

coerceFmapTensorProduct :: Functor p => p v -> Coercion a b -> Coercion (TensorProduct v a) (TensorProduct v b) Source #

wellDefinedVector :: v -> Maybe v Source #

“Sanity-check” a vector. This typically amounts to detecting any NaN components, which should trigger a Nothing result. Otherwise, the result should be Just the input, but may also be optimised / memoised if applicable (i.e. for function spaces).

wellDefinedVector :: Eq v => v -> Maybe v Source #

“Sanity-check” a vector. This typically amounts to detecting any NaN components, which should trigger a Nothing result. Otherwise, the result should be Just the input, but may also be optimised / memoised if applicable (i.e. for function spaces).

wellDefinedTensor :: (TensorSpace w, Scalar w ~ Scalar v) => (v w) -> Maybe (v w) Source #

Instances
TensorSpace Rational Source # 
Instance details

Defined in Math.LinearMap.Category.Instances

Associated Types

type TensorProduct Rational w :: Type Source #

Methods

scalarSpaceWitness :: ScalarSpaceWitness Rational Source #

linearManifoldWitness :: LinearManifoldWitness Rational Source #

zeroTensor :: (TensorSpace w, Scalar w ~ Scalar Rational) => Rational w Source #

toFlatTensor :: Rational -+> (Rational Scalar Rational) Source #

fromFlatTensor :: (Rational Scalar Rational) -+> Rational Source #

addTensors :: (TensorSpace w, Scalar w ~ Scalar Rational) => (Rational w) -> (Rational w) -> Rational w Source #

subtractTensors :: (TensorSpace Rational, TensorSpace w, Scalar w ~ Scalar Rational) => (Rational w) -> (Rational w) -> Rational w Source #

scaleTensor :: (TensorSpace w, Scalar w ~ Scalar Rational) => Bilinear (Scalar Rational) (Rational w) (Rational w) Source #

negateTensor :: (TensorSpace w, Scalar w ~ Scalar Rational) => (Rational w) -+> (Rational w) Source #

tensorProduct :: (TensorSpace w, Scalar w ~ Scalar Rational) => Bilinear Rational w (Rational w) Source #

tensorProducts :: (TensorSpace w, Scalar w ~ Scalar Rational) => [(Rational, w)] -> Rational w Source #

transposeTensor :: (TensorSpace w, Scalar w ~ Scalar Rational) => (Rational w) -+> (w Rational) Source #

fmapTensor :: (TensorSpace w, TensorSpace x, Scalar w ~ Scalar Rational, Scalar x ~ Scalar Rational) => Bilinear (w -+> x) (Rational w) (Rational x) Source #

fzipTensorWith :: (TensorSpace u, TensorSpace w, TensorSpace x, Scalar u ~ Scalar Rational, Scalar w ~ Scalar Rational, Scalar x ~ Scalar Rational) => Bilinear ((w, x) -+> u) (Rational w, Rational x) (Rational u) Source #

coerceFmapTensorProduct :: Functor p => p Rational -> Coercion a b -> Coercion (TensorProduct Rational a) (TensorProduct Rational b) Source #

wellDefinedVector :: Rational -> Maybe Rational Source #

wellDefinedTensor :: (TensorSpace w, Scalar w ~ Scalar Rational) => (Rational w) -> Maybe (Rational w) Source #

(Num' n, Unbox n) => TensorSpace (Sequence n) Source # 
Instance details

Defined in Math.LinearMap.Category.Instances

Associated Types

type TensorProduct (Sequence n) w :: Type Source #

Methods

scalarSpaceWitness :: ScalarSpaceWitness (Sequence n) Source #

linearManifoldWitness :: LinearManifoldWitness (Sequence n) Source #

zeroTensor :: (TensorSpace w, Scalar w ~ Scalar (Sequence n)) => Sequence n w Source #

toFlatTensor :: Sequence n -+> (Sequence n Scalar (Sequence n)) Source #

fromFlatTensor :: (Sequence n Scalar (Sequence n)) -+> Sequence n Source #

addTensors :: (TensorSpace w, Scalar w ~ Scalar (Sequence n)) => (Sequence n w) -> (Sequence n w) -> Sequence n w Source #

subtractTensors :: (TensorSpace (Sequence n), TensorSpace w, Scalar w ~ Scalar (Sequence n)) => (Sequence n w) -> (Sequence n w) -> Sequence n w Source #

scaleTensor :: (TensorSpace w, Scalar w ~ Scalar (Sequence n)) => Bilinear (Scalar (Sequence n)) (Sequence n w) (Sequence n w) Source #

negateTensor :: (TensorSpace w, Scalar w ~ Scalar (Sequence n)) => (Sequence n w) -+> (Sequence n w) Source #

tensorProduct :: (TensorSpace w, Scalar w ~ Scalar (Sequence n)) => Bilinear (Sequence n) w (Sequence n w) Source #

tensorProducts :: (TensorSpace w, Scalar w ~ Scalar (Sequence n)) => [(Sequence n, w)] -> Sequence n w Source #

transposeTensor :: (TensorSpace w, Scalar w ~ Scalar (Sequence n)) => (Sequence n w) -+> (w Sequence n) Source #

fmapTensor :: (TensorSpace w, TensorSpace x, Scalar w ~ Scalar (Sequence n), Scalar x ~ Scalar (Sequence n)) => Bilinear (w -+> x) (Sequence n w) (Sequence n x) Source #

fzipTensorWith :: (TensorSpace u, TensorSpace w, TensorSpace x, Scalar u ~ Scalar (Sequence n), Scalar w ~ Scalar (Sequence n), Scalar x ~ Scalar (Sequence n)) => Bilinear ((w, x) -+> u) (Sequence n w, Sequence n x) (Sequence n u) Source #

coerceFmapTensorProduct :: Functor p => p (Sequence n) -> Coercion a b -> Coercion (TensorProduct (Sequence n) a) (TensorProduct (Sequence n) b) Source #

wellDefinedVector :: Sequence n -> Maybe (Sequence n) Source #

wellDefinedTensor :: (TensorSpace w, Scalar w ~ Scalar (Sequence n)) => (Sequence n w) -> Maybe (Sequence n w) Source #

(Num' n, Unbox n) => TensorSpace (FinSuppSeq n) Source # 
Instance details

Defined in Math.LinearMap.Category.Instances

Associated Types

type TensorProduct (FinSuppSeq n) w :: Type Source #

Methods

scalarSpaceWitness :: ScalarSpaceWitness (FinSuppSeq n) Source #

linearManifoldWitness :: LinearManifoldWitness (FinSuppSeq n) Source #

zeroTensor :: (TensorSpace w, Scalar w ~ Scalar (FinSuppSeq n)) => FinSuppSeq n w Source #

toFlatTensor :: FinSuppSeq n -+> (FinSuppSeq n Scalar (FinSuppSeq n)) Source #

fromFlatTensor :: (FinSuppSeq n Scalar (FinSuppSeq n)) -+> FinSuppSeq n Source #

addTensors :: (TensorSpace w, Scalar w ~ Scalar (FinSuppSeq n)) => (FinSuppSeq n w) -> (FinSuppSeq n w) -> FinSuppSeq n w Source #

subtractTensors :: (TensorSpace (FinSuppSeq n), TensorSpace w, Scalar w ~ Scalar (FinSuppSeq n)) => (FinSuppSeq n w) -> (FinSuppSeq n w) -> FinSuppSeq n w Source #

scaleTensor :: (TensorSpace w, Scalar w ~ Scalar (FinSuppSeq n)) => Bilinear (Scalar (FinSuppSeq n)) (FinSuppSeq n w) (FinSuppSeq n w) Source #

negateTensor :: (TensorSpace w, Scalar w ~ Scalar (FinSuppSeq n)) => (FinSuppSeq n w) -+> (FinSuppSeq n w) Source #

tensorProduct :: (TensorSpace w, Scalar w ~ Scalar (FinSuppSeq n)) => Bilinear (FinSuppSeq n) w (FinSuppSeq n w) Source #

tensorProducts :: (TensorSpace w, Scalar w ~ Scalar (FinSuppSeq n)) => [(FinSuppSeq n, w)] -> FinSuppSeq n w Source #

transposeTensor :: (TensorSpace w, Scalar w ~ Scalar (FinSuppSeq n)) => (FinSuppSeq n w) -+> (w FinSuppSeq n) Source #

fmapTensor :: (TensorSpace w, TensorSpace x, Scalar w ~ Scalar (FinSuppSeq n), Scalar x ~ Scalar (FinSuppSeq n)) => Bilinear (w -+> x) (FinSuppSeq n w) (FinSuppSeq n x) Source #

fzipTensorWith :: (TensorSpace u, TensorSpace w, TensorSpace x, Scalar u ~ Scalar (FinSuppSeq n), Scalar w ~ Scalar (FinSuppSeq n), Scalar x ~ Scalar (FinSuppSeq n)) => Bilinear ((w, x) -+> u) (FinSuppSeq n w, FinSuppSeq n x) (FinSuppSeq n u) Source #

coerceFmapTensorProduct :: Functor p => p (FinSuppSeq n) -> Coercion a b -> Coercion (TensorProduct (FinSuppSeq n) a) (TensorProduct (FinSuppSeq n) b) Source #

wellDefinedVector :: FinSuppSeq n -> Maybe (FinSuppSeq n) Source #

wellDefinedTensor :: (TensorSpace w, Scalar w ~ Scalar (FinSuppSeq n)) => (FinSuppSeq n w) -> Maybe (FinSuppSeq n w) Source #

(Num' s, Eq s) => TensorSpace (V1 s) Source # 
Instance details

Defined in Math.LinearMap.Category.Instances

Associated Types

type TensorProduct (V1 s) w :: Type Source #

Methods

scalarSpaceWitness :: ScalarSpaceWitness (V1 s) Source #

linearManifoldWitness :: LinearManifoldWitness (V1 s) Source #

zeroTensor :: (TensorSpace w, Scalar w ~ Scalar (V1 s)) => V1 s w Source #

toFlatTensor :: V1 s -+> (V1 s Scalar (V1 s)) Source #

fromFlatTensor :: (V1 s Scalar (V1 s)) -+> V1 s Source #

addTensors :: (TensorSpace w, Scalar w ~ Scalar (V1 s)) => (V1 s w) -> (V1 s w) -> V1 s w Source #

subtractTensors :: (TensorSpace (V1 s), TensorSpace w, Scalar w ~ Scalar (V1 s)) => (V1 s w) -> (V1 s w) -> V1 s w Source #

scaleTensor :: (TensorSpace w, Scalar w ~ Scalar (V1 s)) => Bilinear (Scalar (V1 s)) (V1 s w) (V1 s w) Source #

negateTensor :: (TensorSpace w, Scalar w ~ Scalar (V1 s)) => (V1 s w) -+> (V1 s w) Source #

tensorProduct :: (TensorSpace w, Scalar w ~ Scalar (V1 s)) => Bilinear (V1 s) w (V1 s w) Source #

tensorProducts :: (TensorSpace w, Scalar w ~ Scalar (V1 s)) => [(V1 s, w)] -> V1 s w Source #

transposeTensor :: (TensorSpace w, Scalar w ~ Scalar (V1 s)) => (V1 s w) -+> (w V1 s) Source #

fmapTensor :: (TensorSpace w, TensorSpace x, Scalar w ~ Scalar (V1 s), Scalar x ~ Scalar (V1 s)) => Bilinear (w -+> x) (V1 s w) (V1 s x) Source #

fzipTensorWith :: (TensorSpace u, TensorSpace w, TensorSpace x, Scalar u ~ Scalar (V1 s), Scalar w ~ Scalar (V1 s), Scalar x ~ Scalar (V1 s)) => Bilinear ((w, x) -+> u) (V1 s w, V1 s x) (V1 s u) Source #

coerceFmapTensorProduct :: Functor p => p (V1 s) -> Coercion a b -> Coercion (TensorProduct (V1 s) a) (TensorProduct (V1 s) b) Source #

wellDefinedVector :: V1 s -> Maybe (V1 s) Source #

wellDefinedTensor :: (TensorSpace w, Scalar w ~ Scalar (V1 s)) => (V1 s w) -> Maybe (V1 s w) Source #

(Num' s, Eq s) => TensorSpace (V2 s) Source # 
Instance details

Defined in Math.LinearMap.Category.Instances

Associated Types

type TensorProduct (V2 s) w :: Type Source #

Methods

scalarSpaceWitness :: ScalarSpaceWitness (V2 s) Source #

linearManifoldWitness :: LinearManifoldWitness (V2 s) Source #

zeroTensor :: (TensorSpace w, Scalar w ~ Scalar (V2 s)) => V2 s w Source #

toFlatTensor :: V2 s -+> (V2 s Scalar (V2 s)) Source #

fromFlatTensor :: (V2 s Scalar (V2 s)) -+> V2 s Source #

addTensors :: (TensorSpace w, Scalar w ~ Scalar (V2 s)) => (V2 s w) -> (V2 s w) -> V2 s w Source #

subtractTensors :: (TensorSpace (V2 s), TensorSpace w, Scalar w ~ Scalar (V2 s)) => (V2 s w) -> (V2 s w) -> V2 s w Source #

scaleTensor :: (TensorSpace w, Scalar w ~ Scalar (V2 s)) => Bilinear (Scalar (V2 s)) (V2 s w) (V2 s w) Source #

negateTensor :: (TensorSpace w, Scalar w ~ Scalar (V2 s)) => (V2 s w) -+> (V2 s w) Source #

tensorProduct :: (TensorSpace w, Scalar w ~ Scalar (V2 s)) => Bilinear (V2 s) w (V2 s w) Source #

tensorProducts :: (TensorSpace w, Scalar w ~ Scalar (V2 s)) => [(V2 s, w)] -> V2 s w Source #

transposeTensor :: (TensorSpace w, Scalar w ~ Scalar (V2 s)) => (V2 s w) -+> (w V2 s) Source #

fmapTensor :: (TensorSpace w, TensorSpace x, Scalar w ~ Scalar (V2 s), Scalar x ~ Scalar (V2 s)) => Bilinear (w -+> x) (V2 s w) (V2 s x) Source #

fzipTensorWith :: (TensorSpace u, TensorSpace w, TensorSpace x, Scalar u ~ Scalar (V2 s), Scalar w ~ Scalar (V2 s), Scalar x ~ Scalar (V2 s)) => Bilinear ((w, x) -+> u) (V2 s w, V2 s x) (V2 s u) Source #

coerceFmapTensorProduct :: Functor p => p (V2 s) -> Coercion a b -> Coercion (TensorProduct (V2 s) a) (TensorProduct (V2 s) b) Source #

wellDefinedVector :: V2 s -> Maybe (V2 s) Source #

wellDefinedTensor :: (TensorSpace w, Scalar w ~ Scalar (V2 s)) => (V2 s w) -> Maybe (V2 s w) Source #

(Num' s, Eq s) => TensorSpace (V3 s) Source # 
Instance details

Defined in Math.LinearMap.Category.Instances

Associated Types

type TensorProduct (V3 s) w :: Type Source #

Methods

scalarSpaceWitness :: ScalarSpaceWitness (V3 s) Source #

linearManifoldWitness :: LinearManifoldWitness (V3 s) Source #

zeroTensor :: (TensorSpace w, Scalar w ~ Scalar (V3 s)) => V3 s w Source #

toFlatTensor :: V3 s -+> (V3 s Scalar (V3 s)) Source #

fromFlatTensor :: (V3 s Scalar (V3 s)) -+> V3 s Source #

addTensors :: (TensorSpace w, Scalar w ~ Scalar (V3 s)) => (V3 s w) -> (V3 s w) -> V3 s w Source #

subtractTensors :: (TensorSpace (V3 s), TensorSpace w, Scalar w ~ Scalar (V3 s)) => (V3 s w) -> (V3 s w) -> V3 s w Source #

scaleTensor :: (TensorSpace w, Scalar w ~ Scalar (V3 s)) => Bilinear (Scalar (V3 s)) (V3 s w) (V3 s w) Source #

negateTensor :: (TensorSpace w, Scalar w ~ Scalar (V3 s)) => (V3 s w) -+> (V3 s w) Source #

tensorProduct :: (TensorSpace w, Scalar w ~ Scalar (V3 s)) => Bilinear (V3 s) w (V3 s w) Source #

tensorProducts :: (TensorSpace w, Scalar w ~ Scalar (V3 s)) => [(V3 s, w)] -> V3 s w Source #

transposeTensor :: (TensorSpace w, Scalar w ~ Scalar (V3 s)) => (V3 s w) -+> (w V3 s) Source #

fmapTensor :: (TensorSpace w, TensorSpace x, Scalar w ~ Scalar (V3 s), Scalar x ~ Scalar (V3 s)) => Bilinear (w -+> x) (V3 s w) (V3 s x) Source #

fzipTensorWith :: (TensorSpace u, TensorSpace w, TensorSpace x, Scalar u ~ Scalar (V3 s), Scalar w ~ Scalar (V3 s), Scalar x ~ Scalar (V3 s)) => Bilinear ((w, x) -+> u) (V3 s w, V3 s x) (V3 s u) Source #

coerceFmapTensorProduct :: Functor p => p (V3 s) -> Coercion a b -> Coercion (TensorProduct (V3 s) a) (TensorProduct (V3 s) b) Source #

wellDefinedVector :: V3 s -> Maybe (V3 s) Source #

wellDefinedTensor :: (TensorSpace w, Scalar w ~ Scalar (V3 s)) => (V3 s w) -> Maybe (V3 s w) Source #

(Num' s, Eq s) => TensorSpace (V4 s) Source # 
Instance details

Defined in Math.LinearMap.Category.Instances

Associated Types

type TensorProduct (V4 s) w :: Type Source #

Methods

scalarSpaceWitness :: ScalarSpaceWitness (V4 s) Source #

linearManifoldWitness :: LinearManifoldWitness (V4 s) Source #

zeroTensor :: (TensorSpace w, Scalar w ~ Scalar (V4 s)) => V4 s w Source #

toFlatTensor :: V4 s -+> (V4 s Scalar (V4 s)) Source #

fromFlatTensor :: (V4 s Scalar (V4 s)) -+> V4 s Source #

addTensors :: (TensorSpace w, Scalar w ~ Scalar (V4 s)) => (V4 s w) -> (V4 s w) -> V4 s w Source #

subtractTensors :: (TensorSpace (V4 s), TensorSpace w, Scalar w ~ Scalar (V4 s)) => (V4 s w) -> (V4 s w) -> V4 s w Source #

scaleTensor :: (TensorSpace w, Scalar w ~ Scalar (V4 s)) => Bilinear (Scalar (V4 s)) (V4 s w) (V4 s w) Source #

negateTensor :: (TensorSpace w, Scalar w ~ Scalar (V4 s)) => (V4 s w) -+> (V4 s w) Source #

tensorProduct :: (TensorSpace w, Scalar w ~ Scalar (V4 s)) => Bilinear (V4 s) w (V4 s w) Source #

tensorProducts :: (TensorSpace w, Scalar w ~ Scalar (V4 s)) => [(V4 s, w)] -> V4 s w Source #

transposeTensor :: (TensorSpace w, Scalar w ~ Scalar (V4 s)) => (V4 s w) -+> (w V4 s) Source #

fmapTensor :: (TensorSpace w, TensorSpace x, Scalar w ~ Scalar (V4 s), Scalar x ~ Scalar (V4 s)) => Bilinear (w -+> x) (V4 s w) (V4 s x) Source #

fzipTensorWith :: (TensorSpace u, TensorSpace w, TensorSpace x, Scalar u ~ Scalar (V4 s), Scalar w ~ Scalar (V4 s), Scalar x ~ Scalar (V4 s)) => Bilinear ((w, x) -+> u) (V4 s w, V4 s x) (V4 s u) Source #

coerceFmapTensorProduct :: Functor p => p (V4 s) -> Coercion a b -> Coercion (TensorProduct (V4 s) a) (TensorProduct (V4 s) b) Source #

wellDefinedVector :: V4 s -> Maybe (V4 s) Source #

wellDefinedTensor :: (TensorSpace w, Scalar w ~ Scalar (V4 s)) => (V4 s w) -> Maybe (V4 s w) Source #

(Num' s, Eq s) => TensorSpace (V0 s) Source # 
Instance details

Defined in Math.LinearMap.Category.Instances

Associated Types

type TensorProduct (V0 s) w :: Type Source #

Methods

scalarSpaceWitness :: ScalarSpaceWitness (V0 s) Source #

linearManifoldWitness :: LinearManifoldWitness (V0 s) Source #

zeroTensor :: (TensorSpace w, Scalar w ~ Scalar (V0 s)) => V0 s w Source #

toFlatTensor :: V0 s -+> (V0 s Scalar (V0 s)) Source #

fromFlatTensor :: (V0 s Scalar (V0 s)) -+> V0 s Source #

addTensors :: (TensorSpace w, Scalar w ~ Scalar (V0 s)) => (V0 s w) -> (V0 s w) -> V0 s w Source #

subtractTensors :: (TensorSpace (V0 s), TensorSpace w, Scalar w ~ Scalar (V0 s)) => (V0 s w) -> (V0 s w) -> V0 s w Source #

scaleTensor :: (TensorSpace w, Scalar w ~ Scalar (V0 s)) => Bilinear (Scalar (V0 s)) (V0 s w) (V0 s w) Source #

negateTensor :: (TensorSpace w, Scalar w ~ Scalar (V0 s)) => (V0 s w) -+> (V0 s w) Source #

tensorProduct :: (TensorSpace w, Scalar w ~ Scalar (V0 s)) => Bilinear (V0 s) w (V0 s w) Source #

tensorProducts :: (TensorSpace w, Scalar w ~ Scalar (V0 s)) => [(V0 s, w)] -> V0 s w Source #

transposeTensor :: (TensorSpace w, Scalar w ~ Scalar (V0 s)) => (V0 s w) -+> (w V0 s) Source #

fmapTensor :: (TensorSpace w, TensorSpace x, Scalar w ~ Scalar (V0 s), Scalar x ~ Scalar (V0 s)) => Bilinear (w -+> x) (V0 s w) (V0 s x) Source #

fzipTensorWith :: (TensorSpace u, TensorSpace w, TensorSpace x, Scalar u ~ Scalar (V0 s), Scalar w ~ Scalar (V0 s), Scalar x ~ Scalar (V0 s)) => Bilinear ((w, x) -+> u) (V0 s w, V0 s x) (V0 s u) Source #

coerceFmapTensorProduct :: Functor p => p (V0 s) -> Coercion a b -> Coercion (TensorProduct (V0 s) a) (TensorProduct (V0 s) b) Source #

wellDefinedVector :: V0 s -> Maybe (V0 s) Source #

wellDefinedTensor :: (TensorSpace w, Scalar w ~ Scalar (V0 s)) => (V0 s w) -> Maybe (V0 s w) Source #

(Semimanifold m, TensorSpace (Needle (VRep m)), Scalar (Needle m) ~ Scalar (Needle (VRep m))) => TensorSpace (GenericNeedle m) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Associated Types

type TensorProduct (GenericNeedle m) w :: Type Source #

Methods

scalarSpaceWitness :: ScalarSpaceWitness (GenericNeedle m) Source #

linearManifoldWitness :: LinearManifoldWitness (GenericNeedle m) Source #

zeroTensor :: (TensorSpace w, Scalar w ~ Scalar (GenericNeedle m)) => GenericNeedle m w Source #

toFlatTensor :: GenericNeedle m -+> (GenericNeedle m Scalar (GenericNeedle m)) Source #

fromFlatTensor :: (GenericNeedle m Scalar (GenericNeedle m)) -+> GenericNeedle m Source #

addTensors :: (TensorSpace w, Scalar w ~ Scalar (GenericNeedle m)) => (GenericNeedle m w) -> (GenericNeedle m w) -> GenericNeedle m w Source #

subtractTensors :: (TensorSpace (GenericNeedle m), TensorSpace w, Scalar w ~ Scalar (GenericNeedle m)) => (GenericNeedle m w) -> (GenericNeedle m w) -> GenericNeedle m w Source #

scaleTensor :: (TensorSpace w, Scalar w ~ Scalar (GenericNeedle m)) => Bilinear (Scalar (GenericNeedle m)) (GenericNeedle m w) (GenericNeedle m w) Source #

negateTensor :: (TensorSpace w, Scalar w ~ Scalar (GenericNeedle m)) => (GenericNeedle m w) -+> (GenericNeedle m w) Source #

tensorProduct :: (TensorSpace w, Scalar w ~ Scalar (GenericNeedle m)) => Bilinear (GenericNeedle m) w (GenericNeedle m w) Source #

tensorProducts :: (TensorSpace w, Scalar w ~ Scalar (GenericNeedle m)) => [(GenericNeedle m, w)] -> GenericNeedle m w Source #

transposeTensor :: (TensorSpace w, Scalar w ~ Scalar (GenericNeedle m)) => (GenericNeedle m w) -+> (w GenericNeedle m) Source #

fmapTensor :: (TensorSpace w, TensorSpace x, Scalar w ~ Scalar (GenericNeedle m), Scalar x ~ Scalar (GenericNeedle m)) => Bilinear (w -+> x) (GenericNeedle m w) (GenericNeedle m x) Source #

fzipTensorWith :: (TensorSpace u, TensorSpace w, TensorSpace x, Scalar u ~ Scalar (GenericNeedle m), Scalar w ~ Scalar (GenericNeedle m), Scalar x ~ Scalar (GenericNeedle m)) => Bilinear ((w, x) -+> u) (GenericNeedle m w, GenericNeedle m x) (GenericNeedle m u) Source #

coerceFmapTensorProduct :: Functor p => p (GenericNeedle m) -> Coercion a b -> Coercion (TensorProduct (GenericNeedle m) a) (TensorProduct (GenericNeedle m) b) Source #

wellDefinedVector :: GenericNeedle m -> Maybe (GenericNeedle m) Source #

wellDefinedTensor :: (TensorSpace w, Scalar w ~ Scalar (GenericNeedle m)) => (GenericNeedle m w) -> Maybe (GenericNeedle m w) Source #

Num' s => TensorSpace (ZeroDim s) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Associated Types

type TensorProduct (ZeroDim s) w :: Type Source #

Methods

scalarSpaceWitness :: ScalarSpaceWitness (ZeroDim s) Source #

linearManifoldWitness :: LinearManifoldWitness (ZeroDim s) Source #

zeroTensor :: (TensorSpace w, Scalar w ~ Scalar (ZeroDim s)) => ZeroDim s w Source #

toFlatTensor :: ZeroDim s -+> (ZeroDim s Scalar (ZeroDim s)) Source #

fromFlatTensor :: (ZeroDim s Scalar (ZeroDim s)) -+> ZeroDim s Source #

addTensors :: (TensorSpace w, Scalar w ~ Scalar (ZeroDim s)) => (ZeroDim s w) -> (ZeroDim s w) -> ZeroDim s w Source #

subtractTensors :: (TensorSpace (ZeroDim s), TensorSpace w, Scalar w ~ Scalar (ZeroDim s)) => (ZeroDim s w) -> (ZeroDim s w) -> ZeroDim s w Source #

scaleTensor :: (TensorSpace w, Scalar w ~ Scalar (ZeroDim s)) => Bilinear (Scalar (ZeroDim s)) (ZeroDim s w) (ZeroDim s w) Source #

negateTensor :: (TensorSpace w, Scalar w ~ Scalar (ZeroDim s)) => (ZeroDim s w) -+> (ZeroDim s w) Source #

tensorProduct :: (TensorSpace w, Scalar w ~ Scalar (ZeroDim s)) => Bilinear (ZeroDim s) w (ZeroDim s w) Source #

tensorProducts :: (TensorSpace w, Scalar w ~ Scalar (ZeroDim s)) => [(ZeroDim s, w)] -> ZeroDim s w Source #

transposeTensor :: (TensorSpace w, Scalar w ~ Scalar (ZeroDim s)) => (ZeroDim s w) -+> (w ZeroDim s) Source #

fmapTensor :: (TensorSpace w, TensorSpace x, Scalar w ~ Scalar (ZeroDim s), Scalar x ~ Scalar (ZeroDim s)) => Bilinear (w -+> x) (ZeroDim s w) (ZeroDim s x) Source #

fzipTensorWith :: (TensorSpace u, TensorSpace w, TensorSpace x, Scalar u ~ Scalar (ZeroDim s), Scalar w ~ Scalar (ZeroDim s), Scalar x ~ Scalar (ZeroDim s)) => Bilinear ((w, x) -+> u) (ZeroDim s w, ZeroDim s x) (ZeroDim s u) Source #

coerceFmapTensorProduct :: Functor p => p (ZeroDim s) -> Coercion a b -> Coercion (TensorProduct (ZeroDim s) a) (TensorProduct (ZeroDim s) b) Source #

wellDefinedVector :: ZeroDim s -> Maybe (ZeroDim s) Source #

wellDefinedTensor :: (TensorSpace w, Scalar w ~ Scalar (ZeroDim s)) => (ZeroDim s w) -> Maybe (ZeroDim s w) Source #

(TensorSpace u, TensorSpace v, Scalar u ~ Scalar v) => TensorSpace (u, v) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Associated Types

type TensorProduct (u, v) w :: Type Source #

Methods

scalarSpaceWitness :: ScalarSpaceWitness (u, v) Source #

linearManifoldWitness :: LinearManifoldWitness (u, v) Source #

zeroTensor :: (TensorSpace w, Scalar w ~ Scalar (u, v)) => (u, v) w Source #

toFlatTensor :: (u, v) -+> ((u, v) Scalar (u, v)) Source #

fromFlatTensor :: ((u, v) Scalar (u, v)) -+> (u, v) Source #

addTensors :: (TensorSpace w, Scalar w ~ Scalar (u, v)) => ((u, v) w) -> ((u, v) w) -> (u, v) w Source #

subtractTensors :: (TensorSpace (u, v), TensorSpace w, Scalar w ~ Scalar (u, v)) => ((u, v) w) -> ((u, v) w) -> (u, v) w Source #

scaleTensor :: (TensorSpace w, Scalar w ~ Scalar (u, v)) => Bilinear (Scalar (u, v)) ((u, v) w) ((u, v) w) Source #

negateTensor :: (TensorSpace w, Scalar w ~ Scalar (u, v)) => ((u, v) w) -+> ((u, v) w) Source #

tensorProduct :: (TensorSpace w, Scalar w ~ Scalar (u, v)) => Bilinear (u, v) w ((u, v) w) Source #

tensorProducts :: (TensorSpace w, Scalar w ~ Scalar (u, v)) => [((u, v), w)] -> (u, v) w Source #

transposeTensor :: (TensorSpace w, Scalar w ~ Scalar (u, v)) => ((u, v) w) -+> (w (u, v)) Source #

fmapTensor :: (TensorSpace w, TensorSpace x, Scalar w ~ Scalar (u, v), Scalar x ~ Scalar (u, v)) => Bilinear (w -+> x) ((u, v) w) ((u, v) x) Source #

fzipTensorWith :: (TensorSpace u0, TensorSpace w, TensorSpace x, Scalar u0 ~ Scalar (u, v), Scalar w ~ Scalar (u, v), Scalar x ~ Scalar (u, v)) => Bilinear ((w, x) -+> u0) ((u, v) w, (u, v) x) ((u, v) u0) Source #

coerceFmapTensorProduct :: Functor p => p (u, v) -> Coercion a b -> Coercion (TensorProduct (u, v) a) (TensorProduct (u, v) b) Source #

wellDefinedVector :: (u, v) -> Maybe (u, v) Source #

wellDefinedTensor :: (TensorSpace w, Scalar w ~ Scalar (u, v)) => ((u, v) w) -> Maybe ((u, v) w) Source #

(Num' s, TensorSpace v, Scalar v ~ s) => TensorSpace (SymmetricTensor s v) Source # 
Instance details

Defined in Math.LinearMap.Category.Instances

Associated Types

type TensorProduct (SymmetricTensor s v) w :: Type Source #

Methods

scalarSpaceWitness :: ScalarSpaceWitness (SymmetricTensor s v) Source #

linearManifoldWitness :: LinearManifoldWitness (SymmetricTensor s v) Source #

zeroTensor :: (TensorSpace w, Scalar w ~ Scalar (SymmetricTensor s v)) => SymmetricTensor s v w Source #

toFlatTensor :: SymmetricTensor s v -+> (SymmetricTensor s v Scalar (SymmetricTensor s v)) Source #

fromFlatTensor :: (SymmetricTensor s v Scalar (SymmetricTensor s v)) -+> SymmetricTensor s v Source #

addTensors :: (TensorSpace w, Scalar w ~ Scalar (SymmetricTensor s v)) => (SymmetricTensor s v w) -> (SymmetricTensor s v w) -> SymmetricTensor s v w Source #

subtractTensors :: (TensorSpace (SymmetricTensor s v), TensorSpace w, Scalar w ~ Scalar (SymmetricTensor s v)) => (SymmetricTensor s v w) -> (SymmetricTensor s v w) -> SymmetricTensor s v w Source #

scaleTensor :: (TensorSpace w, Scalar w ~ Scalar (SymmetricTensor s v)) => Bilinear (Scalar (SymmetricTensor s v)) (SymmetricTensor s v w) (SymmetricTensor s v w) Source #

negateTensor :: (TensorSpace w, Scalar w ~ Scalar (SymmetricTensor s v)) => (SymmetricTensor s v w) -+> (SymmetricTensor s v w) Source #

tensorProduct :: (TensorSpace w, Scalar w ~ Scalar (SymmetricTensor s v)) => Bilinear (SymmetricTensor s v) w (SymmetricTensor s v w) Source #

tensorProducts :: (TensorSpace w, Scalar w ~ Scalar (SymmetricTensor s v)) => [(SymmetricTensor s v, w)] -> SymmetricTensor s v w Source #

transposeTensor :: (TensorSpace w, Scalar w ~ Scalar (SymmetricTensor s v)) => (SymmetricTensor s v w) -+> (w SymmetricTensor s v) Source #

fmapTensor :: (TensorSpace w, TensorSpace x, Scalar w ~ Scalar (SymmetricTensor s v), Scalar x ~ Scalar (SymmetricTensor s v)) => Bilinear (w -+> x) (SymmetricTensor s v w) (SymmetricTensor s v x) Source #

fzipTensorWith :: (TensorSpace u, TensorSpace w, TensorSpace x, Scalar u ~ Scalar (SymmetricTensor s v), Scalar w ~ Scalar (SymmetricTensor s v), Scalar x ~ Scalar (SymmetricTensor s v)) => Bilinear ((w, x) -+> u) (SymmetricTensor s v w, SymmetricTensor s v x) (SymmetricTensor s v u) Source #

coerceFmapTensorProduct :: Functor p => p (SymmetricTensor s v) -> Coercion a b -> Coercion (TensorProduct (SymmetricTensor s v) a) (TensorProduct (SymmetricTensor s v) b) Source #

wellDefinedVector :: SymmetricTensor s v -> Maybe (SymmetricTensor s v) Source #

wellDefinedTensor :: (TensorSpace w, Scalar w ~ Scalar (SymmetricTensor s v)) => (SymmetricTensor s v w) -> Maybe (SymmetricTensor s v w) Source #

TensorSpace v => TensorSpace (Rec0 v s) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Associated Types

type TensorProduct (Rec0 v s) w :: Type Source #

Methods

scalarSpaceWitness :: ScalarSpaceWitness (Rec0 v s) Source #

linearManifoldWitness :: LinearManifoldWitness (Rec0 v s) Source #

zeroTensor :: (TensorSpace w, Scalar w ~ Scalar (Rec0 v s)) => Rec0 v s w Source #

toFlatTensor :: Rec0 v s -+> (Rec0 v s Scalar (Rec0 v s)) Source #

fromFlatTensor :: (Rec0 v s Scalar (Rec0 v s)) -+> Rec0 v s Source #

addTensors :: (TensorSpace w, Scalar w ~ Scalar (Rec0 v s)) => (Rec0 v s w) -> (Rec0 v s w) -> Rec0 v s w Source #

subtractTensors :: (TensorSpace (Rec0 v s), TensorSpace w, Scalar w ~ Scalar (Rec0 v s)) => (Rec0 v s w) -> (Rec0 v s w) -> Rec0 v s w Source #

scaleTensor :: (TensorSpace w, Scalar w ~ Scalar (Rec0 v s)) => Bilinear (Scalar (Rec0 v s)) (Rec0 v s w) (Rec0 v s w) Source #

negateTensor :: (TensorSpace w, Scalar w ~ Scalar (Rec0 v s)) => (Rec0 v s w) -+> (Rec0 v s w) Source #

tensorProduct :: (TensorSpace w, Scalar w ~ Scalar (Rec0 v s)) => Bilinear (Rec0 v s) w (Rec0 v s w) Source #

tensorProducts :: (TensorSpace w, Scalar w ~ Scalar (Rec0 v s)) => [(Rec0 v s, w)] -> Rec0 v s w Source #

transposeTensor :: (TensorSpace w, Scalar w ~ Scalar (Rec0 v s)) => (Rec0 v s w) -+> (w Rec0 v s) Source #

fmapTensor :: (TensorSpace w, TensorSpace x, Scalar w ~ Scalar (Rec0 v s), Scalar x ~ Scalar (Rec0 v s)) => Bilinear (w -+> x) (Rec0 v s w) (Rec0 v s x) Source #

fzipTensorWith :: (TensorSpace u, TensorSpace w, TensorSpace x, Scalar u ~ Scalar (Rec0 v s), Scalar w ~ Scalar (Rec0 v s), Scalar x ~ Scalar (Rec0 v s)) => Bilinear ((w, x) -+> u) (Rec0 v s w, Rec0 v s x) (Rec0 v s u) Source #

coerceFmapTensorProduct :: Functor p => p (Rec0 v s) -> Coercion a b -> Coercion (TensorProduct (Rec0 v s) a) (TensorProduct (Rec0 v s) b) Source #

wellDefinedVector :: Rec0 v s -> Maybe (Rec0 v s) Source #

wellDefinedTensor :: (TensorSpace w, Scalar w ~ Scalar (Rec0 v s)) => (Rec0 v s w) -> Maybe (Rec0 v s w) Source #

(LinearSpace u, LinearSpace v, Scalar u ~ s, Scalar v ~ s) => TensorSpace (LinearFunction s u v) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Associated Types

type TensorProduct (LinearFunction s u v) w :: Type Source #

Methods

scalarSpaceWitness :: ScalarSpaceWitness (LinearFunction s u v) Source #

linearManifoldWitness :: LinearManifoldWitness (LinearFunction s u v) Source #

zeroTensor :: (TensorSpace w, Scalar w ~ Scalar (LinearFunction s u v)) => LinearFunction s u v w Source #

toFlatTensor :: LinearFunction s u v -+> (LinearFunction s u v Scalar (LinearFunction s u v)) Source #

fromFlatTensor :: (LinearFunction s u v Scalar (LinearFunction s u v)) -+> LinearFunction s u v Source #

addTensors :: (TensorSpace w, Scalar w ~ Scalar (LinearFunction s u v)) => (LinearFunction s u v w) -> (LinearFunction s u v w) -> LinearFunction s u v w Source #

subtractTensors :: (TensorSpace (LinearFunction s u v), TensorSpace w, Scalar w ~ Scalar (LinearFunction s u v)) => (LinearFunction s u v w) -> (LinearFunction s u v w) -> LinearFunction s u v w Source #

scaleTensor :: (TensorSpace w, Scalar w ~ Scalar (LinearFunction s u v)) => Bilinear (Scalar (LinearFunction s u v)) (LinearFunction s u v w) (LinearFunction s u v w) Source #

negateTensor :: (TensorSpace w, Scalar w ~ Scalar (LinearFunction s u v)) => (LinearFunction s u v w) -+> (LinearFunction s u v w) Source #

tensorProduct :: (TensorSpace w, Scalar w ~ Scalar (LinearFunction s u v)) => Bilinear (LinearFunction s u v) w (LinearFunction s u v w) Source #

tensorProducts :: (TensorSpace w, Scalar w ~ Scalar (LinearFunction s u v)) => [(LinearFunction s u v, w)] -> LinearFunction s u v w Source #

transposeTensor :: (TensorSpace w, Scalar w ~ Scalar (LinearFunction s u v)) => (LinearFunction s u v w) -+> (w LinearFunction s u v) Source #

fmapTensor :: (TensorSpace w, TensorSpace x, Scalar w ~ Scalar (LinearFunction s u v), Scalar x ~ Scalar (LinearFunction s u v)) => Bilinear (w -+> x) (LinearFunction s u v w) (LinearFunction s u v x) Source #

fzipTensorWith :: (TensorSpace u0, TensorSpace w, TensorSpace x, Scalar u0 ~ Scalar (LinearFunction s u v), Scalar w ~ Scalar (LinearFunction s u v), Scalar x ~ Scalar (LinearFunction s u v)) => Bilinear ((w, x) -+> u0) (LinearFunction s u v w, LinearFunction s u v x) (LinearFunction s u v u0) Source #

coerceFmapTensorProduct :: Functor p => p (LinearFunction s u v) -> Coercion a b -> Coercion (TensorProduct (LinearFunction s u v) a) (TensorProduct (LinearFunction s u v) b) Source #

wellDefinedVector :: LinearFunction s u v -> Maybe (LinearFunction s u v) Source #

wellDefinedTensor :: (TensorSpace w, Scalar w ~ Scalar (LinearFunction s u v)) => (LinearFunction s u v w) -> Maybe (LinearFunction s u v w) Source #

(TensorSpace u, TensorSpace v, Scalar u ~ s, Scalar v ~ s) => TensorSpace (Tensor s u v) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Associated Types

type TensorProduct (Tensor s u v) w :: Type Source #

Methods

scalarSpaceWitness :: ScalarSpaceWitness (Tensor s u v) Source #

linearManifoldWitness :: LinearManifoldWitness (Tensor s u v) Source #

zeroTensor :: (TensorSpace w, Scalar w ~ Scalar (Tensor s u v)) => Tensor s u v w Source #

toFlatTensor :: Tensor s u v -+> (Tensor s u v Scalar (Tensor s u v)) Source #

fromFlatTensor :: (Tensor s u v Scalar (Tensor s u v)) -+> Tensor s u v Source #

addTensors :: (TensorSpace w, Scalar w ~ Scalar (Tensor s u v)) => (Tensor s u v w) -> (Tensor s u v w) -> Tensor s u v w Source #

subtractTensors :: (TensorSpace (Tensor s u v), TensorSpace w, Scalar w ~ Scalar (Tensor s u v)) => (Tensor s u v w) -> (Tensor s u v w) -> Tensor s u v w Source #

scaleTensor :: (TensorSpace w, Scalar w ~ Scalar (Tensor s u v)) => Bilinear (Scalar (Tensor s u v)) (Tensor s u v w) (Tensor s u v w) Source #

negateTensor :: (TensorSpace w, Scalar w ~ Scalar (Tensor s u v)) => (Tensor s u v w) -+> (Tensor s u v w) Source #

tensorProduct :: (TensorSpace w, Scalar w ~ Scalar (Tensor s u v)) => Bilinear (Tensor s u v) w (Tensor s u v w) Source #

tensorProducts :: (TensorSpace w, Scalar w ~ Scalar (Tensor s u v)) => [(Tensor s u v, w)] -> Tensor s u v w Source #

transposeTensor :: (TensorSpace w, Scalar w ~ Scalar (Tensor s u v)) => (Tensor s u v w) -+> (w Tensor s u v) Source #

fmapTensor :: (TensorSpace w, TensorSpace x, Scalar w ~ Scalar (Tensor s u v), Scalar x ~ Scalar (Tensor s u v)) => Bilinear (w -+> x) (Tensor s u v w) (Tensor s u v x) Source #

fzipTensorWith :: (TensorSpace u0, TensorSpace w, TensorSpace x, Scalar u0 ~ Scalar (Tensor s u v), Scalar w ~ Scalar (Tensor s u v), Scalar x ~ Scalar (Tensor s u v)) => Bilinear ((w, x) -+> u0) (Tensor s u v w, Tensor s u v x) (Tensor s u v u0) Source #

coerceFmapTensorProduct :: Functor p => p (Tensor s u v) -> Coercion a b -> Coercion (TensorProduct (Tensor s u v) a) (TensorProduct (Tensor s u v) b) Source #

wellDefinedVector :: Tensor s u v -> Maybe (Tensor s u v) Source #

wellDefinedTensor :: (TensorSpace w, Scalar w ~ Scalar (Tensor s u v)) => (Tensor s u v w) -> Maybe (Tensor s u v w) Source #

(LinearSpace u, TensorSpace v, Scalar u ~ s, Scalar v ~ s) => TensorSpace (LinearMap s u v) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Associated Types

type TensorProduct (LinearMap s u v) w :: Type Source #

Methods

scalarSpaceWitness :: ScalarSpaceWitness (LinearMap s u v) Source #

linearManifoldWitness :: LinearManifoldWitness (LinearMap s u v) Source #

zeroTensor :: (TensorSpace w, Scalar w ~ Scalar (LinearMap s u v)) => LinearMap s u v w Source #

toFlatTensor :: LinearMap s u v -+> (LinearMap s u v Scalar (LinearMap s u v)) Source #

fromFlatTensor :: (LinearMap s u v Scalar (LinearMap s u v)) -+> LinearMap s u v Source #

addTensors :: (TensorSpace w, Scalar w ~ Scalar (LinearMap s u v)) => (LinearMap s u v w) -> (LinearMap s u v w) -> LinearMap s u v w Source #

subtractTensors :: (TensorSpace (LinearMap s u v), TensorSpace w, Scalar w ~ Scalar (LinearMap s u v)) => (LinearMap s u v w) -> (LinearMap s u v w) -> LinearMap s u v w Source #

scaleTensor :: (TensorSpace w, Scalar w ~ Scalar (LinearMap s u v)) => Bilinear (Scalar (LinearMap s u v)) (LinearMap s u v w) (LinearMap s u v w) Source #

negateTensor :: (TensorSpace w, Scalar w ~ Scalar (LinearMap s u v)) => (LinearMap s u v w) -+> (LinearMap s u v w) Source #

tensorProduct :: (TensorSpace w, Scalar w ~ Scalar (LinearMap s u v)) => Bilinear (LinearMap s u v) w (LinearMap s u v w) Source #

tensorProducts :: (TensorSpace w, Scalar w ~ Scalar (LinearMap s u v)) => [(LinearMap s u v, w)] -> LinearMap s u v w Source #

transposeTensor :: (TensorSpace w, Scalar w ~ Scalar (LinearMap s u v)) => (LinearMap s u v w) -+> (w LinearMap s u v) Source #

fmapTensor :: (TensorSpace w, TensorSpace x, Scalar w ~ Scalar (LinearMap s u v), Scalar x ~ Scalar (LinearMap s u v)) => Bilinear (w -+> x) (LinearMap s u v w) (LinearMap s u v x) Source #

fzipTensorWith :: (TensorSpace u0, TensorSpace w, TensorSpace x, Scalar u0 ~ Scalar (LinearMap s u v), Scalar w ~ Scalar (LinearMap s u v), Scalar x ~ Scalar (LinearMap s u v)) => Bilinear ((w, x) -+> u0) (LinearMap s u v w, LinearMap s u v x) (LinearMap s u v u0) Source #

coerceFmapTensorProduct :: Functor p => p (LinearMap s u v) -> Coercion a b -> Coercion (TensorProduct (LinearMap s u v) a) (TensorProduct (LinearMap s u v) b) Source #

wellDefinedVector :: LinearMap s u v -> Maybe (LinearMap s u v) Source #

wellDefinedTensor :: (TensorSpace w, Scalar w ~ Scalar (LinearMap s u v)) => (LinearMap s u v w) -> Maybe (LinearMap s u v w) Source #

(TensorSpace (f p), TensorSpace (g p), Scalar (f p) ~ Scalar (g p)) => TensorSpace ((f :*: g) p) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Associated Types

type TensorProduct ((f :*: g) p) w :: Type Source #

Methods

scalarSpaceWitness :: ScalarSpaceWitness ((f :*: g) p) Source #

linearManifoldWitness :: LinearManifoldWitness ((f :*: g) p) Source #

zeroTensor :: (TensorSpace w, Scalar w ~ Scalar ((f :*: g) p)) => (f :*: g) p w Source #

toFlatTensor :: (f :*: g) p -+> ((f :*: g) p Scalar ((f :*: g) p)) Source #

fromFlatTensor :: ((f :*: g) p Scalar ((f :*: g) p)) -+> (f :*: g) p Source #

addTensors :: (TensorSpace w, Scalar w ~ Scalar ((f :*: g) p)) => ((f :*: g) p w) -> ((f :*: g) p w) -> (f :*: g) p w Source #

subtractTensors :: (TensorSpace ((f :*: g) p), TensorSpace w, Scalar w ~ Scalar ((f :*: g) p)) => ((f :*: g) p w) -> ((f :*: g) p w) -> (f :*: g) p w Source #

scaleTensor :: (TensorSpace w, Scalar w ~ Scalar ((f :*: g) p)) => Bilinear (Scalar ((f :*: g) p)) ((f :*: g) p w) ((f :*: g) p w) Source #

negateTensor :: (TensorSpace w, Scalar w ~ Scalar ((f :*: g) p)) => ((f :*: g) p w) -+> ((f :*: g) p w) Source #

tensorProduct :: (TensorSpace w, Scalar w ~ Scalar ((f :*: g) p)) => Bilinear ((f :*: g) p) w ((f :*: g) p w) Source #

tensorProducts :: (TensorSpace w, Scalar w ~ Scalar ((f :*: g) p)) => [((f :*: g) p, w)] -> (f :*: g) p w Source #

transposeTensor :: (TensorSpace w, Scalar w ~ Scalar ((f :*: g) p)) => ((f :*: g) p w) -+> (w (f :*: g) p) Source #

fmapTensor :: (TensorSpace w, TensorSpace x, Scalar w ~ Scalar ((f :*: g) p), Scalar x ~ Scalar ((f :*: g) p)) => Bilinear (w -+> x) ((f :*: g) p w) ((f :*: g) p x) Source #

fzipTensorWith :: (TensorSpace u, TensorSpace w, TensorSpace x, Scalar u ~ Scalar ((f :*: g) p), Scalar w ~ Scalar ((f :*: g) p), Scalar x ~ Scalar ((f :*: g) p)) => Bilinear ((w, x) -+> u) ((f :*: g) p w, (f :*: g) p x) ((f :*: g) p u) Source #

coerceFmapTensorProduct :: Functor p0 => p0 ((f :*: g) p) -> Coercion a b -> Coercion (TensorProduct ((f :*: g) p) a) (TensorProduct ((f :*: g) p) b) Source #

wellDefinedVector :: (f :*: g) p -> Maybe ((f :*: g) p) Source #

wellDefinedTensor :: (TensorSpace w, Scalar w ~ Scalar ((f :*: g) p)) => ((f :*: g) p w) -> Maybe ((f :*: g) p w) Source #

TensorSpace (f p) => TensorSpace (M1 i c f p) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Associated Types

type TensorProduct (M1 i c f p) w :: Type Source #

Methods

scalarSpaceWitness :: ScalarSpaceWitness (M1 i c f p) Source #

linearManifoldWitness :: LinearManifoldWitness (M1 i c f p) Source #

zeroTensor :: (TensorSpace w, Scalar w ~ Scalar (M1 i c f p)) => M1 i c f p w Source #

toFlatTensor :: M1 i c f p -+> (M1 i c f p Scalar (M1 i c f p)) Source #

fromFlatTensor :: (M1 i c f p Scalar (M1 i c f p)) -+> M1 i c f p Source #

addTensors :: (TensorSpace w, Scalar w ~ Scalar (M1 i c f p)) => (M1 i c f p w) -> (M1 i c f p w) -> M1 i c f p w Source #

subtractTensors :: (TensorSpace (M1 i c f p), TensorSpace w, Scalar w ~ Scalar (M1 i c f p)) => (M1 i c f p w) -> (M1 i c f p w) -> M1 i c f p w Source #

scaleTensor :: (TensorSpace w, Scalar w ~ Scalar (M1 i c f p)) => Bilinear (Scalar (M1 i c f p)) (M1 i c f p w) (M1 i c f p w) Source #

negateTensor :: (TensorSpace w, Scalar w ~ Scalar (M1 i c f p)) => (M1 i c f p w) -+> (M1 i c f p w) Source #

tensorProduct :: (TensorSpace w, Scalar w ~ Scalar (M1 i c f p)) => Bilinear (M1 i c f p) w (M1 i c f p w) Source #

tensorProducts :: (TensorSpace w, Scalar w ~ Scalar (M1 i c f p)) => [(M1 i c f p, w)] -> M1 i c f p w Source #

transposeTensor :: (TensorSpace w, Scalar w ~ Scalar (M1 i c f p)) => (M1 i c f p w) -+> (w M1 i c f p) Source #

fmapTensor :: (TensorSpace w, TensorSpace x, Scalar w ~ Scalar (M1 i c f p), Scalar x ~ Scalar (M1 i c f p)) => Bilinear (w -+> x) (M1 i c f p w) (M1 i c f p x) Source #

fzipTensorWith :: (TensorSpace u, TensorSpace w, TensorSpace x, Scalar u ~ Scalar (M1 i c f p), Scalar w ~ Scalar (M1 i c f p), Scalar x ~ Scalar (M1 i c f p)) => Bilinear ((w, x) -+> u) (M1 i c f p w, M1 i c f p x) (M1 i c f p u) Source #

coerceFmapTensorProduct :: Functor p0 => p0 (M1 i c f p) -> Coercion a b -> Coercion (TensorProduct (M1 i c f p) a) (TensorProduct (M1 i c f p) b) Source #

wellDefinedVector :: M1 i c f p -> Maybe (M1 i c f p) Source #

wellDefinedTensor :: (TensorSpace w, Scalar w ~ Scalar (M1 i c f p)) => (M1 i c f p w) -> Maybe (M1 i c f p w) Source #

class (TensorSpace v, Num (Scalar v)) => LinearSpace v where Source #

The class of vector spaces v for which LinearMap s v w is well-implemented.

Associated Types

type DualVector v :: * Source #

Suitable representation of a linear map from the space v to its field.

For the usual euclidean spaces, you can just define DualVector v = v. (In this case, a dual vector will be just a “row vector” if you consider v-vectors as “column vectors”. LinearMap will then effectively have a matrix layout.)

Instances
LinearSpace Rational Source # 
Instance details

Defined in Math.LinearMap.Category.Instances

Associated Types

type DualVector Rational :: Type Source #

Methods

dualSpaceWitness :: DualSpaceWitness Rational Source #

linearId :: Rational +> Rational Source #

idTensor :: Rational DualVector Rational Source #

sampleLinearFunction :: (TensorSpace w, Scalar Rational ~ Scalar w) => (Rational -+> w) -+> (Rational +> w) Source #

toLinearForm :: DualVector Rational -+> (Rational +> Scalar Rational) Source #

fromLinearForm :: (Rational +> Scalar Rational) -+> DualVector Rational Source #

coerceDoubleDual :: Coercion Rational (DualVector (DualVector Rational)) Source #

trace :: (Rational +> Rational) -+> Scalar Rational Source #

contractTensorMap :: (TensorSpace w, Scalar w ~ Scalar Rational) => (Rational +> (Rational w)) -+> w Source #

contractMapTensor :: (TensorSpace w, Scalar w ~ Scalar Rational) => (Rational (Rational +> w)) -+> w Source #

contractTensorFn :: (TensorSpace w, Scalar w ~ Scalar Rational) => (Rational -+> (Rational w)) -+> w Source #

contractLinearMapAgainst :: (LinearSpace w, Scalar w ~ Scalar Rational) => Bilinear (Rational +> w) (w -+> Rational) (Scalar Rational) Source #

applyDualVector :: Bilinear (DualVector Rational) Rational (Scalar Rational) Source #

applyLinear :: (TensorSpace w, Scalar w ~ Scalar Rational) => Bilinear (Rational +> w) Rational w Source #

composeLinear :: (LinearSpace w, TensorSpace x, Scalar w ~ Scalar Rational, Scalar x ~ Scalar Rational) => Bilinear (w +> x) (Rational +> w) (Rational +> x) Source #

tensorId :: (LinearSpace w, Scalar w ~ Scalar Rational) => (Rational w) +> (Rational w) Source #

applyTensorFunctional :: (LinearSpace u, Scalar u ~ Scalar Rational) => Bilinear (DualVector (Rational u)) (Rational u) (Scalar Rational) Source #

applyTensorLinMap :: (LinearSpace u, TensorSpace w, Scalar u ~ Scalar Rational, Scalar w ~ Scalar Rational) => Bilinear ((Rational u) +> w) (Rational u) w Source #

(Num' n, Unbox n) => LinearSpace (Sequence n) Source # 
Instance details

Defined in Math.LinearMap.Category.Instances

Associated Types

type DualVector (Sequence n) :: Type Source #

Methods

dualSpaceWitness :: DualSpaceWitness (Sequence n) Source #

linearId :: Sequence n +> Sequence n Source #

idTensor :: Sequence n DualVector (Sequence n) Source #

sampleLinearFunction :: (TensorSpace w, Scalar (Sequence n) ~ Scalar w) => (Sequence n -+> w) -+> (Sequence n +> w) Source #

toLinearForm :: DualVector (Sequence n) -+> (Sequence n +> Scalar (Sequence n)) Source #

fromLinearForm :: (Sequence n +> Scalar (Sequence n)) -+> DualVector (Sequence n) Source #

coerceDoubleDual :: Coercion (Sequence n) (DualVector (DualVector (Sequence n))) Source #

trace :: (Sequence n +> Sequence n) -+> Scalar (Sequence n) Source #

contractTensorMap :: (TensorSpace w, Scalar w ~ Scalar (Sequence n)) => (Sequence n +> (Sequence n w)) -+> w Source #

contractMapTensor :: (TensorSpace w, Scalar w ~ Scalar (Sequence n)) => (Sequence n (Sequence n +> w)) -+> w Source #

contractTensorFn :: (TensorSpace w, Scalar w ~ Scalar (Sequence n)) => (Sequence n -+> (Sequence n w)) -+> w Source #

contractLinearMapAgainst :: (LinearSpace w, Scalar w ~ Scalar (Sequence n)) => Bilinear (Sequence n +> w) (w -+> Sequence n) (Scalar (Sequence n)) Source #

applyDualVector :: Bilinear (DualVector (Sequence n)) (Sequence n) (Scalar (Sequence n)) Source #

applyLinear :: (TensorSpace w, Scalar w ~ Scalar (Sequence n)) => Bilinear (Sequence n +> w) (Sequence n) w Source #

composeLinear :: (LinearSpace w, TensorSpace x, Scalar w ~ Scalar (Sequence n), Scalar x ~ Scalar (Sequence n)) => Bilinear (w +> x) (Sequence n +> w) (Sequence n +> x) Source #

tensorId :: (LinearSpace w, Scalar w ~ Scalar (Sequence n)) => (Sequence n w) +> (Sequence n w) Source #

applyTensorFunctional :: (LinearSpace u, Scalar u ~ Scalar (Sequence n)) => Bilinear (DualVector (Sequence n u)) (Sequence n u) (Scalar (Sequence n)) Source #

applyTensorLinMap :: (LinearSpace u, TensorSpace w, Scalar u ~ Scalar (Sequence n), Scalar w ~ Scalar (Sequence n)) => Bilinear ((Sequence n u) +> w) (Sequence n u) w Source #

(Num' n, Unbox n) => LinearSpace (FinSuppSeq n) Source # 
Instance details

Defined in Math.LinearMap.Category.Instances

Associated Types

type DualVector (FinSuppSeq n) :: Type Source #

Methods

dualSpaceWitness :: DualSpaceWitness (FinSuppSeq n) Source #

linearId :: FinSuppSeq n +> FinSuppSeq n Source #

idTensor :: FinSuppSeq n DualVector (FinSuppSeq n) Source #

sampleLinearFunction :: (TensorSpace w, Scalar (FinSuppSeq n) ~ Scalar w) => (FinSuppSeq n -+> w) -+> (FinSuppSeq n +> w) Source #

toLinearForm :: DualVector (FinSuppSeq n) -+> (FinSuppSeq n +> Scalar (FinSuppSeq n)) Source #

fromLinearForm :: (FinSuppSeq n +> Scalar (FinSuppSeq n)) -+> DualVector (FinSuppSeq n) Source #

coerceDoubleDual :: Coercion (FinSuppSeq n) (DualVector (DualVector (FinSuppSeq n))) Source #

trace :: (FinSuppSeq n +> FinSuppSeq n) -+> Scalar (FinSuppSeq n) Source #

contractTensorMap :: (TensorSpace w, Scalar w ~ Scalar (FinSuppSeq n)) => (FinSuppSeq n +> (FinSuppSeq n w)) -+> w Source #

contractMapTensor :: (TensorSpace w, Scalar w ~ Scalar (FinSuppSeq n)) => (FinSuppSeq n (FinSuppSeq n +> w)) -+> w Source #

contractTensorFn :: (TensorSpace w, Scalar w ~ Scalar (FinSuppSeq n)) => (FinSuppSeq n -+> (FinSuppSeq n w)) -+> w Source #

contractLinearMapAgainst :: (LinearSpace w, Scalar w ~ Scalar (FinSuppSeq n)) => Bilinear (FinSuppSeq n +> w) (w -+> FinSuppSeq n) (Scalar (FinSuppSeq n)) Source #

applyDualVector :: Bilinear (DualVector (FinSuppSeq n)) (FinSuppSeq n) (Scalar (FinSuppSeq n)) Source #

applyLinear :: (TensorSpace w, Scalar w ~ Scalar (FinSuppSeq n)) => Bilinear (FinSuppSeq n +> w) (FinSuppSeq n) w Source #

composeLinear :: (LinearSpace w, TensorSpace x, Scalar w ~ Scalar (FinSuppSeq n), Scalar x ~ Scalar (FinSuppSeq n)) => Bilinear (w +> x) (FinSuppSeq n +> w) (FinSuppSeq n +> x) Source #

tensorId :: (LinearSpace w, Scalar w ~ Scalar (FinSuppSeq n)) => (FinSuppSeq n w) +> (FinSuppSeq n w) Source #

applyTensorFunctional :: (LinearSpace u, Scalar u ~ Scalar (FinSuppSeq n)) => Bilinear (DualVector (FinSuppSeq n u)) (FinSuppSeq n u) (Scalar (FinSuppSeq n)) Source #

applyTensorLinMap :: (LinearSpace u, TensorSpace w, Scalar u ~ Scalar (FinSuppSeq n), Scalar w ~ Scalar (FinSuppSeq n)) => Bilinear ((FinSuppSeq n u) +> w) (FinSuppSeq n u) w Source #

(Num' s, Eq s) => LinearSpace (V1 s) Source # 
Instance details

Defined in Math.LinearMap.Category.Instances

Associated Types

type DualVector (V1 s) :: Type Source #

Methods

dualSpaceWitness :: DualSpaceWitness (V1 s) Source #

linearId :: V1 s +> V1 s Source #

idTensor :: V1 s DualVector (V1 s) Source #

sampleLinearFunction :: (TensorSpace w, Scalar (V1 s) ~ Scalar w) => (V1 s -+> w) -+> (V1 s +> w) Source #

toLinearForm :: DualVector (V1 s) -+> (V1 s +> Scalar (V1 s)) Source #

fromLinearForm :: (V1 s +> Scalar (V1 s)) -+> DualVector (V1 s) Source #

coerceDoubleDual :: Coercion (V1 s) (DualVector (DualVector (V1 s))) Source #

trace :: (V1 s +> V1 s) -+> Scalar (V1 s) Source #

contractTensorMap :: (TensorSpace w, Scalar w ~ Scalar (V1 s)) => (V1 s +> (V1 s w)) -+> w Source #

contractMapTensor :: (TensorSpace w, Scalar w ~ Scalar (V1 s)) => (V1 s (V1 s +> w)) -+> w Source #

contractTensorFn :: (TensorSpace w, Scalar w ~ Scalar (V1 s)) => (V1 s -+> (V1 s w)) -+> w Source #

contractLinearMapAgainst :: (LinearSpace w, Scalar w ~ Scalar (V1 s)) => Bilinear (V1 s +> w) (w -+> V1 s) (Scalar (V1 s)) Source #

applyDualVector :: Bilinear (DualVector (V1 s)) (V1 s) (Scalar (V1 s)) Source #

applyLinear :: (TensorSpace w, Scalar w ~ Scalar (V1 s)) => Bilinear (V1 s +> w) (V1 s) w Source #

composeLinear :: (LinearSpace w, TensorSpace x, Scalar w ~ Scalar (V1 s), Scalar x ~ Scalar (V1 s)) => Bilinear (w +> x) (V1 s +> w) (V1 s +> x) Source #

tensorId :: (LinearSpace w, Scalar w ~ Scalar (V1 s)) => (V1 s w) +> (V1 s w) Source #

applyTensorFunctional :: (LinearSpace u, Scalar u ~ Scalar (V1 s)) => Bilinear (DualVector (V1 s u)) (V1 s u) (Scalar (V1 s)) Source #

applyTensorLinMap :: (LinearSpace u, TensorSpace w, Scalar u ~ Scalar (V1 s), Scalar w ~ Scalar (V1 s)) => Bilinear ((V1 s u) +> w) (V1 s u) w Source #

(Num' s, Eq s) => LinearSpace (V2 s) Source # 
Instance details

Defined in Math.LinearMap.Category.Instances

Associated Types

type DualVector (V2 s) :: Type Source #

Methods

dualSpaceWitness :: DualSpaceWitness (V2 s) Source #

linearId :: V2 s +> V2 s Source #

idTensor :: V2 s DualVector (V2 s) Source #

sampleLinearFunction :: (TensorSpace w, Scalar (V2 s) ~ Scalar w) => (V2 s -+> w) -+> (V2 s +> w) Source #

toLinearForm :: DualVector (V2 s) -+> (V2 s +> Scalar (V2 s)) Source #

fromLinearForm :: (V2 s +> Scalar (V2 s)) -+> DualVector (V2 s) Source #

coerceDoubleDual :: Coercion (V2 s) (DualVector (DualVector (V2 s))) Source #

trace :: (V2 s +> V2 s) -+> Scalar (V2 s) Source #

contractTensorMap :: (TensorSpace w, Scalar w ~ Scalar (V2 s)) => (V2 s +> (V2 s w)) -+> w Source #

contractMapTensor :: (TensorSpace w, Scalar w ~ Scalar (V2 s)) => (V2 s (V2 s +> w)) -+> w Source #

contractTensorFn :: (TensorSpace w, Scalar w ~ Scalar (V2 s)) => (V2 s -+> (V2 s w)) -+> w Source #

contractLinearMapAgainst :: (LinearSpace w, Scalar w ~ Scalar (V2 s)) => Bilinear (V2 s +> w) (w -+> V2 s) (Scalar (V2 s)) Source #

applyDualVector :: Bilinear (DualVector (V2 s)) (V2 s) (Scalar (V2 s)) Source #

applyLinear :: (TensorSpace w, Scalar w ~ Scalar (V2 s)) => Bilinear (V2 s +> w) (V2 s) w Source #

composeLinear :: (LinearSpace w, TensorSpace x, Scalar w ~ Scalar (V2 s), Scalar x ~ Scalar (V2 s)) => Bilinear (w +> x) (V2 s +> w) (V2 s +> x) Source #

tensorId :: (LinearSpace w, Scalar w ~ Scalar (V2 s)) => (V2 s w) +> (V2 s w) Source #

applyTensorFunctional :: (LinearSpace u, Scalar u ~ Scalar (V2 s)) => Bilinear (DualVector (V2 s u)) (V2 s u) (Scalar (V2 s)) Source #

applyTensorLinMap :: (LinearSpace u, TensorSpace w, Scalar u ~ Scalar (V2 s), Scalar w ~ Scalar (V2 s)) => Bilinear ((V2 s u) +> w) (V2 s u) w Source #

(Num' s, Eq s) => LinearSpace (V3 s) Source # 
Instance details

Defined in Math.LinearMap.Category.Instances

Associated Types

type DualVector (V3 s) :: Type Source #

Methods

dualSpaceWitness :: DualSpaceWitness (V3 s) Source #

linearId :: V3 s +> V3 s Source #

idTensor :: V3 s DualVector (V3 s) Source #

sampleLinearFunction :: (TensorSpace w, Scalar (V3 s) ~ Scalar w) => (V3 s -+> w) -+> (V3 s +> w) Source #

toLinearForm :: DualVector (V3 s) -+> (V3 s +> Scalar (V3 s)) Source #

fromLinearForm :: (V3 s +> Scalar (V3 s)) -+> DualVector (V3 s) Source #

coerceDoubleDual :: Coercion (V3 s) (DualVector (DualVector (V3 s))) Source #

trace :: (V3 s +> V3 s) -+> Scalar (V3 s) Source #

contractTensorMap :: (TensorSpace w, Scalar w ~ Scalar (V3 s)) => (V3 s +> (V3 s w)) -+> w Source #

contractMapTensor :: (TensorSpace w, Scalar w ~ Scalar (V3 s)) => (V3 s (V3 s +> w)) -+> w Source #

contractTensorFn :: (TensorSpace w, Scalar w ~ Scalar (V3 s)) => (V3 s -+> (V3 s w)) -+> w Source #

contractLinearMapAgainst :: (LinearSpace w, Scalar w ~ Scalar (V3 s)) => Bilinear (V3 s +> w) (w -+> V3 s) (Scalar (V3 s)) Source #

applyDualVector :: Bilinear (DualVector (V3 s)) (V3 s) (Scalar (V3 s)) Source #

applyLinear :: (TensorSpace w, Scalar w ~ Scalar (V3 s)) => Bilinear (V3 s +> w) (V3 s) w Source #

composeLinear :: (LinearSpace w, TensorSpace x, Scalar w ~ Scalar (V3 s), Scalar x ~ Scalar (V3 s)) => Bilinear (w +> x) (V3 s +> w) (V3 s +> x) Source #

tensorId :: (LinearSpace w, Scalar w ~ Scalar (V3 s)) => (V3 s w) +> (V3 s w) Source #

applyTensorFunctional :: (LinearSpace u, Scalar u ~ Scalar (V3 s)) => Bilinear (DualVector (V3 s u)) (V3 s u) (Scalar (V3 s)) Source #

applyTensorLinMap :: (LinearSpace u, TensorSpace w, Scalar u ~ Scalar (V3 s), Scalar w ~ Scalar (V3 s)) => Bilinear ((V3 s u) +> w) (V3 s u) w Source #

(Num' s, Eq s) => LinearSpace (V4 s) Source # 
Instance details

Defined in Math.LinearMap.Category.Instances

Associated Types

type DualVector (V4 s) :: Type Source #

Methods

dualSpaceWitness :: DualSpaceWitness (V4 s) Source #

linearId :: V4 s +> V4 s Source #

idTensor :: V4 s DualVector (V4 s) Source #

sampleLinearFunction :: (TensorSpace w, Scalar (V4 s) ~ Scalar w) => (V4 s -+> w) -+> (V4 s +> w) Source #

toLinearForm :: DualVector (V4 s) -+> (V4 s +> Scalar (V4 s)) Source #

fromLinearForm :: (V4 s +> Scalar (V4 s)) -+> DualVector (V4 s) Source #

coerceDoubleDual :: Coercion (V4 s) (DualVector (DualVector (V4 s))) Source #

trace :: (V4 s +> V4 s) -+> Scalar (V4 s) Source #

contractTensorMap :: (TensorSpace w, Scalar w ~ Scalar (V4 s)) => (V4 s +> (V4 s w)) -+> w Source #

contractMapTensor :: (TensorSpace w, Scalar w ~ Scalar (V4 s)) => (V4 s (V4 s +> w)) -+> w Source #

contractTensorFn :: (TensorSpace w, Scalar w ~ Scalar (V4 s)) => (V4 s -+> (V4 s w)) -+> w Source #

contractLinearMapAgainst :: (LinearSpace w, Scalar w ~ Scalar (V4 s)) => Bilinear (V4 s +> w) (w -+> V4 s) (Scalar (V4 s)) Source #

applyDualVector :: Bilinear (DualVector (V4 s)) (V4 s) (Scalar (V4 s)) Source #

applyLinear :: (TensorSpace w, Scalar w ~ Scalar (V4 s)) => Bilinear (V4 s +> w) (V4 s) w Source #

composeLinear :: (LinearSpace w, TensorSpace x, Scalar w ~ Scalar (V4 s), Scalar x ~ Scalar (V4 s)) => Bilinear (w +> x) (V4 s +> w) (V4 s +> x) Source #

tensorId :: (LinearSpace w, Scalar w ~ Scalar (V4 s)) => (V4 s w) +> (V4 s w) Source #

applyTensorFunctional :: (LinearSpace u, Scalar u ~ Scalar (V4 s)) => Bilinear (DualVector (V4 s u)) (V4 s u) (Scalar (V4 s)) Source #

applyTensorLinMap :: (LinearSpace u, TensorSpace w, Scalar u ~ Scalar (V4 s), Scalar w ~ Scalar (V4 s)) => Bilinear ((V4 s u) +> w) (V4 s u) w Source #

(Num' s, Eq s) => LinearSpace (V0 s) Source # 
Instance details

Defined in Math.LinearMap.Category.Instances

Associated Types

type DualVector (V0 s) :: Type Source #

Methods

dualSpaceWitness :: DualSpaceWitness (V0 s) Source #

linearId :: V0 s +> V0 s Source #

idTensor :: V0 s DualVector (V0 s) Source #

sampleLinearFunction :: (TensorSpace w, Scalar (V0 s) ~ Scalar w) => (V0 s -+> w) -+> (V0 s +> w) Source #

toLinearForm :: DualVector (V0 s) -+> (V0 s +> Scalar (V0 s)) Source #

fromLinearForm :: (V0 s +> Scalar (V0 s)) -+> DualVector (V0 s) Source #

coerceDoubleDual :: Coercion (V0 s) (DualVector (DualVector (V0 s))) Source #

trace :: (V0 s +> V0 s) -+> Scalar (V0 s) Source #

contractTensorMap :: (TensorSpace w, Scalar w ~ Scalar (V0 s)) => (V0 s +> (V0 s w)) -+> w Source #

contractMapTensor :: (TensorSpace w, Scalar w ~ Scalar (V0 s)) => (V0 s (V0 s +> w)) -+> w Source #

contractTensorFn :: (TensorSpace w, Scalar w ~ Scalar (V0 s)) => (V0 s -+> (V0 s w)) -+> w Source #

contractLinearMapAgainst :: (LinearSpace w, Scalar w ~ Scalar (V0 s)) => Bilinear (V0 s +> w) (w -+> V0 s) (Scalar (V0 s)) Source #

applyDualVector :: Bilinear (DualVector (V0 s)) (V0 s) (Scalar (V0 s)) Source #

applyLinear :: (TensorSpace w, Scalar w ~ Scalar (V0 s)) => Bilinear (V0 s +> w) (V0 s) w Source #

composeLinear :: (LinearSpace w, TensorSpace x, Scalar w ~ Scalar (V0 s), Scalar x ~ Scalar (V0 s)) => Bilinear (w +> x) (V0 s +> w) (V0 s +> x) Source #

tensorId :: (LinearSpace w, Scalar w ~ Scalar (V0 s)) => (V0 s w) +> (V0 s w) Source #

applyTensorFunctional :: (LinearSpace u, Scalar u ~ Scalar (V0 s)) => Bilinear (DualVector (V0 s u)) (V0 s u) (Scalar (V0 s)) Source #

applyTensorLinMap :: (LinearSpace u, TensorSpace w, Scalar u ~ Scalar (V0 s), Scalar w ~ Scalar (V0 s)) => Bilinear ((V0 s u) +> w) (V0 s u) w Source #

(Num' s, Semimanifold m, LinearSpace (Needle (VRep m)), Scalar (Needle m) ~ s, Scalar (Needle (VRep m)) ~ s) => LinearSpace (GenericNeedle m) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Associated Types

type DualVector (GenericNeedle m) :: Type Source #

Methods

dualSpaceWitness :: DualSpaceWitness (GenericNeedle m) Source #

linearId :: GenericNeedle m +> GenericNeedle m Source #

idTensor :: GenericNeedle m DualVector (GenericNeedle m) Source #

sampleLinearFunction :: (TensorSpace w, Scalar (GenericNeedle m) ~ Scalar w) => (GenericNeedle m -+> w) -+> (GenericNeedle m +> w) Source #

toLinearForm :: DualVector (GenericNeedle m) -+> (GenericNeedle m +> Scalar (GenericNeedle m)) Source #

fromLinearForm :: (GenericNeedle m +> Scalar (GenericNeedle m)) -+> DualVector (GenericNeedle m) Source #

coerceDoubleDual :: Coercion (GenericNeedle m) (DualVector (DualVector (GenericNeedle m))) Source #

trace :: (GenericNeedle m +> GenericNeedle m) -+> Scalar (GenericNeedle m) Source #

contractTensorMap :: (TensorSpace w, Scalar w ~ Scalar (GenericNeedle m)) => (GenericNeedle m +> (GenericNeedle m w)) -+> w Source #

contractMapTensor :: (TensorSpace w, Scalar w ~ Scalar (GenericNeedle m)) => (GenericNeedle m (GenericNeedle m +> w)) -+> w Source #

contractTensorFn :: (TensorSpace w, Scalar w ~ Scalar (GenericNeedle m)) => (GenericNeedle m -+> (GenericNeedle m w)) -+> w Source #

contractLinearMapAgainst :: (LinearSpace w, Scalar w ~ Scalar (GenericNeedle m)) => Bilinear (GenericNeedle m +> w) (w -+> GenericNeedle m) (Scalar (GenericNeedle m)) Source #

applyDualVector :: Bilinear (DualVector (GenericNeedle m)) (GenericNeedle m) (Scalar (GenericNeedle m)) Source #

applyLinear :: (TensorSpace w, Scalar w ~ Scalar (GenericNeedle m)) => Bilinear (GenericNeedle m +> w) (GenericNeedle m) w Source #

composeLinear :: (LinearSpace w, TensorSpace x, Scalar w ~ Scalar (GenericNeedle m), Scalar x ~ Scalar (GenericNeedle m)) => Bilinear (w +> x) (GenericNeedle m +> w) (GenericNeedle m +> x) Source #

tensorId :: (LinearSpace w, Scalar w ~ Scalar (GenericNeedle m)) => (GenericNeedle m w) +> (GenericNeedle m w) Source #

applyTensorFunctional :: (LinearSpace u, Scalar u ~ Scalar (GenericNeedle m)) => Bilinear (DualVector (GenericNeedle m u)) (GenericNeedle m u) (Scalar (GenericNeedle m)) Source #

applyTensorLinMap :: (LinearSpace u, TensorSpace w, Scalar u ~ Scalar (GenericNeedle m), Scalar w ~ Scalar (GenericNeedle m)) => Bilinear ((GenericNeedle m u) +> w) (GenericNeedle m u) w Source #

Num' s => LinearSpace (ZeroDim s) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Associated Types

type DualVector (ZeroDim s) :: Type Source #

Methods

dualSpaceWitness :: DualSpaceWitness (ZeroDim s) Source #

linearId :: ZeroDim s +> ZeroDim s Source #

idTensor :: ZeroDim s DualVector (ZeroDim s) Source #

sampleLinearFunction :: (TensorSpace w, Scalar (ZeroDim s) ~ Scalar w) => (ZeroDim s -+> w) -+> (ZeroDim s +> w) Source #

toLinearForm :: DualVector (ZeroDim s) -+> (ZeroDim s +> Scalar (ZeroDim s)) Source #

fromLinearForm :: (ZeroDim s +> Scalar (ZeroDim s)) -+> DualVector (ZeroDim s) Source #

coerceDoubleDual :: Coercion (ZeroDim s) (DualVector (DualVector (ZeroDim s))) Source #

trace :: (ZeroDim s +> ZeroDim s) -+> Scalar (ZeroDim s) Source #

contractTensorMap :: (TensorSpace w, Scalar w ~ Scalar (ZeroDim s)) => (ZeroDim s +> (ZeroDim s w)) -+> w Source #

contractMapTensor :: (TensorSpace w, Scalar w ~ Scalar (ZeroDim s)) => (ZeroDim s (ZeroDim s +> w)) -+> w Source #

contractTensorFn :: (TensorSpace w, Scalar w ~ Scalar (ZeroDim s)) => (ZeroDim s -+> (ZeroDim s w)) -+> w Source #

contractLinearMapAgainst :: (LinearSpace w, Scalar w ~ Scalar (ZeroDim s)) => Bilinear (ZeroDim s +> w) (w -+> ZeroDim s) (Scalar (ZeroDim s)) Source #

applyDualVector :: Bilinear (DualVector (ZeroDim s)) (ZeroDim s) (Scalar (ZeroDim s)) Source #

applyLinear :: (TensorSpace w, Scalar w ~ Scalar (ZeroDim s)) => Bilinear (ZeroDim s +> w) (ZeroDim s) w Source #

composeLinear :: (LinearSpace w, TensorSpace x, Scalar w ~ Scalar (ZeroDim s), Scalar x ~ Scalar (ZeroDim s)) => Bilinear (w +> x) (ZeroDim s +> w) (ZeroDim s +> x) Source #

tensorId :: (LinearSpace w, Scalar w ~ Scalar (ZeroDim s)) => (ZeroDim s w) +> (ZeroDim s w) Source #

applyTensorFunctional :: (LinearSpace u, Scalar u ~ Scalar (ZeroDim s)) => Bilinear (DualVector (ZeroDim s u)) (ZeroDim s u) (Scalar (ZeroDim s)) Source #

applyTensorLinMap :: (LinearSpace u, TensorSpace w, Scalar u ~ Scalar (ZeroDim s), Scalar w ~ Scalar (ZeroDim s)) => Bilinear ((ZeroDim s u) +> w) (ZeroDim s u) w Source #

(LinearSpace u, LinearSpace v, Scalar u ~ Scalar v) => LinearSpace (u, v) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Associated Types

type DualVector (u, v) :: Type Source #

Methods

dualSpaceWitness :: DualSpaceWitness (u, v) Source #

linearId :: (u, v) +> (u, v) Source #

idTensor :: (u, v) DualVector (u, v) Source #

sampleLinearFunction :: (TensorSpace w, Scalar (u, v) ~ Scalar w) => ((u, v) -+> w) -+> ((u, v) +> w) Source #

toLinearForm :: DualVector (u, v) -+> ((u, v) +> Scalar (u, v)) Source #

fromLinearForm :: ((u, v) +> Scalar (u, v)) -+> DualVector (u, v) Source #

coerceDoubleDual :: Coercion (u, v) (DualVector (DualVector (u, v))) Source #

trace :: ((u, v) +> (u, v)) -+> Scalar (u, v) Source #

contractTensorMap :: (TensorSpace w, Scalar w ~ Scalar (u, v)) => ((u, v) +> ((u, v) w)) -+> w Source #

contractMapTensor :: (TensorSpace w, Scalar w ~ Scalar (u, v)) => ((u, v) ((u, v) +> w)) -+> w Source #

contractTensorFn :: (TensorSpace w, Scalar w ~ Scalar (u, v)) => ((u, v) -+> ((u, v) w)) -+> w Source #

contractLinearMapAgainst :: (LinearSpace w, Scalar w ~ Scalar (u, v)) => Bilinear ((u, v) +> w) (w -+> (u, v)) (Scalar (u, v)) Source #

applyDualVector :: Bilinear (DualVector (u, v)) (u, v) (Scalar (u, v)) Source #

applyLinear :: (TensorSpace w, Scalar w ~ Scalar (u, v)) => Bilinear ((u, v) +> w) (u, v) w Source #

composeLinear :: (LinearSpace w, TensorSpace x, Scalar w ~ Scalar (u, v), Scalar x ~ Scalar (u, v)) => Bilinear (w +> x) ((u, v) +> w) ((u, v) +> x) Source #

tensorId :: (LinearSpace w, Scalar w ~ Scalar (u, v)) => ((u, v) w) +> ((u, v) w) Source #

applyTensorFunctional :: (LinearSpace u0, Scalar u0 ~ Scalar (u, v)) => Bilinear (DualVector ((u, v) u0)) ((u, v) u0) (Scalar (u, v)) Source #

applyTensorLinMap :: (LinearSpace u0, TensorSpace w, Scalar u0 ~ Scalar (u, v), Scalar w ~ Scalar (u, v)) => Bilinear (((u, v) u0) +> w) ((u, v) u0) w Source #

(Num' s, LinearSpace v, Scalar v ~ s) => LinearSpace (SymmetricTensor s v) Source # 
Instance details

Defined in Math.LinearMap.Category.Instances

Associated Types

type DualVector (SymmetricTensor s v) :: Type Source #

Methods

dualSpaceWitness :: DualSpaceWitness (SymmetricTensor s v) Source #

linearId :: SymmetricTensor s v +> SymmetricTensor s v Source #

idTensor :: SymmetricTensor s v DualVector (SymmetricTensor s v) Source #

sampleLinearFunction :: (TensorSpace w, Scalar (SymmetricTensor s v) ~ Scalar w) => (SymmetricTensor s v -+> w) -+> (SymmetricTensor s v +> w) Source #

toLinearForm :: DualVector (SymmetricTensor s v) -+> (SymmetricTensor s v +> Scalar (SymmetricTensor s v)) Source #

fromLinearForm :: (SymmetricTensor s v +> Scalar (SymmetricTensor s v)) -+> DualVector (SymmetricTensor s v) Source #

coerceDoubleDual :: Coercion (SymmetricTensor s v) (DualVector (DualVector (SymmetricTensor s v))) Source #

trace :: (SymmetricTensor s v +> SymmetricTensor s v) -+> Scalar (SymmetricTensor s v) Source #

contractTensorMap :: (TensorSpace w, Scalar w ~ Scalar (SymmetricTensor s v)) => (SymmetricTensor s v +> (SymmetricTensor s v w)) -+> w Source #

contractMapTensor :: (TensorSpace w, Scalar w ~ Scalar (SymmetricTensor s v)) => (SymmetricTensor s v (SymmetricTensor s v +> w)) -+> w Source #

contractTensorFn :: (TensorSpace w, Scalar w ~ Scalar (SymmetricTensor s v)) => (SymmetricTensor s v -+> (SymmetricTensor s v w)) -+> w Source #

contractLinearMapAgainst :: (LinearSpace w, Scalar w ~ Scalar (SymmetricTensor s v)) => Bilinear (SymmetricTensor s v +> w) (w -+> SymmetricTensor s v) (Scalar (SymmetricTensor s v)) Source #

applyDualVector :: Bilinear (DualVector (SymmetricTensor s v)) (SymmetricTensor s v) (Scalar (SymmetricTensor s v)) Source #

applyLinear :: (TensorSpace w, Scalar w ~ Scalar (SymmetricTensor s v)) => Bilinear (SymmetricTensor s v +> w) (SymmetricTensor s v) w Source #

composeLinear :: (LinearSpace w, TensorSpace x, Scalar w ~ Scalar (SymmetricTensor s v), Scalar x ~ Scalar (SymmetricTensor s v)) => Bilinear (w +> x) (SymmetricTensor s v +> w) (SymmetricTensor s v +> x) Source #

tensorId :: (LinearSpace w, Scalar w ~ Scalar (SymmetricTensor s v)) => (SymmetricTensor s v w) +> (SymmetricTensor s v w) Source #

applyTensorFunctional :: (LinearSpace u, Scalar u ~ Scalar (SymmetricTensor s v)) => Bilinear (DualVector (SymmetricTensor s v u)) (SymmetricTensor s v u) (Scalar (SymmetricTensor s v)) Source #

applyTensorLinMap :: (LinearSpace u, TensorSpace w, Scalar u ~ Scalar (SymmetricTensor s v), Scalar w ~ Scalar (SymmetricTensor s v)) => Bilinear ((SymmetricTensor s v u) +> w) (SymmetricTensor s v u) w Source #

(LinearSpace v, Num (Scalar v)) => LinearSpace (Rec0 v s) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Associated Types

type DualVector (Rec0 v s) :: Type Source #

Methods

dualSpaceWitness :: DualSpaceWitness (Rec0 v s) Source #

linearId :: Rec0 v s +> Rec0 v s Source #

idTensor :: Rec0 v s DualVector (Rec0 v s) Source #

sampleLinearFunction :: (TensorSpace w, Scalar (Rec0 v s) ~ Scalar w) => (Rec0 v s -+> w) -+> (Rec0 v s +> w) Source #

toLinearForm :: DualVector (Rec0 v s) -+> (Rec0 v s +> Scalar (Rec0 v s)) Source #

fromLinearForm :: (Rec0 v s +> Scalar (Rec0 v s)) -+> DualVector (Rec0 v s) Source #

coerceDoubleDual :: Coercion (Rec0 v s) (DualVector (DualVector (Rec0 v s))) Source #

trace :: (Rec0 v s +> Rec0 v s) -+> Scalar (Rec0 v s) Source #

contractTensorMap :: (TensorSpace w, Scalar w ~ Scalar (Rec0 v s)) => (Rec0 v s +> (Rec0 v s w)) -+> w Source #

contractMapTensor :: (TensorSpace w, Scalar w ~ Scalar (Rec0 v s)) => (Rec0 v s (Rec0 v s +> w)) -+> w Source #

contractTensorFn :: (TensorSpace w, Scalar w ~ Scalar (Rec0 v s)) => (Rec0 v s -+> (Rec0 v s w)) -+> w Source #

contractLinearMapAgainst :: (LinearSpace w, Scalar w ~ Scalar (Rec0 v s)) => Bilinear (Rec0 v s +> w) (w -+> Rec0 v s) (Scalar (Rec0 v s)) Source #

applyDualVector :: Bilinear (DualVector (Rec0 v s)) (Rec0 v s) (Scalar (Rec0 v s)) Source #

applyLinear :: (TensorSpace w, Scalar w ~ Scalar (Rec0 v s)) => Bilinear (Rec0 v s +> w) (Rec0 v s) w Source #

composeLinear :: (LinearSpace w, TensorSpace x, Scalar w ~ Scalar (Rec0 v s), Scalar x ~ Scalar (Rec0 v s)) => Bilinear (w +> x) (Rec0 v s +> w) (Rec0 v s +> x) Source #

tensorId :: (LinearSpace w, Scalar w ~ Scalar (Rec0 v s)) => (Rec0 v s w) +> (Rec0 v s w) Source #

applyTensorFunctional :: (LinearSpace u, Scalar u ~ Scalar (Rec0 v s)) => Bilinear (DualVector (Rec0 v s u)) (Rec0 v s u) (Scalar (Rec0 v s)) Source #

applyTensorLinMap :: (LinearSpace u, TensorSpace w, Scalar u ~ Scalar (Rec0 v s), Scalar w ~ Scalar (Rec0 v s)) => Bilinear ((Rec0 v s u) +> w) (Rec0 v s u) w Source #

(LinearSpace u, LinearSpace v, Scalar u ~ s, Scalar v ~ s) => LinearSpace (LinearFunction s u v) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Associated Types

type DualVector (LinearFunction s u v) :: Type Source #

Methods

dualSpaceWitness :: DualSpaceWitness (LinearFunction s u v) Source #

linearId :: LinearFunction s u v +> LinearFunction s u v Source #

idTensor :: LinearFunction s u v DualVector (LinearFunction s u v) Source #

sampleLinearFunction :: (TensorSpace w, Scalar (LinearFunction s u v) ~ Scalar w) => (LinearFunction s u v -+> w) -+> (LinearFunction s u v +> w) Source #

toLinearForm :: DualVector (LinearFunction s u v) -+> (LinearFunction s u v +> Scalar (LinearFunction s u v)) Source #

fromLinearForm :: (LinearFunction s u v +> Scalar (LinearFunction s u v)) -+> DualVector (LinearFunction s u v) Source #

coerceDoubleDual :: Coercion (LinearFunction s u v) (DualVector (DualVector (LinearFunction s u v))) Source #

trace :: (LinearFunction s u v +> LinearFunction s u v) -+> Scalar (LinearFunction s u v) Source #

contractTensorMap :: (TensorSpace w, Scalar w ~ Scalar (LinearFunction s u v)) => (LinearFunction s u v +> (LinearFunction s u v w)) -+> w Source #

contractMapTensor :: (TensorSpace w, Scalar w ~ Scalar (LinearFunction s u v)) => (LinearFunction s u v (LinearFunction s u v +> w)) -+> w Source #

contractTensorFn :: (TensorSpace w, Scalar w ~ Scalar (LinearFunction s u v)) => (LinearFunction s u v -+> (LinearFunction s u v w)) -+> w Source #

contractLinearMapAgainst :: (LinearSpace w, Scalar w ~ Scalar (LinearFunction s u v)) => Bilinear (LinearFunction s u v +> w) (w -+> LinearFunction s u v) (Scalar (LinearFunction s u v)) Source #

applyDualVector :: Bilinear (DualVector (LinearFunction s u v)) (LinearFunction s u v) (Scalar (LinearFunction s u v)) Source #

applyLinear :: (TensorSpace w, Scalar w ~ Scalar (LinearFunction s u v)) => Bilinear (LinearFunction s u v +> w) (LinearFunction s u v) w Source #

composeLinear :: (LinearSpace w, TensorSpace x, Scalar w ~ Scalar (LinearFunction s u v), Scalar x ~ Scalar (LinearFunction s u v)) => Bilinear (w +> x) (LinearFunction s u v +> w) (LinearFunction s u v +> x) Source #

tensorId :: (LinearSpace w, Scalar w ~ Scalar (LinearFunction s u v)) => (LinearFunction s u v w) +> (LinearFunction s u v w) Source #

applyTensorFunctional :: (LinearSpace u0, Scalar u0 ~ Scalar (LinearFunction s u v)) => Bilinear (DualVector (LinearFunction s u v u0)) (LinearFunction s u v u0) (Scalar (LinearFunction s u v)) Source #

applyTensorLinMap :: (LinearSpace u0, TensorSpace w, Scalar u0 ~ Scalar (LinearFunction s u v), Scalar w ~ Scalar (LinearFunction s u v)) => Bilinear ((LinearFunction s u v u0) +> w) (LinearFunction s u v u0) w Source #

(LinearSpace u, LinearSpace v, Scalar u ~ s, Scalar v ~ s) => LinearSpace (Tensor s u v) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Associated Types

type DualVector (Tensor s u v) :: Type Source #

Methods

dualSpaceWitness :: DualSpaceWitness (Tensor s u v) Source #

linearId :: Tensor s u v +> Tensor s u v Source #

idTensor :: Tensor s u v DualVector (Tensor s u v) Source #

sampleLinearFunction :: (TensorSpace w, Scalar (Tensor s u v) ~ Scalar w) => (Tensor s u v -+> w) -+> (Tensor s u v +> w) Source #

toLinearForm :: DualVector (Tensor s u v) -+> (Tensor s u v +> Scalar (Tensor s u v)) Source #

fromLinearForm :: (Tensor s u v +> Scalar (Tensor s u v)) -+> DualVector (Tensor s u v) Source #

coerceDoubleDual :: Coercion (Tensor s u v) (DualVector (DualVector (Tensor s u v))) Source #

trace :: (Tensor s u v +> Tensor s u v) -+> Scalar (Tensor s u v) Source #

contractTensorMap :: (TensorSpace w, Scalar w ~ Scalar (Tensor s u v)) => (Tensor s u v +> (Tensor s u v w)) -+> w Source #

contractMapTensor :: (TensorSpace w, Scalar w ~ Scalar (Tensor s u v)) => (Tensor s u v (Tensor s u v +> w)) -+> w Source #

contractTensorFn :: (TensorSpace w, Scalar w ~ Scalar (Tensor s u v)) => (Tensor s u v -+> (Tensor s u v w)) -+> w Source #

contractLinearMapAgainst :: (LinearSpace w, Scalar w ~ Scalar (Tensor s u v)) => Bilinear (Tensor s u v +> w) (w -+> Tensor s u v) (Scalar (Tensor s u v)) Source #

applyDualVector :: Bilinear (DualVector (Tensor s u v)) (Tensor s u v) (Scalar (Tensor s u v)) Source #

applyLinear :: (TensorSpace w, Scalar w ~ Scalar (Tensor s u v)) => Bilinear (Tensor s u v +> w) (Tensor s u v) w Source #

composeLinear :: (LinearSpace w, TensorSpace x, Scalar w ~ Scalar (Tensor s u v), Scalar x ~ Scalar (Tensor s u v)) => Bilinear (w +> x) (Tensor s u v +> w) (Tensor s u v +> x) Source #

tensorId :: (LinearSpace w, Scalar w ~ Scalar (Tensor s u v)) => (Tensor s u v w) +> (Tensor s u v w) Source #

applyTensorFunctional :: (LinearSpace u0, Scalar u0 ~ Scalar (Tensor s u v)) => Bilinear (DualVector (Tensor s u v u0)) (Tensor s u v u0) (Scalar (Tensor s u v)) Source #

applyTensorLinMap :: (LinearSpace u0, TensorSpace w, Scalar u0 ~ Scalar (Tensor s u v), Scalar w ~ Scalar (Tensor s u v)) => Bilinear ((Tensor s u v u0) +> w) (Tensor s u v u0) w Source #

(LinearSpace u, LinearSpace v, Scalar u ~ s, Scalar v ~ s) => LinearSpace (LinearMap s u v) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Associated Types

type DualVector (LinearMap s u v) :: Type Source #

Methods

dualSpaceWitness :: DualSpaceWitness (LinearMap s u v) Source #

linearId :: LinearMap s u v +> LinearMap s u v Source #

idTensor :: LinearMap s u v DualVector (LinearMap s u v) Source #

sampleLinearFunction :: (TensorSpace w, Scalar (LinearMap s u v) ~ Scalar w) => (LinearMap s u v -+> w) -+> (LinearMap s u v +> w) Source #

toLinearForm :: DualVector (LinearMap s u v) -+> (LinearMap s u v +> Scalar (LinearMap s u v)) Source #

fromLinearForm :: (LinearMap s u v +> Scalar (LinearMap s u v)) -+> DualVector (LinearMap s u v) Source #

coerceDoubleDual :: Coercion (LinearMap s u v) (DualVector (DualVector (LinearMap s u v))) Source #

trace :: (LinearMap s u v +> LinearMap s u v) -+> Scalar (LinearMap s u v) Source #

contractTensorMap :: (TensorSpace w, Scalar w ~ Scalar (LinearMap s u v)) => (LinearMap s u v +> (LinearMap s u v w)) -+> w Source #

contractMapTensor :: (TensorSpace w, Scalar w ~ Scalar (LinearMap s u v)) => (LinearMap s u v (LinearMap s u v +> w)) -+> w Source #

contractTensorFn :: (TensorSpace w, Scalar w ~ Scalar (LinearMap s u v)) => (LinearMap s u v -+> (LinearMap s u v w)) -+> w Source #

contractLinearMapAgainst :: (LinearSpace w, Scalar w ~ Scalar (LinearMap s u v)) => Bilinear (LinearMap s u v +> w) (w -+> LinearMap s u v) (Scalar (LinearMap s u v)) Source #

applyDualVector :: Bilinear (DualVector (LinearMap s u v)) (LinearMap s u v) (Scalar (LinearMap s u v)) Source #

applyLinear :: (TensorSpace w, Scalar w ~ Scalar (LinearMap s u v)) => Bilinear (LinearMap s u v +> w) (LinearMap s u v) w Source #

composeLinear :: (LinearSpace w, TensorSpace x, Scalar w ~ Scalar (LinearMap s u v), Scalar x ~ Scalar (LinearMap s u v)) => Bilinear (w +> x) (LinearMap s u v +> w) (LinearMap s u v +> x) Source #

tensorId :: (LinearSpace w, Scalar w ~ Scalar (LinearMap s u v)) => (LinearMap s u v w) +> (LinearMap s u v w) Source #

applyTensorFunctional :: (LinearSpace u0, Scalar u0 ~ Scalar (LinearMap s u v)) => Bilinear (DualVector (LinearMap s u v u0)) (LinearMap s u v u0) (Scalar (LinearMap s u v)) Source #

applyTensorLinMap :: (LinearSpace u0, TensorSpace w, Scalar u0 ~ Scalar (LinearMap s u v), Scalar w ~ Scalar (LinearMap s u v)) => Bilinear ((LinearMap s u v u0) +> w) (LinearMap s u v u0) w Source #

(LinearSpace (f p), LinearSpace (g p), Scalar (f p) ~ Scalar (g p)) => LinearSpace ((f :*: g) p) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Associated Types

type DualVector ((f :*: g) p) :: Type Source #

Methods

dualSpaceWitness :: DualSpaceWitness ((f :*: g) p) Source #

linearId :: (f :*: g) p +> (f :*: g) p Source #

idTensor :: (f :*: g) p DualVector ((f :*: g) p) Source #

sampleLinearFunction :: (TensorSpace w, Scalar ((f :*: g) p) ~ Scalar w) => ((f :*: g) p -+> w) -+> ((f :*: g) p +> w) Source #

toLinearForm :: DualVector ((f :*: g) p) -+> ((f :*: g) p +> Scalar ((f :*: g) p)) Source #

fromLinearForm :: ((f :*: g) p +> Scalar ((f :*: g) p)) -+> DualVector ((f :*: g) p) Source #

coerceDoubleDual :: Coercion ((f :*: g) p) (DualVector (DualVector ((f :*: g) p))) Source #

trace :: ((f :*: g) p +> (f :*: g) p) -+> Scalar ((f :*: g) p) Source #

contractTensorMap :: (TensorSpace w, Scalar w ~ Scalar ((f :*: g) p)) => ((f :*: g) p +> ((f :*: g) p w)) -+> w Source #

contractMapTensor :: (TensorSpace w, Scalar w ~ Scalar ((f :*: g) p)) => ((f :*: g) p ((f :*: g) p +> w)) -+> w Source #

contractTensorFn :: (TensorSpace w, Scalar w ~ Scalar ((f :*: g) p)) => ((f :*: g) p -+> ((f :*: g) p w)) -+> w Source #

contractLinearMapAgainst :: (LinearSpace w, Scalar w ~ Scalar ((f :*: g) p)) => Bilinear ((f :*: g) p +> w) (w -+> (f :*: g) p) (Scalar ((f :*: g) p)) Source #

applyDualVector :: Bilinear (DualVector ((f :*: g) p)) ((f :*: g) p) (Scalar ((f :*: g) p)) Source #

applyLinear :: (TensorSpace w, Scalar w ~ Scalar ((f :*: g) p)) => Bilinear ((f :*: g) p +> w) ((f :*: g) p) w Source #

composeLinear :: (LinearSpace w, TensorSpace x, Scalar w ~ Scalar ((f :*: g) p), Scalar x ~ Scalar ((f :*: g) p)) => Bilinear (w +> x) ((f :*: g) p +> w) ((f :*: g) p +> x) Source #

tensorId :: (LinearSpace w, Scalar w ~ Scalar ((f :*: g) p)) => ((f :*: g) p w) +> ((f :*: g) p w) Source #

applyTensorFunctional :: (LinearSpace u, Scalar u ~ Scalar ((f :*: g) p)) => Bilinear (DualVector ((f :*: g) p u)) ((f :*: g) p u) (Scalar ((f :*: g) p)) Source #

applyTensorLinMap :: (LinearSpace u, TensorSpace w, Scalar u ~ Scalar ((f :*: g) p), Scalar w ~ Scalar ((f :*: g) p)) => Bilinear (((f :*: g) p u) +> w) ((f :*: g) p u) w Source #

(LinearSpace (f p), Num (Scalar (f p))) => LinearSpace (M1 i c f p) Source # 
Instance details

Defined in Math.LinearMap.Category.Class

Associated Types

type DualVector (M1 i c f p) :: Type Source #

Methods

dualSpaceWitness :: DualSpaceWitness (M1 i c f p) Source #

linearId :: M1 i c f p +> M1 i c f p Source #

idTensor :: M1 i c f p DualVector (M1 i c f p) Source #

sampleLinearFunction :: (TensorSpace w, Scalar (M1 i c f p) ~ Scalar w) => (M1 i c f p -+> w) -+> (M1 i c f p +> w) Source #

toLinearForm :: DualVector (M1 i c f p) -+> (M1 i c f p +> Scalar (M1 i c f p)) Source #

fromLinearForm :: (M1 i c f p +> Scalar (M1 i c f p)) -+> DualVector (M1 i c f p) Source #

coerceDoubleDual :: Coercion (M1 i c f p) (DualVector (DualVector (M1 i c f p))) Source #

trace :: (M1 i c f p +> M1 i c f p) -+> Scalar (M1 i c f p) Source #

contractTensorMap :: (TensorSpace w, Scalar w ~ Scalar (M1 i c f p)) => (M1 i c f p +> (M1 i c f p w)) -+> w Source #

contractMapTensor :: (TensorSpace w, Scalar w ~ Scalar (M1 i c f p)) => (M1 i c f p (M1 i c f p +> w)) -+> w Source #

contractTensorFn :: (TensorSpace w, Scalar w ~ Scalar (M1 i c f p)) => (M1 i c f p -+> (M1 i c f p w)) -+> w Source #

contractLinearMapAgainst :: (LinearSpace w, Scalar w ~ Scalar (M1 i c f p)) => Bilinear (M1 i c f p +> w) (w -+> M1 i c f p) (Scalar (M1 i c f p)) Source #

applyDualVector :: Bilinear (DualVector (M1 i c f p)) (M1 i c f p) (Scalar (M1 i c f p)) Source #

applyLinear :: (TensorSpace w, Scalar w ~ Scalar (M1 i c f p)) => Bilinear (M1 i c f p +> w) (M1 i c f p) w Source #

composeLinear :: (LinearSpace w, TensorSpace x, Scalar w ~ Scalar (M1 i c f p), Scalar x ~ Scalar (M1 i c f p)) => Bilinear (w +> x) (M1 i c f p +> w) (M1 i c f p +> x) Source #

tensorId :: (LinearSpace w, Scalar w ~ Scalar (M1 i c f p)) => (M1 i c f p w) +> (M1 i c f p w) Source #

applyTensorFunctional :: (LinearSpace u, Scalar u ~ Scalar (M1 i c f p)) => Bilinear (DualVector (M1 i c f p u)) (M1 i c f p u) (Scalar (M1 i c f p)) Source #

applyTensorLinMap :: (LinearSpace u, TensorSpace w, Scalar u ~ Scalar (M1 i c f p), Scalar w ~ Scalar (M1 i c f p)) => Bilinear ((M1 i c f p u) +> w) (M1 i c f p u) w Source #

Orthonormal systems

class LinearSpace v => SemiInner v where Source #

SemiInner is the class of vector spaces with finite subspaces in which you can define a basis that can be used to project from the whole space into the subspace. The usual application is for using a kind of Galerkin method to give an approximate solution (see \$) to a linear equation in a possibly infinite-dimensional space.

Of course, this also works for spaces which are already finite-dimensional themselves.

Methods

dualBasisCandidates :: [(Int, v)] -> Forest (Int, DualVector v) Source #

Lazily enumerate choices of a basis of functionals that can be made dual to the given vectors, in order of preference (which roughly means, large in the normal direction.) I.e., if the vector 𝑣 is assigned early to the dual vector 𝑣', then (𝑣' $ 𝑣) should be large and all the other products comparably small.

The purpose is that we should be able to make this basis orthonormal with a ~Gaussian-elimination approach, in a way that stays numerically stable. This is otherwise known as the choice of a pivot element.

For simple finite-dimensional array-vectors, you can easily define this method using cartesianDualBasisCandidates.

tensorDualBasisCandidates :: (SemiInner w, Scalar w ~ Scalar v) => [(Int, v w)] -> Forest (Int, DualVector (v w)) Source #

symTensorDualBasisCandidates :: [(Int, SymmetricTensor (Scalar v) v)] -> Forest (Int, SymmetricTensor (Scalar v) (DualVector v)) Source #

symTensorTensorDualBasisCandidates :: forall w. (SemiInner w, Scalar w ~ Scalar v) => [(Int, SymmetricTensor (Scalar v) v w)] -> Forest (Int, SymmetricTensor (Scalar v) v +> DualVector w) Source #

Instances
(Fractional' s, Ord s, SemiInner s) => SemiInner (V1 s) Source # 
Instance details

Defined in Math.VectorSpace.Docile

(Fractional' s, SemiInner s) => SemiInner (V0 s) Source # 
Instance details

Defined in Math.VectorSpace.Docile

(Fractional' s, SemiInner s) => SemiInner (ZeroDim s) Source # 
Instance details

Defined in Math.VectorSpace.Docile

(SemiInner u, SemiInner v, Scalar u ~ Scalar v, Num' (Scalar u)) => SemiInner (u, v) Source # 
Instance details

Defined in Math.VectorSpace.Docile

Methods

dualBasisCandidates :: [(Int, (u, v))] -> Forest (Int, DualVector (u, v)) Source #

tensorDualBasisCandidates :: (SemiInner w, Scalar w ~ Scalar (u, v)) => [(Int, (u, v) w)] -> Forest (Int, DualVector ((u, v) w)) Source #

symTensorDualBasisCandidates :: [(Int, SymmetricTensor (Scalar (u, v)) (u, v))] -> Forest (Int, SymmetricTensor (Scalar (u, v)) (DualVector (u, v))) Source #

symTensorTensorDualBasisCandidates :: (SemiInner w, Scalar w ~ Scalar (u, v)) => [(Int, SymmetricTensor (Scalar (u, v)) (u, v) w)] -> Forest (Int, SymmetricTensor (Scalar (u, v)) (u, v) +> DualVector w) Source #

(Num' s, SemiInner v, Scalar v ~ s) => SemiInner (SymmetricTensor s v) Source # 
Instance details

Defined in Math.VectorSpace.Docile

(SemiInner u, SemiInner v, Scalar u ~ s, Scalar v ~ s) => SemiInner (Tensor s u v) Source # 
Instance details

Defined in Math.VectorSpace.Docile

(LinearSpace u, SemiInner (DualVector u), SemiInner v, Scalar u ~ s, Scalar v ~ s) => SemiInner (LinearMap s u v) Source # 
Instance details

Defined in Math.VectorSpace.Docile

cartesianDualBasisCandidates Source #

Arguments

:: [DualVector v]

Set of canonical basis functionals.

-> (v -> [ℝ])

Decompose a vector in absolute value components. the list indices should correspond to those in the functional list.

-> [(Int, v)] -> Forest (Int, DualVector v)

Suitable definition of dualBasisCandidates.

Finite baseis

class LSpace v => FiniteDimensional v where Source #

Associated Types

data SubBasis v :: * Source #

Whereas Basis-values refer to a single basis vector, a single SubBasis value represents a collection of such basis vectors, which can be used to associate a vector with a list of coefficients.

For spaces with a canonical finite basis, SubBasis does not actually need to contain any information, it can simply have the full finite basis as its only value. Even for large sparse spaces, it should only have a very coarse structure that can be shared by many vectors.

Methods

entireBasis :: SubBasis v Source #

enumerateSubBasis :: SubBasis v -> [v] Source #

subbasisDimension :: SubBasis v -> Int Source #

decomposeLinMap :: (LSpace w, Scalar w ~ Scalar v) => (v +> w) -> (SubBasis v, DList w) Source #

Split up a linear map in “column vectors” WRT some suitable basis.

decomposeLinMapWithin :: (LSpace w, Scalar w ~ Scalar v) => SubBasis v -> (v +> w) -> Either (SubBasis v, DList w) (DList w) Source #

Expand in the given basis, if possible. Else yield a superbasis of the given one, in which this is possible, and the decomposition therein.

recomposeSB :: SubBasis v -> [Scalar v] -> (v, [Scalar v]) Source #

Assemble a vector from coefficients in some basis. Return any excess coefficients.

recomposeSBTensor :: (FiniteDimensional w, Scalar w ~ Scalar v) => SubBasis v -> SubBasis w -> [Scalar v] -> (v w, [Scalar v]) Source #

recomposeLinMap :: (LSpace w, Scalar w ~ Scalar v) => SubBasis v -> [w] -> (v +> w, [w]) Source #

recomposeContraLinMap :: (LinearSpace w, Scalar w ~ Scalar v, Functor f) => (f (Scalar w) -> w) -> f (DualVector v) -> v +> w Source #

Given a function that interprets a coefficient-container as a vector representation, build a linear function mapping to that space.

recomposeContraLinMapTensor :: (FiniteDimensional u, LinearSpace w, Scalar u ~ Scalar v, Scalar w ~ Scalar v, Functor f) => (f (Scalar w) -> w) -> f (v +> DualVector u) -> (v u) +> w Source #

uncanonicallyFromDual :: DualVector v -+> v Source #

The existance of a finite basis gives us an isomorphism between a space and its dual space. Note that this isomorphism is not natural (i.e. it depends on the actual choice of basis, unlike everything else in this library).

uncanonicallyToDual :: v -+> DualVector v Source #

Instances
(Num' s, Eq s, LSpace s) => FiniteDimensional (V1 s) Source # 
Instance details

Defined in Math.VectorSpace.Docile

Associated Types

data SubBasis (V1 s) :: Type Source #

Methods

entireBasis :: SubBasis (V1 s) Source #

enumerateSubBasis :: SubBasis (V1 s) -> [V1 s] Source #

subbasisDimension :: SubBasis (V1 s) -> Int Source #

decomposeLinMap :: (LSpace w, Scalar w ~ Scalar (V1 s)) => (V1 s +> w) -> (SubBasis (V1 s), DList w) Source #

decomposeLinMapWithin :: (LSpace w, Scalar w ~ Scalar (V1 s)) => SubBasis (V1 s) -> (V1 s +> w) -> Either (SubBasis (V1 s), DList w) (DList w) Source #

recomposeSB :: SubBasis (V1 s) -> [Scalar (V1 s)] -> (V1 s, [Scalar (V1 s)]) Source #

recomposeSBTensor :: (FiniteDimensional w, Scalar w ~ Scalar (V1 s)) => SubBasis (V1 s) -> SubBasis w -> [Scalar (V1 s)] -> (V1 s w, [Scalar (V1 s)]) Source #

recomposeLinMap :: (LSpace w, Scalar w ~ Scalar (V1 s)) => SubBasis (V1 s) -> [w] -> (V1 s +> w, [w]) Source #

recomposeContraLinMap :: (LinearSpace w, Scalar w ~ Scalar (V1 s), Functor f) => (f (Scalar w) -> w) -> f (DualVector (V1 s)) -> V1 s +> w Source #

recomposeContraLinMapTensor :: (FiniteDimensional u, LinearSpace w, Scalar u ~ Scalar (V1 s), Scalar w ~ Scalar (V1 s), Functor f) => (f (Scalar w) -> w) -> f (V1 s +> DualVector u) -> (V1 s u) +> w Source #

uncanonicallyFromDual :: DualVector (V1 s) -+> V1 s Source #

uncanonicallyToDual :: V1 s -+> DualVector (V1 s) Source #

(Num' s, Eq s, LSpace s) => FiniteDimensional (V2 s) Source # 
Instance details

Defined in Math.VectorSpace.Docile

Associated Types

data SubBasis (V2 s) :: Type Source #

Methods

entireBasis :: SubBasis (V2 s) Source #

enumerateSubBasis :: SubBasis (V2 s) -> [V2 s] Source #

subbasisDimension :: SubBasis (V2 s) -> Int Source #

decomposeLinMap :: (LSpace w, Scalar w ~ Scalar (V2 s)) => (V2 s +> w) -> (SubBasis (V2 s), DList w) Source #

decomposeLinMapWithin :: (LSpace w, Scalar w ~ Scalar (V2 s)) => SubBasis (V2 s) -> (V2 s +> w) -> Either (SubBasis (V2 s), DList w) (DList w) Source #

recomposeSB :: SubBasis (V2 s) -> [Scalar (V2 s)] -> (V2 s, [Scalar (V2 s)]) Source #

recomposeSBTensor :: (FiniteDimensional w, Scalar w ~ Scalar (V2 s)) => SubBasis (V2 s) -> SubBasis w -> [Scalar (V2 s)] -> (V2 s w, [Scalar (V2 s)]) Source #

recomposeLinMap :: (LSpace w, Scalar w ~ Scalar (V2 s)) => SubBasis (V2 s) -> [w] -> (V2 s +> w, [w]) Source #

recomposeContraLinMap :: (LinearSpace w, Scalar w ~ Scalar (V2 s), Functor f) => (f (Scalar w) -> w) -> f (DualVector (V2 s)) -> V2 s +> w Source #

recomposeContraLinMapTensor :: (FiniteDimensional u, LinearSpace w, Scalar u ~ Scalar (V2 s), Scalar w ~ Scalar (V2 s), Functor f) => (f (Scalar w) -> w) -> f (V2 s +> DualVector u) -> (V2 s u) +> w Source #

uncanonicallyFromDual :: DualVector (V2 s) -+> V2 s Source #

uncanonicallyToDual :: V2 s -+> DualVector (V2 s) Source #

(Num' s, Eq s, LSpace s) => FiniteDimensional (V3 s) Source # 
Instance details

Defined in Math.VectorSpace.Docile

Associated Types

data SubBasis (V3 s) :: Type Source #

Methods

entireBasis :: SubBasis (V3 s) Source #

enumerateSubBasis :: SubBasis (V3 s) -> [V3 s] Source #

subbasisDimension :: SubBasis (V3 s) -> Int Source #

decomposeLinMap :: (LSpace w, Scalar w ~ Scalar (V3 s)) => (V3 s +> w) -> (SubBasis (V3 s), DList w) Source #

decomposeLinMapWithin :: (LSpace w, Scalar w ~ Scalar (V3 s)) => SubBasis (V3 s) -> (V3 s +> w) -> Either (SubBasis (V3 s), DList w) (DList w) Source #

recomposeSB :: SubBasis (V3 s) -> [Scalar (V3 s)] -> (V3 s, [Scalar (V3 s)]) Source #

recomposeSBTensor :: (FiniteDimensional w, Scalar w ~ Scalar (V3 s)) => SubBasis (V3 s) -> SubBasis w -> [Scalar (V3 s)] -> (V3 s w, [Scalar (V3 s)]) Source #

recomposeLinMap :: (LSpace w, Scalar w ~ Scalar (V3 s)) => SubBasis (V3 s) -> [w] -> (V3 s +> w, [w]) Source #

recomposeContraLinMap :: (LinearSpace w, Scalar w ~ Scalar (V3 s), Functor f) => (f (Scalar w) -> w) -> f (DualVector (V3 s)) -> V3 s +> w Source #

recomposeContraLinMapTensor :: (FiniteDimensional u, LinearSpace w, Scalar u ~ Scalar (V3 s), Scalar w ~ Scalar (V3 s), Functor f) => (f (Scalar w) -> w) -> f (V3 s +> DualVector u) -> (V3 s u) +> w Source #

uncanonicallyFromDual :: DualVector (V3 s) -+> V3 s Source #

uncanonicallyToDual :: V3 s -+> DualVector (V3 s) Source #

(Num' s, Eq s, LSpace s) => FiniteDimensional (V4 s) Source # 
Instance details

Defined in Math.VectorSpace.Docile

Associated Types

data SubBasis (V4 s) :: Type Source #

Methods

entireBasis :: SubBasis (V4 s) Source #

enumerateSubBasis :: SubBasis (V4 s) -> [V4 s] Source #

subbasisDimension :: SubBasis (V4 s) -> Int Source #

decomposeLinMap :: (LSpace w, Scalar w ~ Scalar (V4 s)) => (V4 s +> w) -> (SubBasis (V4 s), DList w) Source #

decomposeLinMapWithin :: (LSpace w, Scalar w ~ Scalar (V4 s)) => SubBasis (V4 s) -> (V4 s +> w) -> Either (SubBasis (V4 s), DList w) (DList w) Source #

recomposeSB :: SubBasis (V4 s) -> [Scalar (V4 s)] -> (V4 s, [Scalar (V4 s)]) Source #

recomposeSBTensor :: (FiniteDimensional w, Scalar w ~ Scalar (V4 s)) => SubBasis (V4 s) -> SubBasis w -> [Scalar (V4 s)] -> (V4 s w, [Scalar (V4 s)]) Source #

recomposeLinMap :: (LSpace w, Scalar w ~ Scalar (V4 s)) => SubBasis (V4 s) -> [w] -> (V4 s +> w, [w]) Source #

recomposeContraLinMap :: (LinearSpace w, Scalar w ~ Scalar (V4 s), Functor f) => (f (Scalar w) -> w) -> f (DualVector (V4 s)) -> V4 s +> w Source #

recomposeContraLinMapTensor :: (FiniteDimensional u, LinearSpace w, Scalar u ~ Scalar (V4 s), Scalar w ~ Scalar (V4 s), Functor f) => (f (Scalar w) -> w) -> f (V4 s +> DualVector u) -> (V4 s u) +> w Source #

uncanonicallyFromDual :: DualVector (V4 s) -+> V4 s Source #

uncanonicallyToDual :: V4 s -+> DualVector (V4 s) Source #

(Num' s, Eq s, LinearSpace s) => FiniteDimensional (V0 s) Source # 
Instance details

Defined in Math.VectorSpace.Docile

Associated Types

data SubBasis (V0 s) :: Type Source #

Methods

entireBasis :: SubBasis (V0 s) Source #

enumerateSubBasis :: SubBasis (V0 s) -> [V0 s] Source #

subbasisDimension :: SubBasis (V0 s) -> Int Source #

decomposeLinMap :: (LSpace w, Scalar w ~ Scalar (V0 s)) => (V0 s +> w) -> (SubBasis (V0 s), DList w) Source #

decomposeLinMapWithin :: (LSpace w, Scalar w ~ Scalar (V0 s)) => SubBasis (V0 s) -> (V0 s +> w) -> Either (SubBasis (V0 s), DList w) (DList w) Source #

recomposeSB :: SubBasis (V0 s) -> [Scalar (V0 s)] -> (V0 s, [Scalar (V0 s)]) Source #

recomposeSBTensor :: (FiniteDimensional w, Scalar w ~ Scalar (V0 s)) => SubBasis (V0 s) -> SubBasis w -> [Scalar (V0 s)] -> (V0 s w, [Scalar (V0 s)]) Source #

recomposeLinMap :: (LSpace w, Scalar w ~ Scalar (V0 s)) => SubBasis (V0 s) -> [w] -> (V0 s +> w, [w]) Source #

recomposeContraLinMap :: (LinearSpace w, Scalar w ~ Scalar (V0 s), Functor f) => (f (Scalar w) -> w) -> f (DualVector (V0 s)) -> V0 s +> w Source #

recomposeContraLinMapTensor :: (FiniteDimensional u, LinearSpace w, Scalar u ~ Scalar (V0 s), Scalar w ~ Scalar (V0 s), Functor f) => (f (Scalar w) -> w) -> f (V0 s +> DualVector u) -> (V0 s u) +> w Source #

uncanonicallyFromDual :: DualVector (V0 s) -+> V0 s Source #

uncanonicallyToDual :: V0 s -+> DualVector (V0 s) Source #

Num' s => FiniteDimensional (ZeroDim s) Source # 
Instance details

Defined in Math.VectorSpace.Docile

Associated Types

data SubBasis (ZeroDim s) :: Type Source #

(FiniteDimensional u, FiniteDimensional v, Scalar u ~ Scalar v, Scalar (DualVector u) ~ Scalar (DualVector v)) => FiniteDimensional (u, v) Source # 
Instance details

Defined in Math.VectorSpace.Docile

Associated Types

data SubBasis (u, v) :: Type Source #

Methods

entireBasis :: SubBasis (u, v) Source #

enumerateSubBasis :: SubBasis (u, v) -> [(u, v)] Source #

subbasisDimension :: SubBasis (u, v) -> Int Source #

decomposeLinMap :: (LSpace w, Scalar w ~ Scalar (u, v)) => ((u, v) +> w) -> (SubBasis (u, v), DList w) Source #

decomposeLinMapWithin :: (LSpace w, Scalar w ~ Scalar (u, v)) => SubBasis (u, v) -> ((u, v) +> w) -> Either (SubBasis (u, v), DList w) (DList w) Source #

recomposeSB :: SubBasis (u, v) -> [Scalar (u, v)] -> ((u, v), [Scalar (u, v)]) Source #

recomposeSBTensor :: (FiniteDimensional w, Scalar w ~ Scalar (u, v)) => SubBasis (u, v) -> SubBasis w -> [Scalar (u, v)] -> ((u, v) w, [Scalar (u, v)]) Source #

recomposeLinMap :: (LSpace w, Scalar w ~ Scalar (u, v)) => SubBasis (u, v) -> [w] -> ((u, v) +> w, [w]) Source #

recomposeContraLinMap :: (LinearSpace w, Scalar w ~ Scalar (u, v), Functor f) => (f (Scalar w) -> w) -> f (DualVector (u, v)) -> (u, v) +> w Source #

recomposeContraLinMapTensor :: (FiniteDimensional u0, LinearSpace w, Scalar u0 ~ Scalar (u, v), Scalar w ~ Scalar (u, v), Functor f) => (f (Scalar w) -> w) -> f ((u, v) +> DualVector u0) -> ((u, v) u0) +> w Source #

uncanonicallyFromDual :: DualVector (u, v) -+> (u, v) Source #

uncanonicallyToDual :: (u, v) -+> DualVector (u, v) Source #

(FiniteDimensional v, Scalar v ~ s, Scalar (DualVector v) ~ s, RealFloat' s) => FiniteDimensional (SymmetricTensor s v) Source # 
Instance details

Defined in Math.VectorSpace.Docile

Associated Types

data SubBasis (SymmetricTensor s v) :: Type Source #

Methods

entireBasis :: SubBasis (SymmetricTensor s v) Source #

enumerateSubBasis :: SubBasis (SymmetricTensor s v) -> [SymmetricTensor s v] Source #

subbasisDimension :: SubBasis (SymmetricTensor s v) -> Int Source #

decomposeLinMap :: (LSpace w, Scalar w ~ Scalar (SymmetricTensor s v)) => (SymmetricTensor s v +> w) -> (SubBasis (SymmetricTensor s v), DList w) Source #

decomposeLinMapWithin :: (LSpace w, Scalar w ~ Scalar (SymmetricTensor s v)) => SubBasis (SymmetricTensor s v) -> (SymmetricTensor s v +> w) -> Either (SubBasis (SymmetricTensor s v), DList w) (DList w) Source #

recomposeSB :: SubBasis (SymmetricTensor s v) -> [Scalar (SymmetricTensor s v)] -> (SymmetricTensor s v, [Scalar (SymmetricTensor s v)]) Source #

recomposeSBTensor :: (FiniteDimensional w, Scalar w ~ Scalar (SymmetricTensor s v)) => SubBasis (SymmetricTensor s v) -> SubBasis w -> [Scalar (SymmetricTensor s v)] -> (SymmetricTensor s v w, [Scalar (SymmetricTensor s v)]) Source #

recomposeLinMap :: (LSpace w, Scalar w ~ Scalar (SymmetricTensor s v)) => SubBasis (SymmetricTensor s v) -> [w] -> (SymmetricTensor s v +> w, [w]) Source #

recomposeContraLinMap :: (LinearSpace w, Scalar w ~ Scalar (SymmetricTensor s v), Functor f) => (f (Scalar w) -> w) -> f (DualVector (SymmetricTensor s v)) -> SymmetricTensor s v +> w Source #

recomposeContraLinMapTensor :: (FiniteDimensional u, LinearSpace w, Scalar u ~ Scalar (SymmetricTensor s v), Scalar w ~ Scalar (SymmetricTensor s v), Functor f) => (f (Scalar w) -> w) -> f (SymmetricTensor s v +> DualVector u) -> (SymmetricTensor s v u) +> w Source #

uncanonicallyFromDual :: DualVector (SymmetricTensor s v) -+> SymmetricTensor s v Source #

uncanonicallyToDual :: SymmetricTensor s v -+> DualVector (SymmetricTensor s v) Source #

(FiniteDimensional u, FiniteDimensional v, Scalar u ~ s, Scalar v ~ s, Scalar (DualVector u) ~ s, Scalar (DualVector v) ~ s, Fractional' (Scalar v)) => FiniteDimensional (Tensor s u v) Source # 
Instance details

Defined in Math.VectorSpace.Docile

Associated Types

data SubBasis (Tensor s u v) :: Type Source #

Methods

entireBasis :: SubBasis (Tensor s u v) Source #

enumerateSubBasis :: SubBasis (Tensor s u v) -> [Tensor s u v] Source #

subbasisDimension :: SubBasis (Tensor s u v) -> Int Source #

decomposeLinMap :: (LSpace w, Scalar w ~ Scalar (Tensor s u v)) => (Tensor s u v +> w) -> (SubBasis (Tensor s u v), DList w) Source #

decomposeLinMapWithin :: (LSpace w, Scalar w ~ Scalar (Tensor s u v)) => SubBasis (Tensor s u v) -> (Tensor s u v +> w) -> Either (SubBasis (Tensor s u v), DList w) (DList w) Source #

recomposeSB :: SubBasis (Tensor s u v) -> [Scalar (Tensor s u v)] -> (Tensor s u v, [Scalar (Tensor s u v)]) Source #

recomposeSBTensor :: (FiniteDimensional w, Scalar w ~ Scalar (Tensor s u v)) => SubBasis (Tensor s u v) -> SubBasis w -> [Scalar (Tensor s u v)] -> (Tensor s u v w, [Scalar (Tensor s u v)]) Source #

recomposeLinMap :: (LSpace w, Scalar w ~ Scalar (Tensor s u v)) => SubBasis (Tensor s u v) -> [w] -> (Tensor s u v +> w, [w]) Source #

recomposeContraLinMap :: (LinearSpace w, Scalar w ~ Scalar (Tensor s u v), Functor f) => (f (Scalar w) -> w) -> f (DualVector (Tensor s u v)) -> Tensor s u v +> w Source #

recomposeContraLinMapTensor :: (FiniteDimensional u0, LinearSpace w, Scalar u0 ~ Scalar (Tensor s u v), Scalar w ~ Scalar (Tensor s u v), Functor f) => (f (Scalar w) -> w) -> f (Tensor s u v +> DualVector u0) -> (Tensor s u v u0) +> w Source #

uncanonicallyFromDual :: DualVector (Tensor s u v) -+> Tensor s u v Source #

uncanonicallyToDual :: Tensor s u v -+> DualVector (Tensor s u v) Source #

(LSpace u, FiniteDimensional (DualVector u), FiniteDimensional v, Scalar u ~ s, Scalar v ~ s, Scalar (DualVector v) ~ s, Fractional' (Scalar v)) => FiniteDimensional (LinearMap s u v) Source # 
Instance details

Defined in Math.VectorSpace.Docile

Associated Types

data SubBasis (LinearMap s u v) :: Type Source #

Methods

entireBasis :: SubBasis (LinearMap s u v) Source #

enumerateSubBasis :: SubBasis (LinearMap s u v) -> [LinearMap s u v] Source #

subbasisDimension :: SubBasis (LinearMap s u v) -> Int Source #

decomposeLinMap :: (LSpace w, Scalar w ~ Scalar (LinearMap s u v)) => (LinearMap s u v +> w) -> (SubBasis (LinearMap s u v), DList w) Source #

decomposeLinMapWithin :: (LSpace w, Scalar w ~ Scalar (LinearMap s u v)) => SubBasis (LinearMap s u v) -> (LinearMap s u v +> w) -> Either (SubBasis (LinearMap s u v), DList w) (DList w) Source #

recomposeSB :: SubBasis (LinearMap s u v) -> [Scalar (LinearMap s u v)] -> (LinearMap s u v, [Scalar (LinearMap s u v)]) Source #

recomposeSBTensor :: (FiniteDimensional w, Scalar w ~ Scalar (LinearMap s u v)) => SubBasis (LinearMap s u v) -> SubBasis w -> [Scalar (LinearMap s u v)] -> (LinearMap s u v w, [Scalar (LinearMap s u v)]) Source #

recomposeLinMap :: (LSpace w, Scalar w ~ Scalar (LinearMap s u v)) => SubBasis (LinearMap s u v) -> [w] -> (LinearMap s u v +> w, [w]) Source #

recomposeContraLinMap :: (LinearSpace w, Scalar w ~ Scalar (LinearMap s u v), Functor f) => (f (Scalar w) -> w) -> f (DualVector (LinearMap s u v)) -> LinearMap s u v +> w Source #

recomposeContraLinMapTensor :: (FiniteDimensional u0, LinearSpace w, Scalar u0 ~ Scalar (LinearMap s u v), Scalar w ~ Scalar (LinearMap s u v), Functor f) => (f (Scalar w) -> w) -> f (LinearMap s u v +> DualVector u0) -> (LinearMap s u v u0) +> w Source #

uncanonicallyFromDual :: DualVector (LinearMap s u v) -+> LinearMap s u v Source #

uncanonicallyToDual :: LinearMap s u v -+> DualVector (LinearMap s u v) Source #

Utility

Linear primitives

flipBilin :: Bilinear v w y -> Bilinear w v y Source #

bilinearFunction :: (v -> w -> y) -> Bilinear v w y Source #

Tensors with basis decomposition

(.⊗) :: (TensorSpace v, HasBasis v, TensorSpace w, Num' (Scalar v), Scalar v ~ Scalar w) => Basis v -> w -> v w infixr 7 Source #

Hilbert space operations

(·) :: TensorQuot v w => (v ⨸ w) -> v -> w infixl 7 Source #

Generalised multiplication operation. This subsumes <.>^ and *^. For scalars therefore also *, and for InnerSpace, <.>.

type DualSpace v = v +> Scalar v Source #

riesz :: forall v. (FiniteDimensional v, InnerSpace v) => DualVector v -+> v Source #

The Riesz representation theorem provides an isomorphism between a Hilbert space and its (continuous) dual space.

coRiesz :: forall v. (LSpace v, InnerSpace v) => v -+> DualVector v Source #

showsPrecAsRiesz :: forall v. (FiniteDimensional v, InnerSpace v, Show v, HasBasis (Scalar v), Basis (Scalar v) ~ ()) => Int -> DualSpace v -> ShowS Source #

Functions are generally a pain to display, but since linear functionals in a Hilbert space can be represented by vectors in that space, this can be used for implementing a Show instance.

(.<) :: (FiniteDimensional v, Num' (Scalar v), InnerSpace v, LSpace w, HasBasis w, Scalar v ~ Scalar w) => Basis w -> v -> v +> w infixl 7 Source #

Outer product of a general v-vector and a basis element from w. Note that this operation is in general pretty inefficient; it is provided mostly to lay out matrix definitions neatly.

Constraint synonyms

type RealSpace v = (LinearSpace v, Scalar v ~ ℝ, TensorQuot v ℝ, (v ⨸ ℝ) ~ DualVector v, TensorQuot v v, (v ⨸ v) ~ ℝ) Source #

A space in which you can use · both for scaling with a real number, and as dot-product for obtaining such a number.

type LinearShowable v = (Show v, RieszDecomposable v) Source #

Double-dual, scalar-scalar etc. identity

data ClosedScalarWitness s where Source #

Constructors

ClosedScalarWitness :: (Scalar s ~ s, DualVector s ~ s) => ClosedScalarWitness s 

Misc

relaxNorm :: forall v. SimpleSpace v => Norm v -> [v] -> Norm v Source #

Modify a norm in such a way that the given vectors lie within its unit ball. (Not optimally – the unit ball may be bigger than necessary.)

transformNorm :: forall v w. (LSpace v, LSpace w, Scalar v ~ Scalar w) => (v +> w) -> Norm w -> Norm v Source #

transformVariance :: forall v w. (LSpace v, LSpace w, Scalar v ~ Scalar w) => (v +> w) -> Variance v -> Variance w Source #

findNormalLength :: forall s. RealFrac' s => Norm s -> Maybe s Source #

The unique positive number whose norm is 1 (if the norm is not constant zero).

normalLength :: forall s. RealFrac' s => Norm s -> s Source #

Unsafe version of findNormalLength, only works reliable if the norm is actually positive definite.

summandSpaceNorms :: forall u v. (SimpleSpace u, SimpleSpace v, Scalar u ~ Scalar v) => Norm (u, v) -> (Norm u, Norm v) Source #

sumSubspaceNorms :: forall u v. (LSpace u, LSpace v, Scalar u ~ Scalar v) => Norm u -> Norm v -> Norm (u, v) Source #

sharedNormSpanningSystem :: SimpleSpace v => Norm v -> Seminorm v -> [(DualVector v, Scalar v)] Source #

For any two norms, one can find a system of co-vectors that, with suitable coefficients, spans either of them: if shSys = sharedNormSpanningSystem n₀ n₁, then

n₀ = spanNorm $ fst$shSys

and

n₁ = spanNorm [dv^*η | (dv,η)<-shSys]

A rather crude approximation (roughEigenSystem) is used in this function, so do not expect the above equations to hold with great accuracy.

sharedSeminormSpanningSystem :: forall v. SimpleSpace v => Seminorm v -> Seminorm v -> [(DualVector v, Maybe (Scalar v))] Source #

Like 'sharedNormSpanningSystem n₀ n₁', but allows either of the norms to be singular.

n₀ = spanNorm [dv | (dv, Just _)<-shSys]

and

n₁ = spanNorm $ [dv^*η | (dv, Just η)<-shSys]
                ++ [ dv | (dv, Nothing)<-shSys]

You may also interpret a Nothing here as an “infinite eigenvalue”, i.e. it is so small as an spanning vector of n₀ that you would need to scale it by ∞ to use it for spanning n₁.

sharedSeminormSpanningSystem' :: forall v. SimpleSpace v => Seminorm v -> Seminorm v -> [v] Source #

A system of vectors which are orthogonal with respect to both of the given seminorms. (In general they are not orthonormal to either of them.)

convexPolytopeHull :: forall v. SimpleSpace v => [v] -> [DualVector v] Source #