|
JScience v4.3 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jscience.mathematics.vector.Matrix<F>
org.jscience.mathematics.vector.DenseMatrix<F>
public final class DenseMatrix<F extends Field<F>>
This class represents a matrix made of dense
vectors (as rows). To create a dense matrix made of column vectors the
transpose() method can be used.
For example:
DenseVector<Rational> column0 = DenseVector.valueOf(...);
DenseVector<Rational> column1 = DenseVector.valueOf(...);
DenseMatrix<Rational> M = DenseMatrix.valueOf(column0, column1).transpose();
As for any concrete structure, this class is declared final (otherwise most
operations would have to be overridden to return the appropriate type).
Specialized dense matrix should sub-class Matrix directly.
For example:
// Extension through composition.
final class TriangularMatrix <F extends Field<F>> extends Matrix<F> {
private DenseMatrix<F> _value; // Possible implementation.
...
public TriangularMatrix opposite() { // Returns the right type.
return TriangularMatrix.valueOf(_value.opposite());
}
...
}
| Field Summary |
|---|
| Fields inherited from class org.jscience.mathematics.vector.Matrix |
|---|
XML |
| Method Summary | ||
|---|---|---|
DenseMatrix<F> |
adjoint()
Returns the adjoint of this matrix. |
|
F |
cofactor(int i,
int j)
Returns the cofactor of an element in this matrix. |
|
DenseMatrix<F> |
copy()
Returns a copy of this matrix allocated
by the calling thread (possibly on the stack). |
|
F |
determinant()
Returns the determinant of this matrix. |
|
F |
get(int i,
int j)
Returns a single element from this matrix. |
|
DenseVector<F> |
getColumn(int j)
Returns the column identified by the specified index in this matrix. |
|
DenseVector<F> |
getDiagonal()
Returns the diagonal vector. |
|
int |
getNumberOfColumns()
Returns the number of columns n for this matrix. |
|
int |
getNumberOfRows()
Returns the number of rows m for this matrix. |
|
DenseVector<F> |
getRow(int i)
Returns the row identified by the specified index in this matrix. |
|
DenseMatrix<F> |
inverse()
Returns the inverse of this matrix (must be square). |
|
DenseMatrix<F> |
minus(Matrix<F> that)
Returns the difference between this matrix and the one specified. |
|
DenseMatrix<F> |
opposite()
Returns the negation of this matrix. |
|
DenseMatrix<F> |
plus(Matrix<F> that)
Returns the sum of this matrix with the one specified. |
|
Matrix<F> |
tensor(Matrix<F> that)
Returns the linear algebraic matrix tensor product of this matrix and another (Kronecker product). |
|
DenseMatrix<F> |
times(F k)
Returns the product of this matrix by the specified factor. |
|
DenseMatrix<F> |
times(Matrix<F> that)
Returns the product of this matrix with the one specified. |
|
DenseVector<F> |
times(Vector<F> v)
Returns the product of this matrix by the specified vector. |
|
DenseMatrix<F> |
transpose()
Returns the transpose of this matrix. |
|
static
|
valueOf(DenseVector<F>... rows)
Returns a dense matrix holding the specified row vectors (column vectors if transposed). |
|
static
|
valueOf(F[][] elements)
Returns a dense matrix from the specified 2-dimensional array. |
|
static
|
valueOf(java.util.List<DenseVector<F>> rows)
Returns a dense matrix holding the row vectors from the specified collection (column vectors if transposed). |
|
static
|
valueOf(Matrix<F> that)
Returns a dense matrix equivalent to the specified matrix. |
|
Vector<F> |
vectorization()
Returns the vectorization of this matrix. |
|
| Methods inherited from class org.jscience.mathematics.vector.Matrix |
|---|
divide, equals, equals, hashCode, isSquare, pow, pseudoInverse, solve, solve, toString, toText, trace |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public static <F extends Field<F>> DenseMatrix<F> valueOf(F[][] elements)
elements - this matrix elements.
DimensionException - if rows have different length.DenseMatrixpublic static <F extends Field<F>> DenseMatrix<F> valueOf(DenseVector<F>... rows)
transposed).
rows - the row vectors.
DimensionException - if the rows do not have the same dimension.public static <F extends Field<F>> DenseMatrix<F> valueOf(java.util.List<DenseVector<F>> rows)
transposed).
rows - the list of row vectors.
DimensionException - if the rows do not have the same dimension.public static <F extends Field<F>> DenseMatrix<F> valueOf(Matrix<F> that)
that - the matrix to convert.
that or a dense matrix holding the same elements
as the specified matrix.public int getNumberOfRows()
Matrixm for this matrix.
getNumberOfRows in class Matrix<F extends Field<F>>public int getNumberOfColumns()
Matrixn for this matrix.
getNumberOfColumns in class Matrix<F extends Field<F>>
public F get(int i,
int j)
Matrix
get in class Matrix<F extends Field<F>>i - the row index (range [0..m[).j - the column index (range [0..n[).
public DenseVector<F> getRow(int i)
Matrix
getRow in class Matrix<F extends Field<F>>i - the row index (range [0..m[).
public DenseVector<F> getColumn(int j)
Matrix
getColumn in class Matrix<F extends Field<F>>j - the column index (range [0..n[).
public DenseVector<F> getDiagonal()
Matrix
getDiagonal in class Matrix<F extends Field<F>>public DenseMatrix<F> opposite()
Matrix
opposite in interface GroupAdditive<Matrix<F extends Field<F>>>opposite in class Matrix<F extends Field<F>>-this.public DenseMatrix<F> plus(Matrix<F> that)
Matrix
plus in interface GroupAdditive<Matrix<F extends Field<F>>>plus in class Matrix<F extends Field<F>>that - the matrix to be added.
this + that.public DenseMatrix<F> minus(Matrix<F> that)
Matrix
minus in class Matrix<F extends Field<F>>that - the matrix to be subtracted.
this - that.public DenseMatrix<F> times(F k)
Matrix
times in interface VectorSpace<Matrix<F extends Field<F>>,F extends Field<F>>times in class Matrix<F extends Field<F>>k - the coefficient multiplier.
this · kpublic DenseVector<F> times(Vector<F> v)
Matrix
times in class Matrix<F extends Field<F>>v - the vector.
this · vpublic DenseMatrix<F> times(Matrix<F> that)
Matrix
times in interface Ring<Matrix<F extends Field<F>>>times in class Matrix<F extends Field<F>>that - the matrix multiplier.
this · that.public DenseMatrix<F> inverse()
Matrix
inverse in class Matrix<F extends Field<F>>1 / thispublic F determinant()
Matrix
determinant in class Matrix<F extends Field<F>>public DenseMatrix<F> transpose()
Matrix
transpose in class Matrix<F extends Field<F>>A'.
public F cofactor(int i,
int j)
Matrix
cofactor in class Matrix<F extends Field<F>>i - the row index.j - the column index.
THIS[i,j].public DenseMatrix<F> adjoint()
Matrix
adjoint in class Matrix<F extends Field<F>>public Matrix<F> tensor(Matrix<F> that)
MatrixDenseMatrix.
tensor in class Matrix<F extends Field<F>>that - the second matrix.
this ⊗ thatpublic Vector<F> vectorization()
MatrixDenseVector.
vectorization in class Matrix<F extends Field<F>>public DenseMatrix<F> copy()
Matrixallocated
by the calling thread (possibly on the stack).
copy in interface ValueTypecopy in class Matrix<F extends Field<F>>
|
JScience v4.3 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||