25 #ifndef LSST_AFW_MATH_GAUSSIAN_PROCESS_H 26 #define LSST_AFW_MATH_GAUSSIAN_PROCESS_H 28 #include <Eigen/Dense> 31 #include "ndarray/eigen.h" 117 double _before, _beginning;
118 double _eigenTime, _iterationTime, _searchTime, _varianceTime, _totalTime;
119 int _interpolationCount;
128 template <
typename T>
153 virtual T operator()(ndarray::Array<const T, 1, 1>
const &p1,
154 ndarray::Array<const T, 1, 1>
const &p2)
const;
166 template <
typename T>
177 void setEllSquared(
double ellSquared);
179 T operator()(ndarray::Array<const T, 1, 1>
const &, ndarray::Array<const T, 1, 1>
const &)
const override;
195 template <
typename T>
205 void setSigma0(
double sigma0);
210 void setSigma1(
double sigma1);
212 T operator()(ndarray::Array<const T, 1, 1>
const &, ndarray::Array<const T, 1, 1>
const &)
const override;
215 double _sigma0, _sigma1;
226 template <
typename T>
248 void Initialize(ndarray::Array<T, 2, 2>
const &dt);
265 void findNeighbors(ndarray::Array<int, 1, 1> neighdex, ndarray::Array<double, 1, 1> dd,
266 ndarray::Array<const T, 1, 1>
const &v,
int n_nn)
const;
275 T getData(
int ipt,
int idim)
const;
298 ndarray::Array<T, 1, 1> getData(
int ipt)
const;
307 void addPoint(ndarray::Array<const T, 1, 1>
const &v);
317 void removePoint(
int dex);
322 int getNPoints()
const;
331 void getTreeNode(ndarray::Array<int, 1, 1>
const &v,
int dex)
const;
334 ndarray::Array<int, 2, 2> _tree;
335 ndarray::Array<int, 1, 1> _inn;
336 ndarray::Array<T, 2, 2> _data;
338 enum { DIMENSION, LT, GEQ,
PARENT };
353 int _npts, _dimensions, _room, _roomStep, _masterParent;
354 mutable int _neighborsFound, _neighborsWanted;
360 mutable ndarray::Array<double, 1, 1> _neighborDistances;
361 mutable ndarray::Array<int, 1, 1> _neighborCandidates;
375 void _organize(ndarray::Array<int, 1, 1>
const &use,
int ct,
int parent,
int dir);
382 int _findNode(ndarray::Array<const T, 1, 1>
const &v)
const;
400 void _lookForNeighbors(ndarray::Array<const T, 1, 1>
const &v,
int consider,
int from)
const;
405 int _testTree()
const;
420 int _walkUpTree(
int target,
int dir,
int root)
const;
430 void _count(
int where,
int *ct)
const;
437 void _descend(
int root);
444 void _reassign(
int target);
449 double _distance(ndarray::Array<const T, 1, 1>
const &p1, ndarray::Array<const T, 1, 1>
const &p2)
const;
473 template <
typename T>
496 GaussianProcess(ndarray::Array<T, 2, 2>
const &dataIn, ndarray::Array<T, 1, 1>
const &ff,
518 GaussianProcess(ndarray::Array<T, 2, 2>
const &dataIn, ndarray::Array<T, 1, 1>
const &mn,
519 ndarray::Array<T, 1, 1>
const &mx, ndarray::Array<T, 1, 1>
const &ff,
533 GaussianProcess(ndarray::Array<T, 2, 2>
const &dataIn, ndarray::Array<T, 2, 2>
const &ff,
551 GaussianProcess(ndarray::Array<T, 2, 2>
const &dataIn, ndarray::Array<T, 1, 1>
const &mn,
552 ndarray::Array<T, 1, 1>
const &mx, ndarray::Array<T, 2, 2>
const &ff,
558 int getNPoints()
const;
575 void getData(ndarray::Array<T, 2, 2> pts, ndarray::Array<T, 1, 1> fn,
576 ndarray::Array<int, 1, 1> indices)
const;
587 void getData(ndarray::Array<T, 2, 2> pts, ndarray::Array<T, 2, 2> fn,
588 ndarray::Array<int, 1, 1> indices)
const;
608 int numberOfNeighbors)
const;
624 void interpolate(ndarray::Array<T, 1, 1> mu, ndarray::Array<T, 1, 1> variance,
625 ndarray::Array<T, 1, 1>
const &vin,
int numberOfNeighbors)
const;
646 T selfInterpolate(ndarray::Array<T, 1, 1> variance,
int dex,
int numberOfNeighbors)
const;
662 void selfInterpolate(ndarray::Array<T, 1, 1> mu, ndarray::Array<T, 1, 1> variance,
int dex,
663 int numberOfNeighbors)
const;
686 void batchInterpolate(ndarray::Array<T, 1, 1> mu, ndarray::Array<T, 1, 1> variance,
687 ndarray::Array<T, 2, 2>
const &queries)
const;
706 void batchInterpolate(ndarray::Array<T, 1, 1> mu, ndarray::Array<T, 2, 2>
const &queries)
const;
712 void batchInterpolate(ndarray::Array<T, 2, 2> mu, ndarray::Array<T, 2, 2> variance,
713 ndarray::Array<T, 2, 2>
const &queries)
const;
719 void batchInterpolate(ndarray::Array<T, 2, 2> mu, ndarray::Array<T, 2, 2>
const &queries)
const;
737 void addPoint(ndarray::Array<T, 1, 1>
const &vin, T f);
748 void addPoint(ndarray::Array<T, 1, 1>
const &vin, ndarray::Array<T, 1, 1>
const &f);
761 void removePoint(
int dex);
769 void setKrigingParameter(T kk);
790 void setLambda(T lambda);
809 int _npts, _useMaxMin, _dimensions, _room, _roomStep, _nFunctions;
811 T _krigingParameter, _lambda;
813 ndarray::Array<T, 1, 1> _max, _min;
814 ndarray::Array<T, 2, 2> _function;
825 #endif //#ifndef LSST_AFW_MATH_GAUSSIAN_PROCESS_H GaussianProcessTimer & operator=(GaussianProcessTimer const &)=default
Key< Flag > const & target
Stores values of a function sampled on an image and allows you to interpolate the function to unsampl...
void addToTotal(int i)
Adds time to _totalTime and adds counts to _interpolationCount.
This is a structure for keeping track of how long the interpolation methods spend on different parts ...
The parent class of covariogram functions for use in Gaussian Process interpolation.
void start()
Starts the timer for an individual call to an interpolation routine.
void addToVariance()
Adds time to _varianceTime.
~GaussianProcessTimer()=default
A base class for image defects.
void addToIteration()
Adds time to _iterationTime.
The data for GaussianProcess is stored in a KD tree to facilitate nearest-neighbor searches...
a Covariogram that recreates a neural network with one hidden layer and infinite units in that layer ...
Covariogram()
construct a Covariogram assigning default values to the hyper parameters
void addToSearch()
Adds time to _searchTime.
void display()
Displays the current values of all times and _interpolationCount.
void reset()
Resets all of the data members of GaussianProcessTimer to zero.
void addToEigen()
Adds time to _eigenTime.
table::Key< double > sigma1