Top Description Methods
org.apache.commons.math3.linear

public Interface FieldMatrix<T extends FieldElement<T>>

extends AnyMatrix
Known Direct Implementers
org.apache.commons.math3.linear.AbstractFieldMatrix
Type Parameters
<T>
the type of the field elements
Imports
org.apache.commons.math3.Field, .FieldElement, org.apache.commons.math3.exception.DimensionMismatchException, .NoDataException, .NotPositiveException, .NotStrictlyPositiveException, .NullArgumentException, .NumberIsTooSmallException, .OutOfRangeException

Interface defining field-valued matrix with basic algebraic operations.

Matrix element indexing is 0-based -- e.g., getEntry(0, 0) returns the element in the first row, first column of the matrix.

Method Summary

Modifier and TypeMethod and Description
public FieldMatrix<T>

Returns:

this + m.
add
(FieldMatrix<T>
Matrix to be added.
m
)

Compute the sum of this and m.

public void
addToEntry(int
Row location of entry to be set.
row
,
int
Column location of entry to be set.
column
,
T
Value to add to the current matrix entry in (row, column).
increment
)

Change an entry in the specified row and column.

public FieldMatrix<T>

Returns:

a copy of this matrix.
copy
()

Make a (deep) copy of this.

public void
copySubMatrix(int
Initial row index.
startRow
,
int
Final row index (inclusive).
endRow
,
int
Initial column index.
startColumn
,
int
Final column index (inclusive).
endColumn
,
T[][]
The array where the submatrix data should be copied (if larger than rows/columns counts, only the upper-left part will be modified).
destination
)

Copy a submatrix.

public void
copySubMatrix(int[]
Array of row indices.
selectedRows
,
int[]
Array of column indices.
selectedColumns
,
T[][]
Arrays where the submatrix data should be copied (if larger than rows/columns counts, only the upper-left part will be used)
destination
)

Copy a submatrix.

public FieldMatrix<T>

Returns:

a new matrix of the same type as the instance
createMatrix
(final int
the number of rows in the new matrix
rowDimension
,
final int
the number of columns in the new matrix
columnDimension
)

Create a new FieldMatrix<t> of the same type as the instance with the supplied row and column dimensions.

public T[]

Returns:

array of entries in the column
getColumn
(int
the column to be fetched
column
)

Get the entries in column number col as an array.

public FieldMatrix<T>

Returns:

a column matrix.
getColumnMatrix
(int
Column to be fetched.
column
)

Get the entries in column number column as a column matrix.

public FieldVector<T>

Returns:

a column vector.
getColumnVector
(int
Column to be fetched.
column
)

Returns the entries in column number column as a vector.

public T[][]

Returns:

a 2-dimensional array of entries.
getData
()

Returns matrix entries as a two-dimensional array.

public T

Returns:

matrix entry in row,column
getEntry
(int
row location of entry to be fetched
row
,
int
column location of entry to be fetched
column
)

Returns the entry in the specified row and column.

public Field<T>

Returns:

the type of field elements of the matrix.
getField
()

Get the type of field elements of the matrix.

public T[]

Returns:

array of entries in the row.
getRow
(int
Row to be fetched.
row
)

Get the entries in row number row as an array.

public FieldMatrix<T>

Returns:

a row matrix.
getRowMatrix
(int
Row to be fetched.
row
)

Get the entries in row number row as a row matrix.

public FieldVector<T>

Returns:

a row vector.
getRowVector
(int
Row to be fetched
row
)

Get the entries in row number row as a vector.

public FieldMatrix<T>

Returns:

the matrix containing the data of the specified rows and columns.
getSubMatrix
(int
Initial row index
startRow
,
int
Final row index (inclusive)
endRow
,
int
Initial column index
startColumn
,
int
Final column index (inclusive)
endColumn
)

Get a submatrix.

public FieldMatrix<T>

Returns:

the matrix containing the data in the specified rows and columns.
getSubMatrix
(int[]
Array of row indices.
selectedRows
,
int[]
Array of column indices.
selectedColumns
)

