Class NaivePermanent

  • All Implemented Interfaces:

    
    public final class NaivePermanent
    extends PermSolver
                        

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

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      Unit compute() Compute the permanent or approximation for the given matrix.
      • Methods inherited from class jline.lib.perm.PermSolver

        getMatrix, getMemory, getN, getTime, getValue, setMemory, setTime, setValue, solve
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • NaivePermanent

        NaivePermanent(Matrix matrix, Boolean solve)
        Parameters:
        matrix - The matrix for which to compute the exact permanent
        solve - Whether to automatically run solve() after construction (default: false)
    • Method Detail

      • compute

         Unit compute()

        Compute 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 property.