Function: matadjoint
Section: linear_algebra
C-Name: matadjoint0
Prototype: GD0,L,
Help: matadjoint(x,{flag=0}): adjoint matrix of x. If flag is 0 or omitted,
 n! must be invertible, where n is the dimension of the matrix. If flag is 1,
 uses a slower division-free algorithm.
Doc:
 \idx{adjoint matrix} of $x$, i.e.~the matrix $y$
 of cofactors of $x$, satisfying $x*y=\det(x)*\Id$. $x$ must be a
 (non-necessarily invertible) square matrix of dimension $n$.
 If $\fl$ is 0 or omitted, use a fast algorithm which assumes that $n!$ is
 invertible. If $\fl$ is 1, use a slower division-free algorithm.
 \bprog
 ? a = [1,2,3;3,4,5;6,7,8] * Mod(1,2);
 ? matadjoint(a)
  ***   at top-level: matadjoint([1,2,3;3,
  ***                 ^--------------------
  *** matadjoint: impossible inverse modulo: Mod(0, 2).
 ? matadjoint(a, 1)  \\ use safe algorithm
 %2 =
 [Mod(1, 2) Mod(1, 2) Mod(0, 2)]

 [Mod(0, 2) Mod(0, 2) Mod(0, 2)]

 [Mod(1, 2) Mod(1, 2) Mod(0, 2)]
 @eprog\noindent
 Both algorithms use $O(n^4)$ operations in the base ring.
Variant: Also available are
 \fun{GEN}{adj}{GEN x} (\fl=0) and
 \fun{GEN}{adjsafe}{GEN x} (\fl=1).


