module Sym.Perm.Group
(
compose
, act
) where
import Sym.Perm
import Foreign
import Foreign.C.Types
import System.IO.Unsafe
marshal :: (Ptr CLong -> Ptr CLong -> CLong -> Ptr CLong -> CLong -> IO ())
-> Perm -> Perm -> Perm
marshal op u v =
unsafePerformIO $
unsafeWith u $ \u' ->
unsafeWith v $ \v' -> do
let k = size u
let n = size v
let m = max k n
unsafeNew m $ \p -> op p u' (fromIntegral k) v' (fromIntegral n)
foreign import ccall unsafe "group.h compose" c_compose
:: Ptr CLong -> Ptr CLong -> CLong -> Ptr CLong -> CLong -> IO ()
compose :: Perm -> Perm -> Perm
compose = marshal c_compose
foreign import ccall unsafe "group.h act" c_act
:: Ptr CLong -> Ptr CLong -> CLong -> Ptr CLong -> CLong -> IO ()
act :: Perm -> Perm -> Perm
act = marshal c_act