-
Notifications
You must be signed in to change notification settings - Fork 122
/
DeltaFunction.cpp
49 lines (40 loc) · 1.54 KB
/
DeltaFunction.cpp
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
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
// NScD Oak Ridge National Laboratory, European Spallation Source,
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
// SPDX - License - Identifier: GPL - 3.0 +
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
#include "MantidCurveFitting/Functions/DeltaFunction.h"
#include "MantidAPI/FunctionFactory.h"
#include <algorithm>
namespace Mantid {
namespace CurveFitting {
namespace Functions {
using namespace CurveFitting;
using namespace Kernel;
using namespace API;
DECLARE_FUNCTION(DeltaFunction)
DeltaFunction::DeltaFunction() : IPeakFunction() {
declareParameter("Height", 1.0,
"Scaling factor to be applied to the resolution.");
declareParameter("Centre", 0.0,
"Shift along the x-axis to be applied to the resolution.");
}
void DeltaFunction::function1D(double *out, const double *xValues,
const size_t nData) const {
UNUSED_ARG(xValues);
std::fill(out, out + nData, 0);
}
void DeltaFunction::functionDeriv1D(Jacobian *out, const double *xValues,
const size_t nData) {
UNUSED_ARG(out);
UNUSED_ARG(xValues);
UNUSED_ARG(nData);
std::runtime_error("Cannot compute derivative of a delta function");
}
} // namespace Functions
} // namespace CurveFitting
} // namespace Mantid