Loading...
Searching...
No Matches
gpr::bo::RadialShape Class Reference

One of SquaredExponential, Matern32 and Matern52 behind a tag. More...

#include <gpr/bo/StationaryKernel.h>

Public Member Functions

 RadialShape (RadialKind kind, double variance=1.0)
double operator() (double squared_distance) const
double derivative (double squared_distance) const
 Right-hand derivative of operator() with respect to its argument.
double secondDerivative (double squared_distance) const
double variance () const noexcept
RadialKind kind () const noexcept

Detailed Description

One of SquaredExponential, Matern32 and Matern52 behind a tag.

It has the members of those classes, so it is a radial function of a StationaryKernel whose shape is chosen by a caller at run time, as the C API does.

Definition at line 271 of file StationaryKernel.h.

Constructor & Destructor Documentation

◆ RadialShape()

gpr::bo::RadialShape::RadialShape ( RadialKind kind,
double variance = 1.0 )
inlineexplicit

Definition at line 273 of file StationaryKernel.h.

274 : kind_(kind), variance_(variance)
275 {
276 if (!(variance_ > 0.0) || !std::isfinite(variance_)) {
277 throw std::invalid_argument("signal variance must be positive");
278 }
279 if (kind_ != RadialKind::SquaredExponential &&
280 kind_ != RadialKind::Matern32 && kind_ != RadialKind::Matern52) {
281 throw std::invalid_argument("radial kind is unknown");
282 }
283 }
double variance() const noexcept
RadialKind kind() const noexcept

Member Function Documentation

◆ derivative()

double gpr::bo::RadialShape::derivative ( double squared_distance) const
inlinenodiscard

Right-hand derivative of operator() with respect to its argument.

Definition at line 299 of file StationaryKernel.h.

300 {
301 switch (kind_) {
303 return Matern32(variance_).derivative(squared_distance);
305 return Matern52(variance_).derivative(squared_distance);
307 break;
308 }
309 return SquaredExponential(variance_).derivative(squared_distance);
310 }

◆ kind()

RadialKind gpr::bo::RadialShape::kind ( ) const
inlinenodiscardnoexcept

Definition at line 330 of file StationaryKernel.h.

331 {
332 return kind_;
333 }

◆ operator()()

double gpr::bo::RadialShape::operator() ( double squared_distance) const
inline

Definition at line 285 of file StationaryKernel.h.

286 {
287 switch (kind_) {
289 return Matern32(variance_)(squared_distance);
291 return Matern52(variance_)(squared_distance);
293 break;
294 }
295 return SquaredExponential(variance_)(squared_distance);
296 }

◆ secondDerivative()

double gpr::bo::RadialShape::secondDerivative ( double squared_distance) const
inlinenodiscard

Definition at line 312 of file StationaryKernel.h.

313 {
314 switch (kind_) {
316 return Matern32(variance_).secondDerivative(squared_distance);
318 return Matern52(variance_).secondDerivative(squared_distance);
320 break;
321 }
322 return SquaredExponential(variance_).secondDerivative(squared_distance);
323 }

◆ variance()

double gpr::bo::RadialShape::variance ( ) const
inlinenodiscardnoexcept

Definition at line 325 of file StationaryKernel.h.

326 {
327 return variance_;
328 }

The documentation for this class was generated from the following file: