HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

Modulematrices-0.5.0Haskell2010

Data.Matrix

Contents
  1. Accessors
  2. length information
  3. Indexing
  4. Construction
  5. Conversions
  6. Mapping
  7. Monadic mapping
  8. Zipping
  9. Monadic Zipping
  10. Unzipping
  11. Monadic sequencing
  12. Mutable matrix
Synopsis
  • Packagematrices-0.5.0
  • Exports69
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceMatrix.hs

Accessors

length information

Indexing

Construction

valuefromLists :: Context a => [[a]] -> Matrix a

O(m*n) Create matrix from list of lists, it doesn't check if the list of list is a valid matrix

Conversions

valuetoList :: Context a => Matrix a -> [a]

O(m*n) Create a list by concatenating rows

valuediag
  1. :: (Context a, Num a, Foldable t)
  2. => t a

    diagonal

  3. -> Matrix a

O(m*n) Create a square matrix with given diagonal, other entries default to 0

valuediagRect
  1. :: (Context a, Foldable t)
  2. => a

    default value

  3. -> (Int, Int)
  4. -> t a

    diagonal

  5. -> Matrix a

O(m*n) Create a rectangular matrix with default values and given diagonal

valuefoldl :: Context b => (a -> b -> a) -> a -> Matrix b -> a
#

Mapping

Monadic mapping

valueimapM
  1. :: (Context a, Context b, Monad m)
  2. => (Int, Int) -> a -> m b
  3. -> Matrix a
  4. -> m (Matrix b)

O(m*n) Apply the monadic action to every element and its index, yielding a matrix of results.

valueimapM_
  1. :: (Context a, Monad m)
  2. => (Int, Int) -> a -> m b
  3. -> Matrix a
  4. -> m ()

O(m*n) Apply the monadic action to every element and its index, ignoring the results.

Zipping

Monadic Zipping

Unzipping

Monadic sequencing

Mutable matrix