|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--pipe.modules.invariantAnalysis.IntMatrix
Field Summary | |
private int[][] |
A
Array for internal storage of elements. |
private int |
m
Row and column dimensions. |
private int |
n
Row and column dimensions. |
Constructor Summary | |
IntMatrix(int[][] A)
Construct a matrix from a 2-D array. |
|
IntMatrix(int[][] A,
int m,
int n)
Construct a matrix quickly without checking arguments. |
|
IntMatrix(int[] vals,
int m)
Construct a matrix from a one-dimensional packed array |
|
IntMatrix(int m,
int n)
Construct an m-by-n matrix of zeros. |
|
IntMatrix(int m,
int n,
int s)
Construct an m-by-n constant matrix. |
Method Summary | |
IntMatrix |
appendVector(IntMatrix X)
Append a column matrix (vector) to the right of another matrix. |
int |
cardinalityCondition()
Check if a matrix has a row that satisfies the cardinality condition 1.1.b of the algorithm. |
int |
cardinalityOne()
Find the column index of the element in the pPlus or pMinus set, where pPlus or pMinus has cardinality == 1. |
boolean |
checkCase11()
Check if a matrix satisfies condition 1.1 of the algorithm. |
private void |
checkMatrixDimensions(IntMatrix B)
Check if size(A) == size(B) |
java.lang.Object |
clone()
Clone the IntMatrix object. |
int[] |
colsToUpdate()
Find the comlumn indices to be changed by linear combination. |
static IntMatrix |
constructWithCopy(int[][] A)
Construct a matrix from a copy of a 2-D array. |
IntMatrix |
copy()
Make a deep copy of a matrix |
IntMatrix |
divideEquals(int s)
Divide a matrix by an int in place, A = s*A |
IntMatrix |
eliminateCol(int toDelete)
Eliminate a column from the matrix, column index is toDelete |
int |
findNonMinimal()
Find a column with non-minimal support. |
int[] |
findRemainingNZCoef(int h)
Find the coefficients corresponding to column indices of all but the first non zero elements of row h. |
int[] |
findRemainingNZIndices(int h)
Find the column indices of all but the first non zero elements of row h. |
int |
firstNonZeroElementIndex(int h)
Find the column index of the first non zero element of row h. |
int |
firstNonZeroRowIndex()
Find the first non-zero row of a matrix. |
int |
gcd()
Find the greatest common divisor of a column matrix (vector) of integers. |
private int |
gcd2(int a,
int b)
Find the greatest common divisor of 2 integers. |
int |
get(int i,
int j)
Get a single element. |
int[][] |
getArray()
Access the internal two-dimensional array. |
int[][] |
getArrayCopy()
Copy the internal two-dimensional array. |
int |
getColumnDimension()
Get column dimension. |
int[] |
getColumnPackedCopy()
Make a one-dimensional column packed copy of the internal array. |
IntMatrix |
getMatrix(int[] r,
int[] c)
Get a submatrix. |
IntMatrix |
getMatrix(int[] r,
int j0,
int j1)
Get a submatrix. |
IntMatrix |
getMatrix(int i0,
int i1,
int[] c)
Get a submatrix. |
IntMatrix |
getMatrix(int i0,
int i1,
int j0,
int j1)
Get a submatrix. |
int[] |
getNegativeIndices(int rowNo)
For row rowNo of the matrix received return the column indices of all the negative elements |
int[] |
getPositiveIndices(int rowNo)
For row rowNo of the matrix received return the column indices of all the positive elements |
int |
getRowDimension()
Get row dimension. |
int[] |
getRowPackedCopy()
Make a one-dimensional row packed copy of the internal array. |
boolean |
hasNegativeElements()
Find if a column vector has negative elements. |
static IntMatrix |
identity(int m,
int n)
Generate identity matrix] |
boolean |
isCovered()
Find if a matrix of invariants is covered. |
boolean |
isZeroMatrix()
Check if a matrix is all zeros. |
boolean |
isZeroRow(int r)
isZeroRow returns true if the ith row is all zeros |
void |
linearlyCombine(int k,
int[] alpha,
int[] j,
int[] beta)
Add a linear combination of column k to columns in array j[]. |
void |
linearlyCombine(int k,
int chk,
int[] j,
int[] jC)
Add a linear combination of column k to columns in array j[]. |
IntMatrix |
minus(IntMatrix B)
C = A - B |
IntMatrix |
minusEquals(IntMatrix B)
A = A - B |
IntMatrix |
nonZeroIndices()
Form a matrix with columns the row indices of non-zero elements. |
IntMatrix |
plus(IntMatrix B)
C = A + B |
IntMatrix |
plusEquals(IntMatrix B)
A = A + B |
void |
print(int w,
int d)
Print the matrix to stdout. |
void |
print(java.text.NumberFormat format,
int width)
Print the matrix to stdout. |
void |
print(java.io.PrintWriter output,
int w,
int d)
Print the matrix to the output stream. |
void |
print(java.io.PrintWriter output,
java.text.NumberFormat format,
int width)
Print the matrix to the output stream. |
void |
printArray(int[] a)
Used to display intermiadiate results for checking |
java.lang.String |
printString(int w,
int d)
Print the matrix to a string. |
int |
rowWithNegativeElement()
Find the first row with a negative element in a matrix. |
void |
set(int i,
int j,
int s)
Set a single element. |
void |
setMatrix(int[] r,
int[] c,
IntMatrix X)
Set a submatrix. |
void |
setMatrix(int[] r,
int j0,
int j1,
IntMatrix X)
Set a submatrix. |
void |
setMatrix(int i0,
int i1,
int[] c,
IntMatrix X)
Set a submatrix. |
void |
setMatrix(int i0,
int i1,
int j0,
int j1,
IntMatrix X)
Set a submatrix. |
IntMatrix |
timesEquals(int s)
Multiply a matrix by an int in place, A = s*A |
IntMatrix |
transpose()
Matrix transpose. |
IntMatrix |
uminus()
Unary minus |
int |
vectorTimes(IntMatrix B)
Multiply a row matrix by a column matrix, A = s*A |
Methods inherited from class java.lang.Object |
|
Field Detail |
private int[][] A
private int m
private int n
Constructor Detail |
public IntMatrix(int m, int n)
m
- Number of rows.n
- Number of colums.public IntMatrix(int m, int n, int s)
m
- Number of rows.n
- Number of colums.s
- Fill the matrix with this scalar value.public IntMatrix(int[][] A)
A
- Two-dimensional array of integers.java.lang.IllegalArgumentException
- All rows must have the same lengthconstructWithCopy(int[][])
public IntMatrix(int[][] A, int m, int n)
A
- Two-dimensional array of integers.m
- Number of rows.n
- Number of colums.public IntMatrix(int[] vals, int m)
vals
- One-dimensional array of integers, packed by columns (ala Fortran).m
- Number of rows.java.lang.IllegalArgumentException
- Array length must be a multiple of m.Method Detail |
public IntMatrix appendVector(IntMatrix X)
X
- Column matrix (vector) to append.ArrayIndexOutOfBoundsException
- Submatrix indicespublic int cardinalityCondition()
public int cardinalityOne()
public boolean checkCase11()
public int[] colsToUpdate()
public static IntMatrix constructWithCopy(int[][] A)
A
- Two-dimensional array of integers.java.lang.IllegalArgumentException
- All rows must have the same lengthpublic IntMatrix copy()
public java.lang.Object clone()
clone
in class java.lang.Object
public IntMatrix eliminateCol(int toDelete)
toDelete
- The column number to delete.public int[][] getArray()
public int[][] getArrayCopy()
public int[] getColumnPackedCopy()
public int[] getRowPackedCopy()
public int getRowDimension()
public int getColumnDimension()
public int firstNonZeroRowIndex()
public IntMatrix nonZeroIndices()
public int findNonMinimal()
public boolean hasNegativeElements()
public int firstNonZeroElementIndex(int h)
h
- The row to look for the non-zero element inpublic int[] findRemainingNZIndices(int h)
h
- The row to look for the non-zero element inpublic int[] findRemainingNZCoef(int h)
h
- The row to look for the non-zero coefficients inpublic int get(int i, int j)
i
- Row index.j
- Column index.ArrayIndexOutOfBoundsException
- public IntMatrix getMatrix(int i0, int i1, int j0, int j1)
i0
- Initial row indexi1
- Final row indexj0
- Initial column indexj1
- Final column indexArrayIndexOutOfBoundsException
- Submatrix indicespublic IntMatrix getMatrix(int[] r, int[] c)
r
- Array of row indices.c
- Array of column indices.ArrayIndexOutOfBoundsException
- Submatrix indicespublic IntMatrix getMatrix(int i0, int i1, int[] c)
i0
- Initial row indexi1
- Final row indexc
- Array of column indices.ArrayIndexOutOfBoundsException
- Submatrix indicespublic IntMatrix getMatrix(int[] r, int j0, int j1)
r
- Array of row indices.j0
- Initial column indexj1
- Final column indexArrayIndexOutOfBoundsException
- Submatrix indicespublic int[] getNegativeIndices(int rowNo)
rowNo
- row iside the Matrix to check for -ve elementsArrayIndexOutOfBoundsException
- Submatrix indicespublic int[] getPositiveIndices(int rowNo)
rowNo
- row iside the Matrix to check for +ve elementsArrayIndexOutOfBoundsException
- Submatrix indicespublic boolean isZeroMatrix()
public boolean isZeroRow(int r)
r
- row to check for full zeros.public boolean isCovered()
public void linearlyCombine(int k, int chk, int[] j, int[] jC)
k
- Column index to add.chk
- Coefficient of col to addj
- Array of column indices to add to.jC
- Array of coefficients of column indices to add to.ArrayIndexOutOfBoundsException
- public void linearlyCombine(int k, int[] alpha, int[] j, int[] beta)
k
- Column index to add.alpha
- Array of coefficients of col to addj
- Array of column indices to add to.beta
- Array of coefficients of column indices to add to.ArrayIndexOutOfBoundsException
- public int rowWithNegativeElement()
public void set(int i, int j, int s)
i
- Row index.j
- Column index.s
- A(i,j).ArrayIndexOutOfBoundsException
- public void setMatrix(int i0, int i1, int j0, int j1, IntMatrix X)
i0
- Initial row indexi1
- Final row indexj0
- Initial column indexj1
- Final column indexX
- A(i0:i1,j0:j1)ArrayIndexOutOfBoundsException
- Submatrix indicespublic void setMatrix(int[] r, int[] c, IntMatrix X)
r
- Array of row indices.c
- Array of column indices.X
- A(r(:),c(:))ArrayIndexOutOfBoundsException
- Submatrix indicespublic void setMatrix(int[] r, int j0, int j1, IntMatrix X)
r
- Array of row indices.j0
- Initial column indexj1
- Final column indexX
- A(r(:),j0:j1)ArrayIndexOutOfBoundsException
- Submatrix indicespublic void setMatrix(int i0, int i1, int[] c, IntMatrix X)
i0
- Initial row indexi1
- Final row indexc
- Array of column indices.X
- A(i0:i1,c(:))ArrayIndexOutOfBoundsException
- Submatrix indicespublic IntMatrix transpose()
public int gcd()
private int gcd2(int a, int b)
a
- The first integer.b
- The second integer.public IntMatrix uminus()
public IntMatrix plus(IntMatrix B)
B
- another matrixpublic IntMatrix plusEquals(IntMatrix B)
B
- another matrixpublic IntMatrix minus(IntMatrix B)
B
- another matrixpublic IntMatrix minusEquals(IntMatrix B)
B
- another matrixpublic IntMatrix timesEquals(int s)
s
- int multiplierpublic int vectorTimes(IntMatrix B)
B
- column vectorpublic IntMatrix divideEquals(int s)
s
- int divisorpublic static IntMatrix identity(int m, int n)
m
- Number of rows.n
- Number of colums.public void print(int w, int d)
w
- Column width.d
- Number of digits after the decimal.public java.lang.String printString(int w, int d)
w
- Column width.d
- Number of digits after the decimal.public void print(java.io.PrintWriter output, int w, int d)
output
- Output stream.w
- Column width.d
- Number of digits after the decimal.public void print(java.text.NumberFormat format, int width)
format
- A Formatting object for individual elements.width
- Field width for each column.DecimalFormat.setDecimalFormatSymbols(java.text.DecimalFormatSymbols)
public void print(java.io.PrintWriter output, java.text.NumberFormat format, int width)
output
- the output stream.format
- A formatting object to format the matrix elementswidth
- Column width.DecimalFormat.setDecimalFormatSymbols(java.text.DecimalFormatSymbols)
private void checkMatrixDimensions(IntMatrix B)
B
- The matrix to check the dimensions.public void printArray(int[] a)
a
- The array of integers to print.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |