public class InverseDistanceWeights extends java.lang.Object implements PointInterpolationWeights
p and a set
of support points p_i.
Each weight w_i is generated according to
w_i = f(p,p_i)/ sum_i f(p,p_i)where
f(p,p_i) = 1/ (d(p,p_i)^exp + lam)and
d(p,p_i) is the distance from p to
p_i. If normalize is true,
d(p,p_i) is normalized by dividing by the maximum
distance.| Constructor and Description |
|---|
InverseDistanceWeights(double exp,
double lam,
boolean normalize)
Creates an InverseDistanceWeightGenerator with specified parameters.
|
| Modifier and Type | Method and Description |
|---|---|
static boolean |
adjustWeightsForPosition(VectorNd w,
Vector3d p,
java.util.Collection<Vector3d> support)
Takes a set of desired weights, based on distance calculations, and
adjusts them so that the weighted sum of the support points equals p, and
the sum of the weights equals 1.
|
boolean |
compute(VectorNd w,
Vector3d p,
java.util.Collection<Vector3d> support)
Given a reference point
p, computes and returns a set of
weights w_i that can be used for interpolation of values
associated with a set of support points p_i. |
public InverseDistanceWeights(double exp,
double lam,
boolean normalize)
exp - exponent for the inverse distance functionlam - regularization term for the inverse distance functionnormalize - if true, use normalized distances
(distance divided by the maximum distance)public static boolean adjustWeightsForPosition(VectorNd w, Vector3d p, java.util.Collection<Vector3d> support)
min || w - wd ||^2
subject to
G w = y
where the columns of G and y are given by
[ p_i ] [ p ]
G(j) = [ ] y = [ ]
[ 1 ] [ 1 ]
This problem can be solved by computing
w = G^T inv(G G^T) (y + G wd) - wd
Since G may be rank deficient, we compute the inverse using
a singular value decomposition of G^T, noting that if
G^T = U S V^T
then
G^T inv(G G^T) = U inv(S) V^T
Rank deficiency can be determined by examining the singular values.public boolean compute(VectorNd w, Vector3d p, java.util.Collection<Vector3d> support)
p, computes and returns a set of
weights w_i that can be used for interpolation of values
associated with a set of support points p_i. The weights are
normalized so that they sum to unity. The weights should also be computed
such that
p = sum w_i p_iIf the support points do not have sufficient coverage, the last condition may not be possible. In that case, the method should return false.
compute in interface PointInterpolationWeights