| Copyright | (c) Justus Sagemüller 2021 | 
|---|---|
| License | GPL v3 | 
| Maintainer | (@) jsag $ hvl.no | 
| Stability | experimental | 
| Portability | portable | 
| Safe Haskell | Safe-Inferred | 
| Language | Haskell2010 | 
Math.LinearMap.Category.Instances.Deriving
Description
Synopsis
- makeLinearSpaceFromBasis :: Q Type -> DecsQ
 - makeFiniteDimensionalFromBasis :: Q Type -> DecsQ
 - copyNewtypeInstances :: Q Type -> [Name] -> DecsQ
 - pattern AbstractDualVector :: AbstractLinearSpace v => DualVector (VectorSpaceImplementation v) -> DualVector v
 - class AdditiveGroup (Diff p) => AffineSpace p where
 - class AdditiveGroup (Needle x) => Semimanifold x where
- type Needle x
 - (.+~^) :: x -> Needle x -> x
 - (.-~^) :: x -> Needle x -> x
 - semimanifoldWitness :: SemimanifoldWitness x
 
 - class Semimanifold x => PseudoAffine x where
- (.-~.) :: x -> x -> Maybe (Needle x)
 - (.-~!) :: x -> x -> Needle x
 - pseudoAffineWitness :: PseudoAffineWitness x
 
 - class (VectorSpace v, PseudoAffine v) => TensorSpace v where
- type TensorProduct v w :: Type
 - scalarSpaceWitness :: ScalarSpaceWitness v
 - linearManifoldWitness :: LinearManifoldWitness v
 - zeroTensor :: (TensorSpace w, Scalar w ~ Scalar v) => v ⊗ w
 - toFlatTensor :: v -+> (v ⊗ Scalar v)
 - fromFlatTensor :: (v ⊗ Scalar v) -+> v
 - addTensors :: (TensorSpace w, Scalar w ~ Scalar v) => (v ⊗ w) -> (v ⊗ w) -> v ⊗ w
 - subtractTensors :: (TensorSpace v, TensorSpace w, Scalar w ~ Scalar v) => (v ⊗ w) -> (v ⊗ w) -> v ⊗ w
 - scaleTensor :: (TensorSpace w, Scalar w ~ Scalar v) => Bilinear (Scalar v) (v ⊗ w) (v ⊗ w)
 - negateTensor :: (TensorSpace w, Scalar w ~ Scalar v) => (v ⊗ w) -+> (v ⊗ w)
 - tensorProduct :: (TensorSpace w, Scalar w ~ Scalar v) => Bilinear v w (v ⊗ w)
 - tensorProducts :: (TensorSpace w, Scalar w ~ Scalar v) => [(v, w)] -> v ⊗ w
 - transposeTensor :: (TensorSpace w, Scalar w ~ Scalar v) => (v ⊗ w) -+> (w ⊗ v)
 - fmapTensor :: (TensorSpace w, TensorSpace x, Scalar w ~ Scalar v, Scalar x ~ Scalar v) => Bilinear (w -+> x) (v ⊗ w) (v ⊗ x)
 - 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)
 - coerceFmapTensorProduct :: Functor p => p v -> VSCCoercion a b -> VSCCoercion (TensorProduct v a) (TensorProduct v b)
 - wellDefinedVector :: v -> Maybe v
 - wellDefinedTensor :: (TensorSpace w, Scalar w ~ Scalar v) => (v ⊗ w) -> Maybe (v ⊗ w)
 
 - class (TensorSpace v, Num (Scalar v)) => LinearSpace v where
