IntervalProd.dist

IntervalProd.dist(point, exponent=2.0)[source]

Return the distance of point to this set.

Parameters:
pointarray-like or float

Point whose distance to calculate. Its length must be equal to the set's dimension. Can be a float in the 1d case.

exponentnon-zero float or float('inf'), optional

Exponent of the norm used in the distance calculation.

Returns:
distfloat

Distance to the interior of the IntervalProd. Points strictly inside have distance 0.0, points with NaN have distance float('inf').

See also

numpy.linalg.norm

norm used to compute the distance

Examples

>>> min_pt, max_pt = [-1, 0, 2], [-0.5, 0, 3]
>>> rbox = IntervalProd(min_pt, max_pt)
>>> rbox.dist([-5, 3, 2])
5.0
>>> rbox.dist([-5, 3, 2], exponent=float('inf'))
4.0