# elsa functionals¶

## Residual¶

template<typename data_t = real_t>
class elsa::Residual : public elsa::Cloneable<Residual<real_t>>

Abstract base class representing a residual, i.e. a vector-valued mapping.

A residual is a vector-valued mapping representing an error (or mismatch). For real numbers this corresponds to

$$\mathbb{R}^n\to\mathbb{R}^m$$ (e.g. $$x \mapsto Ax-b$$ for linear residuals). In order to measure this error, the residual can be used as input to a Functional.
Author

Matthias Wieczorek - initial code

Author

Tobias Lasser - modularization, streamlining

Template Parameters
• data_t: data type for the domain and range of the operator, defaulting to real_t

Public Functions

Residual(const DataDescriptor &domainDescriptor, const DataDescriptor &rangeDescriptor)

Constructor for the residual, mapping from domain to range.

Parameters
• [in] domainDescriptor: describing the domain of the residual

• [in] rangeDescriptor: describing the range of the residual

~Residual() override = default

default destructor

const DataDescriptor &getDomainDescriptor() const

return the domain descriptor

const DataDescriptor &getRangeDescriptor() const

return the range descriptor

DataContainer<data_t> evaluate(const DataContainer<data_t> &x)

evaluate the residual at x and return the result

Please note: this method uses evaluate(x, result) to perform the actual operation.

Return

result DataContainer (in the range of the residual) containing the result of the evaluation of the residual at x

Parameters
• [in] x: input DataContainer (in the domain of the residual)

void evaluate(const DataContainer<data_t> &x, DataContainer<data_t> &result)

evaluate the residual at x and store in result

Please note: this method calls the method _evaluate that has to be overridden in derived classes. (Why is this method here not virtual itself? Because you cannot have a non-virtual function overloading a virtual one [evaluate with one vs. two args].)

Parameters
• [in] x: input DataContainer (in the domain of the residual)

• [out] result: output DataContainer (in the range of the residual)

LinearOperator<data_t> getJacobian(const DataContainer<data_t> &x)

return the Jacobian (first derivative) of the residual at x.

Please note: this method calls the method _getJacobian that has to be overridden in derived classes. (This is not strictly necessary, it’s just for consistency with evaluate.)

Return

a LinearOperator (the Jacobian)

Parameters
• [in] x: input DataContainer (in the domain of the residual) at which the Jacobian of the residual will be evaluated

Protected Functions

bool isEqual(const Residual<data_t> &other) const override

implement the polymorphic comparison operation

void evaluateImpl(const DataContainer<data_t> &x, DataContainer<data_t> &result) = 0

the evaluate method that has to be overridden in derived classes

LinearOperator<data_t> getJacobianImpl(const DataContainer<data_t> &x) = 0

the getJacobian method that has to be overriden in derived classes

Protected Attributes

std::unique_ptr<DataDescriptor> _domainDescriptor

the data descriptor of the domain of the residual

std::unique_ptr<DataDescriptor> _rangeDescriptor

the data descriptor of the range of the residual

## LinearResidual¶

template<typename data_t = real_t>
class elsa::LinearResidual : public elsa::Residual<real_t>

Class representing a linear residual, i.e. Ax - b with operator A and vectors x, b.

A linear residual is a vector-valued mapping

$$\mathbb{R}^n\to\mathbb{R}^m$$, namely $$x \mapsto Ax - b$$, where A is a LinearOperator, b a constant data vector (DataContainer) and x a variable (DataContainer). This linear residual can be used as input to a Functional.
Author

Matthias Wieczorek - initial code

Author

Tobias Lasser - modularization, modernization

Template Parameters
• data_t: data type for the domain and range of the operator, default to real_t

Public Functions

LinearResidual(const DataDescriptor &descriptor)

Constructor for a trivial residual $$x \mapsto x$$.

Parameters
• [in] descriptor: describing the domain = range of the residual

LinearResidual(const DataContainer<data_t> &b)

Constructor for a simple residual $$x \mapsto x - b$$.

Parameters
• [in] b: a vector (DataContainer) that will be subtracted from x

