Class Modulo2System.Modulo2Equation
java.lang.Object
it.unimi.dsi.sux4j.mph.solve.Modulo2System.Modulo2Equation
- Enclosing class:
Modulo2System
An equation on F2.
- Author:
- Sebastiano Vigna
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionModulo2Equation(long c, int numVars) Creates a new equation.protectedModulo2Equation(Modulo2System.Modulo2Equation equation) -
Method Summary
Modifier and TypeMethodDescriptionadd(int variable) Adds a new variable.voidadd(Modulo2System.Modulo2Equation equation) Add another equation to this equation.copy()booleaninthashCode()booleanbooleanstatic longscalarProduct(long[] bits, long[] values) Returns the modulo-2 scalar product of the two provided bit vectors.toString()voidUpdates the information contained infirstVar.int[]Returns an array containing the variables in increasing order.
-
Field Details
-
bitVector
protected final it.unimi.dsi.bits.LongArrayBitVector bitVectorThe vector representing the coefficients (one bit for each variable). -
bits
protected final long[] bitsThebv.bits(), cached. -
c
protected long cThe constant term. -
firstVar
protected int firstVarThe first variable. It isInteger.MAX_VALUEif the first variable is not known. This field must be updated byupdateFirstVar()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
-
-
Method Details
-
add
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
Add another equation to this equation.- Parameters:
equation- an equation.
-
updateFirstVar
public void updateFirstVar()Updates the information contained infirstVar. -
isUnsolvable
public boolean isUnsolvable() -
isIdentity
public boolean isIdentity() -
hashCode
-
equals
-
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
xand {code y}.
-
toString
-
copy
-