Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- class (AdditiveGroup s, VectorSpace v, VectorSpace dv, Scalar v ~ s, Scalar dv ~ s) => Dual s v dv where
- evalGrad :: dv -> v -> s
- class (Dual (Scalar g) (MtVector g) (MtCovector g), VectorSpace g) => MetricTensor g where
- type MtVector g :: Type
- type MtCovector g :: Type
- evalMetric :: g -> MtCovector g -> MtVector g
- innerProduct :: g -> MtCovector g -> MtCovector g -> Scalar g
- sqrNorm :: g -> MtCovector g -> Scalar g
- class (Dual (MScalar p) (Tang p) (Grad p), MetricTensor (Metric p), MtVector (Metric p) ~ Tang p, MtCovector (Metric p) ~ Grad p, BasicVector (Tang p), BasicVector (Grad p)) => HasGrad p where
- type GradBuilder v = VecBuilder (Grad v)
- type HasFullGrad p = (HasGrad p, FullVector (Grad p))
- type HasGradAffine p = (AffineSpace p, HasGrad p, HasGrad (Tang p), Tang p ~ Diff p, Tang (Tang p) ~ Tang p, Grad (Tang p) ~ Grad p)
Documentation
class (AdditiveGroup s, VectorSpace v, VectorSpace dv, Scalar v ~ s, Scalar dv ~ s) => Dual s v dv where Source #
Dual of a vector v
is a linear map v -> Scalar v
.
Instances
Dual Double Double Double Source # | |
Dual Float Float Float Source # | |
Dual Integer Integer Integer Source # | |
(Dual s a da, Dual s b db) => Dual s (a, b) (da, db) Source # | |
Defined in Downhill.Grad | |
(Dual s a da, Dual s b db, Dual s c dc) => Dual s (a, b, c) (da, db, dc) Source # | |
Defined in Downhill.Grad | |
Num a => Dual (AsNum a) (AsNum a) (AsNum a) Source # | |
class (Dual (Scalar g) (MtVector g) (MtCovector g), VectorSpace g) => MetricTensor g where Source #
MetricTensor
converts gradients to vectors.
It is really inverse of a metric tensor, because it maps cotangent space into tangent space. Gradient descent doesn't need metric tensor, it needs inverse.
evalMetric :: g -> MtCovector g -> MtVector g Source #
m
must be symmetric:
evalGrad x (evalMetric m y) = evalGrad y (evalMetric m x)
innerProduct :: g -> MtCovector g -> MtCovector g -> Scalar g Source #
innerProduct m x y = evalGrad x (evalMetric m y)
sqrNorm :: g -> MtCovector g -> Scalar g Source #
sqrNorm m x = innerProduct m x x
Instances
class (Dual (MScalar p) (Tang p) (Grad p), MetricTensor (Metric p), MtVector (Metric p) ~ Tang p, MtCovector (Metric p) ~ Grad p, BasicVector (Tang p), BasicVector (Grad p)) => HasGrad p Source #
HasGrad
is a collection of types and constraints that are useful
in many places. It helps to keep type signatures short.
type MScalar p :: Type Source #
Scalar of Tang p
and Grad p
.
Tangent vector of manifold p
. If p is AffineSpace
, Tang p
should
be
. If Diff
pp
is VectorSpace
, Tang p
might be the same as p
itself.
Dual of tangent space of p
.
type Metric p :: Type Source #
A MetricTensor
.
Instances
HasGrad Double Source # | |
HasGrad Float Source # | |
HasGrad Integer Source # | |
Num a => HasGrad (AsNum a) Source # | |
(HasGrad a, HasGrad b, MScalar b ~ MScalar a) => HasGrad (a, b) Source # | |
(HasGrad a, HasGrad b, HasGrad c, MScalar b ~ MScalar a, MScalar c ~ MScalar a) => HasGrad (a, b, c) Source # | |
HasGrad a => HasGrad (TraversableVar f a) Source # | |
Defined in Downhill.BVar.Traversable type MScalar (TraversableVar f a) Source # type Tang (TraversableVar f a) Source # type Grad (TraversableVar f a) Source # type Metric (TraversableVar f a) Source # |
type GradBuilder v = VecBuilder (Grad v) Source #
type HasFullGrad p = (HasGrad p, FullVector (Grad p)) Source #