eigen-1.2.1: Eigen C++ library (linear algebra: matrices, vectors, numerical solvers).

Safe HaskellNone
LanguageHaskell98

Data.Eigen.Matrix.Mutable

Contents

Synopsis

Documentation

data MMatrix s Source

Mutable matrix. You can modify elements

Constructors

MMatrix 

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.

Raw pointers

unsafeWith :: IOMatrix -> (CInt -> CInt -> Ptr CDouble -> IO a) -> IO a Source

Pass a pointer to the matrix's data to the IO action. Modifying data through the pointer is unsafe if the matrix could have been frozen before the modification.