Hoogle Search

Within LTS Haskell 24.58 (ghc-9.10.3)

Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.

  1. module Data.Matrix

    Matrix datatype and operations. Every provided example has been tested. Run cabal test for further tests.

  2. data Matrix a

    matrix Data.Matrix

    Type of matrices. Elements can be of any type. Rows and columns are indexed starting by 1. This means that, if m :: Matrix a and i,j :: Int, then m ! (i,j) is the element in the i-th row and j-th column of m.

  3. forceMatrix :: Matrix a -> Matrix a

    matrix Data.Matrix

    O(rows*cols). Similar to force. It copies the matrix content dropping any extra memory. Useful when using submatrix from a big matrix.

  4. getMatrixAsVector :: Matrix a -> Vector a

    matrix Data.Matrix

    O(rows*cols). Transform a Matrix to a Vector of size rows*cols. This is equivalent to get all the rows of the matrix using getRow and then append them, but far more efficient.

  5. matrix :: Int -> Int -> ((Int, Int) -> a) -> Matrix a

    matrix Data.Matrix

    O(rows*cols). Generate a matrix from a generator function. Example of usage:

    (  1  0 -1 -2 )
    (  3  2  1  0 )
    (  5  4  3  2 )
    matrix 4 4 $ \(i,j) -> 2*i - j = (  7  6  5  4 )
    

  6. minorMatrix :: Int -> Int -> Matrix a -> Matrix a

    matrix Data.Matrix

    O(rows*cols). Remove a row and a column from a matrix. Example:

    ( 1 2 3 )
    ( 4 5 6 )   ( 1 3 )
    minorMatrix 2 2 ( 7 8 9 ) = ( 7 9 )
    

  7. multStrassenMixed :: Num a => Matrix a -> Matrix a -> Matrix a

    matrix Data.Matrix

    Mixed Strassen's matrix multiplication.

  8. permMatrix :: Num a => Int -> Int -> Int -> Matrix a

    matrix Data.Matrix

    O(rows*cols). Permutation matrix.

    permMatrix n i j =
    i     j       n
    1 ( 1 0 ... 0 ... 0 ... 0 0 )
    2 ( 0 1 ... 0 ... 0 ... 0 0 )
    (     ...   ...   ...     )
    i ( 0 0 ... 0 ... 1 ... 0 0 )
    (     ...   ...   ...     )
    j ( 0 0 ... 1 ... 0 ... 0 0 )
    (     ...   ...   ...     )
    ( 0 0 ... 0 ... 0 ... 1 0 )
    n ( 0 0 ... 0 ... 0 ... 0 1 )
    
    When i == j it reduces to identity n.

  9. prettyMatrix :: Show a => Matrix a -> String

    matrix Data.Matrix

    Display a matrix as a String using the Show instance of its elements.

  10. scaleMatrix :: Num a => a -> Matrix a -> Matrix a

    matrix Data.Matrix

    Scale a matrix by a given factor. Example:

    ( 1 2 3 )   (  2  4  6 )
    ( 4 5 6 )   (  8 10 12 )
    scaleMatrix 2 ( 7 8 9 ) = ( 14 16 18 )
    

Page 181 of many | Previous | Next