Class Modulo2System.Modulo2Equation

java.lang.Object
it.unimi.dsi.sux4j.mph.solve.Modulo2System.Modulo2Equation
Enclosing class:
Modulo2System

public static class Modulo2System.Modulo2Equation extends Object
An equation on F2.
  • Field Details

    • bitVector

      protected final LongArrayBitVector bitVector
      The vector representing the coefficients (one bit for each variable).
    • bits

      protected final long[] bits
      The bv.bits(), cached.
    • c

      protected long c
      The constant term.
    • firstVar

      protected int firstVar
      The first variable. It is Integer.MAX_VALUE if the first variable is not known. This field must be updated by updateFirstVar() to be meaningful.
  • Constructor Details

    • Modulo2Equation

      public Modulo2Equation(long c, int numVars)
      Creates a new equation.
      Parameters:
      c - the constant term.
      numVars - the number of variables.
    • Modulo2Equation

      protected Modulo2Equation(Modulo2System.Modulo2Equation equation)
  • Method Details

    • add

      public Modulo2System.Modulo2Equation add(int variable)
      Adds a new variable.
      Parameters:
      variable - a variable.
      Returns:
      this equation.
      Throws:
      IllegalStateException - if you try to add twice the same variable.
    • variables

      public int[] variables()
      Returns an array containing the variables in increasing order.

      Mainly for debugging purposes.

      Returns:
      an array containing the variables in increasing order.
    • add

      public void add(Modulo2System.Modulo2Equation equation)
      Add another equation to this equation.
      Parameters:
      equation - an equation.
    • updateFirstVar

      public void updateFirstVar()
      Updates the information contained in firstVar.
    • isUnsolvable

      public boolean isUnsolvable()
    • isIdentity

      public boolean isIdentity()
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • scalarProduct

      public static long scalarProduct(long[] bits, long[] values)
      Returns the modulo-2 scalar product of the two provided bit vectors.
      Parameters:
      bits - a bit vector represented as an array of longs.
      values - an array of long representing the 64-bit values associated with each variable.
      Returns:
      the modulo-2 scalar product of x and {code y}.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • copy