LATS-0.4.1: Linear Algebra on Typed Spaces

Safe HaskellNone
LanguageHaskell2010

LinearAlgebra.TypedSpaces.Matrix

Synopsis

Documentation

newtype Matrix i j a Source

Constructors

Matrix 

Fields

matrix :: Matrix a
 

Instances

CFunctor (Matrix i j) Source 
(Isomorphism Int i, Isomorphism Int j) => CIndexed (Matrix i j) (i, j) Source 
(Show a, Element a) => Show (Matrix i j a) Source 
type CFun (Matrix i j) a = (Container Matrix a, Storable a, Num a) Source 

class Storable a

The member functions of this class facilitate writing values of primitive types to raw memory (which may have been allocated with the above mentioned routines) and reading values from blocks of raw memory. The class, furthermore, includes support for computing the storage requirements and alignment restrictions of storable types.

Memory addresses are represented as values of type Ptr a, for some a which is an instance of class Storable. The type argument to Ptr helps provide some valuable type safety in FFI code (you can't mix pointers of different types without an explicit cast), while helping the Haskell type system figure out which marshalling method is needed for a given pointer.

All marshalling between Haskell and a foreign language ultimately boils down to translating Haskell data structures into the binary representation of a corresponding data structure of the foreign language and vice versa. To code this marshalling in Haskell, it is necessary to manipulate primitive data types stored in unstructured memory blocks. The class Storable facilitates this manipulation on all types for which it is instantiated, which are the standard basic types of Haskell, the fixed size Int types (Int8, Int16, Int32, Int64), the fixed size Word types (Word8, Word16, Word32, Word64), StablePtr, all types from Foreign.C.Types, as well as Ptr.

Minimal complete definition

sizeOf, alignment, (peek | peekElemOff | peekByteOff), (poke | pokeElemOff | pokeByteOff)

class Storable a => Element a

Supported matrix elements.

Minimal complete definition

constantD, extractR, setRect, sortI, sortV, compareV, selectV, remapM, rowOp, gemm

class (Numeric t, Convert t, Normed Matrix t, Normed Vector t, Floating t, Linear t Vector, Linear t Matrix, Additive (Vector t), Additive (Matrix t), (~) * (RealOf t) Double) => Field t

Generic linear algebra functions for double precision real and complex matrices.

(Single precision data can be converted using single and double).

Minimal complete definition

svd', thinSVD', sv', luPacked', luSolve', mbLinearSolve', linearSolve', cholSolve', ldlPacked', ldlSolve', linearSolveSVD', linearSolveLS', eig', eigSH'', eigOnly, eigOnlySH, cholSH', mbCholSH', qr', qrgr', hess', schur'

rows :: Matrix i j a -> Int Source

cols :: Matrix i j a -> Int Source

fromRows :: Element a => [Vector j a] -> Matrix i j a Source

toRows :: Element a => Matrix i j a -> [Vector j a] Source

fromColumns :: Element a => [Vector i a] -> Matrix i j a Source

toColumns :: Element a => Matrix i j a -> [Vector i a] Source

takeRows :: Element a => Int -> Matrix i j a -> Matrix i j a Source

takeColumns :: Element a => Int -> Matrix i j a -> Matrix i j a Source

tr :: Transposable (Matrix a) (Matrix a) => Matrix i j a -> Matrix j i a Source

newtype Sparse i j a Source

Constructors

Sparse 

Fields

sparse :: [((Int, Int), a)]
 

Instances

Show a => Show (Sparse i j a) Source 

addToSparse :: (Isomorphism Int i, Isomorphism Int j) => ((i, j), a) -> Sparse i j a -> Sparse i j a Source

(<.>) :: Numeric a => Vector i a -> Vector i a -> a infixr 8 Source

(#>) :: Numeric a => Matrix i j a -> Vector j a -> Vector i a infixr 8 Source

(<#) :: Numeric a => Vector i a -> Matrix i j a -> Vector j a infixl 8 Source

(#) :: Numeric a => Matrix i j a -> Matrix j k a -> Matrix i k a infixr 8 Source

inv :: Field a => Matrix i j a -> Matrix j i a Source

pinv :: Field a => Matrix i j a -> Matrix j i a Source