Package edu.cmu.tetrad.util
Class IndexedMatrix
java.lang.Object
edu.cmu.tetrad.util.IndexedMatrix
Indexed matrix.
- Version:
- $Id: $Id
- Author:
- josephramsey Returns values of the given square matrix, where the indices are remapped via the given indices array. If the supplied matrix is 6 x 6, for example, and the indices set are [5 4 2 1], then getValue(1, 2) will return element [4][2] of the given matrix.
-
Constructor Summary
ConstructorsConstructorDescriptionIndexedMatrix
(double[][] matrix) Constructs a new IndexedMatrix for the given matrix. -
Method Summary
Modifier and TypeMethodDescriptionint[]
Getter for the fieldindices
.double
getValue
(int i, int j) getValue.void
setIndices
(int[] indices) Sets the index array.
-
Constructor Details
-
IndexedMatrix
public IndexedMatrix(double[][] matrix) Constructs a new IndexedMatrix for the given matrix.- Parameters:
matrix
- The wrapped matrix.
-
-
Method Details
-
getIndices
public int[] getIndices()Getter for the field
indices
.- Returns:
- Ibid.
-
setIndices
public void setIndices(int[] indices) Sets the index array. The index array must be of length <= the order of the matrix, each element of which is distinct and < the order of the matrix.- Parameters:
indices
- The indices of the submatrix desired.
-
getValue
public double getValue(int i, int j) getValue.
- Parameters:
i
- The row value in the remapped indices of the cell desired.j
- The column value in teh remapped indices of the cell desired.- Returns:
- Ibid.
-