-- 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 Num with appropriate value types. -- Provides operations for addition, subtraction, element-wise -- multiplication (through Num), scalar multiplication (through -- VectorSpace), and dot product. @package vector-space-map @version 0.1.0.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 (Map.fromList [])
--   
-- -- * in the Num instance performs elementwise -- multiplication. It is defined in terms of <*> and -- therefore also operates under intersection: -- --
--   >>> (MapVector $ Map.fromList [("x", 2), ("y", 3)]) * (MapVector $ Map.fromList [("x", 5),("y", 7)])
--   MapVector (Map.fromList [("x", 10), ("y", 21)])
--   
-- --
--   >>> (MapVector $ Map.fromList [("x", 2), ("y", 3)]) * (MapVector $ Map.fromList [("y", 7)])
--   MapVector (Map.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, using either + or ^+^, 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 Typeable2 MapVector instance (Eq k, Eq v) => Eq (MapVector k v) instance Functor (MapVector k) instance (Show k, Show v) => Show (MapVector k v) instance (Ord k, Read k, Read v) => Read (MapVector k v) instance Foldable (MapVector k) instance Traversable (MapVector k) instance (Data k, Data v, Ord k) => Data (MapVector k v) instance (Ord k, AdditiveGroup v, Num v) => Num (MapVector k v) instance (Ord k, VectorSpace v, InnerSpace v, AdditiveGroup (Scalar v)) => InnerSpace (MapVector k v) instance (Ord k, VectorSpace v) => VectorSpace (MapVector k v) instance (AdditiveGroup v, Ord k) => AdditiveGroup (MapVector k v) instance Ord k => Applicative (MapVector k)