Package it.unimi.dsi.sux4j.mph.solve
Class Modulo2System.Modulo2Equation
java.lang.Object
it.unimi.dsi.sux4j.mph.solve.Modulo2System.Modulo2Equation
- Enclosing class:
- Modulo2System
An equation on F2.
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionModulo2Equation
(long c, int numVars) Creates a new equation.protected
Modulo2Equation
(Modulo2System.Modulo2Equation equation) -
Method Summary
Modifier and TypeMethodDescriptionadd
(int variable) Adds a new variable.void
add
(Modulo2System.Modulo2Equation equation) Add another equation to this equation.copy()
boolean
int
hashCode()
boolean
boolean
static long
scalarProduct
(long[] bits, long[] values) Returns the modulo-2 scalar product of the two provided bit vectors.toString()
void
Updates the information contained infirstVar
.int[]
Returns an array containing the variables in increasing order.
-
Field Details
-
bitVector
The 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_VALUE
if 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
public int 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
x
and {code y}.
-
toString
-
copy
-