.. java:import:: fr.inria.tapenade.representation TapEnv BoolMatrix ========== .. java:package:: fr.inria.tapenade.utils :noindex: .. java:type:: public class BoolMatrix A matrix of booleans internally stored as an array of BoolVector's (i.e. bit sets). Use conventions to reduce storage: "implicit-zero": \ ``rows == null``\ means matrix is full of "false" "implicit-identity": \ ``rows[i] == null``\ means row i is an "identity" row. Fields ------ nCols ^^^^^ .. java:field:: public int nCols :outertype: BoolMatrix The number of columns of this matrix. nRows ^^^^^ .. java:field:: public int nRows :outertype: BoolMatrix The number of rows of this matrix. rows ^^^^ .. java:field:: public BoolVector[] rows :outertype: BoolMatrix The contents of the matrix, internally stored as an array of BoolVector's, one per row. Constructors ------------ BoolMatrix ^^^^^^^^^^ .. java:constructor:: public BoolMatrix(int rowNumber, int colNumber) :outertype: BoolMatrix Creates a new BoolMatrix of size "rowNumber" times "colNumber". This matrix is initially empty, using "implicit-zero" convention. BoolMatrix ^^^^^^^^^^ .. java:constructor:: public BoolMatrix(boolean sparse, int rowNumber, int colNumber) :outertype: BoolMatrix Methods ------- copy ^^^^ .. java:method:: public BoolMatrix copy() :outertype: BoolMatrix Create a copy of this matrix. cumulOr ^^^^^^^ .. java:method:: public final void cumulOr(BoolMatrix orMatrix, boolean explicitIdentities, int len) :outertype: BoolMatrix OR-accumulates "orMatrix" into this BoolMatrix. Does something reasonable when the sizes of matrices differ. Takes care of NOT using the dangling bits in the last number of each row of "orMatrix". Tries to preserve the "implicit-zero" and "implicit-identity" conventions. :param orMatrix: The BoolMatrix that must be OR-accumulated into this BoolMatrix. :param explicitIdentities: false when expliciting of identity is already done (e.g. for pointers). :param len: Unless equals -1, restricts this accumulation to the "len" first rows. cumulOrTimes ^^^^^^^^^^^^ .. java:method:: protected void cumulOrTimes(BoolMatrix leftMatrix, BoolMatrix rightMatrix) :outertype: BoolMatrix Matrix multiplication into a cumulative matrix. Multiplies the "leftMatrix" with the "rightMatrix", and accumulates the result with a "or" into "this" BoolMatrix. Takes care of preserving the "implicit-identity" convention. cumulRows ^^^^^^^^^ .. java:method:: public final void cumulRows(TapIntList rowIndices, BoolVector orVector) :outertype: BoolMatrix dump ^^^^ .. java:method:: public void dump() throws java.io.IOException :outertype: BoolMatrix Prints in detail the contents of this BoolMatrix, onto TapEnv.curOutputStream(). dump ^^^^ .. java:method:: public void dump(int[] rowMap, int[] colMap) throws java.io.IOException :outertype: BoolMatrix Prints in detail the contents of this BoolMatrix, onto TapEnv.curOutputStream(), knowing the Maps of its rows and columns. :param rowMap: the map of the rows of this BoolMatrix :param colMap: the map of the columns of this BoolMatrix. equalsBoolMatrix ^^^^^^^^^^^^^^^^ .. java:method:: public final boolean equalsBoolMatrix(BoolMatrix otherMatrix) :outertype: BoolMatrix :return: true when this BoolMatrix is equal to "otherMatrix". equalsBoolMatrix ^^^^^^^^^^^^^^^^ .. java:method:: public final boolean equalsBoolMatrix(BoolMatrix otherMatrix, int nrows, int ncols) :outertype: BoolMatrix :return: true when this BoolMatrix is equal to "otherMatrix", on their upper-left square of size "nrows" by "ncols". get ^^^ .. java:method:: public final boolean get(int i, int j) :outertype: BoolMatrix :return: the (i,j) element of this BoolMatrix. getExplicitRow ^^^^^^^^^^^^^^ .. java:method:: public final BoolVector getExplicitRow(int i) :outertype: BoolMatrix Same as getRow(), but when the row found is implicit-identity (i.e. null), returns a new explicit identity row. getImplicitIdentityIndices ^^^^^^^^^^^^^^^^^^^^^^^^^^ .. java:method:: public final TapIntList getImplicitIdentityIndices() :outertype: BoolMatrix :return: the TapIntList of the row indices that are Implicit-Identity. getNCols ^^^^^^^^ .. java:method:: public final int getNCols() :outertype: BoolMatrix :return: the number of columns of this matrix. getNRows ^^^^^^^^ .. java:method:: public final int getNRows() :outertype: BoolMatrix :return: the number of rows of this matrix. getRow ^^^^^^ .. java:method:: public final BoolVector getRow(int i) :outertype: BoolMatrix :return: the i-th row of this BoolMatrix. If rows==null, returns a new empty row. isImplicitIdentityRow ^^^^^^^^^^^^^^^^^^^^^ .. java:method:: public final boolean isImplicitIdentityRow(int i) :outertype: BoolMatrix :return: true if the row "i" of this BoolMatrix is implicitly identity, i.e. using the "implicit-identity" convention. isImplicitZero ^^^^^^^^^^^^^^ .. java:method:: public final boolean isImplicitZero() :outertype: BoolMatrix :return: true if this BoolMatrix is implicitly zero, i.e. using the "implicit-zero" convention. isZero ^^^^^^ .. java:method:: public final boolean isZero(int rowNumber) :outertype: BoolMatrix :return: true when this BoolMatrix is full of zero. leftTimes ^^^^^^^^^ .. java:method:: public final BoolVector leftTimes(BoolVector leftVector) :outertype: BoolMatrix BoolVector * BoolMatrix multiplication. :return: a new BoolVector, containing the product of the BoolVector "leftVector" with this BoolMatrix. It makes no sense to accept an "implicit-identity" leftVector, nor to return an "implicit-identity" result, since these vectors are not related to any BoolMatrix. notImplicitRows ^^^^^^^^^^^^^^^ .. java:method:: public final BoolVector notImplicitRows() :outertype: BoolMatrix :return: a new BoolVector sized after the rows of this BoolMatrix, holding true for rows that are not implicit-Identity (i.e. that are non null). numberOfOnes ^^^^^^^^^^^^ .. java:method:: public final int numberOfOnes() :outertype: BoolMatrix (for debugging) @return the number of "true" elements in this matrix. overwriteDeps ^^^^^^^^^^^^^ .. java:method:: public final void overwriteDeps(TapIntList rowIndices, BoolVector cumulZ, boolean total) :outertype: BoolMatrix Overwrites into this BoolMatrix, so that all rows in "rowIndices" are now set to depend on the given "cumulZ". When "total" is true, this dependence overwrites the previous one, otherwise it just accumulates to it. set ^^^ .. java:method:: public final void set(int i, int j, boolean val) :outertype: BoolMatrix Sets the (i,j) element of this matrix to "val". This function assumes that (rows != null). setExplicitIdentity ^^^^^^^^^^^^^^^^^^^ .. java:method:: final void setExplicitIdentity() :outertype: BoolMatrix Re-initializes this BoolMatrix explicitly to Identity. Does not use the "implicit-identity" convention. setExplicitIdentityRow ^^^^^^^^^^^^^^^^^^^^^^ .. java:method:: public final void setExplicitIdentityRow(int i) :outertype: BoolMatrix Re-initializes row "i" of this BoolMatrix explicitly to Identity. Does not use the "implicit-identity" convention. This function assumes that (rows != null). setExplicitZero ^^^^^^^^^^^^^^^ .. java:method:: public final void setExplicitZero() :outertype: BoolMatrix Re-initializes this BoolMatrix explicitly to Zero. Does not use the "implicit-zero" convention. setExplicitZeroRow ^^^^^^^^^^^^^^^^^^ .. java:method:: public final void setExplicitZeroRow(int i) :outertype: BoolMatrix Sets row i of this BoolMatrix explicitly to Zero. Does not use the "implicit-zero" convention. Crashes (rightfully!) if matrix is "implicit-zero". setIdentity ^^^^^^^^^^^ .. java:method:: public final void setIdentity() :outertype: BoolMatrix Re-initializes this BoolMatrix to Identity. Each row of the matrix is initialized to null, using the "implicit-identity" convention. setIdentityRow ^^^^^^^^^^^^^^ .. java:method:: public final void setIdentityRow(int i) :outertype: BoolMatrix Re-initializes row "i" of this BoolMatrix to Identity. Row "i" is set to null, using "implicit-identity" convention. This function assumes that (rows != null). setRow ^^^^^^ .. java:method:: public final void setRow(int i, BoolVector row) :outertype: BoolMatrix Sets row "i" of this BoolMatrix to "row". This function assumes that (rows != null). times ^^^^^ .. java:method:: public final BoolMatrix times(BoolMatrix rightMatrix) :outertype: BoolMatrix :return: a new BoolMatrix, product of this BoolMatrix with the BoolMatrix "rightMatrix". times ^^^^^ .. java:method:: public final BoolVector times(BoolVector rightVector) :outertype: BoolMatrix BoolMatrix * BoolVector multiplication. :return: a new BoolVector, containing the product of this BoolMatrix with the BoolVector "rightVector". It makes no sense to accept an "implicit-identity" rightVector, nor to return an "implicit-identity" result, since these vectors are disconnected from any BoolMatrix. timesTransposed ^^^^^^^^^^^^^^^ .. java:method:: public final BoolMatrix timesTransposed(BoolMatrix rightMatrix) :outertype: BoolMatrix :return: a new matrix containing "this" times the transposed of "rightMatrix".