org.apache.commons.math3.linear

## Class SparseFieldMatrix<T extends FieldElement<T>>

- java.lang.Object
- - org.apache.commons.math3.linear.AbstractFieldMatrix<T>
  - - org.apache.commons.math3.linear.SparseFieldMatrix<T>

Type Parameters:
  `T` - the type of the field elements

All Implemented Interfaces:
  AnyMatrix, FieldMatrix<T>

Deprecated.
As of version 3.1, this class is deprecated, for reasons exposed in this JIRA ticket. This class will be removed in version 4.0.

    @Deprecated
    public class SparseFieldMatrix<T extends FieldElement<T>>
    extends AbstractFieldMatrix<T>

Sparse matrix implementation based on an open addressed map.

Since:
  2.0
Version:
  $Id: SparseFieldMatrix.java 1416643 2012-12-03 19:37:14Z tn $

### Field Summary

Fields
`private int` `columns` Deprecated. Column dimension.
`private OpenIntToFieldHashMap<T>` `entries` Deprecated. Storage for (sparse) matrix elements.
`private int` `rows` Deprecated. Row dimension.

### Constructor Summary

Constructors
Constructor and Description
`SparseFieldMatrix(Field<T> field)` Deprecated. Create a matrix with no data.
`SparseFieldMatrix(Field<T> field, int rowDimension, int columnDimension)` Deprecated. Create a new SparseFieldMatrix<T> with the supplied row and column dimensions.
`SparseFieldMatrix(FieldMatrix<T> other)` Deprecated. Generic copy constructor.
`SparseFieldMatrix(SparseFieldMatrix<T> other)` Deprecated. Copy constructor.

### Method Summary

Methods
`void` `addToEntry(int row, int column, T increment)` Deprecated. Change an entry in the specified row and column.
`private int` `computeKey(int row, int column)` Deprecated. Compute the key to access a matrix element.
`FieldMatrix<T>` `copy()` Deprecated. Make a (deep) copy of this.
`FieldMatrix<T>` `createMatrix(int rowDimension, int columnDimension)` Deprecated. Create a new FieldMatrix<T> of the same type as the instance with the supplied row and column dimensions.
`int` `getColumnDimension()` Deprecated. Returns the number of columns in the matrix.
`T` `getEntry(int row, int column)` Deprecated. Returns the entry in the specified row and column.
`int` `getRowDimension()` Deprecated. Returns the number of rows in the matrix.
`void` `multiplyEntry(int row, int column, T factor)` Deprecated. Change an entry in the specified row and column.
`void` `setEntry(int row, int column, T value)` Deprecated. Set the entry in the specified row and column.

### Methods inherited from class org.apache.commons.math3.linear.AbstractFieldMatrix

`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`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Field Detail

#### entries

    private final OpenIntToFieldHashMap<T extends FieldElement<T>> entries

Deprecated.
Storage for (sparse) matrix elements.

#### rows

    private final int rows

Deprecated.
Row dimension.

#### columns

    private final int columns

Deprecated.
Column dimension.

### Constructor Detail

#### SparseFieldMatrix

    public SparseFieldMatrix(Field<T> field)

Deprecated.
Create a matrix with no data.

Parameters:
  `field` - Field to which the elements belong.

#### SparseFieldMatrix

    public SparseFieldMatrix(Field<T> field,
                     int rowDimension,
                     int columnDimension)

Deprecated.
Create a new SparseFieldMatrix<T> with the supplied row and column dimensions.

Parameters:
  `field` - Field to which the elements belong.
  `rowDimension` - Number of rows in the new matrix.
  `columnDimension` - Number of columns in the new matrix.
Throws:
  `NotStrictlyPositiveException` - if row or column dimension is not positive.

#### SparseFieldMatrix

    public SparseFieldMatrix(SparseFieldMatrix<T> other)

Deprecated.
Copy constructor.

Parameters:
  `other` - Instance to copy.

#### SparseFieldMatrix

    public SparseFieldMatrix(FieldMatrix<T> other)

Deprecated.
Generic copy constructor.

Parameters:
  `other` - Instance to copy.

### Method Detail

#### addToEntry

    public void addToEntry(int row,
                  int column,
                  T increment)

Deprecated.
Change an entry in the specified row and column.

Specified by:
  `addToEntry` in interface `FieldMatrix<T extends FieldElement<T>>`
Specified by:
  `addToEntry` in class `AbstractFieldMatrix<T extends FieldElement<T>>`
Parameters:
  `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)`.

#### copy

    public FieldMatrix<T> copy()

Deprecated.
Make a (deep) copy of this.

Specified by:
  `copy` in interface `FieldMatrix<T extends FieldElement<T>>`
Specified by:
  `copy` in class `AbstractFieldMatrix<T extends FieldElement<T>>`
Returns:
  a copy of this matrix.

#### createMatrix

    public FieldMatrix<T> createMatrix(int rowDimension,
                              int columnDimension)

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

Specified by:
  `createMatrix` in interface `FieldMatrix<T extends FieldElement<T>>`
Specified by:
  `createMatrix` in class `AbstractFieldMatrix<T extends FieldElement<T>>`
Parameters:
  `rowDimension` - the number of rows in the new matrix
  `columnDimension` - the number of columns in the new matrix
Returns:
  a new matrix of the same type as the instance

#### getColumnDimension

    public int getColumnDimension()

Deprecated.
Returns the number of columns in the matrix.

Specified by:
  `getColumnDimension` in interface `AnyMatrix`
Specified by:
  `getColumnDimension` in class `AbstractFieldMatrix<T extends FieldElement<T>>`
Returns:
  columnDimension

#### getEntry

    public T getEntry(int row,
             int column)

Deprecated.
Returns the entry in the specified row and column.

Specified by:
  `getEntry` in interface `FieldMatrix<T extends FieldElement<T>>`
Specified by:
  `getEntry` in class `AbstractFieldMatrix<T extends FieldElement<T>>`
Parameters:
  `row` - row location of entry to be fetched
  `column` - column location of entry to be fetched
Returns:
  matrix entry in row,column

#### getRowDimension

    public int getRowDimension()

Deprecated.
Returns the number of rows in the matrix.

Specified by:
  `getRowDimension` in interface `AnyMatrix`
Specified by:
  `getRowDimension` in class `AbstractFieldMatrix<T extends FieldElement<T>>`
Returns:
  rowDimension

#### multiplyEntry

    public void multiplyEntry(int row,
                     int column,
                     T factor)

Deprecated.
Change an entry in the specified row and column.

Specified by:
  `multiplyEntry` in interface `FieldMatrix<T extends FieldElement<T>>`
Specified by:
  `multiplyEntry` in class `AbstractFieldMatrix<T extends FieldElement<T>>`
Parameters:
  `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)`

#### setEntry

    public void setEntry(int row,
                int column,
                T value)

Deprecated.
Set the entry in the specified row and column.

Specified by:
  `setEntry` in interface `FieldMatrix<T extends FieldElement<T>>`
Specified by:
  `setEntry` in class `AbstractFieldMatrix<T extends FieldElement<T>>`
Parameters:
  `row` - row location of entry to be set
  `column` - column location of entry to be set
  `value` - matrix entry to be set in row,column

#### computeKey

    private int computeKey(int row,
                 int column)

Deprecated.
Compute the key to access a matrix element.

Parameters:
  `row` - Row index of the matrix element.
  `column` - Column index of the matrix element.
Returns:
  the key within the map to access the matrix element.