Get a submatrix.

public T

Returns:

trace
getTrace
()

Returns the trace of the matrix (the sum of the elements on the main diagonal).

public FieldMatrix<T>

Returns:

this * m.
multiply
(FieldMatrix<T>
Matrix to postmultiply by.
m
)

Postmultiply this matrix by m.

public void
multiplyEntry(int
Row location of entry to be set.
row
,
int
Column location of entry to be set.
column
,
T
Multiplication factor for the current matrix entry in (row,column)
factor
)

Change an entry in the specified row and column.

public T[]

Returns:

this * v
operate
(T[]
the vector to operate on
v
)

Returns the result of multiplying this by the vector v.

public FieldVector<T>

Returns:

this * v
operate
(FieldVector<T>
the vector to operate on
v
)

Returns the result of multiplying this by the vector v.

public FieldMatrix<T>

Returns:

this^p
power
(final int
raise this to power p
p
)

Returns the result multiplying this with itself p times.

public FieldMatrix<T>

Returns:

m * this.
preMultiply
(FieldMatrix<T>
Matrix to premultiply by.
m
)

Premultiply this matrix by m.

public T[]

Returns:

v * this
preMultiply
(T[]
the row vector to premultiply by
v
)

Returns the (row) vector result of premultiplying this by the vector v.

public FieldVector<T>

Returns:

v * this
preMultiply
(FieldVector<T>
the row vector to premultiply by
v
)

Returns the (row) vector result of premultiplying this by the vector v.

public FieldMatrix<T>

Returns:

d + this.
scalarAdd
(T
Value to be added to each entry.
d
)

Increment each entry of this matrix.

public FieldMatrix<T>

Returns:

d * this.
scalarMultiply
(T
Value to multiply all entries by.
d
)

Multiply each entry by d.

public void
setColumn(int
the column to be set
column
,
T[]
column array (must have the same number of rows as the instance)
array
)

Set the entries in column number column as a column matrix.

public void
setColumnMatrix(int
Column to be set.
column
,
FieldMatrix<T>
column matrix (must have one column and the same number of rows as the instance).
matrix
)

Set the entries in column number column as a column matrix.

public void
setColumnVector(int
Column to be set.
column
,
FieldVector<T>
Column vector (must have the same number of rows as the instance).
vector
)

Set the entries in column number column as a vector.

public void
setEntry(int
row location of entry to be set
row
,
int
column location of entry to be set
column
,
T
matrix entry to be set in row,column
value
)

Set the entry in the specified row and column.

public void
setRow(int
Row to be set.
row
,
T[]
Row matrix (must have the same number of columns as the instance).
array
)

Set the entries in row number row as a row matrix.

public void
setRowMatrix(int
Row to be set.
row
,
FieldMatrix<T>
Row matrix (must have one row and the same number of columns as the instance).
matrix
)

Set the entries in row number row as a row matrix.

public void
setRowVector(int
Row to be set.
row
,
FieldVector<T>
row vector (must have the same number of columns as the instance).
vector
)

Set the entries in row number row as a vector.

public void
setSubMatrix(T[][]
Array containing the submatrix replacement data.
subMatrix
,
int
Row coordinate of the top-left element to be replaced.
row
,
int
Column coordinate of the top-left element to be replaced.
column
)

Replace the submatrix starting at (row, column) using data in the input subMatrix array.

public FieldMatrix<T>

Returns:

this - m.
subtract
(FieldMatrix<T>
Matrix to be subtracted.
m
)

Subtract m from this matrix.

public FieldMatrix<T>

Returns:

transpose matrix
transpose
()

Returns the transpose of this matrix.

public T

Returns:

the value returned by FieldMatrixChangingVisitor#end() at the end of the walk
walkInColumnOrder
(FieldMatrixChangingVisitor<T>
visitor used to process all matrix entries
visitor
)

Visit (and possibly change) all matrix entries in column order.

public T

Returns:

