File Exchange

image thumbnail

Matrix Permanent Using Recursion

version (19.6 KB) by Brian Butler
Computes the permanent of a matrix.


Updated 23 Nov 2016

View License

Computes the permanent of a matrix using recursion. The technique is known as "expansion by minors" or the Laplace expansion. Two versions are included:
1) The MATLAB language routine permanent_mat() is about 8 times faster than equivalent native MATLAB function by Xu plus it has some optimization for sparse matrices.

2) The C language routine permanent()uses the CMEX interface to integrate into MATLAB. It is more than 500 times faster than the native MATLAB function by Xu. Also, I have found it to be faster than more advanced algorithms when the matrix is very sparse. One optimization available in C is that the matrix is kept in-place, in memory. Thus, less memory in consumed and less time is spent copying the matrix.

Cite As

Brian Butler (2020). Matrix Permanent Using Recursion (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (1)


Updated title and description. Very small change to permanent_mat.m to make it cleaner.

Add support for rectangular matrices (more columns than rows).

Fixes to supplementary files; no change to CMEX.

updated requirements.

typo in description

Updated cover figure.

* Added support for complex input matrices.
* Error checking for non-numeric and sparse format inputs.
* Return a permanent of 1 for 0x0 (empty matrix) input.
* Supplemental: added equivalent MATLAB functions and further speedtesting.

Added description to front graphic,

Added a figure.

Made note of small memory requirement.

Edited description

MATLAB Release Compatibility
Created with R2016a
Compatible with any release
Platform Compatibility
Windows macOS Linux