|
SSJ V. 2.6.2. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object umontreal.iro.lecuyer.util.BitMatrix
public class BitMatrix
This class implements matrices of bits of arbitrary dimensions. Basic facilities for bits operations, multiplications and exponentiations are provided.
Nested Class Summary | |
---|---|
class |
BitMatrix.IncompatibleDimensionException
Runtime exception raised when the dimensions of the BitMatrix are not appropriate for the operation. |
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
BitMatrix |
and(BitMatrix that)
Returns the BitMatrix resulting from the application of the and operator on the original BitMatrix and that. |
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. |
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. |
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. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
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 copyMethod Detail |
---|
public Object clone()
clone
in class Object
public boolean equals(BitMatrix that)
that
- the BitMatrix to compare
public 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 Object
public 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 bit
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 boolean
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 operator
BitMatrix.IncompatibleDimensionException
- if the two BitMatrix are
not of the same dimensionspublic BitMatrix or(BitMatrix that)
that
- the second operand of the or operator
BitMatrix.IncompatibleDimensionException
- if the two BitMatrix are
not of the same dimensionspublic BitMatrix xor(BitMatrix that)
that
- the second operand of the xor operator
BitMatrix.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 multiply
public 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 multiply
public BitMatrix multiply(BitMatrix that)
that
- the other BitMatrix to multiply
BitMatrix.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 BitMatrix
BitMatrix.IncompatibleDimensionException
- if the BitMatrix
is not square
IllegalArgumentException
- if p is negativepublic BitMatrix power2e(int e)
e
- the exponent of the power up to which to raise the BitMatrix
BitMatrix.IncompatibleDimensionException
- if the BitMatrix is
not square
|
SSJ V. 2.6.2. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |