linearmap-category 0.3.4.0 → 0.3.5.0
raw patch · 2 files changed
+17/−5 lines, 2 filesdep +call-stackdep ~constrained-categoriesdep ~manifolds-coredep ~vector-space
Dependencies added: call-stack
Dependency ranges changed: constrained-categories, manifolds-core, vector-space
Files
- Math/VectorSpace/Docile.hs +12/−1
- linearmap-category.cabal +5/−4
Math/VectorSpace/Docile.hs view
@@ -65,9 +65,11 @@ import Numeric.IEEE +import Data.CallStack + -- | '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@@ -246,16 +248,25 @@ [] -> StateT $ const Nothing (b:bs') -> put bs' >> return (f a b) -embedFreeSubspace :: ∀ v t r . (SemiInner v, RealFrac' (Scalar v), Hask.Traversable t)+embedFreeSubspace :: ∀ v t r . (HasCallStack, SemiInner v, RealFrac' (Scalar v), Hask.Traversable t) => t v -> Maybe (ReifiedLens' v (t (Scalar v))) embedFreeSubspace vs = fmap (\(g,s) -> Lens (lens g s)) result where vsList = toList vs result = fmap (genGet&&&genSet) . sequenceA $ dualBasis vsList genGet vsDuals u = case zipTravWith (\_v dv -> dv<.>^u) vs vsDuals of Just cs -> cs+ Nothing -> error $ "Cannot map into free subspace using a set of "+ ++ show (length vsList)+ ++ " vectors and " ++ show (length vsDuals)+ ++ " dual vectors." genSet vsDuals u coefs = case zipTravWith (,) coefs $ zip vsList vsDuals of Just updators -> foldl' (\ur (c,(v,v')) -> ur ^+^ v^*(c - v'<.>^ur)) u updators+ Nothing -> error $ "Cannot map from free subspace using a set of "+ ++ show (length vsList)+ ++ " vectors, " ++ show (length vsDuals)+ ++ " dual vectors and "+ ++ show (length coefs) ++ " coefficients." instance SemiInner ℝ where
linearmap-category.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: linearmap-category-version: 0.3.4.0+version: 0.3.5.0 synopsis: Native, complete, matrix-free linear algebra. description: The term /numerical linear algebra/ is often used almost synonymous with /matrix modifications/. However, what's interesting@@ -48,14 +48,15 @@ Math.VectorSpace.Docile other-extensions: FlexibleInstances, UndecidableInstances, FunctionalDependencies, TypeOperators, TypeFamilies build-depends: base >=4.8 && <5,- vector-space >=0.11 && <0.12,+ vector-space >=0.11 && <0.13, constrained-categories >=0.3 && <0.4, containers, vector, tagged, free-vector-spaces >= 0.1.4 && < 0.2, linear, lens, transformers,- manifolds-core >= 0.4.4 && < 0.5,+ manifolds-core >= 0.4.4 && < 0.6, semigroups,- ieee754 >= 0.7 && < 0.9+ ieee754 >= 0.7 && < 0.9,+ call-stack -- hs-source-dirs: default-language: Haskell2010