Package wsh.opt
Class CoordinateTransform
- java.lang.Object
 - 
- wsh.opt.CoordinateTransform
 
 
- 
public class CoordinateTransform extends java.lang.ObjectFind a best linear combination of input coordinates to fit output coordinates. Finds a_io (a with subscripts i and o) to best approximate the linear transform.out_o = sum_i ( a_io * in_i )
where in_i are input coordinates,
out_o are output coordinates,
i is the index of each input dimension,
and o is the index of each output dimension.
The optimum coefficients minimize this least squares error:sum_oj [ sum_i ( a_io * in_ij ) - out_oj ]^2
where in_ij is an input array of different coordinates,
out_oj is an output array of corresponding coordinates,
and j is the index of pairs of coordinates to be fit in a least-squares sense. Normal equations (indexed by k) are solved independently for each o:sum_ij ( in_kj * in_ij * a_io ) = sum_j ( in_kj * out_oj )
The Hessian isH = sum_j ( in_kj * in_ij )and the gradientb = - sum_j ( in_kj * out_oj )The solution is undamped and may not behave as you want for degenerate solutions. If the linear transform needs a translation shift, then include a constant as one of the input coordinates. 
- 
- 
Constructor Summary
Constructors Constructor Description CoordinateTransform(int dimensionOut, int dimensionIn)Constructor sets number of input and output coordinates. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(double[] out, double[] in)Add an observation of a set of input and output coordinates You should add enough of these to determine (or overdetermine) a unique linear mapping.double[]get(double[] in)For a given set of input coordinates, return the linearly predicted output coordinates. 
 - 
 
- 
- 
Method Detail
- 
add
public void add(double[] out, double[] in)Add an observation of a set of input and output coordinates You should add enough of these to determine (or overdetermine) a unique linear mapping. To allow translation, include a constant 1 as an input coordinate.- Parameters:
 out- A set of observed output coordinates with an unknown linear relationship to input coordinates.in- A set of observed input coordinates that should be linearly combined to calculate each of the output coordinates. To allow translation, include a constant 1.
 
- 
get
public double[] get(double[] in)
For a given set of input coordinates, return the linearly predicted output coordinates.- Parameters:
 in- A set of input coordinates- Returns:
 - A computed set of output coordinates.
 
 
 - 
 
 -