Permanent of (0,1) Matrix using Kallman in CMEX

Versión 1.2 (26.8 KB) por Brian Butler
Computes the permanent of a (0,1) matrix.
176 descargas
Actualizado 16 Oct 2020

Ver licencia

Computes the permanent of a (0,1) matrix. This implementation is in CMEX (C language for MATLAB) and is often faster than my implementation in CMEX of the Laplace expansion algorithm for matrix order, n >= 6. The latter uses recursion and has an optimization for sparse matrices. This contribution, "permKallman", is an implementation of Ralph Kallman's algorithm (1982) which applies only to (0,1) matrices. The matrices do not have to be square; in this implementation, the m-by-n input matrix is required to satisfy m <= n <= 64. Usage of this algorithm is advantageous when the matrix is sparse. In limited testing on sparse square (0,1) matrices, we found our Nijenhuis-Wilf implementation to be faster when the column weight was greater than 4 and Kallman's algorithm to be faster when the column weight was less than 4. When m > 27 and the column weight was 3, this algorithm was 1000x (or more) faster than Nijenhuis-Wilf. (See the speed testing results provided in PDF format.)
---Overflow---
All internal calculations are always carried out using uint64 values, exactly. There are no approximations and no rounding, internally. However, there is no overflow detection on the uint64 calculations! The final result is returned in the class specified and overflow and rounding warnings are provided only at this final step.

---Tested Using---
MATLAB 2015b on Windows7 using MinGW-w64 64-bit compiler (gcc 4.9.2; This compiler package is the default add-on for MATLAB 2015b.)
MATLAB 2008b on Windows7 using Microsoft Visual C++ 2008 Express Edition SP1
Failed to compile using Lcc-win32 2.4.1 (This compiler is included with MATLAB 2009a.)

Citar como

Brian Butler (2024). Permanent of (0,1) Matrix using Kallman in CMEX (https://www.mathworks.com/matlabcentral/fileexchange/53860-permanent-of-0-1-matrix-using-kallman-in-cmex), MATLAB Central File Exchange. Recuperado .

Compatibilidad con la versión de MATLAB
Se creó con R2016a
Compatible con cualquier versión
Compatibilidad con las plataformas
Windows macOS Linux
Categorías
Más información sobre Sparse Matrices en Help Center y MATLAB Answers.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Versión Publicado Notas de la versión
1.2

Fixed compile-time errors having to do with stricmp() which is no longer supported by gcc.

1.1.0.0

* Compiled and tested using Microsoft Visual C 2008. Minor change.

1.0.0.0

* typos
* Added a figure. (I keep forgetting the figure)