packages feed

chemical-equation-0.0: src/FLINT/MatrixInteger.hs

{-# LANGUAGE ForeignFunctionInterface #-}
module FLINT.MatrixInteger where

import qualified FLINT.Integer as Fmpz
import qualified FLINT.Type as FLINT

import qualified Foreign.C.Types as C
import Foreign.C.Types (CLong)
import Foreign.Ptr (Ptr)



foreign import ccall "flint/fmpz_mat.h fmpz_mat_init"
   init :: Ptr FLINT.Matrix -> CLong -> CLong -> IO ()

foreign import ccall "flint/fmpz_mat.h fmpz_mat_clear"
   clear :: Ptr FLINT.Matrix -> IO ()

foreign import ccall "flint/fmpz_mat.h fmpz_mat_entry"
   entry :: Ptr FLINT.Matrix -> CLong -> CLong -> IO (Ptr FLINT.Integer)

foreign import ccall "flint/fmpz_mat.h fmpz_mat_nrows"
   nrows :: Ptr FLINT.Matrix -> IO C.CLong

foreign import ccall "flint/fmpz_mat.h fmpz_mat_ncols"
   ncols :: Ptr FLINT.Matrix -> IO C.CLong

foreign import ccall "flint/fmpz_mat.h fmpz_mat_zero"
   zero :: Ptr FLINT.Matrix -> IO ()

foreign import ccall "flint/fmpz_mat.h fmpz_mat_nullspace"
   nullspace :: Ptr FLINT.Matrix -> Ptr FLINT.Matrix -> IO CLong


set_si :: Ptr FLINT.Matrix -> CLong -> CLong -> CLong -> IO ()
set_si mat i j x = do
   ptr <- entry mat i j
   Fmpz.set_si ptr x