License | GPL-3 |
---|---|
Safe Haskell | Safe |
Language | Haskell2010 |
An implementation of the cups of the category of matrices over an arbitary semiring. In this module we call "vector space" to what would be more generally a module over a semiring. The representation is done using sparse vectors that do not include the elements of the basis whose element is zero. |
Synopsis
- data Vectorspace u m = Vector (Map [u] m)
- sparse :: (Ord u, Eq u, Semiring m) => [([u], m)] -> Vectorspace u m
- fromList :: (Ord u, Eq u, Semiring m) => [([u], m)] -> Vectorspace u m
- fromMap :: Map [u] m -> Vectorspace u m
- toMap :: Vectorspace u m -> Map [u] m
- class (Eq m, Ord m) => Semiring m where
Documentation
data Vectorspace u m Source #
A vector is given internally by a map representing the coefficients of each basis element.
Instances
(Show m, Show u) => Show (Vectorspace u m) Source # | Shows the coefficients of the vector. |
Defined in Discokitty.Models.Vectorspaces showsPrec :: Int -> Vectorspace u m -> ShowS # show :: Vectorspace u m -> String # showList :: [Vectorspace u m] -> ShowS # | |
Dim (Vectorspace u m) Source # | |
Defined in Discokitty.Models.Vectorspaces dim :: Vectorspace u m -> Int Source # | |
(Ord u, Eq u, Semiring m) => HasCups (Vectorspace u m) Source # | |
Defined in Discokitty.Models.Vectorspaces cup :: Int -> Vectorspace u m -> Vectorspace u m -> Vectorspace u m Source # cunit :: Vectorspace u m Source # |
sparse :: (Ord u, Eq u, Semiring m) => [([u], m)] -> Vectorspace u m Source #
Creates a sparse vector from a list of basis elements multiplied by scalars.
fromMap :: Map [u] m -> Vectorspace u m Source #
Creates a sparse vector from a map assigning a scalar to each base element.
toMap :: Vectorspace u m -> Map [u] m Source #
Outputs a map assigning to each base element its coefficient.