LinearResidual(const LinearOperator<data_t> &A)

Constructor for a residual $$x \mapsto Ax$$.

Parameters

LinearResidual(const LinearOperator<data_t> &A, const DataContainer<data_t> &b)

Constructor for a residual $$x \mapsto Ax - b$$.

Parameters

LinearResidual(const LinearResidual<data_t>&) = delete

make copy constructor deletion explicit

~LinearResidual() override = default

default destructor

bool hasOperator() const

return true if the residual has an operator A

bool hasDataVector() const

return true if the residual has a data vector b

const LinearOperator<data_t> &getOperator() const

return the operator A (throws if the residual has none)

const DataContainer<data_t> &getDataVector() const

return the data vector b (throws if the residual has none)

Protected Functions

LinearResidual<data_t> *cloneImpl() const override

implement the polymorphic clone operation

bool isEqual(const Residual<data_t> &other) const override

implement the polymorphic comparison operation

void evaluateImpl(const DataContainer<data_t> &x, DataContainer<data_t> &result) override

the evaluate method, evaluating the residual at x and placing the value in result

LinearOperator<data_t> getJacobianImpl(const DataContainer<data_t> &x) override

return the Jacobian (first derivative) of the linear residual at x.

If A is set, then the Jacobian is A and this returns a copy of A. If A is not set, then an

Identity operator is returned.
Return

a LinearOperator (the Jacobian)

Parameters
• x: input DataContainer (in the domain of the residual)

Private Members

bool _hasOperator

flag if operator A is present

bool _hasDataVector

flag if data vector b is present

std::unique_ptr<LinearOperator<data_t>> _operator = {}

the operator A

std::unique_ptr<const DataContainer<data_t>> _dataVector = {}

the data vector b

## Functional¶

template<typename data_t = real_t>
class elsa::Functional : public elsa::Cloneable<Functional<real_t>>

Abstract base class representing a functional, i.e. a mapping from vectors to scalars.

A functional is a mapping a vector to a scalar value (e.g. mapping the output of a

Residual to a scalar). Typical examples of functionals are norms or semi-norms, such as the L2 or L1 norms.
Author

Matthias Wieczorek - initial code

Author

Maximilian Hornung - modularization

Author

Tobias Lasser - rewrite

Template Parameters
• data_t: data type for the domain of the residual of the functional, defaulting to real_t

Using LinearOperators, Residuals (e.g. LinearResidual) and a Functional (e.g. L2NormPow2) enables the formulation of typical terms in an OptimizationProblem.

Public Functions

Functional(const DataDescriptor &domainDescriptor)

Constructor for the functional, mapping a domain vector to a scalar (without a residual)

Parameters
• [in] domainDescriptor: describing the domain of the functional

Functional(const Residual<data_t> &residual)

Constructor for the functional, using a Residual as input to map to a scalar.

Parameters
• [in] residual: to be used when evaluating the functional (or its derivatives)

~Functional() override = default

default destructor

const DataDescriptor &getDomainDescriptor() const

return the domain descriptor

const Residual<data_t> &getResidual() const

return the residual (will be trivial if Functional was constructed without one)

data_t evaluate(const DataContainer<data_t> &x)

evaluate the functional at x and return the result

Please note: after evaluating the residual at x, this method calls the method _evaluate that has to be overridden in derived classes to compute the functional’s value.

Return

result the scalar of the functional evaluated at x

Parameters
• [in] x: input DataContainer (in the domain of the functional)

DataContainer<data_t> getGradient(const DataContainer<data_t> &x)

compute the gradient of the functional at x and return the result

Please note: this method uses getGradient(x, result) to perform the actual operation.

Return

result DataContainer (in the domain of the functional) containing the result of the gradient at x.

Parameters
• [in] x: input DataContainer (in the domain of the functional)

void getGradient(const DataContainer<data_t> &x, DataContainer<data_t> &result)

compute the gradient of the functional at x and store in result

Please note: after evaluating the residual at x, this methods calls the method _getGradientInPlace that has to be overridden in derived classes to compute the functional’s gradient, and after that the chain rule for the residual is applied (if necessary).

