|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectmpv2.AllMatrices
mpv2.SymmetricMatrix
public class SymmetricMatrix
This is a symmetric matrix class made by implementing AllMatrices. Entries are stored columnwise in a one-dimensional array, for each column only elements on or below the main diagonal are stored.
| Field Summary |
|---|
| Fields inherited from class mpv2.AllMatrices |
|---|
K, N |
| Constructor Summary | |
|---|---|
SymmetricMatrix(AllMatrices B)
Construct a new matrix from another matrix (of any kind), only lower-left-values are used. |
|
SymmetricMatrix(double[][] A)
Construct a matrix from a 2-D array, only lower-left-values are used. |
|
SymmetricMatrix(int n)
Construct an n-by-n matrix of zeros. |
|
SymmetricMatrix(int n,
int k)
Construct an n-by-n matrix of zeros. |
|
SymmetricMatrix(int n,
int k,
double s)
Construct an m-by-n constant matrix. |
|
| Method Summary | |
|---|---|
java.lang.Object |
clone()
Clone the Matrix object. |
SymmetricMatrix |
copy()
Make a deep copy of a matrix |
void |
eqInnerProductMatrix(AllMatrices B)
Set inner-products of matrix B into this, i.e. |
void |
eqPermuteColumns(AllMatrices B,
PermutationMatrix P)
Permute the columns of matrix B and put result in this, A = B * P. |
void |
eqPermuteRows(PermutationMatrix P,
AllMatrices B)
Permute the rows of matrix B and put result in this, A = P * B. |
void |
eqProduct(AllMatrices B,
double s)
Set the matrix (this = A) to B*s, A = B*s. |
void |
eqScaleColumns(AllMatrices B,
DiagonalMatrix D)
Scale the columns of matrix B and put result in this, A = B * D. |
void |
eqScaleRows(DiagonalMatrix D,
AllMatrices B)
Scale the rows of matrix B and put result in this, A = D * B. |
void |
eqScaleRowsAndColumns(DiagonalMatrix D,
SymmetricMatrix B)
Scale the rows and columns of symmtric matrix B and put result in this, A = D * B * D. |
void |
eqScaleRowsAndColumns(SymmetricMatrix B,
DiagonalMatrix D)
Scale the rows and columns of symmtric matrix B and put result in this, A = D * B * D. |
double |
get(int n,
int k)
Get a single element. |
void |
getColumn(int k,
double[] d)
Copy a column of the matrix into argument d Legal range of the integer argument is 0 <= k < K. |
void |
getRow(int n,
double[] d)
Copy a row of the matrix into argument d |
static SymmetricMatrix |
identity(int n)
Generate identity matrix |
static SymmetricMatrix |
innerProductMatrix(AllMatrices B)
Generate inner-product matrix from input matrix B, i.e. |
void |
pluseqOuterProduct(double s1,
double s2,
double[] u)
Add outer product of a vector to scaled this, A = s1*A + s2*(u*u'). |
void |
pluseqOuterProduct(double s1,
double s2,
double[] u,
double[] v)
Add outer product of two vectors to this, A = s1*A + s2*(u*v'+v*u'). |
void |
set(int n,
int k,
double s)
Set one or two elements in the symmetric matrix A(n,k)=A(k,n)=s. |
void |
setAll(double[] vals)
Set all entries of the matrix to the supplied new values. |
void |
setColumn(int k,
double[] d)
Copy an array (d) into a column, and a row, of the matrix |
void |
setRow(int n,
double[] r)
Set a row, and a column, of the matrix |
| Methods inherited from class mpv2.AllMatrices |
|---|
addColumn, chol, columnNorm0, columnNorm1, columnNorm2, columnNormInf, cond, det, eig, eqConstant, eqCopy, eqCopy, eqCopy, eqCopy, eqCopy, eqDifference, eqEProduct, eqEQuotient, eqIdentity, eqInverse, eqIProduct, eqNegate, eqOnes, eqProduct, eqRandom, eqSum, eqTProduct, eqTranspose, eqZeros, getAll, getAll, getColumn, getColumnDimension, getK, getN, getRow, getRowDimension, getSubMatrix, getSubMatrix, getSubMatrix, getSubMatrix, getValue, innerProduct, lu, lup, norm1, norm2, normF, normInf, print, print, print, print, qr, rank, setValue, sumAll, svd, times, times, times, times, trace, transposeTimes, transposeTimes, transposeTimes, transposeTimes |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SymmetricMatrix(int n)
n - Number of rows.
public SymmetricMatrix(int n,
int k)
n - Number of rows.k - Number of colums is also n, so k is ignored!
public SymmetricMatrix(int n,
int k,
double s)
n - Number of rows.k - Number of colums is also n, so k is ignored!s - Fill the matrix with this scalar value.public SymmetricMatrix(double[][] A)
A - Two-dimensional array of doubles.
java.lang.IllegalArgumentException - All rows must have the same lengthpublic SymmetricMatrix(AllMatrices B)
B - A matrix of any kind, class is a subclass of AllMatrices
java.lang.IllegalArgumentException - Number of rows and Columns must be the samecopy()| Method Detail |
|---|
public static SymmetricMatrix identity(int n)
n - Size is n-by-npublic static SymmetricMatrix innerProductMatrix(AllMatrices B)
B - A matrix of any kind, class is a subclass of AllMatricespublic SymmetricMatrix 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.ArrayIndexOutOfBoundsException
public void set(int n,
int k,
double s)
set in class AllMatricesn - Row index.k - Column index.s - A(n,k).
java.lang.ArrayIndexOutOfBoundsException
public void getColumn(int k,
double[] d)
0 <= k < K.
If argument is out of range a length N array of zeros should be returned. A(:,k+1).
getColumn in class AllMatricesk - number of the column in the matrixd - the given column of the matrix
java.lang.IllegalArgumentException
public void setColumn(int k,
double[] d)
setColumn in class AllMatricesk - number of the column, and row, in the matrixd - the given column, and row, of the matrix
public void getRow(int n,
double[] d)
getRow in class AllMatricesn - number of the row in the matrixd - the given column of the matrix
public void setRow(int n,
double[] r)
setRow in class AllMatricesn - number of the row in the matrix A.r - the given row of matrix A.public void setAll(double[] vals)
setAll in class AllMatricesvals - One-dimensional array of doubles, packed by columns (ala Fortran).
java.lang.IllegalArgumentException
public void eqProduct(AllMatrices B,
double s)
eqProduct in class AllMatricesB - Matrix of same size as A
java.lang.IllegalArgumentException
public void eqPermuteRows(PermutationMatrix P,
AllMatrices B)
eqPermuteRows in class AllMatricesP - Permutation matrix of size N-by-NB - Matrix of size N-by-K, size of result (this) is also N-by-K
java.lang.IllegalArgumentException
public void eqPermuteColumns(AllMatrices B,
PermutationMatrix P)
eqPermuteColumns in class AllMatricesB - Matrix of size N-by-K, size of result (this) is also N-by-KP - Permutation matrix of size K-by-K
java.lang.IllegalArgumentException
public void eqScaleRowsAndColumns(SymmetricMatrix B,
DiagonalMatrix D)
B - Symmetric matrix of size N-by-N, size of result (this) is also N-by-ND - Diagonal matrix of size N-by-N, class DiagonalMatrix
public void eqScaleRowsAndColumns(DiagonalMatrix D,
SymmetricMatrix B)
D - Diagonal matrix of size N-by-N, class DiagonalMatrixB - Symmetric matrix of size N-by-N, size of result (this) is also N-by-N
public void eqScaleRows(DiagonalMatrix D,
AllMatrices B)
eqScaleRows in class AllMatricesD - Diagonal matrix of size N-by-N, class DiagonalMatrixB - Matrix of size N-by-K, size of result (this) is also N-by-K
java.lang.IllegalArgumentException
public void eqScaleColumns(AllMatrices B,
DiagonalMatrix D)
eqScaleColumns in class AllMatricesB - Matrix of size N-by-K, size of result (this) is also N-by-KD - Diagonal matrix of size N-by-N, class DiagonalMatrix
java.lang.IllegalArgumentExceptionpublic void eqInnerProductMatrix(AllMatrices B)
B - A matrix of any kind, class is a subclass of AllMatrices
java.lang.IllegalArgumentException
public void pluseqOuterProduct(double s1,
double s2,
double[] u,
double[] v)
pluseqOuterProduct in class AllMatricess1 - A single values2 - A single valueu - A vector with N elementsv - A vector with N elements
java.lang.IllegalArgumentException
public void pluseqOuterProduct(double s1,
double s2,
double[] u)
s1 - A single values2 - A single valueu - A vector with N elements
java.lang.IllegalArgumentException
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||