|
Go to the documentation of this file. 1 #ifndef NPSTAT_LOCALQUADRATICLEASTSQUARESND_HH_
2 #define NPSTAT_LOCALQUADRATICLEASTSQUARESND_HH_
33 template< class Po int, typename Numeric>
61 const double* bandwidthValues, unsigned nBandwidthValues,
62 const Point* pointCoords, unsigned nPoints,
63 const Numeric* values, const Numeric* errors = 0);
70 inline unsigned dim() const { return dim_;}
71 inline unsigned polyDegree() const { return polyDegree_;}
72 inline unsigned nPoints() const { return nPoints_;}
73 inline unsigned nTermsFitted() const { return nBasisFcns_;}
74 inline bool hasErrors() const { return errors_;}
75 inline double getBandwidth( const unsigned bwNumber) const
77 if (bwNumber >= dim_) throw std::out_of_range(
78 "In npstat::LocalQuadraticLeastSquaresND::getBandwidth: "
79 "bandwidth index out of range");
103 {assert(newCoords); points_ = newCoords;}
110 {assert(newValues); values_ = newValues;}
117 inline void setErrors( const Numeric* newErrors) {errors_ = newErrors;}
122 if (bwNum >= dim_) throw std::out_of_range(
123 "In npstat::LocalQuadraticLeastSquaresND::setBandwidth: "
124 "bandwidth index out of range");
125 if (newBw <= 0.0) throw std::invalid_argument(
126 "In npstat::LocalQuadraticLeastSquaresND::setBandwidth: "
127 "bandwidth must be positive");
144 template < typename Num2>
145 double fit( const Num2* coordinate, unsigned coordinateDim,
146 double* gradient=0, unsigned lenGradient=0,
147 double* hessian=0, unsigned lenHessian=0,
148 unsigned excludedPoint=UINT_MAX) const;
155 double basisPoly( unsigned num, const double* coords) const;
156 double chisqCalc( bool looMode) const;
158 const unsigned polyDegree_;
159 const unsigned nPoints_;
161 unsigned nBasisFcns_;
163 const Point* points_;
164 const Numeric* values_;
165 const Numeric* errors_;
168 std::vector<double> bwBuf_;
172 std::vector<double> memBuf_;
175 double* singularValues_;
177 mutable std::vector<double> workBuf_;
178 mutable std::vector<int> intBuf_;
186 const double* bandwidthValues, unsigned nBandwidthValues,
187 const std::vector<Point>& pointCoords,
188 const double* values, unsigned nValues,
189 const double* errors, unsigned nErrors);
191 inline void setPointCoords_2( const std::vector<Point>& newCoords)
193 if (nPoints_ != newCoords.size()) throw std::invalid_argument(
194 "In npstat::LocalQuadraticLeastSquaresND::setPointCoords_2: "
195 "incompatible input length");
196 points_ = &newCoords[0];
199 inline void setValues_2( const double* values, unsigned nValues)
201 if (nPoints_ != nValues) throw std::invalid_argument(
202 "In npstat::LocalQuadraticLeastSquaresND::setValues_2: "
203 "incompatible input length");
208 inline void setErrors_2( const double* errors, unsigned nErrors)
212 if (nPoints_ != nErrors) throw std::invalid_argument(
213 "In npstat::LocalQuadraticLeastSquaresND::setErrors_2: "
214 "incompatible input length");
223 const double* coordinate, unsigned coordinateDim) const
225 return this-> fit(coordinate, coordinateDim);
228 inline double fitWithGradient(
229 const double* coordinate, unsigned coordinateDim,
230 double* gradient, unsigned lenGradient) const
232 if (lenGradient != dim_) throw std::invalid_argument(
233 "In npstat::LocalQuadraticLeastSquaresND::fitWithGradient: "
234 "incompatible dimensionality of the gradient");
235 return this-> fit(coordinate, coordinateDim,
236 gradient, lenGradient);
239 inline double fitWithHessian(
240 const double* coordinate, unsigned coordinateDim,
241 double* gradient, unsigned lenGradient,
242 Matrix<double>* hessian) const
244 if (lenGradient != dim_) throw std::invalid_argument(
245 "In npstat::LocalQuadraticLeastSquaresND::fitWithHessian: "
246 "incompatible dimensionality of the gradient");
248 hessian->resize(dim_, dim_);
249 return this-> fit(coordinate, coordinateDim,
250 gradient, lenGradient,
251 hessian->data(), dim_*dim_);
257 #include "npstat/stat/LocalQuadraticLeastSquaresND.icc"
Interface definition for multivariate continuous statistical distributions.
Definition: AbsDistributionND.hh:26
Definition: LocalQuadraticLeastSquaresND.hh:35
void setErrors(const Numeric *newErrors) Definition: LocalQuadraticLeastSquaresND.hh:117
LocalQuadraticLeastSquaresND(unsigned polyDegree, const AbsDistributionND &weight, const double *bandwidthValues, unsigned nBandwidthValues, const Point *pointCoords, unsigned nPoints, const Numeric *values, const Numeric *errors=0)
void setPointCoords(const Point *newCoords) Definition: LocalQuadraticLeastSquaresND.hh:102
double lscvCriterion() const
unsigned dim() const Definition: LocalQuadraticLeastSquaresND.hh:70
void setValues(const Numeric *newValues) Definition: LocalQuadraticLeastSquaresND.hh:109
Matrix< double > smootherMatrix(double stepInErrorUnits=1.0e-3) const
double fit(const Num2 *coordinate, unsigned coordinateDim, double *gradient=0, unsigned lenGradient=0, double *hessian=0, unsigned lenHessian=0, unsigned excludedPoint=UINT_MAX) const
void setBandwidth(const unsigned bwNum, const double newBw) Definition: LocalQuadraticLeastSquaresND.hh:120
Definition: AbsArrayProjector.hh:14
|