Parameters
• [in] x: input DataContainer (in the domain of the functional)

• [out] result: output DataContainer (in the domain of the functional)

LinearOperator<data_t> getHessian(const DataContainer<data_t> &x)

return the Hessian of the functional at x

Note: some derived classes might decide to use only the diagonal of the Hessian as a fast approximation!

Return

a LinearOperator (the Hessian)

Parameters
• [in] x: input DataContainer (in the domain of the functional)

Please note: after evaluating the residual at x, this method calls the method _getHessian that has to be overridden in derived classes to compute the functional’s Hessian, and after that the chain rule for the residual is applied (if necessary).

Protected Functions

bool isEqual(const Functional<data_t> &other) const override

implement the polymorphic comparison operation

data_t evaluateImpl(const DataContainer<data_t> &Rx) = 0

the _evaluate method that has to be overridden in derived classes

Please note: the evaluation of the residual is already performed in evaluate, so this method only has to compute the functional’s value itself.

Return

the evaluated functional

Parameters
• [in] Rx: the residual evaluated at x

void getGradientInPlaceImpl(DataContainer<data_t> &Rx) = 0

the _getGradientInPlace method that has to be overridden in derived classes

Please note: the evaluation of the residual is already performed in getGradient, as well as the application of the chain rule. This method here only has to compute the gradient of the functional itself, in an in-place manner (to avoid unnecessary DataContainers).

Parameters
• [inout] Rx: the residual evaluated at x (in), and the gradient of the functional (out)

LinearOperator<data_t> getHessianImpl(const DataContainer<data_t> &Rx) = 0

the _getHessian method that has to be overridden in derived classes

Please note: the evaluation of the residual is already performed in getHessian, as well as the application of the chain rule. This method here only has to compute the Hessian of the functional itself.

Return

the LinearOperator representing the Hessian of the functional

Parameters
• [in] Rx: the residual evaluated at x

Protected Attributes

std::unique_ptr<DataDescriptor> _domainDescriptor

the data descriptor of the domain of the functional

std::unique_ptr<Residual<data_t>> _residual

the residual

## Huber¶

template<typename data_t = real_t>
class elsa::Huber : public elsa::Functional<real_t>

Class representing the Huber norm.

The

Huber norm evaluates to $$\sum_{i=1}^n \begin{cases} \frac{1}{2} x_i^2 & \text{for } |x_i| \leq \delta \\ \delta\left(|x_i| - \frac{1}{2}\delta\right) & \text{else} \end{cases}$$ for $$x=(x_i)_{i=1}^n$$ and a cut-off parameter $$\delta$$.
Author

Matthias Wieczorek - initial code

Author

Maximilian Hornung - modularization

Author

Tobias Lasser - modernization

Template Parameters
• data_t: data type for the domain of the residual of the functional, defaulting to real_t

Public Functions

Huber(const DataDescriptor &domainDescriptor, real_t delta = static_cast<real_t>(1e-6))

Constructor for the Huber functional, mapping domain vector to scalar (without a residual)

Parameters
• [in] domainDescriptor: describing the domain of the functional

• [in] delta: parameter for linear/square cutoff (defaults to 1e-6)

Huber(const Residual<data_t> &residual, real_t delta = static_cast<real_t>(1e-6))

Constructor for the Huber functional, using a residual as input to map to a scalar.

Parameters
• [in] residual: to be used when evaluating the functional (or its derivative)

• [in] delta: parameter for linear/square cutoff (defaults to 1e-6)

Huber(const Huber<data_t>&) = delete

make copy constructor deletion explicit

~Huber() override = default

default destructor

Protected Functions

data_t evaluateImpl(const DataContainer<data_t> &Rx) override

the evaluation of the Huber norm

void getGradientInPlaceImpl(DataContainer<data_t> &Rx) override

the computation of the gradient (in place)

LinearOperator<data_t> getHessianImpl(const DataContainer<data_t> &Rx) override

the computation of the Hessian

Huber<data_t> *cloneImpl() const override

implement the polymorphic clone operation

