SYNOPSIS
#include "matrix.h" PERM *px_ident(PERM *pi) PERM *px_mlt(PERM *pi1, PERM *pi2, PERM *out) PERM *px_inv(PERM *pi, PERM *out) PERM *px_transp(PERM *pi, int i, int j) int px_sign(PERM *pi)
DESCRIPTION
The routine px_ident() initialises pi to be the identity permutation of the size of pi->size on entry. The permutation pi is returned. If pi is NULL then an error is generated. The routine px_mlt() multiplies pi1 by pi2 to give out. If out is NULL or too small, then out is resized to be a permutation of the correct size. This cannot be done in situ. The routine px_inv() computes the inverse of the permutation pi. The result is stored in out. If out is NULL or is too small, a permutation of the correct size is created, which is returned. This can be done in situ\/ if pi == out. The routine px_transp() swaps pi->pe[i] and pi->pe[j]; it is a multiplication by the transposition $i\leftrightarrow j$. The routine px_sign(pi) computes the sign of the permutation pi. This sign is $(-1)^p$ where pi can be written as the product of $p$ permutations. This is done by sorting the entries of pi using quicksort, and counting the number of transpositions used. This is also the determinant of the permutation matrix represented by pi.
EXAMPLE
PERM *pi1, pi2, pi3; ...... pi1 = px_get(10); px_ident(pi1); /* sets pi1 to identity */ px_transp(pi1,3,5); /* pi1 is now a transposition */ px_inv(pi1,pi1); /* invert pi1 -- in situ */ px_mlt(pi1,pi2,pi3); /* pi3 = pi1.pi2 */ printf("sign(pi3) = px_sign(pi1)*px_sign(pi2), px_sign(pi3));
SOURCE FILE: pxop.c