T
- the type of the field elementspublic class SparseFieldMatrix<T extends FieldElement<T>> extends AbstractFieldMatrix<T>
Caveat: This implementation assumes that, for any x
,
the equality x * 0d == 0d
holds. But it is is not true for
NaN
. Moreover, zero entries will lose their sign.
Some operations (that involve NaN
and/or infinities) may
thus give incorrect results.
Constructor and Description |
---|
SparseFieldMatrix(Field<T> field)
Create a matrix with no data.
|
SparseFieldMatrix(Field<T> field,
int rowDimension,
int columnDimension)
Create a new SparseFieldMatrix
|
SparseFieldMatrix(FieldMatrix<T> other)
Generic copy constructor.
|
SparseFieldMatrix(SparseFieldMatrix<T> other)
Copy constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addToEntry(int row,
int column,
T increment)
Change an entry in the specified row and column.
|
FieldMatrix<T> |
copy()
Make a (deep) copy of this.
|
FieldMatrix<T> |
createMatrix(int rowDimension,
int columnDimension)
Create a new FieldMatrix
|
int |
getColumnDimension()
Returns the number of columns in the matrix.
|
T |
getEntry(int row,
int column)
Returns the entry in the specified row and column.
|
int |
getRowDimension()
Returns the number of rows in the matrix.
|
void |
multiplyEntry(int row,
int column,
T factor)
Change an entry in the specified row and column.
|
void |
setEntry(int row,
int column,
T value)
Set the entry in the specified row and column.
|
add, buildArray, buildArray, checkAdditionCompatible, checkColumnIndex, checkMultiplicationCompatible, checkRowIndex, checkSubMatrixIndex, checkSubMatrixIndex, checkSubtractionCompatible, copySubMatrix, copySubMatrix, equals, extractField, extractField, getColumn, getColumnMatrix, getColumnVector, getData, getField, getRow, getRowMatrix, getRowVector, getSubMatrix, getSubMatrix, getTrace, hashCode, isSquare, multiply, operate, operate, power, preMultiply, preMultiply, preMultiply, scalarAdd, scalarMultiply, setColumn, setColumnMatrix, setColumnVector, setRow, setRowMatrix, setRowVector, setSubMatrix, subtract, toString, transpose, walkInColumnOrder, walkInColumnOrder, walkInColumnOrder, walkInColumnOrder, walkInOptimizedOrder, walkInOptimizedOrder, walkInOptimizedOrder, walkInOptimizedOrder, walkInRowOrder, walkInRowOrder, walkInRowOrder, walkInRowOrder
public SparseFieldMatrix(Field<T> field)
field
- Field to which the elements belong.public SparseFieldMatrix(Field<T> field, int rowDimension, int columnDimension)
field
- Field to which the elements belong.rowDimension
- Number of rows in the new matrix.columnDimension
- Number of columns in the new matrix.NotStrictlyPositiveException
- if row or column dimension is not positive.public SparseFieldMatrix(SparseFieldMatrix<T> other)
other
- Instance to copy.public SparseFieldMatrix(FieldMatrix<T> other)
other
- Instance to copy.public void addToEntry(int row, int column, T increment)
addToEntry
in interface FieldMatrix<T extends FieldElement<T>>
addToEntry
in class AbstractFieldMatrix<T extends FieldElement<T>>
row
- Row location of entry to be set.column
- Column location of entry to be set.increment
- Value to add to the current matrix entry in
(row, column)
.public FieldMatrix<T> copy()
copy
in interface FieldMatrix<T extends FieldElement<T>>
copy
in class AbstractFieldMatrix<T extends FieldElement<T>>
public FieldMatrix<T> createMatrix(int rowDimension, int columnDimension)
createMatrix
in interface FieldMatrix<T extends FieldElement<T>>
createMatrix
in class AbstractFieldMatrix<T extends FieldElement<T>>
rowDimension
- the number of rows in the new matrixcolumnDimension
- the number of columns in the new matrixpublic int getColumnDimension()
getColumnDimension
in interface AnyMatrix
getColumnDimension
in class AbstractFieldMatrix<T extends FieldElement<T>>
public T getEntry(int row, int column)
getEntry
in interface FieldMatrix<T extends FieldElement<T>>
getEntry
in class AbstractFieldMatrix<T extends FieldElement<T>>
row
- row location of entry to be fetchedcolumn
- column location of entry to be fetchedpublic int getRowDimension()
getRowDimension
in interface AnyMatrix
getRowDimension
in class AbstractFieldMatrix<T extends FieldElement<T>>
public void multiplyEntry(int row, int column, T factor)
multiplyEntry
in interface FieldMatrix<T extends FieldElement<T>>
multiplyEntry
in class AbstractFieldMatrix<T extends FieldElement<T>>
row
- Row location of entry to be set.column
- Column location of entry to be set.factor
- Multiplication factor for the current matrix entry
in (row,column)
public void setEntry(int row, int column, T value)
setEntry
in interface FieldMatrix<T extends FieldElement<T>>
setEntry
in class AbstractFieldMatrix<T extends FieldElement<T>>
row
- row location of entry to be setcolumn
- column location of entry to be setvalue
- matrix entry to be set in row,columnCopyright © 2003–2016 The Apache Software Foundation. All rights reserved.