criteria.LqDistance

criteria.LqDistance(self, arr, q=1)

Methods

Name Description
design Calculate the minimum Lq distance among all pairwise distances in the array
index Calculate the Lq norm (distance) between two points (rows or columns) in an array.
pairwise Calculate the Lq distance among all pairwise distances in the array

design

criteria.LqDistance.design()

Calculate the minimum Lq distance among all pairwise distances in the array

Returns

Type Description
float The minimum Lq distance among all pairs of points in the array

Example:

import pyLHD
sample = pyLHD.GoodLatticePoint(size = (5,3),seed =1)
l1 = pyLHD.LqDistance(sample,q=1)
l1.pairwise()
array([4., 5., 7., 7., 5., 5., 9., 4., 6., 8.])
l1.design()
4.0

index

criteria.LqDistance.index(i, j, axis=0)

Calculate the Lq norm (distance) between two points (rows or columns) in an array. The points can be either two rows or two columns in the array, depending on the axis parameter

Parameters

Name Type Description Default
i int The index of the first point (row or column based on axis) required
j int The index of the second point (row or column based on axis) required
axis int The axis along which to compute the distance axis = 0 for distances between rows, axis = 1 for distances between columns. Defaults to 0 0

Raises

Type Description
ValueError If the axis is not 0 (for rows) or 1 (for columns)

Returns

Type Description
float The Lq distance between the two specified points

Example:

import pyLHD
sample = pyLHD.GoodLatticePoint(size = (5,3),seed =1)
l1 = pyLHD.LqDistance(sample,q=1)
l1.index(i = 0, j = 1)
4.0
l1.index(i = 0, j = 1, axis = 1)
6.0

pairwise

criteria.LqDistance.pairwise()

Calculate the Lq distance among all pairwise distances in the array

Returns

Type Description
numpy.numpy.ndarray The Lq distance among all pairs of points in the array

Example:

import pyLHD
sample = pyLHD.GoodLatticePoint(size = (5,3),seed =1)
l1 = pyLHD.LqDistance(sample,q=1)
l1.pairwise()
array([4., 5., 7., 7., 5., 5., 9., 4., 6., 8.])