|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectmpv2.AllMatrices
mpv2.PermutationMatrix
public class PermutationMatrix
This is a permutation matrix class made by implementing AllMatrices.
| Field Summary |
|---|
| Fields inherited from class mpv2.AllMatrices |
|---|
K, N |
| Constructor Summary | |
|---|---|
PermutationMatrix(double[] ord)
Construct an n-by-n permutation matrix which will make the given array when the matrix is applied to the sorted sequence, ord = A*ascending(ord). |
|
PermutationMatrix(int n)
Construct an n-by-n permutation matrix with ones on the diagonal, i.e. identity matrix. |
|
PermutationMatrix(int[] p)
Construct an N-by-N permutation matrix from a vector p, A(n,k)==1 <=> p[n]==k. |
|
| Method Summary | |
|---|---|
java.lang.Object |
clone()
Clone the Matrix object. |
double |
cond()
Matrix condition (2 norm) |
PermutationMatrix |
copy()
Make a deep copy of a matrix |
double |
det()
Matrix determinant |
double |
get(int n,
int k)
Get a single element, A(n,k). |
int[] |
getPos()
Access the internal array pos, we have A(n,k)==1 <=> pos[n]==k. |
static PermutationMatrix |
identity(int n)
Generate identity matrix |
double |
innerProduct(int k1,
int k2)
Returns the inner product of two matrix column vectors, which for a diagonal matrix is zero. |
double |
norm2()
Two norm |
double |
normF()
Frobenius norm |
static PermutationMatrix |
perfectShuffle(int n,
int s)
Generate perfect shuffle (stride) permutation matrix. |
static PermutationMatrix |
random(int n)
Generate randon permutation matrix |
int |
rank()
Matrix rank |
static PermutationMatrix |
reverse(int n)
Generate reverse matrix |
void |
set(int n,
int k,
double s)
Set a single element, A(n,k)=s, this is not allowed som method just return. |
void |
times(double[] y,
double[] x)
Multiplies the matrix by an array, x = A*y. |
void |
transposeTimes(double[] x,
double[] y)
Multiplies the transposed matrix by an array, y = A'*x. |
| Methods inherited from class mpv2.AllMatrices |
|---|
addColumn, chol, columnNorm0, columnNorm1, columnNorm2, columnNormInf, eig, eqConstant, eqCopy, eqCopy, eqCopy, eqCopy, eqCopy, eqDifference, eqEProduct, eqEQuotient, eqIdentity, eqInverse, eqIProduct, eqNegate, eqOnes, eqPermuteColumns, eqPermuteRows, eqProduct, eqProduct, eqRandom, eqScaleColumns, eqScaleRows, eqSum, eqTProduct, eqTranspose, eqZeros, getAll, getAll, getColumn, getColumn, getColumnDimension, getK, getN, getRow, getRow, getRowDimension, getSubMatrix, getSubMatrix, getSubMatrix, getSubMatrix, getValue, lu, lup, norm1, normInf, pluseqOuterProduct, print, print, print, print, qr, setAll, setColumn, setRow, setValue, sumAll, svd, times, times, times, trace, transposeTimes, transposeTimes, transposeTimes |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PermutationMatrix(int n)
n - Number of rows and columnspublic PermutationMatrix(int[] p)
p - the vector that gives p.
java.lang.IllegalArgumentExceptionpublic PermutationMatrix(double[] ord)
ord - the sequence that the permutation matrix will put the ordered sequence into| Method Detail |
|---|
public static PermutationMatrix random(int n)
n - Number of rows and colums.
public static PermutationMatrix identity(int n)
n - Number of rows and colums.
public static PermutationMatrix reverse(int n)
n - Number of rows and colums.
public static PermutationMatrix perfectShuffle(int n,
int s)
n - Number of rows and colums.s - The stride, how many elements to go forward on each, normally a factor of n.
public PermutationMatrix copy()
public java.lang.Object clone()
clone in class java.lang.Object
public double get(int n,
int k)
get in class AllMatricesn - Row index.k - Column index.
java.lang.ArrayIndexOutOfBoundsExceptionpublic int[] getPos()
public void set(int n,
int k,
double s)
set in class AllMatricesn - Row index.k - Column index.s - A(n,k).
java.lang.ArrayIndexOutOfBoundsExceptionpublic double normF()
normF in class AllMatricespublic double det()
det in class AllMatricespublic int rank()
rank in class AllMatricespublic double cond()
cond in class AllMatricespublic double norm2()
norm2 in class AllMatrices
public double innerProduct(int k1,
int k2)
innerProduct in class AllMatricesk1 - number for the first dictionary element.k2 - number for the second dictionary element.
public void times(double[] y,
double[] x)
times in class AllMatricesy - the input arrayx - the results as an array of length N.
public void transposeTimes(double[] x,
double[] y)
transposeTimes in class AllMatricesx - the input arrayy - the results as an array of length K.
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||