Class RyzerPermanent

  • All Implemented Interfaces:

    
    public final class RyzerPermanent
    extends PermSolver
                        

    Implementation of Ryzer's algorithm to calculate the permanent.

    Ryzer's algorithm computes the permanent using the inclusion-exclusion principle. This implementation provides two modes:

    • Gray code version: Uses Gray code ordering for efficient bit manipulation (default)

    • Naive version: Direct implementation using combinations

    The Gray code version is generally more efficient as it incrementally updates row sums rather than recomputing them for each subset.

    • 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

      • RyzerPermanent

        RyzerPermanent(Matrix matrix, String mode, Boolean solve)
        Parameters:
        matrix - The matrix for which to compute the permanent
        mode - The algorithm mode: "graycode" (default) or "naive"
        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.