statistics-0.13.3.0: A library of statistical types, data, and functions

Copyright | (c) 2014 Bryan O'Sullivan
License | BSD3
Safe Haskell | None
Language | Haskell98

Statistics.Matrix.Mutable

Description

Basic mutable matrix operations.

Synopsis

- data MMatrix s = MMatrix !Int !Int !Int !(MVector s)
- type MVector s = MVector s Double
- replicate :: Int -> Int -> Double -> ST s (MMatrix s)
- thaw :: Matrix -> ST s (MMatrix s)
- bounds :: MMatrix s -> Int -> Int -> (MVector s -> Int -> r) -> r
- unsafeNew :: Int -> Int -> ST s (MMatrix s)
- unsafeFreeze :: MMatrix s -> ST s Matrix
- unsafeRead :: MMatrix s -> Int -> Int -> ST s Double
- unsafeWrite :: MMatrix s -> Int -> Int -> Double -> ST s ()
- unsafeModify :: MMatrix s -> Int -> Int -> (Double -> Double) -> ST s ()
- immutably :: NFData a => MMatrix s -> (Matrix -> a) -> ST s a
- unsafeBounds :: MMatrix s -> Int -> Int -> (MVector s -> Int -> r) -> r

# Documentation

data MMatrix s Source #

Two-dimensional mutable matrix, stored in row-major order.

Constructors

MMatrix !Int !Int !Int !(MVector s) |

type MVector s = MVector s Double Source #

replicate :: Int -> Int -> Double -> ST s (MMatrix s) Source #

thaw :: Matrix -> ST s (MMatrix s) Source #

bounds :: MMatrix s -> Int -> Int -> (MVector s -> Int -> r) -> r Source #

Given row and column numbers, calculate the offset into the flat row-major vector.

unsafeNew Source #

Arguments

:: Int | Number of row
-> Int | Number of columns
-> ST s (MMatrix s) |

Allocate new matrix. Matrix content is not initialized hence unsafe.

unsafeFreeze :: MMatrix s -> ST s Matrix Source #

unsafeRead :: MMatrix s -> Int -> Int -> ST s Double Source #

unsafeWrite :: MMatrix s -> Int -> Int -> Double -> ST s () Source #

unsafeModify :: MMatrix s -> Int -> Int -> (Double -> Double) -> ST s () Source #

immutably :: NFData a => MMatrix s -> (Matrix -> a) -> ST s a Source #

unsafeBounds :: MMatrix s -> Int -> Int -> (MVector s -> Int -> r) -> r Source #

Given row and column numbers, calculate the offset into the flat row-major vector, without checking.