bool isEqual(const Functional<data_t> &other) const override

implement the polymorphic comparison operation

Private Members

const real_t _delta

the cut-off delta

## L1Norm¶

template<typename data_t = real_t>
class elsa::L1Norm : public elsa::Functional<real_t>

Class representing the l1 norm functional.

The l1 norm functional evaluates to

$$\sum_{i=1}^n |x_i|$$ for $$x=(x_i)_{i=1}^n$$. Please note that it is not differentiable, hence getGradient and getHessian will throw exceptions.
Author

Matthias Wieczorek - initial code

Author

Maximilian Hornung - modularization

Author

Tobias Lasser - modernization

Template Parameters
• data_t: data type for the domain of the residual of the functional, defaulting to real_t

Public Functions

L1Norm(const DataDescriptor &domainDescriptor)

Constructor for the l1 norm functional, mapping domain vector to a scalar (without a residual)

Parameters
• [in] domainDescriptor: describing the domain of the functional

L1Norm(const Residual<data_t> &residual)

Constructor for the l1 norm functional, using a residual as input to map to a scalar.

Parameters
• [in] residual: to be used when evaluating the functional (or its derivatives)

L1Norm(const L1Norm<data_t>&) = delete

make copy constructor deletion explicit

~L1Norm() override = default

default destructor

Protected Functions

data_t evaluateImpl(const DataContainer<data_t> &Rx) override

the evaluation of the l1 norm

void getGradientInPlaceImpl(DataContainer<data_t> &Rx) override

the computation of the gradient (in place)

LinearOperator<data_t> getHessianImpl(const DataContainer<data_t> &Rx) override

the computation of the Hessian

L1Norm<data_t> *cloneImpl() const override

implement the polymorphic clone operation

bool isEqual(const Functional<data_t> &other) const override

implement the polymorphic comparison operation

## L2NormPow2¶

template<typename data_t = real_t>
class elsa::L2NormPow2 : public elsa::Functional<real_t>

Class representing the l2 norm functional (squared).

The l2 norm (squared) functional evaluates to

$$0.5 * \sum_{i=1}^n x_i^2$$ for $$x=(x_i)_{i=1}^n$$.
Author

Matthias Wieczorek - initial code

Author

Maximilian Hornung - modularization

Author

Tobias Lasser - modernization

Template Parameters
• data_t: data type for the domain of the residual of the functional, defaulting to real_t

Public Functions

L2NormPow2(const DataDescriptor &domainDescriptor)

Constructor for the l2 norm (squared) functional, mapping domain vector to a scalar (without a residual)

Parameters
• [in] domainDescriptor: describing the domain of the functional

L2NormPow2(const Residual<data_t> &residual)

Constructor for the l2 norm (squared) functional, using a residual as input to map to a scalar.

Parameters
• [in] residual: to be used when evaluating the functional (or its derivatives)

L2NormPow2(const L2NormPow2<data_t>&) = delete

make copy constructor deletion explicit

~L2NormPow2() override = default

default destructor

Protected Functions

data_t evaluateImpl(const DataContainer<data_t> &Rx) override

the evaluation of the l2 norm (squared)

void getGradientInPlaceImpl(DataContainer<data_t> &Rx) override

the computation of the gradient (in place)

LinearOperator<data_t> getHessianImpl(const DataContainer<data_t> &Rx) override

the computation of the Hessian

L2NormPow2<data_t> *cloneImpl() const override

implement the polymorphic clone operation

bool isEqual(const Functional<data_t> &other) const override

implement the polymorphic comparison operation

## LInfNorm¶

template<typename data_t = real_t>
class elsa::LInfNorm : public elsa::Functional<real_t>

Class representing the maximum norm functional (l infinity).

The linf / max norm functional evaluates to

$$\max_{i=1,\ldots,n} |x_i|$$ for $$x=(x_i)_{i=1}^n$$. Please note that it is not differentiable, hence getGradient and getHessian will throw exceptions.
Author

Matthias Wieczorek - initial code

Author

Maximilian Hornung - modularization

Author

Tobias Lasser - modernization

