Computing the permanent

Last updated

In linear algebra, the computation of the permanent of a matrix is a problem that is thought to be more difficult than the computation of the determinant of a matrix despite the apparent similarity of the definitions.

Contents

The permanent is defined similarly to the determinant, as a sum of products of sets of matrix entries that lie in distinct rows and columns. However, where the determinant weights each of these products with a ±1 sign based on the parity of the set, the permanent weights them all with a +1 sign.

While the determinant can be computed in polynomial time by Gaussian elimination, it is generally believed that the permanent cannot be computed in polynomial time. In computational complexity theory, a theorem of Valiant states that computing permanents is #P-hard, and even #P-complete for matrices in which all entries are 0 or 1 Valiant (1979). This puts the computation of the permanent in a class of problems believed to be even more difficult to compute than NP. It is known that computing the permanent is impossible for logspace-uniform ACC0 circuits.( Allender & Gore 1994 )

The development of both exact and approximate algorithms for computing the permanent of a matrix is an active area of research.

Definition and naive algorithm

The permanent of an n-by-n matrix A = (ai,j) is defined as

The sum here extends over all elements σ of the symmetric group Sn, i.e. over all permutations of the numbers 1, 2, ..., n. This formula differs from the corresponding formula for the determinant only in that, in the determinant, each product is multiplied by the sign of the permutation σ while in this formula each product is unsigned. The formula may be directly translated into an algorithm that naively expands the formula, summing over all permutations and within the sum multiplying out each matrix entry. This requires n!n arithmetic operations.

Ryser formula

The best known [1] general exact algorithm is due to H. J.Ryser  ( 1963 ). Ryser's method is based on an inclusion–exclusion formula that can be given [2] as follows: Let be obtained from A by deleting k columns, let be the product of the row-sums of , and let be the sum of the values of over all possible . Then

It may be rewritten in terms of the matrix entries as follows [3]

Ryser's formula can be evaluated using arithmetic operations, or by processing the sets in Gray code order. [4]

Balasubramanian–Bax–Franklin–Glynn formula

Another formula that appears to be as fast as Ryser's (or perhaps even twice as fast) is to be found in the two Ph.D. theses; see ( Balasubramanian 1980 ), ( Bax 1998 ); also ( Bax & Franklin 1996 ). The methods to find the formula are quite different, being related to the combinatorics of the Muir algebra, and to finite difference theory respectively. Another way, connected with invariant theory is via the polarization identity for a symmetric tensor ( Glynn 2010 ). The formula generalizes to infinitely many others, as found by all these authors, although it is not clear if they are any faster than the basic one. See ( Glynn 2013 ).

The simplest known formula of this type (when the characteristic of the field is not two) is

where the outer sum is over all vectors .

Special cases

Planar and K3,3-free

The number of perfect matchings in a bipartite graph is counted by the permanent of the graph's biadjacency matrix, and the permanent of any 0-1 matrix can be interpreted in this way as the number of perfect matchings in a graph. For planar graphs (regardless of bipartiteness), the FKT algorithm computes the number of perfect matchings in polynomial time by changing the signs of a carefully chosen subset of the entries in the Tutte matrix of the graph, so that the Pfaffian of the resulting skew-symmetric matrix (the square root of its determinant) is the number of perfect matchings. This technique can be generalized to graphs that contain no subgraph homeomorphic to the complete bipartite graph K3,3. [5]

George Pólya had asked the question [6] of when it is possible to change the signs of some of the entries of a 01 matrix A so that the determinant of the new matrix is the permanent of A. Not all 01 matrices are "convertible" in this manner; in fact it is known (Marcus & Minc (1961)) that there is no linear map such that for all matrices . The characterization of "convertible" matrices was given by Little (1975) who showed that such matrices are precisely those that are the biadjacency matrix of bipartite graphs that have a Pfaffian orientation: an orientation of the edges such that for every even cycle for which has a perfect matching, there are an odd number of edges directed along C (and thus an odd number with the opposite orientation). It was also shown that these graphs are exactly those that do not contain a subgraph homeomorphic to , as above.

Computation modulo a number

Modulo 2, the permanent is the same as the determinant, as It can also be computed modulo in time for . However, it is UP-hard to compute the permanent modulo any number that is not a power of 2. Valiant (1979)

There are various formulae given by Glynn (2010) for the computation modulo a prime p. First, there is one using symbolic calculations with partial derivatives.

Second, for p = 3 there is the following formula for an n×n-matrix , involving the matrix's principal minors (Kogan (1996)):

where is the submatrix of induced by the rows and columns of indexed by , and is the complement of in , while the determinant of the empty submatrix is defined to be 1.

The expansion above can be generalized in an arbitrary characteristic p as the following pair of dual identities:

