sized-types-0.5.0: Sized types in Haskell using the GHC Nat kind.

Data.Sized.Sparse.Matrix

Description

Sparse Matrix.

Maintainer: Andy Gill andygill@ku.edu Stability: unstable Portability: ghc

Synopsis

# Documentation

data SpMatrix ix a Source

Constructors

 SpMatrix a (Map ix a)

Instances

 Functor (SpMatrix ix) (Bounded i, Ix i) => Applicative (SpMatrix i) (Show a, Show ix, Bounded ix, Ix ix) => Show (SpMatrix ix a)

fromAssocList :: (Ord i, Eq a) => a -> [(i, a)] -> SpMatrix i a Source

toAssocList :: SpMatrix i a -> (a, [(i, a)]) Source

getElem :: Ord ix => SpMatrix ix a -> ix -> a Source

`getElem` looks up an element in the sparse matrix. If the element is not found in the sparse matrix, `getElem` returns the default value.

fill :: (Bounded ix, Ix ix) => SpMatrix ix a -> Matrix ix a Source

prune :: (Bounded ix, Ix ix, Eq a) => a -> SpMatrix ix a -> SpMatrix ix a Source

sparse :: (Bounded ix, Ix ix, Eq a) => a -> Matrix ix a -> SpMatrix ix a Source

Make a Matrix sparse, with a default `zero` value.

mm :: (Bounded m, Ix m, Bounded n, Ix n, Bounded m', Ix m', Bounded n', Ix n', n ~ m', Num a, Eq a) => SpMatrix (m, n) a -> SpMatrix (m', n') a -> SpMatrix (m, n') a Source

rowSets :: (Bounded a, Ix a, Ord b) => Set (a, b) -> Matrix a (Set b) Source

columnSets :: (Bounded b, Ix b, Ord a) => Set (a, b) -> Matrix b (Set a) Source

transpose :: (Bounded x, Ix x, Bounded y, Ix y, Eq a) => SpMatrix (x, y) a -> SpMatrix (y, x) a Source

zipWith :: (Bounded x, Ix x) => (a -> b -> c) -> SpMatrix x a -> SpMatrix x b -> SpMatrix x c Source