Documentation

DistanceMatrix

FinalYes

Validates, once and for all at construction, every invariant NeighborJoiningTreeBuilder relies on : square, zero diagonal, symmetric, non-negative, unique non-empty labels. A distance is itself always non-negative by definition (it is a measurement, unlike the branch lengths the neighbor- joining algorithm later derives from it, which can legitimately go negative).

Class DistanceMatrix

Tags
author

Amélie DUVERNET aka Amelaye amelieonline@gmail.com

Table of Contents

Properties

$distances  : array<string|int, array<string|int, float>>
$labels  : array<string|int, string>

Methods

__construct()  : mixed
DistanceMatrix constructor.
getDistance()  : float
getLabels()  : array<string|int, string>
getMatrix()  : array<string|int, array<string|int, float>>
getSize()  : int
inLabelOrder()  : array<string|int, mixed>|null

Properties

$distances

private array<string|int, array<string|int, float>> $distances

Methods

__construct()

DistanceMatrix constructor.

public __construct(array<string|int, string> $aLabels, array<string|int, mixed> $aDistances) : mixed
Parameters
$aLabels : array<string|int, string>

One name per taxon, unique and non-empty

$aDistances : array<string|int, mixed>

An N x N matrix, N = count($aLabels) ; zero diagonal, symmetric, non-negative

Tags
throws
InvalidDistanceMatrixException

getDistance()

public getDistance(int $iRow, int $iColumn) : float
Parameters
$iRow : int
$iColumn : int
Return values
float

getLabels()

public getLabels() : array<string|int, string>
Return values
array<string|int, string>

getMatrix()

public getMatrix() : array<string|int, array<string|int, float>>
Return values
array<string|int, array<string|int, float>>

inLabelOrder()

private static inLabelOrder(array<string|int, mixed> $aMap, array<string|int, string> $aLabels) : array<string|int, mixed>|null
Parameters
$aMap : array<string|int, mixed>

Values keyed by label, or a plain list

$aLabels : array<string|int, string>
Return values
array<string|int, mixed>|null —

The values in the order of the labels, null when the keys are not exactly the labels

On this page

Search results