where in both formulas the sum is taken over all the (p − 1)-tuples that are partitions of the set into p − 1 subsets, some of them possibly empty.

The former formula possesses an analog for the hafnian of a symmetric and an odd p:

with the sum taken over the same set of indexes. Moreover, in characteristic zero a similar convolution sum expression involving both the permanent and the determinant yields the Hamiltonian cycle polynomial (defined as where is the set of n-permutations having only one cycle):

In characteristic 2 the latter equality turns into what therefore provides an opportunity to polynomial-time calculate the Hamiltonian cycle polynomial of any unitary (i.e. such that where is the identity n×n-matrix), because each minor of such a matrix coincides with its algebraic complement: where is the identity n×n-matrix with the entry of indexes 1,1 replaced by 0. Moreover, it may, in turn, be further generalized for a unitary n×n-matrix as where is a subset of {1, ..., n}, is the identity n×n-matrix with the entries of indexes k,k replaced by 0 for all k belonging to , and we define where is the set of n-permutations whose each cycle contains at least one element of .

This formula also implies the following identities over fields of characteristic 3:

for any invertible

for any unitary , that is, a square matrix such that where is the identity matrix of the corresponding size,

where is the matrix whose entries are the cubes of the corresponding entries of .

It was also shown (Kogan (1996)) that, if we define a square matrix as k-semi-unitary when , the permanent of a 1-semi-unitary matrix is computable in polynomial time over fields of characteristic 3, while for k > 1 the problem becomes #3-P-complete. (A parallel theory concerns the Hamiltonian cycle polynomial in characteristic 2: while computing it on the unitary matrices is polynomial-time feasible, the problem is #2-P-complete for the k-semi-unitary ones for any k > 0). The latter result was essentially extended in 2017 (Knezevic & Cohen (2017)) and it was proven that in characteristic 3 there is a simple formula relating the permanents of a square matrix and its partial inverse (for and being square, being invertible):

and it allows to polynomial-time reduce the computation of the permanent of an n×n-matrix with a subset of k or k − 1 rows expressible as linear combinations of another (disjoint) subset of k rows to the computation of the permanent of an (nk)×(nk)- or (nk + 1)×(nk + 1)-matrix correspondingly, hence having introduced a compression operator (analogical to the Gaussian modification applied for calculating the determinant) that "preserves" the permanent in characteristic 3. (Analogically, it would be worth noting that the Hamiltonian cycle polynomial in characteristic 2 does possess its invariant matrix compressions as well, taking into account the fact that ham(A) = 0 for any n×n-matrix A having three equal rows or, if n > 2, a pair of indexes i,j such that its i-th and j-th rows are identical and its i-th and j-th columns are identical too.) The closure of that operator defined as the limit of its sequential application together with the transpose transformation (utilized each time the operator leaves the matrix intact) is also an operator mapping, when applied to classes of matrices, one class to another. While the compression operator maps the class of 1-semi-unitary matrices to itself and the classes of unitary and 2-semi-unitary ones, the compression-closure of the 1-semi-unitary class (as well as the class of matrices received from unitary ones through replacing one row by an arbitrary row vector — the permanent of such a matrix is, via the Laplace expansion, the sum of the permanents of 1-semi-unitary matrices and, accordingly, polynomial-time computable) is yet unknown and tensely related to the general problem of the permanent's computational complexity in characteristic 3 and the chief question of P versus NP: as it was shown in (Knezevic & Cohen (2017)), if such a compression-closure is the set of all square matrices over a field of characteristic 3 or, at least, contains a matrix class the permanent's computation on is #3-P-complete (like the class of 2-semi-unitary matrices) then the permanent is computable in polynomial time in this characteristic.

Besides, the problem of finding and classifying any possible analogs of the permanent-preserving compressions existing in characteristic 3 for other prime characteristics was formulated (Knezevic & Cohen (2017)), while giving the following identity for an n×n matrix and two n-vectors (having all their entries from the set {0, ..., p − 1}) and such that , valid in an arbitrary prime characteristic p:

where for an n×m-matrix , an n-vector and an m-vector , both vectors having all their entries from the set {0, ..., p − 1}, denotes the matrix received from via repeating times its i-th row for i = 1, ..., n and times its j-th column for j = 1, ..., m (if some row's or column's multiplicity equals zero it would mean that the row or column was removed, and thus this notion is a generalization of the notion of submatrix), and denotes the n-vector all whose entries equal unity. This identity is an exact analog of the classical formula expressing a matrix's minor through a minor of its inverse and hence demonstrates (once more) a kind of duality between the determinant and the permanent as relative immanants. (Actually its own analogue for the hafnian of a symmetric and an odd prime p is ).

And, as an even wider generalization for the partial inverse case in a prime characteristic p, for , being square, being invertible and of size x, and , there holds also the identity