- type DualVector v :: Type
 - dualSpaceWitness :: DualSpaceWitness v
 - linearId :: v +> v
 - idTensor :: v ⊗ DualVector v
 - sampleLinearFunction :: (TensorSpace w, Scalar v ~ Scalar w) => (v -+> w) -+> (v +> w)
 - toLinearForm :: DualVector v -+> (v +> Scalar v)
 - fromLinearForm :: (v +> Scalar v) -+> DualVector v
 - coerceDoubleDual :: VSCCoercion v (DualVector (DualVector v))
 - trace :: (v +> v) -+> Scalar v
 - contractTensorMap :: (TensorSpace w, Scalar w ~ Scalar v) => (v +> (v ⊗ w)) -+> w
 - contractMapTensor :: (TensorSpace w, Scalar w ~ Scalar v) => (v ⊗ (v +> w)) -+> w
 - contractTensorFn :: forall w. (TensorSpace w, Scalar w ~ Scalar v) => (v -+> (v ⊗ w)) -+> w
 - contractLinearMapAgainst :: (LinearSpace w, Scalar w ~ Scalar v) => Bilinear (v +> w) (w -+> v) (Scalar v)
 - applyDualVector :: LinearSpace v => Bilinear (DualVector v) v (Scalar v)
 - applyLinear :: (TensorSpace w, Scalar w ~ Scalar v) => Bilinear (v +> w) v w
 - composeLinear :: (LinearSpace w, TensorSpace x, Scalar w ~ Scalar v, Scalar x ~ Scalar v) => Bilinear (w +> x) (v +> w) (v +> x)
 - tensorId :: (LinearSpace w, Scalar w ~ Scalar v) => (v ⊗ w) +> (v ⊗ w)
 - applyTensorFunctional :: (LinearSpace u, Scalar u ~ Scalar v) => Bilinear (DualVector (v ⊗ u)) (v ⊗ u) (Scalar v)
 - applyTensorLinMap :: (LinearSpace u, TensorSpace w, Scalar u ~ Scalar v, Scalar w ~ Scalar v) => Bilinear ((v ⊗ u) +> w) (v ⊗ u) w
 - useTupleLinearSpaceComponents :: v ~ (x, y) => ((LinearSpace x, LinearSpace y, Scalar x ~ Scalar y) => φ) -> φ
 
 - class (LSpace v, Eq v) => FiniteDimensional v where
- data SubBasis v :: Type
 - entireBasis :: SubBasis v
 - enumerateSubBasis :: SubBasis v -> [v]
 - subbasisDimension :: SubBasis v -> Int
 - decomposeLinMap :: (LSpace w, Scalar w ~ Scalar v) => (v +> w) -> (SubBasis v, DList w)
 - decomposeLinMapWithin :: (LSpace w, Scalar w ~ Scalar v) => SubBasis v -> (v +> w) -> Either (SubBasis v, DList w) (DList w)
 - recomposeSB :: SubBasis v -> [Scalar v] -> (v, [Scalar v])
 - recomposeSBTensor :: (FiniteDimensional w, Scalar w ~ Scalar v) => SubBasis v -> SubBasis w -> [Scalar v] -> (v ⊗ w, [Scalar v])
 - recomposeLinMap :: (LSpace w, Scalar w ~ Scalar v) => SubBasis v -> [w] -> (v +> w, [w])
 - recomposeContraLinMap :: (LinearSpace w, Scalar w ~ Scalar v, Functor f) => (f (Scalar w) -> w) -> f (DualVector v) -> v +> w
 - 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
 - uncanonicallyFromDual :: DualVector v -+> v
 - uncanonicallyToDual :: v -+> DualVector v
 - tensorEquality :: (TensorSpace w, Eq w, Scalar w ~ Scalar v) => (v ⊗ w) -> (v ⊗ w) -> Bool
 - dualFinitenessWitness :: DualFinitenessWitness v
 
 - class LinearSpace v => SemiInner v where
