public class BitMatrix
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable
| Modifier and Type | Class and Description |
|---|---|
class |
BitMatrix.IncompatibleDimensionException
Runtime exception raised when the dimensions of the
BitMatrix are not appropriate for the operation.
|
| Constructor and Description |
|---|
BitMatrix(BitMatrix that)
Copy constructor.
|
BitMatrix(BitVector[] rows)
Creates a new BitMatrix using the data in rows.
|
BitMatrix(int[][] data,
int r,
int c)
Creates a new BitMatrix with r rows and c
columns using the data in data.
|
BitMatrix(int r,
int c)
Creates a new BitMatrix with r rows and
c columns filled with 0's.
|
| Modifier and Type | Method and Description |
|---|---|
BitMatrix |
and(BitMatrix that)
Returns the BitMatrix resulting from the application of
the and operator on the original BitMatrix and that.
|
java.lang.Object |
clone()
Creates a copy of the BitMatrix.
|
boolean |
equals(BitMatrix that)
Verifies that this and that are strictly
identical.
|
boolean |
getBool(int row,
int column)
Returns the value of the bit in the specified row and column.
|
BitMatrix |
multiply(BitMatrix that)
Multiplies two BitMatrix's together.
|
BitVector |
multiply(BitVector vect)
Multiplies the column
BitVector by a BitMatrix
and returns the result. |
int |
multiply(int vect)
Multiplies vect, seen as a column
BitVector, by
a BitMatrix. |
BitMatrix |
not()
Returns the BitMatrix resulting from the application of
the not operator on the original BitMatrix.
|
int |
numColumns()
Returns the number of columns of the BitMatrix.
|
int |
numRows()
Returns the number of rows of the BitMatrix.
|
BitMatrix |
or(BitMatrix that)
Returns the BitMatrix resulting from the application of
the or operator on the original BitMatrix and that.
|
BitMatrix |
power(long p)
Raises the BitMatrix to the power p.
|
BitMatrix |
power2e(int e)
Raises the BitMatrix to power
2e.
|
java.lang.String |
printData()
Creates a
String containing all the data of
the BitMatrix. |
void |
setBool(int row,
int column,
boolean value)
Changes the value of the bit in the specified row and column.
|
java.lang.String |
toString()
Creates a
String containing all the data of
the BitMatrix. |
BitMatrix |
transpose()
Returns the transposed matrix.
|
BitMatrix |
xor(BitMatrix that)
Returns the BitMatrix resulting from the application of
the xor operator on the original BitMatrix and that.
|
public BitMatrix(int r,
int c)
r - the number of rowsc - the number of columnspublic BitMatrix(BitVector[] rows)
BitVector will be one of the rows of the
BitMatrix.rows - the rows of the new BitMatrixpublic BitMatrix(int[][] data,
int r,
int c)
BitVector.
This does mean that the first bit is the lowest order bit of the last
int in the row and the last bit is the highest order bit of the
first int int the row.data - the data of the new BitMatrixr - the number of rowsc - the number of columnspublic BitMatrix(BitMatrix that)
that - the BitMatrix to copypublic java.lang.Object clone()
clone in class java.lang.Objectpublic boolean equals(BitMatrix that)
that - the BitMatrix to comparepublic java.lang.String toString()
String containing all the data of
the BitMatrix. The result is displayed in a matrix form, with
each row being put on a different line. Note that the bit at (0,0) is
at the upper left of the matrix, while the bit at (0) in a
BitVector is the least significant bit.toString in class java.lang.Objectpublic java.lang.String printData()
String containing all the data of
the BitMatrix. The data is displayed in the same format as are the
int[][] in Java code. This allows the user to print the
representation of a BitMatrix to be put, directly in the source
code, in the constructor BitMatrix(int[][], int, int). The output
is not designed to be human-readable.public int numRows()
public int numColumns()
public boolean getBool(int row,
int column)
row - the row of the selected bitcolumn - the column of the selected bitjava.lang.IndexOutOfBoundsException - if the selected bit would
be outside the BitMatrixpublic void setBool(int row,
int column,
boolean value)
row - the row of the selected bitcolumn - the column of the selected bitvalue - the new value of the bit as a booleanjava.lang.IndexOutOfBoundsException - if the selected bit would
be outside the BitMatrixpublic BitMatrix transpose()
public BitMatrix not()
public BitMatrix and(BitMatrix that)
that - the second operand of the and operatorBitMatrix.IncompatibleDimensionException - if the two BitMatrix are
not of the same dimensionspublic BitMatrix or(BitMatrix that)
that - the second operand of the or operatorBitMatrix.IncompatibleDimensionException - if the two BitMatrix are
not of the same dimensionspublic BitMatrix xor(BitMatrix that)
that - the second operand of the xor operatorBitMatrix.IncompatibleDimensionException - if the two BitMatrix are
not of the same dimensionspublic BitVector multiply(BitVector vect)
BitVector by a BitMatrix
and returns the result. The result is
A×v, where A is the
BitMatrix, and v is the BitVector.vect - the vector to multiplypublic int multiply(int vect)
BitVector, by
a BitMatrix. (See BitVector to see the conversion between
int and BitVector.) The result is
A×v,
where A is the BitMatrix, and v is the BitVector.vect - the vector to multiplypublic BitMatrix multiply(BitMatrix that)
that - the other BitMatrix to multiplyBitMatrix.IncompatibleDimensionException - if the number of columns
of the first BitMatrix is not equal to the number of rows of
the second BitMatrixpublic BitMatrix power(long p)
p - the power up to which to raise the BitMatrixBitMatrix.IncompatibleDimensionException - if the BitMatrix
is not squarejava.lang.IllegalArgumentException - if p is negativepublic BitMatrix power2e(int e)
e - the exponent of the power up to which to raise the BitMatrixBitMatrix.IncompatibleDimensionException - if the BitMatrix is
not squareTo submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.