-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | vector-space operations for finite maps using Data.Map -- -- Data.Map.Vector provides MapVector, a wrapper around -- Map from containers which supports constant maps, -- i.e. maps containing only one value. This allows an identity under -- intersection and an Applicative instance. It also has -- instances of AdditiveGroup, VectorSpace, -- InnerSpace, and HasBasis with appropriate value -- types. Provides operations for addition, subtraction, element-wise -- operations (through Applicative), scalar multiplication -- (through VectorSpace), and dot product. Also consider Conal -- Elliott's total-map package. @package vector-space-map @version 0.2.1.1 module Data.Map.Vector -- | Note: <*> in the Applicative instance operates -- under intersection. i.e.: -- --
--   >>> (MapVector $ Map.fromList [("x", id)]) <*> (MapVector $ Map.fromList [("y", 3)])
--   MapVector (fromList [])
--   
-- -- Use the Applicative instance for elementwise operations: -- --
--   >>> liftA2 (*) (MapVector $ Map.fromList [("x", 2), ("y", 3)]) (MapVector $ Map.fromList [("x", 5),("y", 7)])
--   MapVector (fromList [("x",10),("y",21)])
--   
-- --
--   >>> liftA2 (*) (MapVector $ Map.fromList [("x", 2), ("y", 3)]) (MapVector $ Map.fromList [("y", 7)])
--   MapVector (fromList [("y",21)])
--   
-- -- *^ in the VectorSpace instance multiplies by the scalar -- of v. Nesting MapVectors preserves the scalar type, e.g. Scalar -- (MapVector k (MapVector k' v)) = Scalar v. -- --
--   >>> 2 *^ (ConstantMap $ MapVector $ Map.fromList [("x", 3 :: Int), ("y", 5)])
--   ConstantMap (MapVector (fromList [("x",6),("y",10)]))
--   
-- -- Finally, <.> in InnerSpace is the dot-product -- operator. Again, it operates under intersection. -- --
--   >>> (MapVector $ Map.fromList [("x", 2 :: Int), ("y", 3)]) <.> (MapVector $ Map.fromList [("x", 5),("y", 7)])
--   31
--   
-- --
--   >>> (pure . MapVector $ Map.fromList [("x", 2 :: Int), ("y", 3)]) <.> (MapVector $ Map.fromList [("a", pure (5::Int))])
--   25
--   
-- -- Addition with ^+^ operates under union. data MapVector k v MapVector :: (Map k v) -> MapVector k v -- | An infinite-dimensional vector with the same value on all dimensions ConstantMap :: v -> MapVector k v instance (Data.Data.Data k, Data.Data.Data v, GHC.Classes.Ord k) => Data.Data.Data (Data.Map.Vector.MapVector k v) instance Data.Traversable.Traversable (Data.Map.Vector.MapVector k) instance Data.Foldable.Foldable (Data.Map.Vector.MapVector k) instance (GHC.Classes.Ord k, GHC.Read.Read k, GHC.Read.Read v) => GHC.Read.Read (Data.Map.Vector.MapVector k v) instance (GHC.Show.Show k, GHC.Show.Show v) => GHC.Show.Show (Data.Map.Vector.MapVector k v) instance GHC.Base.Functor (Data.Map.Vector.MapVector k) instance (GHC.Classes.Eq k, GHC.Classes.Eq v) => GHC.Classes.Eq (Data.Map.Vector.MapVector k v) instance GHC.Base.Semigroup (Data.Map.Vector.MapVector k v) instance (GHC.Classes.Ord k, GHC.Base.Monoid v) => GHC.Base.Monoid (Data.Map.Vector.MapVector k v) instance GHC.Classes.Ord k => GHC.Base.Applicative (Data.Map.Vector.MapVector k) instance (Data.AdditiveGroup.AdditiveGroup v, GHC.Classes.Ord k) => Data.AdditiveGroup.AdditiveGroup (Data.Map.Vector.MapVector k v) instance (GHC.Classes.Ord k, Data.VectorSpace.VectorSpace v) => Data.VectorSpace.VectorSpace (Data.Map.Vector.MapVector k v) instance (GHC.Classes.Ord k, Data.VectorSpace.VectorSpace v, Data.VectorSpace.InnerSpace v, Data.AdditiveGroup.AdditiveGroup (Data.VectorSpace.Scalar v)) => Data.VectorSpace.InnerSpace (Data.Map.Vector.MapVector k v) instance (GHC.Classes.Ord k, Data.Basis.HasBasis v, Data.AdditiveGroup.AdditiveGroup (Data.VectorSpace.Scalar v)) => Data.Basis.HasBasis (Data.Map.Vector.MapVector k v)