Loading...
Searching...
No Matches
loss_base.h
Go to the documentation of this file.
1#ifndef _BBM_LOSS_BASE_H_
2#define _BBM_LOSS_BASE_H_
3
4#include "concepts/loss.h"
5
6/************************************************************************/
7/*! \file loss_base.h
8 \brief Abstract base definition of a LOSS (with virtual functions)
9
10 The difference between a lossfunction and a loss is that the lossfunction
11 does not feature virtual functions, and thus the function call is decided at
12 compile time. loss_base on the other hand declares all methods as virtual,
13 and thus it is decided at run-time which implementation to call.
14*************************************************************************/
15
16namespace bbm {
17
18 /**********************************************************************/
19 /* \brief Abstract base class of LOSSes (with virtual methods)
20
21 Each LOSS implements the following __virtual__ methods:
22 + update(void): initialize the loss computation. Should be called each time the optimization target is changed.
23 + Value operator(Mask=true) const that returns the loss
24
25 Implements: concepts::loss
26 ***********************************************************************/
27 template<typename CONF> requires concepts::config<CONF>
28 struct loss_base
29 {
31
32 //! \brief empty virtual base destructor
33 virtual ~loss_base(void) {}
34
35 /********************************************************************/
36 /*! \brief update
37
38 Update the internal state of the loss computations; perform any
39 intialization and/or precomputations needed. This method should be called
40 each time the optimization target changes.
41 *********************************************************************/
42 virtual void update(void) = 0;
43
44 /********************************************************************/
45 /*! \brief operator(): compute the loss
46
47 \param mask = mask to enable/disable lanes.
48 \returns the loss
49 *********************************************************************/
50 virtual Value operator()(Mask mask=true) const = 0;
51 };
52
53} // end bbm namespace
54
55#endif /* _BBM_LOSS_BASE_H_ */
loss contract: virtual interface wrapper around lossfunctions
Definition: aggregatebsdf.h:29
Forward declaration.
Definition: loss_base.h:29
BBM_IMPORT_CONFIG(CONF)
virtual Value operator()(Mask mask=true) const =0
operator(): compute the loss
virtual ~loss_base(void)
empty virtual base destructor
Definition: loss_base.h:33
virtual void update(void)=0
update