"Fossies" - the Fresh Open Source Software Archive

Member "pari-2.13.1/src/functions/linear_algebra/matadjoint" (1 Nov 2020, 1134 Bytes) of package /linux/misc/pari-2.13.1.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "matadjoint": 2.13.0_vs_2.13.1.

    1 Function: matadjoint
    2 Section: linear_algebra
    3 C-Name: matadjoint0
    4 Prototype: GD0,L,
    5 Help: matadjoint(M,{flag=0}): adjoint matrix of M using Leverrier-Faddeev's
    6  algorithm. If flag is 1, compute the characteristic polynomial independently
    7  first.
    8 Doc:
    9  \idx{adjoint matrix} of $M$, i.e.~a matrix $N$
   10  of cofactors of $M$, satisfying $M*N=\det(M)*\Id$. $M$ must be a
   11  (not necessarily invertible) square matrix of dimension $n$.
   12  If $\fl$ is 0 or omitted, we try to use Leverrier-Faddeev's algorithm,
   13  which assumes that $n!$ invertible. If it fails or $\fl = 1$,
   14  compute $T = \kbd{charpoly}(M)$ independently first and return
   15  $(-1)^{n-1} (T(x)-T(0))/x$ evaluated at $M$.
   16  \bprog
   17  ? a = [1,2,3;3,4,5;6,7,8] * Mod(1,4);
   18  ? matadjoint(a)
   19  %2 =
   20  [Mod(1, 4) Mod(1, 4) Mod(2, 4)]
   21 
   22  [Mod(2, 4) Mod(2, 4) Mod(0, 4)]
   23 
   24  [Mod(1, 4) Mod(1, 4) Mod(2, 4)]
   25  @eprog\noindent
   26  Both algorithms use $O(n^4)$ operations in the base ring. Over a field,
   27  they are usually slower than computing the characteristic polynomial or
   28  the inverse of $M$ directly.
   29 Variant: Also available are
   30  \fun{GEN}{adj}{GEN x} (\fl=0) and
   31  \fun{GEN}{adjsafe}{GEN x} (\fl=1).