Safe Haskell | None |
---|---|
Language | Haskell98 |
- data MMatrix s = MMatrix {}
- type IOMatrix = MMatrix RealWorld
- type STMatrix s = MMatrix s
- new :: PrimMonad m => Int -> Int -> m (MMatrix (PrimState m))
- replicate :: PrimMonad m => Int -> Int -> m (MMatrix (PrimState m))
- read :: PrimMonad m => MMatrix (PrimState m) -> Int -> Int -> m Double
- write :: PrimMonad m => MMatrix (PrimState m) -> Int -> Int -> Double -> m ()
- unsafeRead :: PrimMonad m => MMatrix (PrimState m) -> Int -> Int -> m Double
- unsafeWrite :: PrimMonad m => MMatrix (PrimState m) -> Int -> Int -> Double -> m ()
- set :: PrimMonad m => MMatrix (PrimState m) -> Double -> m ()
- copy :: PrimMonad m => MMatrix (PrimState m) -> MMatrix (PrimState m) -> m ()
- unsafeWith :: IOMatrix -> (CInt -> CInt -> Ptr CDouble -> IO a) -> IO a
Documentation
Mutable matrix. You can modify elements
Construction
new :: PrimMonad m => Int -> Int -> m (MMatrix (PrimState m)) Source
Create a mutable matrix of the given size and fill it with 0 as an initial value.
replicate :: PrimMonad m => Int -> Int -> m (MMatrix (PrimState m)) Source
Create a mutable matrix of the given size and fill it with as an initial value.
Accessing individual elements
read :: PrimMonad m => MMatrix (PrimState m) -> Int -> Int -> m Double Source
Yield the element at the given position.
write :: PrimMonad m => MMatrix (PrimState m) -> Int -> Int -> Double -> m () Source
Replace the element at the given position.
unsafeRead :: PrimMonad m => MMatrix (PrimState m) -> Int -> Int -> m Double Source
Yield the element at the given position. No bounds checks are performed.
unsafeWrite :: PrimMonad m => MMatrix (PrimState m) -> Int -> Int -> Double -> m () Source
Replace the element at the given position. No bounds checks are performed.
Modifying matrices
set :: PrimMonad m => MMatrix (PrimState m) -> Double -> m () Source
Set all elements of the matrix to the given value
copy :: PrimMonad m => MMatrix (PrimState m) -> MMatrix (PrimState m) -> m () Source
Copy a matrix. The two matrices must have the same length and may not overlap.