public class DistanceMatrix implements TableReport
Storage for pairwise distance matrices. Only stores half the matrix as it is symmetrical.
For best performance, iterate over matrix this way.
DistanceMatrix matrix;
for (int i = 0; i < myNumTaxa; i++) {
for (int j = 0; j <= i; j++) {
matrix.getDistance(i, j);
}
}
public DistanceMatrix(kotlin.Array[] distance,
TaxaList taxa)
Constructor taking distances array and taxa list. Use DistanceMatrixBuilder instead of this.
class DistanceMatrixBuilderpublic DistanceMatrix(kotlin.Array[] distances,
TaxaList taxa,
GeneralAnnotation annotations)
Use DistanceMatrixBuilder instead of this.
class DistanceMatrixBuilderpublic DistanceMatrix(DistanceMatrix dm)
Constructor that clones a distance matrix.
public DistanceMatrix(DistanceMatrix dm, TaxaList subset)
Constructor that clones a distance matrix and for only the specified taxa.
public void printPHYLIP(java.io.PrintWriter out)
print alignment (PHYLIP format)
public java.lang.String toString()
returns representation of this alignment as a string
public double squaredDistance(DistanceMatrix mat, boolean weighted)
compute squared distance to second distance matrix
public double absoluteDistance(DistanceMatrix mat)
compute absolute distance to second distance matrix
public int getSize()
Returns the number of taxa which is also the number of rows and columns that the distance matrix has.
public kotlin.Array[] getClonedDistances()
Returns the distances as a 2-dimensional array of doubles. Matrix is cloned first so it can be altered freely.
public kotlin.Array[] getDistances()
Returns the distances as a 2-dimensional array of doubles (in the actual array used to store the distances)
public float getDistance(int row,
int col)
public double meanDistance()
Returns the mean pairwise distance of this matrix
public Taxon getTaxon(int i)
public int numberOfTaxa()
public int whichIdNumber(java.lang.String name)
public int whichIdNumber(Taxon id)
public TaxaList getTaxaList()
Return TaxaList of this alignment.
public boolean isSymmetric()
test whether this matrix is a symmetric distance matrix
public int getClosestIndex(int fromIndex,
kotlin.Array[] exclusion)
fromIndex - the index of the thing (taxa,sequence) from which we want to find the closest (excluding self)exclusion - indexes of things that should not be considered, may be nullpublic static DistanceMatrix hadamardProduct(DistanceMatrix m0, DistanceMatrix m1)
public java.lang.Object[] getTableColumnNames()
public java.lang.Object[] getRow(long rowLong)
Returns specified row.
rowLong - row numberpublic java.lang.String getTableTitle()
public long getRowCount()
public long getElementCount()
public int getColumnCount()
public java.lang.Object getValueAt(long rowIndex,
int columnIndex)
public java.lang.String getColumnName(int col)
public GeneralAnnotation annotations()