Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- _perm_init :: CLong -> IO (Ptr CLong)
- _perm_clear :: Ptr CLong -> IO ()
- _perm_set :: Ptr CLong -> Ptr CLong -> CLong -> IO ()
- _perm_set_one :: Ptr CLong -> CLong -> IO ()
- _perm_inv :: Ptr CLong -> Ptr CLong -> CLong -> IO ()
- _perm_compose :: Ptr CLong -> Ptr CLong -> Ptr CLong -> CLong -> IO ()
- _perm_power :: Ptr CLong -> Ptr CLong -> CLong -> CLong -> IO ()
- _perm_randtest :: Ptr CLong -> CLong -> Ptr CFRandState -> IO CInt
- _perm_print :: Ptr CLong -> CLong -> IO CInt
- _perm_print_pretty :: Ptr CLong -> CLong -> IO CInt
- _perm_fprint_pretty :: Ptr CFile -> Ptr CLong -> CLong -> IO ()
- _perm_get_str_pretty :: Ptr CLong -> CLong -> IO CString
- _perm_order :: Ptr CFmpz -> Ptr CLong -> CLong -> IO ()
- _perm_parity :: Ptr CLong -> CLong -> IO CInt
- _perm_mat :: Ptr CFmpzMat -> Ptr CLong -> CLong -> IO ()
Permutations
Assignment
_perm_set :: Ptr CLong -> Ptr CLong -> CLong -> IO () Source #
_perm_set res vec n
Sets the permutation res
to the same as the permutation vec
.
_perm_set_one :: Ptr CLong -> CLong -> IO () Source #
_perm_set_one vec n
Sets the permutation to the identity permutation.
_perm_inv :: Ptr CLong -> Ptr CLong -> CLong -> IO () Source #
_perm_inv res vec n
Sets res
to the inverse permutation of vec
. Allows aliasing of res
and vec
.
Composition
_perm_compose :: Ptr CLong -> Ptr CLong -> Ptr CLong -> CLong -> IO () Source #
_perm_compose res vec1 vec2 n
Forms the composition \(\pi_1 \circ \pi_2\) of two permutations \(\pi_1\) and \(\pi_2\). Here, \(\pi_2\) is applied first, that is, \((\pi_1 \circ \pi_2)(i) = \pi_1(\pi_2(i))\).
Allows aliasing of res
, vec1
and vec2
.
Randomisation
_perm_randtest :: Ptr CLong -> CLong -> Ptr CFRandState -> IO CInt Source #
_perm_randtest vec n state
Generates a random permutation vector of length \(n\) and returns its parity, 0 or 1.
This function uses the Knuth shuffle algorithm to generate a uniformly random permutation without retries.
Input and output
_perm_print :: Ptr CLong -> CLong -> IO CInt Source #
_perm_print vec n
Prints the permutation vector of length \(n\) to stdout
.
_perm_print_pretty :: Ptr CLong -> CLong -> IO CInt Source #
_perm_print_pretty vec n
Prints permutation vector of length \(n\) in cycle representation
to stdout
.
_perm_fprint_pretty :: Ptr CFile -> Ptr CLong -> CLong -> IO () Source #
_perm_fprint_pretty vec n
Prints permutation vector of length \(n\) in cycle representation
to file
.
_perm_get_str_pretty :: Ptr CLong -> CLong -> IO CString Source #
_perm_get_str_pretty vec n
Return a string representation of permutation vector of length \(n\) in cycle representation.