-
Notifications
You must be signed in to change notification settings - Fork 122
/
Muon_ExpDecayOscTest.cpp
49 lines (37 loc) · 1.13 KB
/
Muon_ExpDecayOscTest.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
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
#include "Muon_ExpDecayOscTest.h"
#include "MantidAPI/FunctionFactory.h"
#include <cmath>
namespace Mantid
{
namespace CurveFitting
{
using namespace Kernel;
using namespace API;
DECLARE_FUNCTION(Muon_ExpDecayOscTest)
void Muon_ExpDecayOscTest::init()
{
declareParameter("A", 0.2);
declareParameter("lambda", 0.2);
declareParameter("frequency", 0.5);
declareParameter("phi", 0.0);
}
void Muon_ExpDecayOscTest::functionLocal(double* out, const double* xValues, const size_t nData)const
{
const double& gA0 = getParameter("A");
const double& gs = getParameter("lambda");
const double& gf = getParameter("frequency");
const double& gphi = getParameter("phi");
for (size_t i = 0; i < nData; i++)
{
out[i] = gA0*exp(-gs*xValues[i])*cos(2*3.1415926536*gf*xValues[i]+gphi);
}
}
void Muon_ExpDecayOscTest::functionDeriv(const API::FunctionDomain& domain, API::Jacobian& out)
{
calNumericalDeriv(domain, out);
}
} // namespace CurveFitting
} // namespace Mantid