\\% Permanent of a matrix. \\ Author: Joerg Arndt \\ License: GPL version 3 or later \\ online at http://www.jjj.de/pari/ \\ version: 2011-January-19 (12:49) matperm(M)= { local(n, ret, pm); n = matsize(M)[1]; if ( n!=matsize(M)[2], error("matperm: M must be square matrix.") ); ret = 0; for (k=0, n!-1, pm = numtoperm(n, k); ret += prod(j=1,n, M[j, pm[j] ]) ); return(ret); } /* ----- */ \\ ==== end of file ====