manifolds 0.1.5.0 → 0.1.5.1
raw patch · 3 files changed
+38/−10 lines, 3 filesdep ~hmatrix
Dependency ranges changed: hmatrix
Files
- Data/LinearMap/HerMetric.hs +4/−4
- Data/Manifold/PseudoAffine.hs +32/−4
- manifolds.cabal +2/−2
Data/LinearMap/HerMetric.hs view
@@ -267,27 +267,27 @@ eigenSpan :: (HasMetric v, Scalar v ~ ℝ) => HerMetric' v -> [v] eigenSpan (HerMetric' Nothing) = [] eigenSpan (HerMetric' (Just m)) = map fromPackedVector eigSpan- where (μs,vsm) = HMat.eigSH m -- TODO: replace with `eigSH'`, which is unchecked+ where (μs,vsm) = HMat.eigSH' m -- TODO: replace with `eigSH'`, which is unchecked -- (`HerMetric` is always Hermitian!) eigSpan = zipWith (HMat.scale . sqrt) (HMat.toList μs) (HMat.toColumns vsm) eigenSpan' :: (HasMetric v, Scalar v ~ ℝ) => HerMetric v -> [DualSpace v] eigenSpan' (HerMetric Nothing) = [] eigenSpan' (HerMetric (Just m)) = map fromPackedVector eigSpan- where (μs,vsm) = HMat.eigSH m -- TODO: replace with `eigSH'`, which is unchecked+ where (μs,vsm) = HMat.eigSH' m -- TODO: replace with `eigSH'`, which is unchecked -- (`HerMetric` is always Hermitian!) eigSpan = zipWith (HMat.scale . sqrt) (HMat.toList μs) (HMat.toColumns vsm) eigenCoSpan :: (HasMetric v, Scalar v ~ ℝ) => HerMetric' v -> [DualSpace v] eigenCoSpan (HerMetric' Nothing) = [] eigenCoSpan (HerMetric' (Just m)) = map fromPackedVector eigSpan- where (μs,vsm) = HMat.eigSH m -- TODO: replace with `eigSH'`, which is unchecked+ where (μs,vsm) = HMat.eigSH' m -- TODO: replace with `eigSH'`, which is unchecked -- (`HerMetric` is always Hermitian!) eigSpan = zipWith (HMat.scale . recip . sqrt) (HMat.toList μs) (HMat.toColumns vsm) eigenCoSpan' :: (HasMetric v, Scalar v ~ ℝ) => HerMetric v -> [v] eigenCoSpan' (HerMetric Nothing) = [] eigenCoSpan' (HerMetric (Just m)) = map fromPackedVector eigSpan- where (μs,vsm) = HMat.eigSH m -- TODO: replace with `eigSH'`, which is unchecked+ where (μs,vsm) = HMat.eigSH' m -- TODO: replace with `eigSH'`, which is unchecked -- (`HerMetric` is always Hermitian!) eigSpan = zipWith (HMat.scale . recip . sqrt) (HMat.toList μs) (HMat.toColumns vsm)
Data/Manifold/PseudoAffine.hs view
@@ -50,7 +50,6 @@ Manifold , Semimanifold(..) , PseudoAffine(..)- , Metric, Metric', euclideanMetric -- * Regions within a manifold , Region -- * Hierarchy of manifold-categories@@ -60,7 +59,11 @@ , PWDiffable -- ** Region-wise defined diff'able funcs , RWDiffable- -- * Helper constraints+ -- * Type definitions+ -- ** Metrics+ , Metric, Metric', euclideanMetric+ , RieMetric, RieMetric'+ -- ** Constraints , RealDimension, AffineManifold , LinearManifold , WithField@@ -68,6 +71,7 @@ , EuclidSpace -- * Misc , palerp+ , discretisePath ) where @@ -221,9 +225,8 @@ class (PseudoAffine m, LinearManifold (Needle m), Interior m ~ m) => Manifold m instance (PseudoAffine m, LinearManifold (Needle m), Interior m ~ m) => Manifold m -type LocallyScalable s x = ( PseudoAffine x, (Needle x) ~ Needle x+type LocallyScalable s x = ( PseudoAffine x , HasMetric (Needle x)- , DualSpace (Needle x) ~ DualSpace (Needle x) , s ~ Scalar (Needle x) ) -- | Basically just an “updated” version of the 'VectorSpace' class.@@ -273,6 +276,12 @@ type Metric x = HerMetric (Needle x) type Metric' x = HerMetric' (Needle x) +-- | A Riemannian metric assigns each point on a manifold a scalar product on the tangent space.+-- Note that this association is /not/ continuous, because the charts/tangent spaces in the bundle+-- are a priori disjoint. However, for a proper Riemannian metric, all arising expressions+-- of scalar products from needles between points on the manifold ought to be differentiable.+type RieMetric x = x -> Metric x+type RieMetric' x = x -> Metric' x -- | Interpolate between points, approximately linearly. For -- points that aren't close neighbours (i.e. lie in an almost@@ -287,6 +296,25 @@ palerp p1 p2 = case (fromInterior p2 :: x) .-~. p1 of Option (Just v) -> return $ \t -> p1 .+~^ t *^ v _ -> Hask.empty++++++discretisePath :: WithField ℝ Manifold x+ => Int -- ^ Limit the number of steps taken in either direction. Note this will not cap the resolution but /length/ of the discretised path.+ -> RieMetric x -- ^ Inaccuracy allowance /ε/.+ -> (Differentiable ℝ ℝ x) -- ^ Path specification.+ -> [(ℝ,x)] -- ^ Trail of points along the path, such that a linear interpolation deviates nowhere by more as /ε/.+discretisePath nLim m (Differentiable f)+ = reverse (tail . take nLim $ traceFwd 0 (-1)) ++ take nLim (traceFwd 0 1)+ where traceFwd x₀ dir+ | abs x₀ > 1e+100 = [(x₀, fx₀)]+ | otherwise = (x₀, fx₀) : traceFwd xn dir+ where (fx₀, _, δx²) = f x₀+ εx = m fx₀+ χ = metric (δx² εx) 1+ xn = x₀ + dir * min (abs x₀+1) (recip χ)
manifolds.cabal view
@@ -1,7 +1,7 @@ Name: manifolds-Version: 0.1.5.0+Version: 0.1.5.1 Category: Math-Synopsis: Working with manifolds in a direct, embedding-free way.+Synopsis: Coordinate-free hypersurfaces Description: Manifolds, a generalisation of the notion of “smooth curves” or surfaces, are topological spaces /locally homeomorphic to a vector space/. This gives rise to what is actually the most natural / mathematically elegant way of dealing