FLINT3.7.0-dev

gr_mat_permute_rows, gr_mat_permute_rows_inv, gr_mat_permute_cols, gr_mat_permute_cols_inv

Synopsis#include <flint/gr_mat.h>
int gr_mat_permute_rows(gr_mat_t mat, slong * perm_store, const slong * perm_act, gr_ctx_t ctx)source
int gr_mat_permute_rows_inv(gr_mat_t mat, slong * perm_store, const slong * perm_act, gr_ctx_t ctx)source
int gr_mat_permute_cols(gr_mat_t mat, slong * perm_store, const slong * perm_act, gr_ctx_t ctx)source
int gr_mat_permute_cols_inv(gr_mat_t mat, slong * perm_store, const slong * perm_act, gr_ctx_t ctx)source

Permute the rows (columns) by perm_act, or by its inverse for the inv versions, and apply the same permutation to perm_store if it is not NULL. gr_mat_permute_rows moves row perm_act[i] to row i (and perm_store[perm_act[i]] to perm_store[i]); the inv version moves row i to row perm_act[i], without computing the inverse permutation. perm_store and perm_act may be the same array.

Swapping rows with gr_mat_swap_rows and gr_mat_invert_rows while recording the swaps in a permutation that starts as the identity, and then calling gr_mat_permute_rows_inv with that permutation, restores the original matrix (and likewise for columns).

Cite this page

The FLINT team, “gr_mat_permute_rows, gr_mat_permute_rows_inv, gr_mat_permute_cols, gr_mat_permute_cols_inv (gr_mat.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/gr_mat/gr_mat_permute_rows.html (generated 2026-10-20).