| 1 | //---------------------------------------------------------------------- |
|---|
| 2 | // Includes |
|---|
| 3 | //---------------------------------------------------------------------- |
|---|
| 4 | #include "Muon_GausDecay.h" |
|---|
| 5 | #include <cmath> |
|---|
| 6 | |
|---|
| 7 | namespace Mantid |
|---|
| 8 | { |
|---|
| 9 | namespace CurveFitting |
|---|
| 10 | { |
|---|
| 11 | |
|---|
| 12 | using namespace Kernel; |
|---|
| 13 | using namespace API; |
|---|
| 14 | |
|---|
| 15 | DECLARE_FUNCTION(Muon_GausDecay) |
|---|
| 16 | |
|---|
| 17 | void Muon_GausDecay::init() |
|---|
| 18 | { |
|---|
| 19 | declareParameter("A", 0.2); |
|---|
| 20 | declareParameter("sigma", 0.2); |
|---|
| 21 | } |
|---|
| 22 | |
|---|
| 23 | |
|---|
| 24 | void Muon_GausDecay::functionLocal(double* out, const double* xValues, const int& nData)const |
|---|
| 25 | { |
|---|
| 26 | const double& A = getParameter("A"); |
|---|
| 27 | const double& G = getParameter("sigma"); |
|---|
| 28 | |
|---|
| 29 | |
|---|
| 30 | for (int i = 0; i < nData; i++) { |
|---|
| 31 | out[i] = A*exp(-G*G*xValues[i]*xValues[i]); |
|---|
| 32 | } |
|---|
| 33 | } |
|---|
| 34 | void Muon_GausDecay::functionDerivLocal(API::Jacobian* out, const double* xValues, const int& nData) |
|---|
| 35 | { |
|---|
| 36 | calNumericalDeriv(out, xValues, nData); |
|---|
| 37 | } |
|---|
| 38 | |
|---|
| 39 | |
|---|
| 40 | |
|---|
| 41 | |
|---|
| 42 | } // namespace CurveFitting |
|---|
| 43 | } // namespace Mantid |
|---|
| 44 | |
|---|
| 45 | |
|---|