Loading [MathJax]/extensions/tex2jax.js
Mantid
Toggle main menu visibility
Main Page
Related Pages
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
z
Variables
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
y
Enumerations
a
c
d
e
f
h
i
l
m
n
o
p
q
r
s
t
u
w
x
Enumerator
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
y
z
Enumerations
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
Enumerator
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Properties
a
b
e
f
i
l
m
o
s
t
u
w
Related Functions
a
b
c
d
e
f
g
i
k
l
m
n
o
p
r
s
t
u
w
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Functions
a
b
c
d
e
f
g
i
l
m
n
o
p
r
s
t
u
v
w
Variables
_
b
c
d
e
f
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Typedefs
a
b
c
e
f
k
l
o
p
r
s
t
v
w
Macros
a
b
c
d
e
f
g
i
k
l
m
n
p
q
r
s
t
u
v
w
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
Loading...
Searching...
No Matches
Framework
CurveFitting
src
Functions
ThermalNeutronBk2BkExpSigma.cpp
Go to the documentation of this file.
1
// Mantid Repository : https://github.com/mantidproject/mantid
2
//
3
// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4
// NScD Oak Ridge National Laboratory, European Spallation Source,
5
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6
// SPDX - License - Identifier: GPL - 3.0 +
7
#include "
MantidCurveFitting/Functions/ThermalNeutronBk2BkExpSigma.h
"
8
#include "
MantidAPI/FunctionFactory.h
"
9
#include "
MantidKernel/System.h
"
10
11
#include <cmath>
12
#include <gsl/gsl_sf_erf.h>
13
14
using namespace
std
;
15
16
using namespace
Mantid
;
17
18
using namespace
Mantid::API
;
19
20
using namespace
Mantid::CurveFitting
;
21
22
namespace
Mantid::CurveFitting::Functions
{
23
24
using namespace
CurveFitting;
25
26
DECLARE_FUNCTION
(
ThermalNeutronBk2BkExpSigma
)
27
28
//----------------------------------------------------------------------------------------------
31
void
ThermalNeutronBk2BkExpSigma
::init() {
32
declareParameter(
"Sig0"
, 0.0);
33
declareParameter(
"Sig1"
, 0.0);
34
declareParameter(
"Sig2"
, 0.0);
35
}
36
37
//----------------------------------------------------------------------------------------------
40
void
ThermalNeutronBk2BkExpSigma::function1D
(
double
*out,
const
double
*xValues,
const
size_t
nData)
const
{
41
double
sig0 =
getParameter
(
"Sig0"
);
42
double
sig1 =
getParameter
(
"Sig1"
);
43
double
sig2 =
getParameter
(
"Sig2"
);
44
45
double
sig0sq = sig0 * sig0;
46
double
sig1sq = sig1 * sig1;
47
double
sig2sq = sig2 * sig2;
48
49
for
(
size_t
i = 0; i < nData; ++i) {
50
out[i] =
corefunction
(xValues[i], sig0sq, sig1sq, sig2sq);
51
}
52
}
53
56
void
ThermalNeutronBk2BkExpSigma::functionDeriv
(
const
FunctionDomain
&domain,
Jacobian
&jacobian) {
57
calNumericalDeriv
(domain, jacobian);
58
}
59
60
//----------------------------------------------------------------------------------------------
63
double
ThermalNeutronBk2BkExpSigma::corefunction
(
double
dh,
double
sig0sq,
double
sig1sq,
double
sig2sq)
const
{
64
double
sigma2 = sig0sq + sig1sq * dh * dh + sig2sq * pow(dh, 4);
65
if
(sigma2 <= 0.0) {
66
throw
runtime_error(
"Sigma^2 cannot be equal to or less than Zero!"
);
67
}
68
69
double
sigma
= sqrt(sigma2);
70
71
return
sigma
;
72
}
73
74
}
// namespace Mantid::CurveFitting::Functions
FunctionFactory.h
DECLARE_FUNCTION
#define DECLARE_FUNCTION(classname)
Macro for declaring a new type of function to be used with the FunctionFactory.
Definition:
FunctionFactory.h:151
sigma
double sigma
Definition:
GetAllEi.cpp:156
System.h
ThermalNeutronBk2BkExpSigma.h
Mantid::API::FunctionDomain
Base class that represents the domain of a function.
Definition:
FunctionDomain.h:31
Mantid::API::IFunction::calNumericalDeriv
void calNumericalDeriv(const FunctionDomain &domain, Jacobian &jacobian)
Calculate numerical derivatives.
Definition:
IFunction.cpp:1031
Mantid::API::Jacobian
Represents the Jacobian in IFitFunction::functionDeriv.
Definition:
Jacobian.h:22
Mantid::API::ParamFunction::getParameter
double getParameter(size_t i) const override
Get i-th parameter.
Definition:
ParamFunction.cpp:62
Mantid::CurveFitting::Functions::ThermalNeutronBk2BkExpSigma
ThermalNeutronBk2BkExpSIGMA : Function to calculate Sigma of Bk2Bk Exponential function from Thermal ...
Definition:
ThermalNeutronBk2BkExpSigma.h:22
Mantid::CurveFitting::Functions::ThermalNeutronBk2BkExpSigma::function1D
void function1D(double *out, const double *xValues, const size_t nData) const override
Override.
Definition:
ThermalNeutronBk2BkExpSigma.cpp:40
Mantid::CurveFitting::Functions::ThermalNeutronBk2BkExpSigma::corefunction
double corefunction(double dh, double sig0sq, double sig1sq, double sig2sq) const
Core function (inline) to calcualte TOF_h from d-spacing.
Definition:
ThermalNeutronBk2BkExpSigma.cpp:63
Mantid::CurveFitting::Functions::ThermalNeutronBk2BkExpSigma::functionDeriv
void functionDeriv(const API::FunctionDomain &domain, API::Jacobian &jacobian) override
Derivative to overwrite.
Definition:
ThermalNeutronBk2BkExpSigma.cpp:56
Mantid::API
Definition:
AbsorptionCorrection.h:20
Mantid::CurveFitting::Functions
Definition:
VesuvioCalculateGammaBackground.h:23
Mantid::CurveFitting
Definition:
IFunction1D.h:19
Mantid
Helper class which provides the Collimation Length for SANS instruments.
Definition:
AbsorptionCorrection.h:18
std
STL namespace.
Generated on Tue Jan 3 2023 11:57:37 for Mantid by
1.9.5