Class FrobeniusSolver

  • All Implemented Interfaces:

    public final class FrobeniusSolverextends Objectimplements OutputPort<int[]>
    Solves system of Frobenius equations.

    Example: This gives all solutions of the system of Frobenius equations { 12 x + 16 y + 20 z + 27 t = 123, x + 3 z = 12}:

     int[][] equations = {{12, 16, 20, 27, 123}, {1, 0, 3, 0, 12}}; FrobeniusSolver solver = new FrobeniusSolver(equations); int[] solution; while ((solution = solver.take()) != null)      System.out.println(Arrays.toString(solution)); 

    This class calculates solutions iteratively: method take() calculates and returns the next solution or null, if no more solutions exist. So next solution will be calculated only on the invocation of take().

    • Constructor Detail

      • FrobeniusSolver

        public FrobeniusSolver(int[]... equations)
        Constructs solver from the given system of equations (see class documentation for example).
        equations - system of Frobenius equations
        IllegalArgumentException - if equations have different lengths
        IllegalArgumentException - if some coefficient is negative
    • Method Detail

      • take

        public int[] take()
        Calculates and returns the next solution or null if no more solutions exist.
        Specified by:
        take in interface OutputPort<int[]>
        the next solution or null if no more solutions exist

SCaVis 2.2 © jWork.ORG