Class Modulo2System.Modulo2Equation

  • Enclosing class:
    Modulo2System

    public static class Modulo2System.Modulo2Equation
    extends java.lang.Object
    An equation on F2.
    • Field Detail

      • bitVector

        protected final it.unimi.dsi.bits.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 Detail

      • Modulo2Equation

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

      • add

        public Modulo2System.Modulo2Equation add​(int variable)
        Adds a new variable.
        Parameters:
        variable - a variable.
        Returns:
        this equation.
        Throws:
        java.lang.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.
      • 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 java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.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 java.lang.String toString()
        Overrides:
        toString in class java.lang.Object