|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.numericalmethod.suanshu.matrix.doubles.operation.CreateMatrix
public class CreateMatrix
This class collects the utility functions to create a new matrix/vector from existing ones.
| Method Summary | |
|---|---|
static DenseMatrix |
cbind(Matrix... matrices)
Take an array of matrices and combine them by columns. |
static DenseMatrix |
cbind(MatrixList matrices)
Take a list of matrices and combine them by columns. |
static DenseMatrix |
cbind(Vector... vectors)
Take an array of vectors and combine them by columns. |
static DenseMatrix |
cbind(VectorList vectors)
Take a list of vectors and combine them by columns. |
static DenseMatrix |
columns(Matrix A,
int[] cols)
CreateMatrix a sub-matrix from the columns of a matrix. |
static DenseMatrix |
columns(Matrix A,
int begin,
int end)
CreateMatrix a sub-matrix from the columns of a matrix. |
static Matrix |
copyAndReplace(Matrix toReplace,
int rowFrom,
int rowTo,
int colFrom,
int colTo,
Matrix replacement)
Deprecated. Not supported yet. |
static DenseMatrix |
diagonalMatrix(Matrix A)
Take the diagonal of a matrix. |
static DenseMatrix |
rbind(Matrix... matrices)
Take an array of matrices and combine them by rows. |
static DenseMatrix |
rbind(MatrixList matrices)
Take a list of matrices and combine them by rows. |
static DenseMatrix |
rbind(Vector... vectors)
Take an array of vectors and combine them by rows. |
static DenseMatrix |
rbind(VectorList vectors)
Take a list of vectors and combine them by rows. |
static Matrix |
replace(Matrix toReplace,
int rowFrom,
int rowTo,
int colFrom,
int colTo,
Matrix replacement)
Replace a part of a matrix with a smaller matrix. |
static DenseMatrix |
rows(Matrix A,
int[] rows)
CreateMatrix a sub-matrix from the rows of a matrix. |
static DenseMatrix |
rows(Matrix A,
int begin,
int end)
CreateMatrix a sub-matrix from the rows of a matrix. |
static DenseMatrix |
subMatrix(Matrix A,
int[] rows,
int[] cols)
CreateMatrix a sub-matrix from the intersections of rows and columns of a matrix. |
static DenseMatrix |
subMatrix(Matrix A,
int rowFrom,
int rowTo,
int colFrom,
int colTo)
CreateMatrix a sub-matrix from the four corners of a matrix. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static DenseMatrix cbind(Vector... vectors)
vectors - an array of vectors, e.g., v1, v2, v3, ...
[v1 v2 v3 ...]public static DenseMatrix cbind(VectorList vectors)
vectors - a list of vector, e.g., {v1, v2, v3, ...}
[v1 v2 v3 ...]public static DenseMatrix cbind(Matrix... matrices)
matrices - an array of matrices, e.g., A1, A2, A3, ...
[A1 A2 A3 ...]public static DenseMatrix cbind(MatrixList matrices)
matrices - a list of matrices, e.g., {A1, A2, A3, ...}
[A1 A2 A3 ...]public static DenseMatrix rbind(Vector... vectors)
vectors - an array of vector, e.g., v1, v2, v3, ...
| v1 |
| v2 |
| v3 |
| ... |
java.lang.IllegalArgumentException - if the vectors form a jagged arraypublic static DenseMatrix rbind(VectorList vectors)
vectors - an array of vector, e.g., {v1, v2, v3, ...}
| v1 |
| v2 |
| v3 |
| ... |
public static DenseMatrix rbind(Matrix... matrices)
matrices - a list of matrices, e.g., A1, A2, A3, ...
| A1 |
| A2 |
| A3 |
| ... |
public static DenseMatrix rbind(MatrixList matrices)
matrices - a list of matrices, e.g., {A1, A2, A3, ...}
| A1 |
| A2 |
| A3 |
| ... |
public static DenseMatrix subMatrix(Matrix A,
int rowFrom,
int rowTo,
int colFrom,
int colTo)
A - matrixrowFrom - the beginning row indexrowTo - the ending row indexcolFrom - the beginning column indexcolTo - the ending column index
A[rowFrom:rowTo, colFrom:colTo]
public static DenseMatrix subMatrix(Matrix A,
int[] rows,
int[] cols)
A - a matrixrows - the rows to be extractedcols - the columns to be extracted
A[rows, cols]
public static DenseMatrix rows(Matrix A,
int[] rows)
A - a matrixrows - the rows to be extracted
A
public static DenseMatrix rows(Matrix A,
int begin,
int end)
A - a matrixbegin - the beginning row index (counting from 1)end - the ending row index (counting from 1)
A
public static DenseMatrix columns(Matrix A,
int[] cols)
A - a matrixcols - the columns to be extracted
A
public static DenseMatrix columns(Matrix A,
int begin,
int end)
A - a matrixbegin - the beginning column index (counting from 1)end - the ending column index (counting from 1)
A
public static Matrix replace(Matrix toReplace,
int rowFrom,
int rowTo,
int colFrom,
int colTo,
Matrix replacement)
This method is best NOT to apply to SymmetricMatrix
because it is hard to ensure the symmetry property after replacement.
Note that no new DoubleMatrixAccessor instance is created.
toReplace - matrix whose part is to be replacedrowFrom - the beginning row indexrowTo - the ending row indexcolFrom - the beginning column indexcolTo - the ending column indexreplacement - matrix to be inserted into 'toReplace'
toReplace matrix, which has changed
@Deprecated
public static Matrix copyAndReplace(Matrix toReplace,
int rowFrom,
int rowTo,
int colFrom,
int colTo,
Matrix replacement)
The two input matrices are not changed.
This method is best NOT to apply to SymmetricMatrix
because it is hard to ensure the symmetry property after replacement.
toReplace - matrix whose part is to be replacedrowFrom - the beginning row indexrowTo - the ending row indexcolFrom - the beginning column indexcolTo - the ending column indexreplacement - matrix to be inserted into toReplace
DenseMatrix whose entries are the same as toReplace, except for the replacement partpublic static DenseMatrix diagonalMatrix(Matrix A)
A - a matrix
Ai, zeros elsewhere
java.lang.IllegalArgumentException - if A is not square
|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||