|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpipe.dataLayer.PNMatrix
public class PNMatrix
Field Summary | |
---|---|
boolean |
matrixChanged
Used to determine whether the matrixes have been modified |
Constructor Summary | |
---|---|
PNMatrix(int[][] A)
Construct a matrix from a 2-D array. |
|
PNMatrix(int[][] A,
int m,
int n)
Construct a matrix quickly without checking arguments. |
|
PNMatrix(int[] vals,
int m)
Construct a matrix from a one-dimensional packed array |
|
PNMatrix(int m,
int n)
Construct an m-by-n matrix of zeros. |
|
PNMatrix(int m,
int n,
int s)
Construct an m-by-n constant matrix. |
Method Summary | |
---|---|
PNMatrix |
appendVector(PNMatrix 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. |
java.lang.Object |
clone()
Clone the IntMatrix object. |
int[] |
colsToUpdate()
Find the comlumn indices to be changed by linear combination. |
static PNMatrix |
constructWithCopy(int[][] A)
Construct a matrix from a copy of a 2-D array. |
PNMatrix |
copy()
Make a deep copy of a matrix |
PNMatrix |
divideEquals(int s)
Divide a matrix by an int in place, A = s*A |
PNMatrix |
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. |
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. |
PNMatrix |
getMatrix(int[] r,
int[] c)
Get a submatrix. |
PNMatrix |
getMatrix(int[] r,
int j0,
int j1)
Get a submatrix. |
PNMatrix |
getMatrix(int i0,
int i1,
int[] c)
Get a submatrix. |
PNMatrix |
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 PNMatrix |
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[]. |
PNMatrix |
minus(PNMatrix B)
C = A - B |
PNMatrix |
minusEquals(PNMatrix B)
A = A - B |
PNMatrix |
nonZeroIndices()
Form a matrix with columns the row indices of non-zero elements. |
PNMatrix |
plus(PNMatrix B)
C = A + B |
PNMatrix |
plusEquals(PNMatrix 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 intermediate 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,
PNMatrix X)
Set a submatrix. |
void |
setMatrix(int[] r,
int j0,
int j1,
PNMatrix X)
Set a submatrix. |
void |
setMatrix(int i0,
int i1,
int[] c,
PNMatrix X)
Set a submatrix. |
void |
setMatrix(int i0,
int i1,
int j0,
int j1,
PNMatrix X)
Set a submatrix. |
void |
setToZero()
|
PNMatrix |
timesEquals(int s)
Multiply a matrix by an int in place, A = s*A |
PNMatrix |
transpose()
Matrix transpose. |
PNMatrix |
uminus()
Unary minus |
int |
vectorTimes(PNMatrix B)
Multiply a row matrix by a column matrix, A = s*A |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public boolean matrixChanged
Constructor Detail |
---|
public PNMatrix(int m, int n)
m
- Number of rows.n
- Number of colums.public PNMatrix(int m, int n, int s)
m
- Number of rows.n
- Number of colums.s
- Fill the matrix with this scalar value.public PNMatrix(int[][] A)
A
- Two-dimensional array of integers.
java.lang.IllegalArgumentException
- All rows must have the same lengthconstructWithCopy(int[][])
public PNMatrix(int[][] A, int m, int n)
A
- Two-dimensional array of integers.m
- Number of rows.n
- Number of colums.public PNMatrix(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 PNMatrix appendVector(PNMatrix X)
X
- Column matrix (vector) to append.
java.lang.ArrayIndexOutOfBoundsException
- Submatrix indicespublic int cardinalityCondition()
public int cardinalityOne()
public boolean checkCase11()
public int[] colsToUpdate()
public static PNMatrix constructWithCopy(int[][] A)
A
- Two-dimensional array of integers.
java.lang.IllegalArgumentException
- All rows must have the same lengthpublic PNMatrix copy()
public java.lang.Object clone()
clone
in class java.lang.Object
public PNMatrix 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 PNMatrix nonZeroIndices()
public int findNonMinimal()
public boolean hasNegativeElements()
public int firstNonZeroElementIndex(int h)
h
- The row to look for the non-zero element in
public int[] findRemainingNZIndices(int h)
h
- The row to look for the non-zero element in
public int[] findRemainingNZCoef(int h)
h
- The row to look for the non-zero coefficients in
public int get(int i, int j)
i
- Row index.j
- Column index.
java.lang.ArrayIndexOutOfBoundsException
public PNMatrix getMatrix(int i0, int i1, int j0, int j1)
i0
- Initial row indexi1
- Final row indexj0
- Initial column indexj1
- Final column index
java.lang.ArrayIndexOutOfBoundsException
- Submatrix indicespublic PNMatrix getMatrix(int[] r, int[] c)
r
- Array of row indices.c
- Array of column indices.
java.lang.ArrayIndexOutOfBoundsException
- Submatrix indicespublic PNMatrix getMatrix(int i0, int i1, int[] c)
i0
- Initial row indexi1
- Final row indexc
- Array of column indices.
java.lang.ArrayIndexOutOfBoundsException
- Submatrix indicespublic PNMatrix getMatrix(int[] r, int j0, int j1)
r
- Array of row indices.j0
- Initial column indexj1
- Final column index
java.lang.ArrayIndexOutOfBoundsException
- Submatrix indicespublic int[] getNegativeIndices(int rowNo)
rowNo
- row iside the Matrix to check for -ve elements
java.lang.ArrayIndexOutOfBoundsException
- Submatrix indicespublic int[] getPositiveIndices(int rowNo)
rowNo
- row iside the Matrix to check for +ve elements
java.lang.ArrayIndexOutOfBoundsException
- 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.
java.lang.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.
java.lang.ArrayIndexOutOfBoundsException
public int rowWithNegativeElement()
public void set(int i, int j, int s)
i
- Row index.j
- Column index.s
- A(i,j).
java.lang.ArrayIndexOutOfBoundsException
public void setMatrix(int i0, int i1, int j0, int j1, PNMatrix X)
i0
- Initial row indexi1
- Final row indexj0
- Initial column indexj1
- Final column indexX
- A(i0:i1,j0:j1)
java.lang.ArrayIndexOutOfBoundsException
- Submatrix indicespublic void setMatrix(int[] r, int[] c, PNMatrix X)
r
- Array of row indices.c
- Array of column indices.X
- A(r(:),c(:))
java.lang.ArrayIndexOutOfBoundsException
- Submatrix indicespublic void setMatrix(int[] r, int j0, int j1, PNMatrix X)
r
- Array of row indices.j0
- Initial column indexj1
- Final column indexX
- A(r(:),j0:j1)
java.lang.ArrayIndexOutOfBoundsException
- Submatrix indicespublic void setMatrix(int i0, int i1, int[] c, PNMatrix X)
i0
- Initial row indexi1
- Final row indexc
- Array of column indices.X
- A(i0:i1,c(:))
java.lang.ArrayIndexOutOfBoundsException
- Submatrix indicespublic PNMatrix transpose()
public int gcd()
public PNMatrix uminus()
public PNMatrix plus(PNMatrix B)
B
- another matrix
public PNMatrix plusEquals(PNMatrix B)
B
- another matrix
public PNMatrix minus(PNMatrix B)
B
- another matrix
public PNMatrix minusEquals(PNMatrix B)
B
- another matrix
public PNMatrix timesEquals(int s)
s
- int multiplier
public int vectorTimes(PNMatrix B)
B
- column vector
public PNMatrix divideEquals(int s)
s
- int divisor
public static PNMatrix 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)
public void printArray(int[] a)
a
- The array of integers to print.public void setToZero()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |