-
Notifications
You must be signed in to change notification settings - Fork 122
/
ProductFunction.cpp
46 lines (40 loc) · 1.51 KB
/
ProductFunction.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
// 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/ProductFunction.h"
#include "MantidAPI/FunctionFactory.h"
namespace Mantid {
namespace CurveFitting {
namespace Functions {
using namespace CurveFitting;
DECLARE_FUNCTION(ProductFunction)
/** Function you want to fit to.
* @param domain :: The buffer for writing the calculated values. Must be big
* enough to accept dataSize() values
*/
void ProductFunction::function(const API::FunctionDomain &domain, API::FunctionValues &values) const {
API::FunctionValues tmp(domain);
values.setCalculated(1.0);
for (size_t iFun = 0; iFun < nFunctions(); ++iFun) {
domain.reset();
getFunction(iFun)->function(domain, tmp);
values *= tmp;
}
}
/**
* Calculate the derivatives numerically.
* @param domain :: Function domein.
* @param jacobian :: Jacobian - stores the calculated derivatives
*/
void ProductFunction::functionDeriv(const API::FunctionDomain &domain, API::Jacobian &jacobian) {
calNumericalDeriv(domain, jacobian);
}
} // namespace Functions
} // namespace CurveFitting
} // namespace Mantid