Package jline.lib.perm
Class NaivePermanent
java.lang.Object
jline.lib.perm.PermSolver
jline.lib.perm.NaivePermanent
Implementation of the naive exact permanent computation.
This solver computes the exact permanent of a matrix by iterating over all
possible permutations and summing the products of matrix elements according
to each permutation. While this gives the exact result, it has O(n!) complexity
and is only practical for small matrices.
The permanent of an n×n matrix A is defined as:
perm(A) = Σ_π ∏_{i=1}^n a_{i,π(i)}
where the sum is over all permutations π of {1,2,...,n}.
-
Constructor Details
-
NaivePermanent
-
NaivePermanent
-
-
Method Details
-
compute
public void compute()Description copied from class:PermSolverCompute the permanent or approximation for the given matrix. This method must be implemented by all concrete solver classes. The result should be stored in the value field.- Specified by:
computein classPermSolver
-