public class FComplexFactory2D extends PersistentObject
Construction | Use idioms like ComplexFactory2D.dense.make(4,4) to construct dense matrices, ComplexFactory2D.sparse.make(4,4) to construct sparse matrices. |
Construction with initial values | Use other make methods to construct matrices with given initial values. |
Appending rows and columns | Use methods appendColumns , appendRows and repeat to append
rows and columns. |
General block matrices | Use methods compose and
decompose to work
with general block matrices. |
Diagonal matrices | Use methods diagonal(vector) ,
diagonal(matrix) and
identity to work with diagonal matrices. |
Diagonal block matrices | Use method
composeDiagonal to work with diagonal block matrices. |
Random | Use methods random and
sample to construct random matrices. |
If the factory is used frequently it might be useful to streamline the notation. For example by aliasing:
ComplexFactory2D F = ComplexFactory2D.dense; F.make(4,4); F.random(4,4); ... |
Modifier and Type | Field and Description |
---|---|
static FComplexFactory2D |
dense
A factory producing dense matrices.
|
static FComplexFactory2D |
sparse
A factory producing sparse hash matrices.
|
Modifier and Type | Method and Description |
---|---|
FComplexMatrix2D |
appendColumn(FComplexMatrix2D A,
FComplexMatrix1D b)
C = A||b; Constructs a new matrix which is the column-wise concatenation
of two other matrices.
|
FComplexMatrix2D |
appendColumns(FComplexMatrix2D A,
FComplexMatrix2D B)
C = A||B; Constructs a new matrix which is the column-wise concatenation
of two other matrices.
|
FComplexMatrix2D |
appendRow(FComplexMatrix2D A,
FComplexMatrix1D b)
C = A||b; Constructs a new matrix which is the row-wise concatenation of
two other matrices.
|
FComplexMatrix2D |
appendRows(FComplexMatrix2D A,
FComplexMatrix2D B)
C = A||B; Constructs a new matrix which is the row-wise concatenation of
two other matrices.
|
FComplexMatrix2D |
compose(FComplexMatrix2D[][] parts)
Constructs a block matrix made from the given parts.
|
FComplexMatrix2D |
composeBidiagonal(FComplexMatrix2D A,
FComplexMatrix2D B)
Constructs a bidiagonal block matrix from the given parts.
|
FComplexMatrix2D |
composeDiagonal(FComplexMatrix2D A,
FComplexMatrix2D B)
Constructs a diagonal block matrix from the given parts (the direct
sum of two matrices).
|
FComplexMatrix2D |
composeDiagonal(FComplexMatrix2D A,
FComplexMatrix2D B,
FComplexMatrix2D C)
Constructs a diagonal block matrix from the given parts.
|
void |
decompose(FComplexMatrix2D[][] parts,
FComplexMatrix2D matrix)
Splits a block matrix into its constituent blocks; Copies blocks of a
matrix into the given parts.
|
void |
demo1()
Demonstrates usage of this class.
|
void |
demo2()
Demonstrates usage of this class.
|
FComplexMatrix2D |
diagonal(FComplexMatrix1D vector)
Constructs a new diagonal matrix whose diagonal elements are the elements
of vector.
|
FComplexMatrix1D |
diagonal(FComplexMatrix2D A)
Constructs a new vector consisting of the diagonal elements of A
.
|
FComplexMatrix2D |
identity(int rowsAndColumns)
Constructs an identity matrix (having ones on the diagonal and zeros
elsewhere).
|
FComplexMatrix2D |
make(float[][] values)
Constructs a matrix with the given cell values.
|
FComplexMatrix2D |
make(int rows,
int columns)
Constructs a matrix with the given shape, each cell initialized with
zero.
|
FComplexMatrix2D |
make(int rows,
int columns,
float[] initialValue)
Constructs a matrix with the given shape, each cell initialized with the
given value.
|
FComplexMatrix2D |
random(int rows,
int columns)
Constructs a matrix with uniformly distributed values in (0,1)
(exclusive).
|
FComplexMatrix2D |
repeat(FComplexMatrix2D A,
int rowRepeat,
int columnRepeat)
C = A||A||..||A; Constructs a new matrix which is duplicated both along
the row and column dimension.
|
FComplexMatrix2D |
sample(FComplexMatrix2D matrix,
float[] value,
float nonZeroFraction)
Modifies the given matrix to be a randomly sampled matrix.
|
FComplexMatrix2D |
sample(int rows,
int columns,
float[] value,
float nonZeroFraction)
Constructs a randomly sampled matrix with the given shape.
|
clone
public static final FComplexFactory2D dense
public static final FComplexFactory2D sparse
public FComplexMatrix2D appendColumns(FComplexMatrix2D A, FComplexMatrix2D B)
0 1 2 3 4 5 appendColumns 6 7 8 9 --> 0 1 2 6 7 3 4 5 8 9
public FComplexMatrix2D appendColumn(FComplexMatrix2D A, FComplexMatrix1D b)
0 1 2 3 4 5 appendColumn 6 8 --> 0 1 2 6 3 4 5 8
public FComplexMatrix2D appendRows(FComplexMatrix2D A, FComplexMatrix2D B)
public FComplexMatrix2D appendRow(FComplexMatrix2D A, FComplexMatrix1D b)
public FComplexMatrix2D compose(FComplexMatrix2D[][] parts)
decompose(FComplexMatrix2D[][], FComplexMatrix2D)
.
All matrices of a given column within parts must have the same number of columns. All matrices of a given row within parts must have the same number of rows. Otherwise an IllegalArgumentException is thrown. Note that nulls within parts[row,col] are an exception to this rule: they are ignored. Cells are copied.
IllegalArgumentException
- subject to the conditions outlined above.public FComplexMatrix2D composeDiagonal(FComplexMatrix2D A, FComplexMatrix2D B)
A 0 0 B(The direct sum has A.rows()+B.rows() rows and A.columns()+B.columns() columns). Cells are copied.
public FComplexMatrix2D composeDiagonal(FComplexMatrix2D A, FComplexMatrix2D B, FComplexMatrix2D C)
A 0 0 0 B 0 0 0 Cfrom the given parts. Cells are copied.
public FComplexMatrix2D composeBidiagonal(FComplexMatrix2D A, FComplexMatrix2D B)
public void decompose(FComplexMatrix2D[][] parts, FComplexMatrix2D matrix)
compose(FComplexMatrix2D[][])
.
All matrices of a given column within parts must have the same number of columns. All matrices of a given row within parts must have the same number of rows. Otherwise an IllegalArgumentException is thrown. Note that nulls within parts[row,col] are an exception to this rule: they are ignored. Cells are copied.
IllegalArgumentException
- subject to the conditions outlined above.public void demo1()
public void demo2()
public FComplexMatrix2D diagonal(FComplexMatrix1D vector)
public FComplexMatrix1D diagonal(FComplexMatrix2D A)
A
- the matrix, need not be square.public FComplexMatrix2D identity(int rowsAndColumns)
public FComplexMatrix2D make(float[][] values)
The values are copied. So subsequent changes in values are not reflected in the matrix, and vice-versa.
values
- The values to be filled into the new matrix.IllegalArgumentException
- if
for any 1 <= row < values.length: values[row].length != values[row-1].length
.public FComplexMatrix2D make(int rows, int columns)
public FComplexMatrix2D make(int rows, int columns, float[] initialValue)
public FComplexMatrix2D random(int rows, int columns)
public FComplexMatrix2D repeat(FComplexMatrix2D A, int rowRepeat, int columnRepeat)
public FComplexMatrix2D sample(int rows, int columns, float[] value, float nonZeroFraction)
IllegalArgumentException
- if nonZeroFraction < 0 || nonZeroFraction > 1.FloatRandomSampler
public FComplexMatrix2D sample(FComplexMatrix2D matrix, float[] value, float nonZeroFraction)
IllegalArgumentException
- if nonZeroFraction < 0 || nonZeroFraction > 1.FloatRandomSampler
Jump to the Parallel Colt Homepage