SOT
rbf.h
1 
9 #ifndef SOT_RBF_H
10 #define SOT_RBF_H
11 
12 #include "common.h"
13 #include "utils.h"
14 #include "surrogate.h"
15 
17 namespace sot {
18 
20 
28  class Kernel {
30  virtual inline int order() const = 0;
31  virtual inline int phiZero() const = 0;
33 
38  virtual inline double eval(double dist) const = 0;
40 
44  virtual inline double deriv(double dist) const = 0;
46 
50  virtual inline mat eval(const mat &dists) const = 0;
52 
56  virtual inline mat deriv(const mat &dists) const = 0;
57  };
58 
60 
68  class CubicKernel : public Kernel {
69  private:
70  int mPhiZero = 0;
71  int mOrder = 2;
72  public:
73  inline int order() const {
74  return mOrder; }
75  inline int phiZero() const { return mPhiZero;
76  }
77  inline double eval(double dist) const {
78  return dist * dist * dist;
79  }
80  inline double deriv(double dist) const {
81  return 3 * dist * dist;
82  }
83  inline mat eval(const mat &dists) const {
84  return dists % dists % dists;
85  }
86  inline mat deriv(const mat &dists) const {
87  return 3 * dists % dists;
88  }
89  };
90 
92 
100  class ThinPlateKernel : public Kernel {
101  private:
102  int mPhiZero = 0;
103  int mOrder = 2;
104  public:
105  inline int order() const {
106  return mOrder;
107  }
108  inline int phiZero() const {
109  return mPhiZero;
110  }
111  inline double eval(double dist) const {
112  return dist * dist * std::log(dist + 1e-12);
113  }
114  inline double deriv(double dist) const {
115  return dist * (1.0 + 2.0 * std::log(dist + 1e-12));
116  }
117  inline mat eval(const mat &dists) const {
118  return dists % dists % arma::log(dists + 1e-12);
119  }
120  inline mat deriv(const mat &dists) const {
121  return dists % (1 + 2.0 * arma::log(dists + 1e-12));
122  }
123  };
124 
126 
134  class LinearKernel : public Kernel {
135  private:
136  int mPhiZero = 0;
137  int mOrder = 1;
138  public:
139  inline int order() const {
140  return mOrder;
141  }
142  inline int phiZero() const {
143  return mPhiZero;
144  }
145  inline double eval(double dist) const {
146  return dist;
147  }
148  inline double deriv(double dist) const {
149  return 1.0;
150  }
151  inline mat eval(const mat &dists) const {
152  return dists;
153  }
154  inline mat deriv(const mat &dists) const {
155  return arma::ones<mat>(dists.n_rows, dists.n_cols);
156  }
157  };
158 
160 
168  class Tail {
170  virtual inline int degree() const = 0;
171 
176  virtual inline int dimTail(int dim) const = 0;
178 
182  virtual inline vec eval(const vec &point) const = 0;
184 
188  virtual inline mat eval(const mat &points) const = 0;
190 
194  virtual inline mat deriv(const vec &point) const = 0;
195  };
196 
198 
207  class LinearTail : public Tail {
208  private:
209  int mDegree = 1;
210  public:
211  inline int degree() const {
212  return mDegree;
213  }
214  inline mat eval(const mat &X) const {
215  return arma::join_vert(arma::ones<mat>(1, X.n_cols), X);
216  }
217  inline vec eval(const vec &x) const {
218  vec tail = arma::ones<vec>(x.n_rows + 1);
219  tail.tail(x.n_rows) = x;
220  return tail;
221  }
222  inline mat deriv(const vec &x) const {
223  return arma::join_vert(arma::zeros<mat>(1, x.n_rows),
224  arma::eye<mat>(x.n_rows, x.n_rows));
225  }
226  inline int dimTail(int dim) const {
227  return 1 + dim;
228  }
229  };
230 
232 
240  class ConstantTail : public Tail {
241  private:
242  int mDegree = 0;
243  public:
244  inline int degree() const {
245  return mDegree;
246  }
247  inline mat eval(const mat &X) const {
248  return arma::ones<mat>(1, X.n_cols);
249  }
250  inline vec eval(const vec &x) const {
251  return arma::ones<mat>(1, 1);
252  }
253  inline mat deriv(const vec &x) const {
254  return arma::zeros<mat>(1, x.n_rows);
255  }
256  inline int dimTail(int dim) const {
257  return 1;
258  }
259  };
260 
262 
318  template<class RBFKernel = CubicKernel, class PolyTail = LinearTail>
319  class RBFInterpolant : public Surrogate {
320 
321  protected:
322  RBFKernel mKernel;
323  PolyTail mTail;
324  mat mL;
325  mat mU;
331  int mDimTail;
333  bool mDirty;
336  double mEta = 1e-8;
337  int mDim;
339 
346  void setPoints(const mat &ppoints, const vec &funVals) {
347 
348  // Map point to be in the unit box
349  mat points = toUnitBox(ppoints, mxLow, mxUp);
350 
351  mNumPoints = (int)points.n_cols;
352  int n = mNumPoints + mDimTail;
353  if(mNumPoints < mDimTail) {
354  throw std::logic_error("Not enough points");
355  }
356  mat px = mTail.eval(points);
357  mat phi = mKernel.eval(arma::sqrt(squaredPairwiseDistance(points, points)));
358 
359  mat A = arma::zeros<mat>(n, n);
360  A(arma::span(mDimTail, n - 1), arma::span(0, mDimTail - 1)) = px.t();
361  A(arma::span(0, mDimTail - 1), arma::span(mDimTail, n - 1)) = px;
362  A(arma::span(mDimTail, n - 1), arma::span(mDimTail, n - 1)) = phi;
363  mfX.rows(mDimTail, n - 1) = funVals;
364 
365  // REGULARIZATION
366  A += mEta*arma::eye(n, n);
367 
368  // Compute the initial LU factorization of A
369  mat L, U, P;
370  arma::lu(L, U, P, A);
371 
372  mL(arma::span(0, n - 1), arma::span(0, n - 1)) = L;
373  mU(arma::span(0, n - 1), arma::span(0, n - 1)) = U;
374 
375  // Convert P to a permutation vector
376  for(int i = 0; i < n; i++) {
377  uvec temp = find(P.row(i) > 0.5);
378  mp(i) = temp(0);
379  }
380 
381  mCenters.cols(0, mNumPoints - 1) = points;
382  mDirty = true;
383  }
384 
385  public:
387 
391  RBFInterpolant(int maxPoints, int dim) :
392  RBFInterpolant(maxPoints, dim, arma::zeros(dim), arma::ones(dim)) {}
394 
399  RBFInterpolant(int maxPoints, int dim, double eta) :
400  RBFInterpolant(maxPoints, dim, arma::zeros(dim), arma::ones(dim), eta) {}
401 
403 
410  RBFInterpolant(int maxPoints, int dim, vec xLow, vec xUp, double eta) :
411  RBFInterpolant(maxPoints, dim, xLow, xUp) {
412  mEta = eta;
413  }
415 
423  RBFInterpolant(int maxPoints, int dim, vec xLow, vec xUp) {
424  mMaxPoints = maxPoints;
425  mDim = dim;
426  mDimTail = mTail.dimTail(dim);
427  mNumPoints = 0;
428  mCenters = arma::zeros<mat>(dim, maxPoints);
429  mL = arma::zeros<mat>(maxPoints + mDimTail, maxPoints + mDimTail);
430  mU = arma::zeros<mat>(maxPoints + mDimTail, maxPoints + mDimTail);
431  mp = arma::zeros<uvec>(maxPoints + mDimTail);
432  mfX = arma::zeros<vec>(maxPoints + mDimTail);
433  mCoeffs = vec(maxPoints + mDimTail);
434  mDirty = false;
435  mxLow = xLow;
436  mxUp = xUp;
437 
438  if ((mKernel.order() - 1) > mTail.degree()) {
439  throw std::logic_error("Kernel and tail mismatch");
440  }
441  }
442 
443  int dim() const {
444  return mDim;
445  }
446 
447  // Reset RBF
448  void reset() {
449  mNumPoints = 0;
450  }
451 
452  // Number of points
453  int numPoints() const {
454  return mNumPoints;
455  }
456 
457  // Return points
458  mat X() const {
459  return fromUnitBox((mat)mCenters.cols(0, mNumPoints - 1), mxLow, mxUp);
460  }
461 
462  // Return point
463  vec X(int i) const {
464  return fromUnitBox((mat)mCenters.col(i), mxLow, mxUp);
465  }
466 
467  // Return function values
468  vec fX() const {
469  return mfX.rows(mDimTail, mDimTail + mNumPoints - 1);
470  }
471 
472  // Return function value
473  double fX(int i) const {
474  return mfX(mDimTail + i);
475  }
476 
478 
484  if(mDirty) { throw std::logic_error("RBF not updated"); }
485  return mCoeffs;
486  }
487 
488  // Fit the RBF
489  void fit() {
490  if(mNumPoints < mDimTail) {
491  throw std::logic_error("Not enough points");
492  }
493  if (mDirty) {
494  int n = mNumPoints + mDimTail;
495  mCoeffs = arma::solve(arma::trimatl(mL(arma::span(0, n - 1), arma::span(0, n - 1))), mfX(mp(arma::span(0, n - 1))));
496  mCoeffs = arma::solve(arma::trimatu(mU(arma::span(0, n - 1), arma::span(0, n - 1))), mCoeffs);
497  mDirty = false;
498  }
499  }
500 
502 
508  void addPoint(const vec &ppoint, double funVal) {
509  if(mNumPoints == 0) {
510  vec fVal = {funVal};
511  mat point = (mat)ppoint;
512  return setPoints(point, fVal);
513  }
514 
515  // Map point to be in the unit box
516  vec point = toUnitBox(ppoint, mxLow, mxUp);
517 
518  int nAct = mDimTail + mNumPoints;
519  if(mNumPoints + 1 > mMaxPoints) {
520  throw std::logic_error("Capacity exceeded");
521  }
522 
523  vec vx = arma::join_vert(mTail.eval(point),
524  mKernel.eval(arma::sqrt(squaredPointSetDistance(point, mCenters.cols(0, mNumPoints - 1)))));
525  vec u12 = arma::solve(arma::trimatl(mL(arma::span(0, nAct - 1), arma::span(0, nAct - 1))), vx.rows(mp.head(nAct)));
526  vec l21 = (arma::solve(arma::trimatl(mU(arma::span(0, nAct - 1), arma::span(0, nAct - 1)).t()), vx));
527  double u22 = mKernel.phiZero() + mEta - arma::dot(u12, l21);
528 
529  mL(nAct, arma::span(0, nAct - 1)) = l21.t();
530  mL(nAct, nAct) = 1;
531  mU(arma::span(0, nAct - 1), nAct) = u12;
532  mU(nAct, nAct) = u22;
533  mp(nAct) = nAct;
534 
535  // Update F and add the centers
536  mfX(nAct) = funVal;
537  mCenters.col(mNumPoints) = point;
538  mNumPoints++;
539 
540  mDirty = true;
541  }
542 
544 
550  void addPoints(const mat &ppoints, const vec &funVals) {
551  if(mNumPoints == 0) {
552  return setPoints(ppoints, funVals);
553  }
554 
555  // Map point to be in the unit box
556  mat points = toUnitBox(ppoints, mxLow, mxUp);
557 
558  int nAct = mDimTail + mNumPoints;
559  int n = (int)funVals.n_rows;
560  if(n < 2) {
561  throw std::logic_error("Use add_point instead");
562  }
563  if(mNumPoints + n > mMaxPoints) {
564  throw std::logic_error("Capacity exceeded");
565  }
566 
567  auto px = mTail.eval(points);
568  mat B = arma::zeros(nAct, n);
569  B.rows(arma::span(0, mDim)) = px;
570  B.rows(mDimTail, nAct - 1) = mKernel.eval(arma::sqrt(squaredPairwiseDistance<mat>(mCenters.cols(0, mNumPoints - 1), points)));
571  mat K = mKernel.eval(arma::sqrt(squaredPairwiseDistance<mat>(points, points)));
572 
573  // REGULARIZATION
574  K += mEta*arma::eye(n, n);
575 
576  // Update the LU factorization
577  mat U12 = arma::solve(arma::trimatl(mL(arma::span(0, nAct - 1), arma::span(0, nAct - 1))), B.rows(mp.head(nAct)));
578  mat L21 = (arma::solve(arma::trimatl(mU(arma::span(0, nAct - 1), arma::span(0, nAct - 1)).t()), B)).t();
579  mat C;
580  try {
581  C = arma::chol(K - L21*U12, "lower");
582  }
583  catch (std::runtime_error) {
584  std::cout << "Warning: Cholesky factorization failed, computing new LU from scratch..." << std::endl;
585  // Add new points
586  mfX.rows(nAct, nAct + n - 1) = funVals;
587  mCenters.cols(mNumPoints, mNumPoints + n - 1) = points;
588  mNumPoints += n;
589  // Build LU from scratch
590  setPoints(X(), mfX.rows(mDimTail, nAct + n - 1));
591  return;
592  }
593  mL(arma::span(nAct, nAct + n - 1), arma::span(0, nAct - 1)) = L21;
594  mL(arma::span(nAct, nAct + n - 1), arma::span(nAct, nAct + n - 1)) = C;
595  mU(arma::span(0, nAct - 1), arma::span(nAct, nAct + n - 1)) = U12;
596  mU(arma::span(nAct, nAct + n - 1), arma::span(nAct, nAct + n - 1)) = C.t();
597  mp.rows(arma::span(nAct, nAct + n - 1)) = arma::linspace<uvec>(nAct, nAct + n - 1, n);
598 
599  // Update F and add the centers
600  mfX.rows(nAct, nAct + n - 1) = funVals;
601  mCenters.cols(mNumPoints, mNumPoints + n - 1) = points;
602  mNumPoints += n;
603 
604  mDirty = true;
605  }
606 
608 
614  double eval(const vec &ppoint) const {
615  if(mDirty) { throw std::logic_error("RBF not updated. You need to call fit() first"); }
616 
617  // Map point to be in the unit box
618  vec point = toUnitBox(ppoint, mxLow, mxUp);
619 
620  vec px = mTail.eval(point);
621  vec phi = mKernel.eval(arma::sqrt(squaredPointSetDistance(point, (mat)mCenters.cols(0, mNumPoints - 1))));
622  vec c = mCoeffs.head(mNumPoints + mDimTail);
623  return arma::dot(c.head(mDimTail), px) + arma::dot(c.tail(mNumPoints), phi);
624  }
625 
627 
634  double eval(const vec &ppoint, const vec &dists) const {
635  if(mDirty) { throw std::logic_error("RBF not updated. You need to call fit() first"); }
636  if(not (arma::all(mxLow == 0) and arma::all(mxUp == 1))) {
637  std::cout << "RBF uses internal scaling so distances have to be recomputed" << std::endl;
638  return eval(ppoint);
639  }
640 
641  // Map point to be in the unit box
642  vec point = toUnitBox(ppoint, mxLow, mxUp);
643 
644  vec px = mTail.eval(point);
645  vec phi = mKernel.eval(dists);
646  vec c = mCoeffs.head(mNumPoints + mDimTail);
647  return arma::dot(c.head(mDimTail), px) + arma::dot(c.tail(mNumPoints), phi);
648  }
649 
651 
657  vec evals(const mat &ppoints) const {
658  if(mDirty) { throw std::logic_error("RBF not updated. You need to call fit() first"); }
659 
660  // Map point to be in the unit box
661  mat points = toUnitBox(ppoints, mxLow, mxUp);
662 
663  mat px = mTail.eval(points);
664  mat phi = mKernel.eval(arma::sqrt(squaredPairwiseDistance(
665  (mat)mCenters.cols(0, mNumPoints - 1), points)));
666  vec c = mCoeffs.head(mNumPoints + mDimTail);
667  return px.t() * c.head(mDimTail) + phi.t() * c.tail(mNumPoints);
668  }
669 
671 
678  vec evals(const mat &ppoints, const mat &dists) const {
679  if(mDirty) { throw std::logic_error("RBF not updated. You need to call fit() first"); }
680  if(not (arma::all(mxLow == 0) and arma::all(mxUp == 1))) {
681  std::cout << "RBF uses internal scaling so distances have to be recomputed" << std::endl;
682  return evals(ppoints);
683  }
684 
685  // Map point to be in the unit box
686  mat points = toUnitBox(ppoints, mxLow, mxUp);
687 
688  mat px = mTail.eval(points);
689  mat phi = mKernel.eval(dists);
690  vec c = mCoeffs.head(mNumPoints + mDimTail);
691  return px.t() * c.head(mDimTail) + phi.t() * c.tail(mNumPoints);
692  }
693 
695 
701  vec deriv(const vec &ppoint) const {
702  if(mDirty) { throw std::logic_error("RBF not updated. You need to call fit() first"); }
703 
704  // Map point to be in the unit box
705  vec point = toUnitBox(ppoint, mxLow, mxUp);
706 
707  mat dpx = mTail.deriv(point);
708  vec c = mCoeffs.head(mNumPoints + mDimTail);
709  vec dists = arma::sqrt(squaredPairwiseDistance<mat>(
710  mCenters.cols(0, mNumPoints - 1), point));
711  dists.elem(arma::find(dists < 1e-10)).fill(1e-10); // Better safe than sorry
712  mat dsx = - mCenters.cols(0, mNumPoints - 1);
713  dsx.each_col() += point;
714  dsx.each_row() %= (mKernel.deriv(dists) % c.tail(mNumPoints)/dists).t();
715  return arma::sum(dsx, 1) + dpx.t() * c.head(mDimTail);
716  }
717  };
718 
720 
731  template<class RBFKernel, class PolyTail>
732  class RBFInterpolantCap : public RBFInterpolant<RBFKernel,PolyTail> {
733  public:
735 
742  RBFInterpolantCap(int maxPoints, int dim, vec xLow, vec xUp, double eta) :
743  RBFInterpolant<RBFKernel,PolyTail>(maxPoints, dim, xLow, xUp, eta) {}
745 
751  RBFInterpolantCap(int maxPoints, int dim, vec xLow, vec xUp) :
752  RBFInterpolant<Kernel,Tail>(maxPoints, dim, xLow, xUp) {}
753 
754  void fit() {
755  if(this->mNumPoints < this->mDimTail) {
756  throw std::logic_error("Not enough points");
757  }
758  if (this->mDirty) {
759  int n = this->mNumPoints + this->mDimTail;
760  vec ff = this->mfX;
761  double medf = arma::median(ff.rows(this->mDimTail, n-1)); // Computes the median
762  for(int i=this->mDimTail; i < n; i++) { // Apply the capping
763  if (ff(i) > medf) {
764  ff(i) = medf;
765  }
766  }
767 
768  // Solve for the coefficients
769  this->mCoeffs = arma::solve(arma::trimatl(
770  this->mL(arma::span(0, n - 1), arma::span(0, n - 1))), ff(this->mp(arma::span(0, n - 1))));
771  this->mCoeffs = arma::solve(arma::trimatu(
772  this->mU(arma::span(0, n - 1), arma::span(0, n - 1))), this->mCoeffs );
773  this->mDirty = false;
774  }
775  }
776  };
777 }
778 
779 #endif
void addPoints(const mat &ppoints, const vec &funVals)
Method for adding multiple points with known values.
Definition: rbf.h:550
vec eval(const vec &x) const
Method for evaluating the monomial basis function for a given point.
Definition: rbf.h:250
RBFInterpolant(int maxPoints, int dim, vec xLow, vec xUp, double eta)
Constructor.
Definition: rbf.h:410
Constant polynomial tail.
Definition: rbf.h:240
Abstract class for a polynomial tail.
Definition: rbf.h:168
arma::vec vec
Default (column) vector class.
Definition: common.h:17
mat mL
Definition: rbf.h:324
vec fX() const
Method for getting the values of the current points.
Definition: rbf.h:468
arma::uvec uvec
Default unsigned (column) vector class.
Definition: common.h:22
mat deriv(const mat &dists) const
Method for evaluating the derivative of the kernel for a matrix of distances.
Definition: rbf.h:154
double deriv(double dist) const
Method for evaluating the derivative of the kernel for a given distance.
Definition: rbf.h:80
RBFInterpolant(int maxPoints, int dim)
Constructor.
Definition: rbf.h:391
int order() const
Method for getting the order of the kernel.
Definition: rbf.h:105
int mDim
Definition: rbf.h:337
void addPoint(const vec &ppoint, double funVal)
Method for adding one points with known value.
Definition: rbf.h:508
double fX(int i) const
Method for getting the value of current point number i (0 is the first)
Definition: rbf.h:473
mat deriv(const mat &dists) const
Method for evaluating the derivative of the kernel for a matrix of distances.
Definition: rbf.h:86
mat eval(const mat &X) const
Method for evaluating the monomial basis function for multiple points.
Definition: rbf.h:247
int order() const
Method for getting the order of the kernel.
Definition: rbf.h:73
vec evals(const mat &ppoints) const
Method for evaluating the surrogate model at multiple points.
Definition: rbf.h:657
Abstract class for a SOT surrogate model.
Definition: surrogate.h:25
mat mCenters
Definition: rbf.h:329
RBFInterpolantCap(int maxPoints, int dim, vec xLow, vec xUp)
Constructor with default eta.
Definition: rbf.h:751
int mMaxPoints
Definition: rbf.h:330
int degree() const
Method for getting the degree of the tail.
Definition: rbf.h:244
double deriv(double dist) const
Method for evaluating the derivative of the kernel for a given distance.
Definition: rbf.h:148
int dimTail(int dim) const
Method for the dimensionality of the polynomial space.
Definition: rbf.h:256
double eval(double dist) const
Method for evaluating the kernel for a given distance.
Definition: rbf.h:111
vec deriv(const vec &ppoint) const
Method for evaluating the derivative of the surrogate model at a point.
Definition: rbf.h:701
mat eval(const mat &dists) const
Method for evaluating the kernel for a matrix of distances.
Definition: rbf.h:83
double eval(const vec &ppoint) const
Method for evaluating the surrogate model at a point.
Definition: rbf.h:614
RBFKernel mKernel
Definition: rbf.h:322
vec eval(const vec &x) const
Method for evaluating the monomial basis function for a given point.
Definition: rbf.h:217
void fit()
Method for fitting the surrogate model.
Definition: rbf.h:754
RBFInterpolant(int maxPoints, int dim, vec xLow, vec xUp)
Constructor with default eta.
Definition: rbf.h:423
Linear kernel.
Definition: rbf.h:134
void fit()
Method for fitting the surrogate model.
Definition: rbf.h:489
int mDimTail
Definition: rbf.h:331
Capped RBF interpolant.
Definition: rbf.h:732
MatType squaredPairwiseDistance(const MatType &X, const MatType &Y)
Fast level-3 distance computation between two sets of points.
Definition: utils.h:48
vec toUnitBox(const vec &x, const vec &xLow, const vec &xUp)
Map one point to the unit box.
Definition: utils.h:66
int order() const
Method for getting the order of the kernel.
Definition: rbf.h:139
double eval(double dist) const
Method for evaluating the kernel for a given distance.
Definition: rbf.h:77
int dim() const
Method for getting the number of dimensions.
Definition: rbf.h:443
VecType squaredPointSetDistance(const VecType &x, const MatType &Y)
Fast level-2 distance computation between one point and a set of points.
Definition: utils.h:32
bool mDirty
Definition: rbf.h:333
vec evals(const mat &ppoints, const mat &dists) const
Method for evaluating the surrogate model at multiple points with known distances.
Definition: rbf.h:678
double eval(const vec &ppoint, const vec &dists) const
Method for evaluating the surrogate model at a point with known distances.
Definition: rbf.h:634
vec X(int i) const
Method for getting current point number i (0 is the first)
Definition: rbf.h:463
Linear polynomial tail.
Definition: rbf.h:207
int phiZero() const
Method for getting the value of the kernel at 0.
Definition: rbf.h:75
mat eval(const mat &X) const
Method for evaluating the monomial basis function for multiple points.
Definition: rbf.h:214
int phiZero() const
Method for getting the value of the kernel at 0.
Definition: rbf.h:142
TPS kernel.
Definition: rbf.h:100
int dimTail(int dim) const
Method for the dimensionality of the polynomial space.
Definition: rbf.h:226
void setPoints(const mat &ppoints, const vec &funVals)
Computes the initial LU decomposition.
Definition: rbf.h:346
Cubic kernel.
Definition: rbf.h:68
Abstract class for a radial kernel.
Definition: rbf.h:28
vec fromUnitBox(const vec &x, const vec &xLow, const vec &xUp)
Map one point from the unit box to another hypercube.
Definition: utils.h:94
PolyTail mTail
Definition: rbf.h:323
mat mU
Definition: rbf.h:325
vec mCoeffs
Definition: rbf.h:327
mat eval(const mat &dists) const
Method for evaluating the kernel for a matrix of distances.
Definition: rbf.h:117
int degree() const
Method for getting the degree of the tail.
Definition: rbf.h:211
int numPoints() const
Method for getting the current number of points.
Definition: rbf.h:453
Radial basis function.
Definition: rbf.h:319
double deriv(double dist) const
Method for evaluating the derivative of the kernel for a given distance.
Definition: rbf.h:114
mat deriv(const vec &x) const
Method for evaluating the derivative of the monomial basis function for a given point.
Definition: rbf.h:253
mat X() const
Method for getting the current points.
Definition: rbf.h:458
mat deriv(const vec &x) const
Method for evaluating the derivative of the monomial basis function for a given point.
Definition: rbf.h:222
SOT namespace.
Definition: sot.h:27
int phiZero() const
Method for getting the value of the kernel at 0.
Definition: rbf.h:108
vec mxUp
Definition: rbf.h:335
int mNumPoints
Definition: rbf.h:332
mat deriv(const mat &dists) const
Method for evaluating the derivative of the kernel for a matrix of distances.
Definition: rbf.h:120
RBFInterpolant(int maxPoints, int dim, double eta)
Constructor.
Definition: rbf.h:399
uvec mp
Definition: rbf.h:326
arma::mat mat
Default matrix class.
Definition: common.h:16
mat eval(const mat &dists) const
Method for evaluating the kernel for a matrix of distances.
Definition: rbf.h:151
vec mfX
Definition: rbf.h:328
vec coeffs()
Method for getting the RBF interpolation coefficients.
Definition: rbf.h:483
vec mxLow
Definition: rbf.h:334
RBFInterpolantCap(int maxPoints, int dim, vec xLow, vec xUp, double eta)
Constructor.
Definition: rbf.h:742
double eval(double dist) const
Method for evaluating the kernel for a given distance.
Definition: rbf.h:145
void reset()
Method for resetting the surrogate model.
Definition: rbf.h:448