Template Parameters
• data_t: data type for the domain of the residual of the functional, defaulting to real_t

Public Functions

LInfNorm(const DataDescriptor &domainDescriptor)

Constructor for the linf norm functional, mapping domain vector to scalar (without a residual)

Parameters
• [in] domainDescriptor: describing the domain of the functional

LInfNorm(const Residual<data_t> &residual)

Constructor for the linf norm functional, using a residual as input to map to a scalar.

Parameters
• [in] residual: to be used when evaluating the functional (or its derivative)

LInfNorm(const LInfNorm<data_t>&) = delete

make copy constructor deletion explicit

~LInfNorm() override = default

default destructor

Protected Functions

data_t evaluateImpl(const DataContainer<data_t> &Rx) override

the evaluation of the linf norm

void getGradientInPlaceImpl(DataContainer<data_t> &Rx) override

the computation of the gradient (in place)

LinearOperator<data_t> getHessianImpl(const DataContainer<data_t> &Rx) override

the computation of the Hessian

LInfNorm<data_t> *cloneImpl() const override

implement the polymorphic clone operation

bool isEqual(const Functional<data_t> &other) const override

implement the polymorphic comparison operation

## PseudoHuber¶

template<typename data_t = real_t>
class elsa::PseudoHuber : public elsa::Functional<real_t>

Class representing the Pseudohuber norm.

The Pseudohuber norm evaluates to

$$\sum_{i=1}^n \delta \left( \sqrt{1 + (x_i / \delta)^2} - 1 \right)$$ for $$x=(x_i)_{i=1}^n$$ and a slope parameter $$\delta$$.
Author

Matthias Wieczorek - initial code

Author

Maximilian Hornung - modularization

Author

Tobias Lasser - modernization, fixes

Template Parameters
• data_t: data type for the domain of the residual of the functional, defaulting to real_t

Reference: https://doi.org/10.1109%2F83.551699

Public Functions

PseudoHuber(const DataDescriptor &domainDescriptor, real_t delta = static_cast<real_t>(1))

Constructor for the Pseudohuber functional, mapping domain vector to scalar (without a residual)

Parameters
• [in] domainDescriptor: describing the domain of the functional

• [in] delta: parameter for linear slope (defaults to 1)

PseudoHuber(const Residual<data_t> &residual, real_t delta = static_cast<real_t>(1))

Constructor for the Pseudohuber functional, using a residual as input to map to a scalar.

Parameters
• [in] residual: to be used when evaluating the functional (or its derivative)

• [in] delta: parameter for linear slope (defaults to 1)

PseudoHuber(const PseudoHuber<data_t>&) = delete

make copy constructor deletion explicit

~PseudoHuber() override = default

default destructor

Protected Functions

data_t evaluateImpl(const DataContainer<data_t> &Rx) override

the evaluation of the Huber norm

void getGradientInPlaceImpl(DataContainer<data_t> &Rx) override

the computation of the gradient (in place)

LinearOperator<data_t> getHessianImpl(const DataContainer<data_t> &Rx) override

the computation of the Hessian

PseudoHuber<data_t> *cloneImpl() const override

implement the polymorphic clone operation

bool isEqual(const Functional<data_t> &other) const override

implement the polymorphic comparison operation

Private Members

const real_t _delta

the slope delta

template<typename data_t = real_t>
class elsa::Quadric : public elsa::Functional<real_t>

The

Quadric functional evaluates to $$\frac{1}{2} x^tAx - x^tb$$ for a symmetric positive definite operator A and a vector b.
Author

Matthias Wieczorek - initial code

Author

Maximilian Hornung - modularization

Author

Tobias Lasser - modernization

Author

Template Parameters
• data_t: data type for the domain of the residual of the functional, defaulting to real_t

Please note: contrary to other functionals, Quadric does not allow wrapping an explicit residual.

Public Functions

Quadric(const LinearOperator<data_t> &A, const DataContainer<data_t> &b)

Constructor for the Quadric functional, using operator A and vector b (no residual).

Parameters
• [in] A: the operator (has to be symmetric positive definite)

• [in] b: the data vector

