Loading...
Searching...
No Matches
loss.h
Go to the documentation of this file.
1#ifndef _BBM_LOSS_H_
2#define _BBM_LOSS_H_
3
4#include "concepts/loss.h"
5
6#include "bbm/config.h"
7#include "bbm/loss_base.h"
8
9/************************************************************************/
10/*! \file loss.h
11 \brief Connects a lossfunction with a loss.
12
13 This class provies a simple interface for connecting loss functions
14 (without virtual functions) to a loss (with virtual functions). Essentially,
15 this class just passes the method calls to the underlying loss function.
16
17 Implements: concepts::loss
18*************************************************************************/
19
20namespace bbm {
21
22 /**********************************************************************/
23 /*! \brief LOSS implementation of a loss function
24
25 \tparam LOSSFUNCTION = the loss function to transfer into a LOSS
26 ***********************************************************************/
27 template<typename LOSSFUNCTION> requires concepts::lossfunction<LOSSFUNCTION>
28 class loss : virtual public loss_base< get_config<LOSSFUNCTION> >, public LOSSFUNCTION
29 {
30 public:
31 BBM_IMPORT_CONFIG( LOSSFUNCTION );
32
33 //! \brief Inherit all constructors
34 using LOSSFUNCTION::LOSSFUNCTION;
35
36 //! \brief Construct directly from a LOSSFUNCTION
37 loss(const LOSSFUNCTION& lossfunc) : LOSSFUNCTION(lossfunc) {}
38
39 //! \brief Assignment operator
40 using LOSSFUNCTION::operator=;
41
42 /********************************************************************/
43 /*! \brief Virtual passthrough of the update method
44 ********************************************************************/
45 virtual void update(void) override final
46 {
47 LOSSFUNCTION::update();
48 }
49
50 /********************************************************************/
51 /*! \brief Virtual passthrough of the loss computation
52 ********************************************************************/
53 virtual Value operator()(Mask mask=true) const override final
54 {
55 return LOSSFUNCTION::operator()(mask);
56 }
57 };
58
59 BBM_CHECK_CONCEPT(concepts::loss, loss<lossfunction<config>>);
60
61} // end bbm namespace
62
63#endif /* _BBM_LOSS_H_ */
All BBM methods are defined to operate on a variety of value types and spectrum types....
LOSS implementation of a loss function.
Definition: loss.h:29
BBM_IMPORT_CONFIG(LOSSFUNCTION)
loss(const LOSSFUNCTION &lossfunc)
Construct directly from a LOSSFUNCTION.
Definition: loss.h:37
virtual Value operator()(Mask mask=true) const override final
Virtual passthrough of the loss computation.
Definition: loss.h:53
virtual void update(void) override final
Virtual passthrough of the update method.
Definition: loss.h:45
loss concept
Definition: loss.h:29
loss contract: virtual interface wrapper around lossfunctions
Abstract base definition of a LOSS (with virtual functions)
#define BBM_CHECK_CONCEPT(CONCEPTNAME, CLASSNAME,...)
Check a class for a concept with bbm::concepts::archetypes in the namespace.
Definition: macro.h:35
Definition: aggregatebsdf.h:29
Forward declaration.
Definition: loss_base.h:29