CMP++: Uncertainty Quantification & Bayesian Calibration
Loading...
Searching...
No Matches
cmp::prior::Product Class Reference

Represents the product (sum of logs) of two independent prior distributions. More...

#include <prior++.h>

Inheritance diagram for cmp::prior::Product:
Collaboration diagram for cmp::prior::Product:

Public Member Functions

 Product ()=default
 
 Product (const Product &)=default
 
 Product (Product &&)=default
 
Productoperator= (const Product &)=default
 
Productoperator= (Product &&)=default
 
 Product (std::shared_ptr< Prior > p1, std::shared_ptr< Prior > p2)
 
double eval (const Eigen::VectorXd &par) const
 
double evalGradient (const Eigen::VectorXd &par, const size_t &i) const
 
double evalHessian (const Eigen::VectorXd &par, const size_t &i, const size_t &j) const
 
- Public Member Functions inherited from cmp::prior::Prior
virtual ~Prior ()=default
 

Static Public Member Functions

static std::shared_ptr< Priormake (std::shared_ptr< Prior > p1, std::shared_ptr< Prior > p2)
 

Private Attributes

std::shared_ptr< PriorleftPrior_
 Left factor independent prior.
 
std::shared_ptr< PriorrightPrior_
 Right factor independent prior.
 

Detailed Description

Represents the product (sum of logs) of two independent prior distributions.

Mathematical Formulation For independent priors \( p_1(\theta) \) and \( p_2(\theta) \), the joint prior is:

\[ \log p(\theta) = \log p_1(\theta) + \log p_2(\theta) \]

Derivatives are additive due to the linearity of differentiation:

\[ \nabla_i \log p(\theta) = \nabla_i \log p_1(\theta) + \nabla_i \log p_2(\theta) \]

\[ \mathcal{H}_{ij} \log p(\theta) = \mathcal{H}_{ij} \log p_1(\theta) + \mathcal{H}_{ij} \log p_2(\theta) \]

Implementation Algorithm Evaluates the log-prior, gradient, and Hessian by summing the results of the leftPrior_ and rightPrior_ objects.

Constructor & Destructor Documentation

◆ Product() [1/4]

cmp::prior::Product::Product ( )
default

◆ Product() [2/4]

cmp::prior::Product::Product ( const Product )
default

◆ Product() [3/4]

cmp::prior::Product::Product ( Product &&  )
default

◆ Product() [4/4]

cmp::prior::Product::Product ( std::shared_ptr< Prior p1,
std::shared_ptr< Prior p2 
)
inline

Member Function Documentation

◆ eval()

double cmp::prior::Product::eval ( const Eigen::VectorXd &  par) const
inlinevirtual

Implements cmp::prior::Prior.

◆ evalGradient()

double cmp::prior::Product::evalGradient ( const Eigen::VectorXd &  par,
const size_t &  i 
) const
inlinevirtual

Implements cmp::prior::Prior.

◆ evalHessian()

double cmp::prior::Product::evalHessian ( const Eigen::VectorXd &  par,
const size_t &  i,
const size_t &  j 
) const
inlinevirtual

Implements cmp::prior::Prior.

◆ make()

static std::shared_ptr< Prior > cmp::prior::Product::make ( std::shared_ptr< Prior p1,
std::shared_ptr< Prior p2 
)
inlinestatic

◆ operator=() [1/2]

Product & cmp::prior::Product::operator= ( const Product )
default

◆ operator=() [2/2]

Product & cmp::prior::Product::operator= ( Product &&  )
default

Member Data Documentation

◆ leftPrior_

std::shared_ptr<Prior> cmp::prior::Product::leftPrior_
private

Left factor independent prior.

◆ rightPrior_

std::shared_ptr<Prior> cmp::prior::Product::rightPrior_
private

Right factor independent prior.


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