Quadric(const LinearOperator<data_t> &A)

Constructor for the Quadric functional $$\frac{1}{2} x^tAx$$ (trivial data vector)

Parameters
• [in] A: the operator (has to be symmetric positive definite)

Quadric(const DataContainer<data_t> &b)

Constructor for the Quadric functional $$\frac{1}{2} x^tx - x^tb$$ (trivial operator)

Parameters
• [in] b: the data vector

Quadric(const DataDescriptor &domainDescriptor)

Constructor for the Quadric functional $$\frac{1}{2} x^tx$$ (trivial operator and data vector)

Parameters
• [in] domainDescriptor: the descriptor of x

Quadric(const Quadric<data_t>&) = delete

make copy constructor deletion explicit

~Quadric() override = default

default destructor

const LinearResidual<data_t> &getGradientExpression() const

returns the residual $$Ax - b$$, which also corresponds to the gradient of the functional

Protected Functions

data_t evaluateImpl(const DataContainer<data_t> &Rx) override

the evaluation of the Quadric functional

void getGradientInPlaceImpl(DataContainer<data_t> &Rx) override

the computation of the gradient (in place)

LinearOperator<data_t> getHessianImpl(const DataContainer<data_t> &Rx) override

the computation of the Hessian

Quadric<data_t> *cloneImpl() const override

implement the polymorphic clone operation

bool isEqual(const Functional<data_t> &other) const override

implement the polymorphic comparison operation

Private Members

LinearResidual<data_t> _linearResidual

storing A,b in a linear residual

## EmissionLogLikelihood¶

template<typename data_t = real_t>
class elsa::EmissionLogLikelihood : public elsa::Functional<real_t>

Class representing a negative log-likelihood functional for emission tomography.

The

EmissionLogLikelihood functional evaluates as $$\sum_{i=1}^n (x_i + r_i) - y_i\log(x_i + r_i)$$, with $$y=(y_i)$$ denoting the measurements, $$r=(r_i)$$ denoting the mean number of background events, and $$x=(x_i)$$.
Author

Matthias Wieczorek - initial code

Author

Maximilian Hornung - modularization

Author

Tobias Lasser - rewrite

Template Parameters
• data_t: data type for the domain of the residual of the functional, defaulting to real_t

Typically, $$x$$ is wrapped in a LinearResidual without a data vector, i.e. $$x \mapsto Ax$$.

Public Functions

EmissionLogLikelihood(const DataDescriptor &domainDescriptor, const DataContainer<data_t> &y, const DataContainer<data_t> &r)

Constructor for emission log-likelihood, using y and r (no residual)

Parameters
• [in] domainDescriptor: describing the domain of the functional

• [in] y: the measurement data vector

• [in] r: the background event data vector

EmissionLogLikelihood(const DataDescriptor &domainDescriptor, const DataContainer<data_t> &y)

Constructor for emission log-likelihood, using only y (no residual)

Parameters
• [in] domainDescriptor: describing the domain of the functional

• [in] y: the measurement data vector

EmissionLogLikelihood(const Residual<data_t> &residual, const DataContainer<data_t> &y, const DataContainer<data_t> &r)

Constructor for emission log-likelihood, using y and r, and a residual as input.

Parameters
• [in] residual: to be used when evaluating the functional (or its derivative)

• [in] y: the measurement data vector

• [in] r: the background event data vector

EmissionLogLikelihood(const Residual<data_t> &residual, const DataContainer<data_t> &y)

Constructor for emission log-likelihood, using only y, and a residual as input.

Parameters
• [in] residual: to be used when evaluating the functional (or its derivative)

• [in] y: the measurement data vector

EmissionLogLikelihood(const EmissionLogLikelihood<data_t>&) = delete

make copy constructor deletion explicit

~EmissionLogLikelihood() override = default

default destructor

Protected Functions

data_t evaluateImpl(const DataContainer<data_t> &Rx) override

the evaluation of the emission log-likelihood

void getGradientInPlaceImpl(DataContainer<data_t> &Rx) override

the computation of the gradient (in place)

