Commit e74557c5 authored by David Frank's avatar David Frank Committed by Tobias Lasser
Browse files

Add constructor to simplify construction of L2NormPow2

Instead of constructiong `L2NormPow2(LinearResidual(A, b))`, you can
now simply write `L2NormPow2(A, b)`.
parent f16b4e54
#include "L2NormPow2.h"
#include "LinearOperator.h"
#include "LinearResidual.h"
#include "Identity.h"
#include "TypeCasts.hpp"
......@@ -17,6 +18,12 @@ namespace elsa
{
}
template <typename data_t>
L2NormPow2<data_t>::L2NormPow2(const LinearOperator<data_t>& A, const DataContainer<data_t>& b)
: Functional<data_t>(LinearResidual<data_t>(A, b))
{
}
template <typename data_t>
data_t L2NormPow2<data_t>::evaluateImpl(const DataContainer<data_t>& Rx)
{
......
#pragma once
#include "Functional.h"
#include "DataContainer.h"
#include "LinearOperator.h"
namespace elsa
{
/**
* @brief Class representing the l2 norm functional (squared).
*
* @author Matthias Wieczorek - initial code
* @author Maximilian Hornung - modularization
* @author Tobias Lasser - modernization
* The l2 norm (squared) functional evaluates to \f$ 0.5 * \sum_{i=1}^n x_i^2 \f$ for \f$
* x=(x_i)_{i=1}^n \f$.
* @author - Matthias Wieczorek - initial code
* - Maximilian Hornung - modularization
* - Tobias Lasser - modernization
*
* @tparam data_t data type for the domain of the residual of the functional, defaulting to
* real_t
*
* The l2 norm (squared) functional evaluates to \f$ 0.5 * \sum_{i=1}^n x_i^2 \f$ for \f$
* x=(x_i)_{i=1}^n \f$.
*/
template <typename data_t = real_t>
class L2NormPow2 : public Functional<data_t>
......@@ -37,6 +39,14 @@ namespace elsa
*/
explicit L2NormPow2(const Residual<data_t>& residual);
/**
* @brief Constructor the l2 norm (squared) functional with a LinearResidual
*
* @param[in] A LinearOperator to use in the residual
* @param[in] b data to use in the linear residual
*/
L2NormPow2(const LinearOperator<data_t>& A, const DataContainer<data_t>& b);
/// make copy constructor deletion explicit
L2NormPow2(const L2NormPow2<data_t>&) = delete;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment