-
Notifications
You must be signed in to change notification settings - Fork 122
/
StaticKuboToyabe.cpp
45 lines (36 loc) · 1.36 KB
/
StaticKuboToyabe.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
// 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/StaticKuboToyabe.h"
#include "MantidAPI/FunctionFactory.h"
#include <cmath>
namespace Mantid {
namespace CurveFitting {
namespace Functions {
using namespace CurveFitting;
using namespace Kernel;
using namespace API;
DECLARE_FUNCTION(StaticKuboToyabe)
void StaticKuboToyabe::init() {
declareParameter("A", 0.2, "Amplitude at time 0");
declareParameter("Delta", 0.2, "Decay rate");
}
void StaticKuboToyabe::function1D(double *out, const double *xValues,
const size_t nData) const {
const double A = getParameter("A");
const double G = getParameter("Delta");
for (size_t i = 0; i < nData; i++) {
out[i] = A * (exp(-pow(G * xValues[i], 2) / 2) *
(1 - pow(G * xValues[i], 2)) * 2.0 / 3 +
1.0 / 3);
}
}
} // namespace Functions
} // namespace CurveFitting
} // namespace Mantid