algebra-4.3.1: Constructive abstract algebra

Numeric.Map

Synopsis

# Documentation

newtype Map r b a Source #

linear maps from elements of a free module to another free module over r

f $# x + y = (f$# x) + (f $# y) f$# (r .* x) = r .* (f $# x) Map r b a represents a linear mapping from a free module with basis a over r to a free module with basis b over r. Note well the reversed direction of the arrow, due to the contravariance of change of basis! This way enables we can employ arbitrary pure functions as linear maps by lifting them using arr, or build them by using the monad instance for Map r b. As a consequence Map is an instance of, well, almost everything. Constructors  Map ((a -> r) -> b -> r) Instances  MonadReader b (Map r b) Source # Methodsask :: Map r b b #local :: (b -> b) -> Map r b a -> Map r b a #reader :: (b -> a) -> Map r b a # RightModule r s => RightModule r (Map s b m) Source # Methods(*.) :: Map s b m -> r -> Map s b m Source # LeftModule r s => LeftModule r (Map s b m) Source # Methods(.*) :: r -> Map s b m -> Map s b m Source # Arrow (Map r) Source # Methodsarr :: (b -> c) -> Map r b c #first :: Map r b c -> Map r (b, d) (c, d) #second :: Map r b c -> Map r (d, b) (d, c) #(***) :: Map r b c -> Map r b' c' -> Map r (b, b') (c, c') #(&&&) :: Map r b c -> Map r b c' -> Map r b (c, c') # Monoidal r => ArrowZero (Map r) Source # MethodszeroArrow :: Map r b c # Monoidal r => ArrowPlus (Map r) Source # Methods(<+>) :: Map r b c -> Map r b c -> Map r b c # Source # Methodsleft :: Map r b c -> Map r (Either b d) (Either c d) #right :: Map r b c -> Map r (Either d b) (Either d c) #(+++) :: Map r b c -> Map r b' c' -> Map r (Either b b') (Either c c') #(|||) :: Map r b d -> Map r c d -> Map r (Either b c) d # Source # Methodsapp :: Map r (Map r b c, b) c # Category * (Map r) Source # Methodsid :: cat a a #(.) :: cat b c -> cat a b -> cat a c # Source # Methodso :: c j k1 -> c i j -> c i k1 # Monad (Map r b) Source # Methods(>>=) :: Map r b a -> (a -> Map r b b) -> Map r b b #(>>) :: Map r b a -> Map r b b -> Map r b b #return :: a -> Map r b a #fail :: String -> Map r b a # Functor (Map r b) Source # Methodsfmap :: (a -> b) -> Map r b a -> Map r b b #(<$) :: a -> Map r b b -> Map r b a # Applicative (Map r b) Source # Methodspure :: a -> Map r b a #(<*>) :: Map r b (a -> b) -> Map r b a -> Map r b b #liftA2 :: (a -> b -> c) -> Map r b a -> Map r b b -> Map r b c #(*>) :: Map r b a -> Map r b b -> Map r b b #(<*) :: Map r b a -> Map r b b -> Map r b a # Monoidal r => Alternative (Map r b) Source # Methodsempty :: Map r b a #(<|>) :: Map r b a -> Map r b a -> Map r b a #some :: Map r b a -> Map r b [a] #many :: Map r b a -> Map r b [a] # Monoidal r => MonadPlus (Map r b) Source # Methodsmzero :: Map r b a #mplus :: Map r b a -> Map r b a -> Map r b a # Monoidal r => Plus (Map r b) Source # Methodszero :: Map r b a # Additive r => Alt (Map r b) Source # Methods() :: Map r b a -> Map r b a -> Map r b a #some :: Applicative (Map r b) => Map r b a -> Map r b [a] #many :: Applicative (Map r b) => Map r b a -> Map r b [a] # Apply (Map r b) Source # Methods(<.>) :: Map r b (a -> b) -> Map r b a -> Map r b b #(.>) :: Map r b a -> Map r b b -> Map r b b #(<.) :: Map r b a -> Map r b b -> Map r b a # Bind (Map r b) Source # Methods(>>-) :: Map r b a -> (a -> Map r b b) -> Map r b b #join :: Map r b (Map r b a) -> Map r b a # Abelian s => Abelian (Map s b a) Source # Additive r => Additive (Map r b a) Source # Methods(+) :: Map r b a -> Map r b a -> Map r b a Source #sinnum1p :: Natural -> Map r b a -> Map r b a Source #sumWith1 :: Foldable1 f => (a -> Map r b a) -> f a -> Map r b a Source # Monoidal s => Monoidal (Map s b a) Source # Methodszero :: Map s b a Source #sinnum :: Natural -> Map s b a -> Map s b a Source #sumWith :: Foldable f => (a -> Map s b a) -> f a -> Map s b a Source # Coalgebra r m => Semiring (Map r b m) Source # Coalgebra r m => Multiplicative (Map r b m) Source # Methods(*) :: Map r b m -> Map r b m -> Map r b m Source #pow1p :: Map r b m -> Natural -> Map r b m Source #productWith1 :: Foldable1 f => (a -> Map r b m) -> f a -> Map r b m Source # Group s => Group (Map s b a) Source # Methods(-) :: Map s b a -> Map s b a -> Map s b a Source #negate :: Map s b a -> Map s b a Source #subtract :: Map s b a -> Map s b a -> Map s b a Source #times :: Integral n => n -> Map s b a -> Map s b a Source # CounitalCoalgebra r m => Unital (Map r b m) Source # Methodsone :: Map r b m Source #pow :: Map r b m -> Natural -> Map r b m Source #productWith :: Foldable f => (a -> Map r b m) -> f a -> Map r b m Source # (Commutative m, Coalgebra r m) => Commutative (Map r b m) Source # (Rig r, CounitalCoalgebra r m) => Rig (Map r b m) Source # MethodsfromNatural :: Natural -> Map r b m Source # (Ring r, CounitalCoalgebra r m) => Ring (Map r a m) Source # MethodsfromInteger :: Integer -> Map r a m Source # Coalgebra r m => RightModule (Map r b m) (Map r b m) Source # Methods(*.) :: Map r b m -> Map r b m -> Map r b m Source # Coalgebra r m => LeftModule (Map r b m) (Map r b m) Source # Methods(.*) :: Map r b m -> Map r b m -> Map r b m Source #

($@) :: Map r b a -> b -> Covector r a infixr 0 Source # extract a linear functional from a linear map multMap :: Coalgebra r c => Map r (c, c) c Source # comultMap :: Algebra r a => Map r a (a, a) Source # (inefficiently) combine a linear combination of basis vectors to make a map. arrMap :: (Monoidal r, Semiring r) => (b -> [(r, a)]) -> Map r b a arrMap f = Map$ k b -> sum [ r * k a | (r, a) <- f b ]

convolveMap :: (Algebra r a, Coalgebra r c) => Map r a c -> Map r a c -> Map r a c Source #

convolution given an associative algebra and coassociative coalgebra