Class Permanent

  • All Implemented Interfaces:

    
    public final class Permanent
    extends PermSolver
                        

    Implementation of the MATLAB perm.m permanent computation algorithm.

    This implementation mirrors the MATLAB perm.m function which computes the permanent of a matrix by applying computational savings when some rows or columns are repeated. It uses the inclusion-exclusion principle with multiplicities to efficiently handle matrices with duplicate rows or columns.

    The algorithm:

    • Detects and counts repeated columns/rows

    • Uses inclusion-exclusion with multinomial coefficients

    • Applies pprod iterator for generating all combinations

    • 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

      • Permanent

        Permanent(Matrix matrix, Boolean solve)
        Parameters:
        matrix - The matrix for which to compute the 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.