hmatrix-0.15.2.1: Linear algebra and numerical computation

Safe HaskellNone
LanguageHaskell98

Data.Packed.Foreign

Description

FFI and hmatrix helpers.

Sample usage, to upload a perspective matrix to a shader.

 glUniformMatrix4fv 0 1 (fromIntegral gl_TRUE) `appMatrix` perspective 0.01 100 (pi/2) (4/3) 

Synopsis

Documentation

app :: (a -> b) -> a -> b infixl 1 Source

Only useful since it is left associated with a precedence of 1, unlike $, which is right associative. e.g.

someFunction
    `appMatrixLen` m
    `appVectorLen` v
    `app` other
    `app` arguments
    `app` go here

One could also write:

(someFunction 
    `appMatrixLen` m
    `appVectorLen` v) 
    other 
    arguments 
    (go here)

appVector :: Storable a => (Ptr a -> b) -> Vector a -> b infixl 1 Source

appVectorLen :: Storable a => (CInt -> Ptr a -> b) -> Vector a -> b Source

appMatrix :: Element a => (Ptr a -> b) -> Matrix a -> b infixl 1 Source

appMatrixLen :: Element a => (CInt -> CInt -> Ptr a -> b) -> Matrix a -> b Source

appMatrixRaw :: Storable a => (Ptr a -> b) -> Matrix a -> b infixl 1 Source

appMatrixRawLen :: Element a => (CInt -> CInt -> Ptr a -> b) -> Matrix a -> b Source

unsafeMatrixToVector :: Matrix a -> Vector a Source

This will disregard the order of the matrix, and simply return it as-is. If the order of the matrix is RowMajor, this function is identical to flatten.