-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathSRCostFunction.h
More file actions
66 lines (51 loc) · 1.71 KB
/
SRCostFunction.h
File metadata and controls
66 lines (51 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/**
* ___ _ _ ___ _ __ __ _ ___
* / __| | | | \ /_\ | \/ | /_\ | _ \
* | (__| |_| | |) / _ \ | |\/| |/ _ \| _/
* \___|\___/|___/_/_\_\_|_|__|_/_/_\_\_|_ ___
* / __| | | | _ \ __| _ \___| _ \ __/ __|
* \__ \ |_| | _/ _|| /___| / _|\__ \
* |___/\___/|_| |___|_|_\ |_|_\___|___/
* 2012
*
* by Jens Wetzl (jens.wetzl@fau.de)
* and Oliver Taubmann (oliver.taubmann@fau.de)
*
* This work is licensed under a Creative Commons
* Attribution 3.0 Unported License. (CC-BY)
* http://creativecommons.org/licenses/by/3.0/
*
**/
#ifndef SR_COST_FUNCTION_H
#define SR_COST_FUNCTION_H
#include "LRImageStack.h"
#include "SRSystemMatrix.h"
#include "GPUHandles.h"
#include <CudaLBFGS/cost_function.h>
#include <CudaLBFGS/timer.h>
// The cost function to be minimized.
// Computes the squared Euclidean norm of the
// residual, adding the prior if available.
class SRCostFunction : public cost_function
{
public:
SRCostFunction(size_t numUnknowns, const SRSystemMatrix &systemMatrix, const LRImageStack &lrImages,
const GPUHandles &gpuHandles, cost_function *priorFunction = NULL);
virtual ~SRCostFunction();
// Computes function value (d_f) and gradient (d_gradf)
// at the given positon (d_x), all in device memory.
void f_gradf(const float *d_x, float *d_f, float *d_gradf);
private:
float *m_d_residual;
size_t m_residualSize;
const SRSystemMatrix &m_systemMatrix;
const LRImageStack &m_lrImages;
const GPUHandles &m_gpuHandles;
cost_function *m_prior;
// ---
timer *m_evalTotalTimer;
timer *m_evalFTimer;
timer *m_evalGradTimer;
timer *m_evalPriorTimer;
};
#endif // SR_COST_FUNCTION_H