where the common row/column multiplicity vectors and for the matrix generate the corresponding row/column multiplicity vectors and , s,t = 1,2, for its blocks (the same concerns 's partial inverse in the equality's right side).

Approximate computation

When the entries of A are nonnegative, the permanent can be computed approximately in probabilistic polynomial time, up to an error of εM, where M is the value of the permanent and ε > 0 is arbitrary. In other words, there exists a fully polynomial-time randomized approximation scheme (FPRAS) (Jerrum, Sinclair & Vigoda (2001)).

The most difficult step in the computation is the construction of an algorithm to sample almost uniformly from the set of all perfect matchings in a given bipartite graph: in other words, a fully polynomial almost uniform sampler (FPAUS). This can be done using a Markov chain Monte Carlo algorithm that uses a Metropolis rule to define and run a Markov chain whose distribution is close to uniform, and whose mixing time is polynomial.

It is possible to approximately count the number of perfect matchings in a graph via the self-reducibility of the permanent, by using the FPAUS in combination with a well-known reduction from sampling to counting due to Jerrum, Valiant & Vazirani (1986). Let denote the number of perfect matchings in . Roughly, for any particular edge in , by sampling many matchings in and counting how many of them are matchings in , one can obtain an estimate of the ratio . The number is then , where can be approximated by applying the same method recursively.

Another class of matrices for which the permanent is of particular interest, is the positive-semidefinite matrices. [7] Using a technique of Stockmeyer counting, they can be computed within the class , but this is considered an infeasible class in general. It is NP-hard to approximate permanents of PSD matrices within a subexponential factor, and it is conjectured to be -hard [8] If further constraints on the spectrum are imposed, there are more efficient algorithms known. One randomized algorithm is based on the model of boson sampling and it uses the tools proper to quantum optics, to represent the permanent of positive-semidefinite matrices as the expected value of a specific random variable. The latter is then approximated by its sample mean. [9] This algorithm, for a certain set of positive-semidefinite matrices, approximates their permanent in polynomial time up to an additive error, which is more reliable than that of the standard classical polynomial-time algorithm by Gurvits. [10]

Notes

  1. As of 2008, see Rempała & Wesolowski (2008)
  2. van Lint & Wilson (2001) p. 99
  3. CRC Concise Encyclopedia of Mathematics
  4. Nijenhuis & Wilf (1978)
  5. Little (1974), Vazirani (1988)
  6. Pólya (1913), Reich (1971)
  7. See open problem (4) at Shtetl Optimized: Introducing some British people to P vs. NP, 22 July 2015
  8. Meiburg, Alexander (2023), "Inapproximability of Positive Semidefinite Permanents and Quantum State Tomography", Algorithmica , 85 (12): 3828–3854, arXiv: 2111.03142 , doi: 10.1007/s00453-023-01169-1
  9. Chakhmakhchyan, Levon; Cerf, Nicolas; Garcia-Patron, Raul (2017), "A quantum-inspired algorithm for estimating the permanent of positive semidefinite matrices", Phys. Rev. A, 96 (2): 022329, arXiv: 1609.02416 , Bibcode:2017PhRvA..96b2329C, doi:10.1103/PhysRevA.96.022329, S2CID   54194194
  10. Gurvits, Leonid (2005), "On the complexity of mixed discriminants and related problems", Mathematical Foundations of Computer Science 2005, Lecture Notes in Computer Science, vol. 3618, pp. 447–458, doi:10.1007/11549345_39, ISBN   978-3-540-28702-5

Related Research Articles

In mathematics, the determinant is a scalar value that is a certain function of the entries of a square matrix. The determinant of a matrix A is commonly denoted det(A), det A, or |A|. Its value characterizes some properties of the matrix and the linear map represented, on a given basis, by the matrix. In particular, the determinant is nonzero if and only if the matrix is invertible and the corresponding linear map is an isomorphism. The determinant of a product of matrices is the product of their determinants.

<span class="mw-page-title-main">Pauli matrices</span> Matrices important in quantum mechanics and the study of spin

In mathematical physics and mathematics, the Pauli matrices are a set of three 2 × 2 complex matrices that are Hermitian, involutory and unitary. Usually indicated by the Greek letter sigma, they are occasionally denoted by tau when used in connection with isospin symmetries.

In linear algebra, the trace of a square matrix A, denoted tr(A), is defined to be the sum of elements on the main diagonal of A. The trace is only defined for a square matrix.

<span class="mw-page-title-main">Square matrix</span> Matrix with the same number of rows and columns

In mathematics, a square matrix is a matrix with the same number of rows and columns. An n-by-n matrix is known as a square matrix of order . Any two square matrices of the same order can be added and multiplied.