the value returned by FieldMatrixPreservingVisitor#end() at the end of the walk
walkInColumnOrder
(FieldMatrixPreservingVisitor<T>
visitor used to process all matrix entries
visitor
)

Visit (but don't change) all matrix entries in column order.

public T

Returns:

the value returned by FieldMatrixChangingVisitor#end() at the end of the walk
walkInColumnOrder
(FieldMatrixChangingVisitor<T>
visitor used to process all matrix entries
visitor
,
int
Initial row index
startRow
,
int
Final row index (inclusive)
endRow
,
int
Initial column index
startColumn
,
int
Final column index
endColumn
)

Visit (and possibly change) some matrix entries in column order.

public T

Returns:

the value returned by FieldMatrixPreservingVisitor#end() at the end of the walk
walkInColumnOrder
(FieldMatrixPreservingVisitor<T>
visitor used to process all matrix entries
visitor
,
int
Initial row index
startRow
,
int
Final row index (inclusive)
endRow
,
int
Initial column index
startColumn
,
int
Final column index
endColumn
)

Visit (but don't change) some matrix entries in column order.

public T

Returns:

the value returned by FieldMatrixChangingVisitor#end() at the end of the walk
walkInOptimizedOrder
(FieldMatrixChangingVisitor<T>
visitor used to process all matrix entries
visitor
)

Visit (and possibly change) all matrix entries using the fastest possible order.

public T

Returns:

the value returned by FieldMatrixPreservingVisitor#end() at the end of the walk
walkInOptimizedOrder
(FieldMatrixPreservingVisitor<T>
visitor used to process all matrix entries
visitor
)

Visit (but don't change) all matrix entries using the fastest possible order.

public T

Returns:

the value returned by FieldMatrixChangingVisitor#end() at the end of the walk
walkInOptimizedOrder
(FieldMatrixChangingVisitor<T>
visitor used to process all matrix entries
visitor
,
int
Initial row index
startRow
,
int
Final row index (inclusive)
endRow
,
int
Initial column index
startColumn
,
int
Final column index (inclusive)
endColumn
)

Visit (and possibly change) some matrix entries using the fastest possible order.

public T

Returns:

the value returned by FieldMatrixPreservingVisitor#end() at the end of the walk
walkInOptimizedOrder
(FieldMatrixPreservingVisitor<T>
visitor used to process all matrix entries
visitor
,
int
Initial row index
startRow
,
int
Final row index (inclusive)
endRow
,
int
Initial column index
startColumn
,
int
Final column index (inclusive)
endColumn
)

Visit (but don't change) some matrix entries using the fastest possible order.

public T

Returns:

the value returned by FieldMatrixChangingVisitor#end() at the end of the walk
walkInRowOrder
(FieldMatrixChangingVisitor<T>
visitor used to process all matrix entries
visitor
)

Visit (and possibly change) all matrix entries in row order.

public T

Returns:

the value returned by FieldMatrixPreservingVisitor#end() at the end of the walk
walkInRowOrder
(FieldMatrixPreservingVisitor<T>
visitor used to process all matrix entries
visitor
)

Visit (but don't change) all matrix entries in row order.

public T

Returns:

the value returned by FieldMatrixChangingVisitor#end() at the end of the walk
walkInRowOrder
(FieldMatrixChangingVisitor<T>
visitor used to process all matrix entries
visitor
,
int
Initial row index
startRow
,
int
Final row index (inclusive)
endRow
,
int
Initial column index
startColumn
,
int
Final column index
endColumn
)

Visit (and possibly change) some matrix entries in row order.

public T

Returns:

the value returned by FieldMatrixPreservingVisitor#end() at the end of the walk
walkInRowOrder
(FieldMatrixPreservingVisitor<T>
visitor used to process all matrix entries
visitor
,
int
Initial row index
startRow
,
int
Final row index (inclusive)
endRow
,
int
Initial column index
startColumn
,
int
Final column index
endColumn
)

Visit (but don't change) some matrix entries in row order.

Inherited from org.apache.commons.math3.linear.AnyMatrix:
getColumnDimensiongetRowDimensionisSquare