LinearOperator<data_t> getHessianImpl(const DataContainer<data_t> &Rx) override

the computation of the Hessian

EmissionLogLikelihood<data_t> *cloneImpl() const override

implement the polymorphic clone operation

bool isEqual(const Functional<data_t> &other) const override

implement the polymorphic comparison operation

Private Members

std::unique_ptr<const DataContainer<data_t>> _y = {}

the measurement data vector y

std::unique_ptr<const DataContainer<data_t>> _r = {}

the background event data vector r

## TransmissionLogLikelihood¶

template<typename data_t = real_t>
class elsa::TransmissionLogLikelihood : public elsa::Functional<real_t>

Class representing a negative log-likelihood functional for transmission tomography.

The

TransmissionLogLikelihood functional evaluates as $$\sum_{i=1}^n (b_i \exp(-x_i) + r_i) - y_i\log(b_i \exp(-x_i) + r_i)$$, with $$b=(b_i)$$ denoting the mean number of photons per detector (blank scan), $$y=(y_i)$$ denoting the measurements, $$r=(r_i)$$ denoting the mean number of background events, and $$x=(x_i)$$.
Author

Matthias Wieczorek - initial code

Author

Maximilian Hornung - modularization

Author

Tobias Lasser - rewrite

Template Parameters
• data_t: data type for the domain of the residual of the functional, defaulting to real_t

Typically, $$x$$ is wrapped in a LinearResidual without a data vector, i.e. $$x \mapsto Ax$$.

Public Functions

TransmissionLogLikelihood(const DataDescriptor &domainDescriptor, const DataContainer<data_t> &y, const DataContainer<data_t> &b, const DataContainer<data_t> &r)

Constructor for transmission log-likelihood, using y, b, and r (no residual)

Parameters
• [in] domainDescriptor: describing the domain of the functional

• [in] y: the measurement data vector

• [in] b: the blank scan data vector

• [in] r: the background event data vector

TransmissionLogLikelihood(const DataDescriptor &domainDescriptor, const DataContainer<data_t> &y, const DataContainer<data_t> &b)

Constructor for transmission log-likelihood, using only y and b (no residual)

Parameters
• [in] domainDescriptor: describing the domain of the functional

• [in] y: the measurement data vector

• [in] b: the blank scan data vector

TransmissionLogLikelihood(const Residual<data_t> &residual, const DataContainer<data_t> &y, const DataContainer<data_t> &b, const DataContainer<data_t> &r)

Constructor for transmission log-likelihood, using y, b, and r, and a residual as input.

Parameters
• [in] residual: to be used when evaluating the functional (or its derivative)

• [in] y: the measurement data vector

• [in] b: the blank scan data vector

• [in] r: the background event data vector

TransmissionLogLikelihood(const Residual<data_t> &residual, const DataContainer<data_t> &y, const DataContainer<data_t> &b)

Constructor for transmission log-likelihood, using y and b, and a residual as input.

Parameters
• [in] residual: to be used when evaluating the functional (or its derivative)

• [in] y: the measurement data vector

• [in] b: the blank scan data vector

TransmissionLogLikelihood(const TransmissionLogLikelihood<data_t>&) = delete

make copy constructor deletion explicit

~TransmissionLogLikelihood() override = default

default destructor

Protected Functions

data_t evaluateImpl(const DataContainer<data_t> &Rx) override

the evaluation of the transmission log-likelihood

void getGradientInPlaceImpl(DataContainer<data_t> &Rx) override

the computation of the gradient (in place)

LinearOperator<data_t> getHessianImpl(const DataContainer<data_t> &Rx) override

the computation of the Hessian

TransmissionLogLikelihood<data_t> *cloneImpl() const override

implement the polymorphic clone operation

bool isEqual(const Functional<data_t> &other) const override

implement the polymorphic comparison operation

Private Members

std::unique_ptr<const DataContainer<data_t>> _y = {}

the measurement data vector y

std::unique_ptr<const DataContainer<data_t>> _b = {}

the blank scan data vector b

std::unique_ptr<const DataContainer<data_t>> _r = {}

the background event data vector r