hmatrix-0.15.2.1: Linear algebra and numerical computation

Safe HaskellNone

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 -> bSource

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 -> bSource

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

appMatrix :: Element a => (Ptr a -> b) -> Matrix a -> bSource

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

appMatrixRaw :: Storable a => (Ptr a -> b) -> Matrix a -> bSource

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

unsafeMatrixToVector :: Matrix a -> Vector aSource

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.