<span class="mw-page-title-main">Cayley–Hamilton theorem</span> Every square matrix over a commutative ring satisfies its own characteristic equation

In linear algebra, the Cayley–Hamilton theorem states that every square matrix over a commutative ring satisfies its own characteristic equation.

<span class="mw-page-title-main">Unitary group</span> Group of unitary matrices

In mathematics, the unitary group of degree n, denoted U(n), is the group of n × n unitary matrices, with the group operation of matrix multiplication. The unitary group is a subgroup of the general linear group GL(n, C). Hyperorthogonal group is an archaic name for the unitary group, especially over finite fields. For the group of unitary matrices with determinant 1, see Special unitary group.

<span class="mw-page-title-main">Special unitary group</span> Group of unitary matrices with determinant of 1

In mathematics, the special unitary group of degree n, denoted SU(n), is the Lie group of n × n unitary matrices with determinant 1.

In linear algebra, the adjugate of a square matrix A is the transpose of its cofactor matrix and is denoted by adj(A). It is also occasionally known as adjunct matrix, or "adjoint", though the latter term today normally refers to a different concept, the adjoint operator which for a matrix is the conjugate transpose.

In linear algebra, the permanent of a square matrix is a function of the matrix similar to the determinant. The permanent, as well as the determinant, is a polynomial in the entries of the matrix. Both are special cases of a more general function of a matrix called the immanant.

In linear algebra, an n-by-n square matrix A is called invertible if there exists an n-by-n square matrix B such that

In linear algebra, the characteristic polynomial of a square matrix is a polynomial which is invariant under matrix similarity and has the eigenvalues as roots. It has the determinant and the trace of the matrix among its coefficients. The characteristic polynomial of an endomorphism of a finite-dimensional vector space is the characteristic polynomial of the matrix of that endomorphism over any base. The characteristic equation, also known as the determinantal equation, is the equation obtained by equating the characteristic polynomial to zero.

In linear algebra, a Householder transformation is a linear transformation that describes a reflection about a plane or hyperplane containing the origin. The Householder transformation was used in a 1958 paper by Alston Scott Householder.

In numerical analysis, one of the most important problems is designing efficient and stable algorithms for finding the eigenvalues of a matrix. These eigenvalue algorithms may also find eigenvectors.

In mathematics, the determinant of an m×m skew-symmetric matrix can always be written as the square of a polynomial in the matrix entries, a polynomial with integer coefficients that only depends on m. When m is odd, the polynomial is zero. When m is even, it is a nonzero polynomial of degree m/2, and is unique up to multiplication by ±1. The convention on skew-symmetric tridiagonal matrices, given below in the examples, then determines one specific polynomial, called the Pfaffian polynomial. The value of this polynomial, when applied to the entries of a skew-symmetric matrix, is called the Pfaffian of that matrix. The term Pfaffian was introduced by Cayley, who indirectly named them after Johann Friedrich Pfaff.

<span class="mw-page-title-main">Euler's rotation theorem</span> Movement with a fixed point is rotation

In geometry, Euler's rotation theorem states that, in three-dimensional space, any displacement of a rigid body such that a point on the rigid body remains fixed, is equivalent to a single rotation about some axis that runs through the fixed point. It also means that the composition of two rotations is also a rotation. Therefore the set of rotations has a group structure, known as a rotation group.

In linear algebra, it is often important to know which vectors have their directions unchanged by a given linear transformation. An eigenvector or characteristic vector is such a vector. Thus an eigenvector of a linear transformation is scaled by a constant factor when the linear transformation is applied to it: . The corresponding eigenvalue, characteristic value, or characteristic root is the multiplying factor .

In mathematics, the resultant of two polynomials is a polynomial expression of their coefficients that is equal to zero if and only if the polynomials have a common root, or, equivalently, a common factor. In some older texts, the resultant is also called the eliminant.

In matrix calculus, Jacobi's formula expresses the derivative of the determinant of a matrix A in terms of the adjugate of A and the derivative of A.

<span class="mw-page-title-main">Faddeev–LeVerrier algorithm</span>

In mathematics, the Faddeev–LeVerrier algorithm is a recursive method to calculate the coefficients of the characteristic polynomial of a square matrix, A, named after Dmitry Konstantinovich Faddeev and Urbain Le Verrier. Calculation of this polynomial yields the eigenvalues of A as its roots; as a matrix polynomial in the matrix A itself, it vanishes by the Cayley–Hamilton theorem. Computing the characteristic polynomial directly from the definition of the determinant is computationally cumbersome insofar as it introduces a new symbolic quantity ; by contrast, the Faddeev-Le Verrier algorithm works directly with coefficients of matrix .

In mathematics, the Hamiltonian cycle polynomial of an n×n-matrix is a polynomial in its entries, defined as

References

Further reading