Package com.compomics.util.math.matrix
Class DoubleMatrix
java.lang.Object
com.compomics.util.math.matrix.DoubleMatrix
public class DoubleMatrix extends Object
Implementation of a matrix for double objects. Warning: all indexes start
from 0.
- Author:
- Marc Vaudel
-
Constructor Summary
Constructors Constructor Description DoubleMatrix()
DoubleMatrix(int nColumns)
DoubleMatrix(DoubleMatrix matrix)
-
Method Summary
Modifier and Type Method Description void
addColumn(ArrayList<Double> column)
void
addLine(ArrayList<Double> line)
void
appendColumns(DoubleMatrix columns)
void
appendLines(DoubleMatrix lines)
void
columnPermutation(int column1, int column2)
boolean
equals(DoubleMatrix anotherMatrix)
ArrayList<Double>
getColumn(int columnIndex)
ArrayList<ArrayList<Double>>
getColumns()
double
getDeterminant()
static DoubleMatrix
getIdentityMatrix(int n)
ArrayList<Double>
getLine(int lineIndex)
ArrayList<ArrayList<Double>>
getLines()
int
getNColumns()
int
getNLines()
double
getNonDiagonalScore()
Returns a score based on the non-diagonal values.DoubleMatrix
getSubMatrix(int lineStart, int lineStop, int columnStart, int columnStop)
double
getTrace()
Double
getValueAt(int lineIndex, int columnIndex)
Returns the value of the matrix at given indexes.boolean
isSquare()
void
linePermutation(int line1, int line2)
void
setColumn(int columnIndex, ArrayList<Double> column)
void
setLine(int lineIndex, ArrayList<Double> line)
void
setValueAt(int lineIndex, int columnIndex, Double value)
static DoubleMatrix
transpose(DoubleMatrix matrix)
-
Constructor Details
-
DoubleMatrix
public DoubleMatrix() -
DoubleMatrix
public DoubleMatrix(int nColumns) -
DoubleMatrix
-
-
Method Details
-
addColumn
-
addLine
-
setLine
-
setColumn
-
getNColumns
public int getNColumns() -
getNLines
public int getNLines() -
isSquare
public boolean isSquare() -
getColumn
-
getColumns
-
getLines
-
getLine
-
getValueAt
Returns the value of the matrix at given indexes. 0 is the first index.- Parameters:
lineIndex
- the line indexcolumnIndex
- the column index- Returns:
- the value of the matrix at given indexes, 0 is the first index
-
setValueAt
-
transpose
-
equals
-
getIdentityMatrix
-
getTrace
public double getTrace() -
getSubMatrix
-
appendColumns
-
appendLines
-
getDeterminant
public double getDeterminant() -
getNonDiagonalScore
public double getNonDiagonalScore()Returns a score based on the non-diagonal values. Score is 0 for identity, 1 for the (1) matrix.- Returns:
- a score based on the non-diagonal values
-
linePermutation
public void linePermutation(int line1, int line2) -
columnPermutation
public void columnPermutation(int column1, int column2)
-