- dualBasisCandidates :: [(Int, v)] -> Forest (Int, DualVector v)
 - tensorDualBasisCandidates :: (SemiInner w, Scalar w ~ Scalar v) => [(Int, v ⊗ w)] -> Forest (Int, DualVector (v ⊗ w))
 - symTensorDualBasisCandidates :: [(Int, SymmetricTensor (Scalar v) v)] -> Forest (Int, SymmetricTensor (Scalar v) (DualVector v))
 - symTensorTensorDualBasisCandidates :: forall w. (SemiInner w, Scalar w ~ Scalar v) => [(Int, SymmetricTensor (Scalar v) v ⊗ w)] -> Forest (Int, SymmetricTensor (Scalar v) v +> DualVector w)
 
 - class (HasBasis v, Num' (Scalar v), LinearSpace v, DualVector v ~ DualVectorFromBasis v) => BasisGeneratedSpace v where
- proveTensorProductIsTrie :: forall w φ. (TensorProduct v w ~ (Basis v :->: w) => φ) -> φ
 
 - data LinearSpaceFromBasisDerivationConfig
 - def :: Default a => a
 
Documentation
makeLinearSpaceFromBasis :: Q Type -> DecsQ Source #
Given a type V that is already a VectorSpace and HasBasis, generate
   the other class instances that are needed to use the type with this
   library.
Prerequisites: (these can often be derived automatically,
   using either the newtype / via strategy or generics / anyclass)
instanceAdditiveGroupV instanceVectorSpaceV where type Scalar V = -- a simple number type, usuallyDoubleinstanceHasBasisV where type Basis V = -- a type with an instance ofHasTrie
Note that the Basis does not need to be orthonormal – in fact it
   is not necessary to have a scalar product (i.e. an InnerSpace instance)
   at all.
The macro, invoked like
 
 makeLinearSpaceFromBasis [t| V |]
 
will then generate V-instances for the classes Semimanifold,
   PseudoAffine, AffineSpace, TensorSpace and LinearSpace.
It also works on parameterised types, in that case you need to use universal-quantification syntax, e.g.
makeLinearSpaceFromBasis [t| ∀ n . (KnownNat n) => V n |]
makeFiniteDimensionalFromBasis :: Q Type -> DecsQ Source #
Like makeLinearSpaceFromBasis, but additionally generate instances for
   FiniteDimensional and SemiInner.
copyNewtypeInstances :: Q Type -> [Name] -> DecsQ Source #
More powerful version of deriving newtype, specialised to the classes from
   this package (and of manifolds-core). The DualVector space will be a separate
   type, even if the type you abstract over is self-dual.
pattern AbstractDualVector :: AbstractLinearSpace v => DualVector (VectorSpaceImplementation v) -> DualVector v Source #
The instantiated classes
class AdditiveGroup (Diff p) => AffineSpace p where #
Minimal complete definition
Nothing
Methods
(.-.) :: p -> p -> Diff p infix 6 #
Subtract points
(.+^) :: p -> Diff p -> p infixl 6 #
Point plus vector
Instances
class AdditiveGroup (Needle x) => Semimanifold x where #
Minimal complete definition
Nothing
Associated Types
The space of “ways” starting from some reference point
   and going to some particular target point. Hence,
   the name: like a compass needle, but also with an actual length.
   For affine spaces, Needle is simply the space of
   line segments (aka vectors) between two points, i.e. the same as Diff.
   The AffineManifold constraint makes that requirement explicit.
This space should be isomorphic to the tangent space (and in fact serves an in many ways similar role), however whereas the tangent space of a manifold is really infinitesimally small, needles actually allow macroscopic displacements.
type Needle x = GenericNeedle x
Methods
(.+~^) :: x -> Needle x -> x infixl 6 #
Generalisation of the translation operation .+^ to possibly non-flat
   manifolds, instead of affine spaces.
(.-~^) :: x -> Needle x -> x infixl 6 #
Shorthand for \p v -> p .+~^ , which should obey the asymptotic lawnegateV v
p .-~^ v .+~^ v ≅ p
Meaning: if v is scaled down with sufficiently small factors η, then
   the difference (p.-~^v.+~^v) .-~. p should eventually scale down even faster:
   as O (η²). For large vectors, it may however behave differently,
   except in flat spaces (where all this should be equivalent to the AffineSpace
   instance).
Instances
class Semimanifold x => PseudoAffine x where #
This is the class underlying what we understand as manifolds.
The interface is almost identical to the better-known
   AffineSpace class, but we don't require associativity of .+~^ with ^+^
   – except in an asymptotic sense for small vectors.
That innocent-looking change makes the class applicable to vastly more general types:
   while an affine space is basically nothing but a vector space without particularly
   designated origin, a pseudo-affine space can have nontrivial topology on the global
   scale, and yet be used in practically the same way as an affine space. At least the
   usual spheres and tori make good instances, perhaps the class is in fact equivalent to
   manifolds in their usual maths definition (with an atlas of charts: a family of
   overlapping regions of the topological space, each homeomorphic to the Needle
   vector space or some simply-connected subset thereof).
The Semimanifold and PseudoAffine classes can be anyclass-derived
   or empty-instantiated based on Generic for product types (including newtypes) of
   existing PseudoAffine instances. For example, the definition
data Cylinder = CylinderPolar { zCyl :: !D¹, φCyl :: !S¹ }
  deriving (Generic, Semimanifold, PseudoAffine)
is equivalent to
data Cylinder = CylinderPolar { zCyl :: !D¹, φCyl :: !S¹ }
data CylinderNeedle = CylinderPolarNeedle { δzCyl :: !(Needle D¹), δφCyl :: !(Needle S¹) }
instance Semimanifold Cylinder where
  type Needle Cylinder = CylinderNeedle
  CylinderPolar z φ .+~^ CylinderPolarNeedle δz δφ
       = CylinderPolar (z.+~^δz) (φ.+~^δφ)
instance PseudoAffine Cylinder where
  CylinderPolar z₁ φ₁ .-~. CylinderPolar z₀ φ₀
       = CylinderPolarNeedle $ z₁.-~.z₀ * φ₁.-~.φ₀
  CylinderPolar z₁ φ₁ .-~! CylinderPolar z₀ φ₀
       = CylinderPolarNeedle (z₁.-~!z₀) (φ₁.-~.φ₀)
Minimal complete definition
Nothing
Methods
(.-~.) :: x -> x -> Maybe (Needle x) infix 6 #
The path reaching from one point to another.
   Should only yield Nothing if the points are on disjoint segments
   of a non–path-connected space.
For a connected manifold, you may define this method as
p.-~.q = pure (p.-~!q)
(.-~!) :: x -> x -> Needle x infix 6 #
Unsafe version of .-~.. If the two points lie in disjoint regions,
   the behaviour is undefined.
Whenever p and q lie in a connected region, the identity
p .+~^ (q.-~.p) ≡ q
should hold (up to possible floating point rounding etc.). Meanwhile, you will in general have
(p.+~^v).-~^v ≠ p
(though in many instances this is at least for sufficiently small v approximately equal).
Instances
class (VectorSpace v, PseudoAffine v) => TensorSpace v where Source #
Minimal complete definition
scalarSpaceWitness, linearManifoldWitness, zeroTensor, toFlatTensor, fromFlatTensor, tensorProduct, transposeTensor, fmapTensor, fzipTensorWith, coerceFmapTensorProduct, wellDefinedTensor
Associated Types
type TensorProduct v w :: Type 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 #
default 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 #
default 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 #
default 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 #
default 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 -> VSCCoercion a b -> VSCCoercion (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).
default wellDefinedVector :: Eq v => v -> Maybe v Source #
wellDefinedTensor :: (TensorSpace w, Scalar w ~ Scalar v) => (v ⊗ w) -> Maybe (v ⊗ w) Source #
Instances
class (TensorSpace v, Num (Scalar v)) => LinearSpace v where Source #
The class of vector spaces v for which  is well-implemented.LinearMap s v w
Minimal complete definition
dualSpaceWitness, linearId, applyDualVector, applyLinear, tensorId, applyTensorFunctional, applyTensorLinMap, useTupleLinearSpaceComponents
Associated Types
type DualVector v :: Type Source #
Suitable representation of a linear map from the space v to its field.
For the usual euclidean spaces, you can just define .
   (In this case, a dual vector will be just a “row vector” if you consider
   DualVector v = vv-vectors as “column vectors”. LinearMap will then effectively have
   a matrix layout.)
Methods
dualSpaceWitness :: DualSpaceWitness v Source #
idTensor :: v ⊗ DualVector v Source #
sampleLinearFunction :: (TensorSpace w, Scalar v ~ Scalar w) => (v -+> w) -+> (v +> w) Source #
toLinearForm :: DualVector v -+> (v +> Scalar v) Source #
fromLinearForm :: (v +> Scalar v) -+> DualVector v Source #
coerceDoubleDual :: VSCCoercion v (DualVector (DualVector v)) Source #
trace :: (v +> v) -+> Scalar v Source #
contractTensorMap :: (TensorSpace w, Scalar w ~ Scalar v) => (v +> (v ⊗ w)) -+> w Source #
contractMapTensor :: (TensorSpace w, Scalar w ~ Scalar v) => (v ⊗ (v +> w)) -+> w Source #
contractTensorFn :: forall w. (TensorSpace w, Scalar w ~ Scalar v) => (v -+> (v ⊗ w)) -+> w Source #
contractLinearMapAgainst :: (LinearSpace w, Scalar w ~ Scalar v) => Bilinear (v +> w) (w -+> v) (Scalar v) Source #
applyDualVector :: LinearSpace v => Bilinear (DualVector v) v (Scalar v) Source #
applyLinear :: (TensorSpace w, Scalar w ~ Scalar v) => Bilinear (v +> w) v w Source #
composeLinear :: (LinearSpace w, TensorSpace x, Scalar w ~ Scalar v, Scalar x ~ Scalar v) => Bilinear (w +> x) (v +> w) (v +> x) Source #
tensorId :: (LinearSpace w, Scalar w ~ Scalar v) => (v ⊗ w) +> (v ⊗ w) Source #
applyTensorFunctional :: (LinearSpace u, Scalar u ~ Scalar v) => Bilinear (DualVector (v ⊗ u)) (v ⊗ u) (Scalar v) Source #
applyTensorLinMap :: (LinearSpace u, TensorSpace w, Scalar u ~ Scalar v, Scalar w ~ Scalar v) => Bilinear ((v ⊗ u) +> w) (v ⊗ u) w Source #
useTupleLinearSpaceComponents :: v ~ (x, y) => ((LinearSpace x, LinearSpace y, Scalar x ~ Scalar y) => φ) -> φ Source #
Instances
class (LSpace v, Eq v) => FiniteDimensional v where Source #
Minimal complete definition
entireBasis, enumerateSubBasis, decomposeLinMap, decomposeLinMapWithin, recomposeSB, recomposeSBTensor, recomposeLinMap, recomposeContraLinMap, recomposeContraLinMapTensor, uncanonicallyFromDual, uncanonicallyToDual, tensorEquality
Associated Types
data SubBasis v :: Type 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 #
tensorEquality :: (TensorSpace w, Eq w, Scalar w ~ Scalar v) => (v ⊗ w) -> (v ⊗ w) -> Bool Source #
dualFinitenessWitness :: DualFinitenessWitness v Source #
default dualFinitenessWitness :: FiniteDimensional (DualVector v) => DualFinitenessWitness v Source #
Instances
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.
Minimal complete definition
dualBasisCandidates, tensorDualBasisCandidates, symTensorDualBasisCandidates
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
Internals
class (HasBasis v, Num' (Scalar v), LinearSpace v, DualVector v ~ DualVectorFromBasis v) => BasisGeneratedSpace v where Source #
Do not manually instantiate this class. It is used internally
   by makeLinearSpaceFromBasis.
Methods
proveTensorProductIsTrie :: forall w φ. (TensorProduct v w ~ (Basis v :->: w) => φ) -> φ Source #
data LinearSpaceFromBasisDerivationConfig Source #