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

版本 1.2 (26.8 KB) 作者: Brian Butler
Computes the permanent of a (0,1) matrix.
179.0 次下载
更新时间 2020/10/16

查看许可证

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.)

引用格式

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. 检索时间: .

MATLAB 版本兼容性
创建方式 R2016a
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Sparse Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
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)