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" 115 double _before, _beginning;
116 double _eigenTime, _iterationTime, _searchTime, _varianceTime, _totalTime;
117 int _interpolationCount;
126 template <
typename T>
151 virtual T operator()(ndarray::Array<const T, 1, 1>
const &p1,
152 ndarray::Array<const T, 1, 1>
const &p2)
const;
164 template <
typename T>
175 void setEllSquared(
double ellSquared);
177 T operator()(ndarray::Array<const T, 1, 1>
const &, ndarray::Array<const T, 1, 1>
const &)
const override;
193 template <
typename T>
203 void setSigma0(
double sigma0);
208 void setSigma1(
double sigma1);
210 T operator()(ndarray::Array<const T, 1, 1>
const &, ndarray::Array<const T, 1, 1>
const &)
const override;
213 double _sigma0, _sigma1;
224 template <
typename T>
246 void Initialize(ndarray::Array<T, 2, 2>
const &dt);
263 void findNeighbors(ndarray::Array<int, 1, 1> neighdex, ndarray::Array<double, 1, 1> dd,
264 ndarray::Array<const T, 1, 1>
const &v,
int n_nn)
const;
273 T getData(
int ipt,
int idim)
const;
296 ndarray::Array<T, 1, 1> getData(
int ipt)
const;
305 void addPoint(ndarray::Array<const T, 1, 1>
const &v);
315 void removePoint(
int dex);
320 int getNPoints()
const;
329 void getTreeNode(ndarray::Array<int, 1, 1>
const &v,
int dex)
const;
332 ndarray::Array<int, 2, 2> _tree;
333 ndarray::Array<int, 1, 1> _inn;
334 ndarray::Array<T, 2, 2> _data;
336 enum { DIMENSION, LT, GEQ,
PARENT };
351 int _npts, _dimensions, _room, _roomStep, _masterParent;
352 mutable int _neighborsFound, _neighborsWanted;
358 mutable ndarray::Array<double, 1, 1> _neighborDistances;
359 mutable ndarray::Array<int, 1, 1> _neighborCandidates;
373 void _organize(ndarray::Array<int, 1, 1>
const &use,
int ct,
int parent,
int dir);
380 int _findNode(ndarray::Array<const T, 1, 1>
const &v)
const;
398 void _lookForNeighbors(ndarray::Array<const T, 1, 1>
const &v,
int consider,
int from)
const;
403 int _testTree()
const;
418 int _walkUpTree(
int target,
int dir,
int root)
const;
428 void _count(
int where,
int *ct)
const;
435 void _descend(
int root);
442 void _reassign(
int target);
447 double _distance(ndarray::Array<const T, 1, 1>
const &p1, ndarray::Array<const T, 1, 1>
const &p2)
const;
471 template <
typename T>
494 GaussianProcess(ndarray::Array<T, 2, 2>
const &dataIn, ndarray::Array<T, 1, 1>
const &ff,
516 GaussianProcess(ndarray::Array<T, 2, 2>
const &dataIn, ndarray::Array<T, 1, 1>
const &mn,
517 ndarray::Array<T, 1, 1>
const &mx, ndarray::Array<T, 1, 1>
const &ff,
531 GaussianProcess(ndarray::Array<T, 2, 2>
const &dataIn, ndarray::Array<T, 2, 2>
const &ff,
549 GaussianProcess(ndarray::Array<T, 2, 2>
const &dataIn, ndarray::Array<T, 1, 1>
const &mn,
550 ndarray::Array<T, 1, 1>
const &mx, ndarray::Array<T, 2, 2>
const &ff,
556 int getNPoints()
const;
573 void getData(ndarray::Array<T, 2, 2> pts, ndarray::Array<T, 1, 1> fn,
574 ndarray::Array<int, 1, 1> indices)
const;
585 void getData(ndarray::Array<T, 2, 2> pts, ndarray::Array<T, 2, 2> fn,
586 ndarray::Array<int, 1, 1> indices)
const;
606 int numberOfNeighbors)
const;
622 void interpolate(ndarray::Array<T, 1, 1>
mu, ndarray::Array<T, 1, 1> variance,
623 ndarray::Array<T, 1, 1>
const &vin,
int numberOfNeighbors)
const;
644 T selfInterpolate(ndarray::Array<T, 1, 1> variance,
int dex,
int numberOfNeighbors)
const;
660 void selfInterpolate(ndarray::Array<T, 1, 1> mu, ndarray::Array<T, 1, 1> variance,
int dex,
661 int numberOfNeighbors)
const;
684 void batchInterpolate(ndarray::Array<T, 1, 1> mu, ndarray::Array<T, 1, 1> variance,
685 ndarray::Array<T, 2, 2>
const &queries)
const;
704 void batchInterpolate(ndarray::Array<T, 1, 1> mu, ndarray::Array<T, 2, 2>
const &queries)
const;
710 void batchInterpolate(ndarray::Array<T, 2, 2> mu, ndarray::Array<T, 2, 2> variance,
711 ndarray::Array<T, 2, 2>
const &queries)
const;
717 void batchInterpolate(ndarray::Array<T, 2, 2> mu, ndarray::Array<T, 2, 2>
const &queries)
const;
735 void addPoint(ndarray::Array<T, 1, 1>
const &vin, T f);
746 void addPoint(ndarray::Array<T, 1, 1>
const &vin, ndarray::Array<T, 1, 1>
const &f);
759 void removePoint(
int dex);
767 void setKrigingParameter(T kk);
788 void setLambda(T lambda);
807 int _npts, _useMaxMin, _dimensions, _room, _roomStep, _nFunctions;
809 T _krigingParameter, _lambda;
811 ndarray::Array<T, 1, 1> _max, _min;
812 ndarray::Array<T, 2, 2> _function;
823 #endif //#ifndef LSST_AFW_MATH_GAUSSIAN_PROCESS_H GaussianProcessTimer & operator=(GaussianProcessTimer const &)=default
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...
Key< Flag > const & target
a Covariogram that recreates a neural network with one hidden layer and infinite units in that layer ...
Interface for DateTime class.
Covariogram()
construct a Covariogram assigning default values to the hyper parameters
void addToSearch()
Adds time to _searchTime.
Citizen is a class that should be among all LSST classes base classes, and handles basic memory manag...
void display()
Displays the current values of all times and _interpolationCount.
void reset()
Resets all of the data members of GaussianProcessTimer to zero.
table::Key< double > sigma1
void addToEigen()
Adds time to _eigenTime.