Class AdjacencyDoubleMatrix
java.lang.Object
repast.simphony.context.space.graph.AdjacencyDoubleMatrix
- All Implemented Interfaces:
AdjacencyMatrix
A network adjacency matrix that stores its values as doubles.
- Author:
- Nick Collier
-
Constructor Summary
ConstructorDescriptionAdjacencyDoubleMatrix
(double[][] m) Constructs an AdjacencyMatrix from the specified two dimensional double array.AdjacencyDoubleMatrix
(int rows, int cols) Constructs an AdjacencyMatrix with the specified number of rows and columns.AdjacencyDoubleMatrix
(cern.colt.matrix.impl.DenseDoubleMatrix2D m) Constructs an AdjacencyMatrix from the specified DenseDoubleMatrix2DAdjacencyDoubleMatrix
(List<String> labels) Constructs an AdjacencyMatrix with the specified row/col labels. -
Method Summary
Modifier and TypeMethodDescriptionint
columns()
Returns the number of columns in the matrix.double
get
(int row, int col) Gets the value at row, col.Gets the node labels, if any, for this matrix.Gets the label for this matrix.cern.colt.matrix.impl.DenseDoubleMatrix1D
getRow
(int row) Gets the specified row of data for this matrix.Returns a String representation of only the actual data matrix.int
rows()
Returns the number of rows int matrix.void
set
(int row, int col, double val) Sets a data value in this matrix.void
setMatrix
(double[][] m) Sets the actual matrix for this AdjacencyMatrix.void
setMatrix
(cern.colt.matrix.impl.DenseDoubleMatrix2D m) Sets the actual matrix for this AdjacencyMatrix.void
setMatrixLabel
(String label) Sets the matrix label.toString()
Returns a String representation of this AdjacencyMatrix (comment etc.) together with the actual data matrix.
-
Constructor Details
-
AdjacencyDoubleMatrix
public AdjacencyDoubleMatrix(int rows, int cols) Constructs an AdjacencyMatrix with the specified number of rows and columns. The intial state of every ij is 0.- Parameters:
rows
- the number of rows in the matrixcols
- the number of cols in the matrix
-
AdjacencyDoubleMatrix
Constructs an AdjacencyMatrix with the specified row/col labels. The matrix row and column size are set equal to the size of the lables vector.- Parameters:
labels
- the row & column labels
-
AdjacencyDoubleMatrix
public AdjacencyDoubleMatrix(cern.colt.matrix.impl.DenseDoubleMatrix2D m) Constructs an AdjacencyMatrix from the specified DenseDoubleMatrix2D- Parameters:
m
- the DenseDoubleMatrix2D to construct this AdjacencyMatrix from
-
AdjacencyDoubleMatrix
public AdjacencyDoubleMatrix(double[][] m) Constructs an AdjacencyMatrix from the specified two dimensional double array.- Parameters:
m
- the 2D double array to construct this AdjacencyMatrix from.
-
-
Method Details
-
setMatrix
public void setMatrix(cern.colt.matrix.impl.DenseDoubleMatrix2D m) Sets the actual matrix for this AdjacencyMatrix.- Parameters:
m
- the actual matrix data for this AdjacencyMatrix
-
setMatrix
public void setMatrix(double[][] m) Sets the actual matrix for this AdjacencyMatrix.- Parameters:
m
- the actual matrix data for this AdjacencyMatrix
-
getRow
public cern.colt.matrix.impl.DenseDoubleMatrix1D getRow(int row) Gets the specified row of data for this matrix.- Specified by:
getRow
in interfaceAdjacencyMatrix
- Parameters:
row
- the index of the row to get- Returns:
- the specified row of data for this matrix.
-
set
public void set(int row, int col, double val) Sets a data value in this matrix.- Parameters:
row
- the row index (i)col
- the col index (j)val
- the value to set ij to.
-
get
public double get(int row, int col) Gets the value at row, col.- Specified by:
get
in interfaceAdjacencyMatrix
- Parameters:
row
- the row index (i)col
- the col index (j)- Returns:
- the double value at row, col (ij)
-
rows
public int rows()Returns the number of rows int matrix.- Specified by:
rows
in interfaceAdjacencyMatrix
- Returns:
- the row count
-
columns
public int columns()Returns the number of columns in the matrix.- Specified by:
columns
in interfaceAdjacencyMatrix
- Returns:
- the column count
-
matrixToString
Returns a String representation of only the actual data matrix.- Specified by:
matrixToString
in interfaceAdjacencyMatrix
- Returns:
- a String representation of only the actual data matrix.
-
toString
Returns a String representation of this AdjacencyMatrix (comment etc.) together with the actual data matrix. -
getLabels
Gets the node labels, if any, for this matrix.- Specified by:
getLabels
in interfaceAdjacencyMatrix
- Returns:
- the node labels, if any, for this matrix.
-
getMatrixLabel
Gets the label for this matrix.- Specified by:
getMatrixLabel
in interfaceAdjacencyMatrix
- Returns:
- the label for this matrix.
-
setMatrixLabel
Sets the matrix label.- Parameters:
label
- the matrix label
-