Commit f2dadc47 authored by Federico Montesino Pouzols's avatar Federico Montesino Pouzols
Browse files

Merge remote-tracking branch 'origin/master' into 15246_reduce_recursive_includes_in_Algorithm.h

Fixed conflicts with last few days changes in master, especially with InstrumentWidget files that
have been moved and revamped, re #15246.
parents ad814ae0 7888407a
......@@ -194,7 +194,7 @@ void ProcessBackground::init() {
// Output background type.
std::vector<std::string> outbkgdtype{"Polynomial", "Chebyshev"};
auto outbkgdvalidator =
boost::make_shared<Kernel::StringListValidator>(bkgdtype);
boost::make_shared<Kernel::StringListValidator>(outbkgdtype);
declareProperty("OutputBackgroundType", "Polynomial", outbkgdvalidator,
"Type of background to fit with selected background points.");
setPropertySettings("OutputBackgroundType",
......
......@@ -131,8 +131,7 @@ public:
private:
Mantid::API::IAlgorithm_sptr
createTestAlgorithm(const Mantid::API::MatrixWorkspace_sptr &inputWS) {
Mantid::API::IAlgorithm_sptr alg =
boost::shared_ptr<Mantid::API::IAlgorithm>(new CalculateMSVesuvio);
Mantid::API::IAlgorithm_sptr alg = boost::make_shared<CalculateMSVesuvio>();
alg->initialize();
alg->setRethrows(true);
alg->setChild(true);
......
......@@ -148,10 +148,14 @@ public:
}
void testFit() {
boost::shared_ptr<CompositeFunction> mfun(new CompositeFunction());
boost::shared_ptr<CurveFittingGauss> g1(new CurveFittingGauss());
boost::shared_ptr<CurveFittingGauss> g2(new CurveFittingGauss());
boost::shared_ptr<CurveFittingLinear> bk(new CurveFittingLinear());
boost::shared_ptr<CompositeFunction> mfun =
boost::make_shared<CompositeFunction>();
boost::shared_ptr<CurveFittingGauss> g1 =
boost::make_shared<CurveFittingGauss>();
boost::shared_ptr<CurveFittingGauss> g2 =
boost::make_shared<CurveFittingGauss>();
boost::shared_ptr<CurveFittingLinear> bk =
boost::make_shared<CurveFittingLinear>();
mfun->addFunction(bk);
mfun->addFunction(g1);
......@@ -290,20 +294,22 @@ public:
values->setFitData(y);
values->setFitWeights(1.0);
boost::shared_ptr<CompositeFunction> mfun(new CompositeFunction);
boost::shared_ptr<CompositeFunction> mfun =
boost::make_shared<CompositeFunction>();
boost::shared_ptr<UserFunction> fun1(new UserFunction);
boost::shared_ptr<UserFunction> fun1 = boost::make_shared<UserFunction>();
fun1->setAttributeValue("Formula", "a*x");
fun1->setParameter("a", 1.1);
boost::shared_ptr<UserFunction> fun2(new UserFunction);
boost::shared_ptr<UserFunction> fun2 = boost::make_shared<UserFunction>();
fun2->setAttributeValue("Formula", "0*x + b");
fun2->setParameter("b", 2.2);
mfun->addFunction(fun1);
mfun->addFunction(fun2);
boost::shared_ptr<CostFuncLeastSquares> costFun(new CostFuncLeastSquares);
boost::shared_ptr<CostFuncLeastSquares> costFun =
boost::make_shared<CostFuncLeastSquares>();
costFun->setFittingFunction(mfun, domain, values);
SimplexMinimizer s;
......@@ -327,13 +333,14 @@ public:
values->setFitData(y);
values->setFitWeights(1.0);
boost::shared_ptr<CompositeFunction> mfun(new CompositeFunction);
boost::shared_ptr<CompositeFunction> mfun =
boost::make_shared<CompositeFunction>();
boost::shared_ptr<UserFunction> fun1(new UserFunction);
boost::shared_ptr<UserFunction> fun1 = boost::make_shared<UserFunction>();
fun1->setAttributeValue("Formula", "a*x");
fun1->setParameter("a", 1.1);
boost::shared_ptr<UserFunction> fun2(new UserFunction);
boost::shared_ptr<UserFunction> fun2 = boost::make_shared<UserFunction>();
fun2->setAttributeValue("Formula", "c*x^2 + b");
fun2->setParameter("c", 0.00);
fun2->setParameter("b", 2.2);
......@@ -341,7 +348,8 @@ public:
mfun->addFunction(fun1);
mfun->addFunction(fun2);
boost::shared_ptr<CostFuncLeastSquares> costFun(new CostFuncLeastSquares);
boost::shared_ptr<CostFuncLeastSquares> costFun =
boost::make_shared<CostFuncLeastSquares>();
costFun->setFittingFunction(mfun, domain, values);
BFGS_Minimizer s;
......@@ -368,13 +376,14 @@ public:
values->setFitDataFromCalculated(mockData);
values->setFitWeights(1.0);
boost::shared_ptr<CompositeFunction> mfun(new CompositeFunction);
boost::shared_ptr<CompositeFunction> mfun =
boost::make_shared<CompositeFunction>();
boost::shared_ptr<UserFunction> fun1(new UserFunction);
boost::shared_ptr<UserFunction> fun1 = boost::make_shared<UserFunction>();
fun1->setAttributeValue("Formula", "a*x");
fun1->setParameter("a", 1.1);
boost::shared_ptr<UserFunction> fun2(new UserFunction);
boost::shared_ptr<UserFunction> fun2 = boost::make_shared<UserFunction>();
fun2->setAttributeValue("Formula", "c*x^2 + b");
fun2->setParameter("c", 0.00);
fun2->setParameter("b", 2.2);
......@@ -382,7 +391,8 @@ public:
mfun->addFunction(fun1);
mfun->addFunction(fun2);
boost::shared_ptr<CostFuncLeastSquares> costFun(new CostFuncLeastSquares);
boost::shared_ptr<CostFuncLeastSquares> costFun =
boost::make_shared<CostFuncLeastSquares>();
costFun->setFittingFunction(mfun, domain, values);
LevenbergMarquardtMDMinimizer s;
......
......@@ -44,12 +44,13 @@ public:
values->setFitData(y);
values->setFitWeights(1.0);
boost::shared_ptr<UserFunction> fun(new UserFunction);
boost::shared_ptr<UserFunction> fun = boost::make_shared<UserFunction>();
fun->setAttributeValue("Formula", "a*x+b");
fun->setParameter("a", 1.1);
fun->setParameter("b", 2.2);
boost::shared_ptr<CostFuncLeastSquares> costFun(new CostFuncLeastSquares);
boost::shared_ptr<CostFuncLeastSquares> costFun =
boost::make_shared<CostFuncLeastSquares>();
costFun->setFittingFunction(fun, domain, values);
SimplexMinimizer s;
......@@ -73,12 +74,12 @@ public:
values->setFitData(y);
values->setFitWeights(sqrty);
boost::shared_ptr<UserFunction> fun(new UserFunction);
boost::shared_ptr<UserFunction> fun = boost::make_shared<UserFunction>();
fun->setAttributeValue("Formula", "a*x+b");
fun->setParameter("a", 1.1);
fun->setParameter("b", 2.2);
boost::shared_ptr<CostFuncRwp> costFun(new CostFuncRwp);
boost::shared_ptr<CostFuncRwp> costFun = boost::make_shared<CostFuncRwp>();
costFun->setFittingFunction(fun, domain, values);
SimplexMinimizer s;
......@@ -105,7 +106,8 @@ public:
fun->setParameter("Height", 1.);
fun->setParameter("Lifetime", 1.);
boost::shared_ptr<CostFuncLeastSquares> costFun(new CostFuncLeastSquares);
boost::shared_ptr<CostFuncLeastSquares> costFun =
boost::make_shared<CostFuncLeastSquares>();
costFun->setFittingFunction(fun, domain, values);
BFGS_Minimizer s;
......@@ -132,12 +134,13 @@ public:
values->setFitData(y);
values->setFitWeights(1.0);
boost::shared_ptr<UserFunction> fun(new UserFunction);
boost::shared_ptr<UserFunction> fun = boost::make_shared<UserFunction>();
fun->setAttributeValue("Formula", "a*x+b");
fun->setParameter("a", 1.1);
fun->setParameter("b", 2.2);
boost::shared_ptr<CostFuncLeastSquares> costFun(new CostFuncLeastSquares);
boost::shared_ptr<CostFuncLeastSquares> costFun =
boost::make_shared<CostFuncLeastSquares>();
costFun->setFittingFunction(fun, domain, values);
TS_ASSERT_DELTA(costFun->val(), 0.145,
1e-10); // == 0.5 *( 0.2^2 + 0.3^2 + 0.4^2 )
......@@ -176,12 +179,13 @@ public:
values->setFitData(y);
values->setFitWeights(1.0);
boost::shared_ptr<UserFunction> fun(new UserFunction);
boost::shared_ptr<UserFunction> fun = boost::make_shared<UserFunction>();
fun->setAttributeValue("Formula", "a*x+b");
fun->setParameter("a", 1.1);
fun->setParameter("b", 2.2);
boost::shared_ptr<CostFuncLeastSquares> costFun(new CostFuncLeastSquares);
boost::shared_ptr<CostFuncLeastSquares> costFun =
boost::make_shared<CostFuncLeastSquares>();
costFun->setFittingFunction(fun, domain, values);
TS_ASSERT_DELTA(costFun->val(), 0.145,
1e-10); // == 0.5 *( 0.2^2 + 0.3^2 + 0.4^2 )
......@@ -216,7 +220,8 @@ public:
fun->setParameter("Lifetime", 1.);
fun->fix(1);
boost::shared_ptr<CostFuncLeastSquares> costFun(new CostFuncLeastSquares);
boost::shared_ptr<CostFuncLeastSquares> costFun =
boost::make_shared<CostFuncLeastSquares>();
costFun->setFittingFunction(fun, domain, values);
BFGS_Minimizer s;
......@@ -247,7 +252,7 @@ public:
fun->setParameter("Height", 19.);
fun->setParameter("Lifetime", 0.1);
boost::shared_ptr<CostFuncRwp> costFun(new CostFuncRwp);
boost::shared_ptr<CostFuncRwp> costFun = boost::make_shared<CostFuncRwp>();
costFun->setFittingFunction(fun, domain, values);
LevenbergMarquardtMDMinimizer s;
......@@ -266,7 +271,7 @@ public:
API::FunctionDomain1D_sptr domain(
new API::FunctionDomain1DVector(79300., 79600., 41));
API::FunctionValues_sptr data(new API::FunctionValues(*domain));
boost::shared_ptr<UserFunction> fun0(new UserFunction);
boost::shared_ptr<UserFunction> fun0 = boost::make_shared<UserFunction>();
fun0->setAttributeValue("Formula", "b + h * exp(-((x-c)/s)^2)");
fun0->setParameter("b", 9);
fun0->setParameter("h", 224.);
......@@ -278,7 +283,7 @@ public:
values->setFitDataFromCalculated(*data);
values->setFitWeights(1.0);
boost::shared_ptr<UserFunction> fun1(new UserFunction);
boost::shared_ptr<UserFunction> fun1 = boost::make_shared<UserFunction>();
fun1->setAttributeValue("Formula", "b + h * exp(-((x-c)/s)^2)");
fun1->setParameter("b", 0);
fun1->setParameter("h", 200.);
......@@ -288,7 +293,8 @@ public:
API::CompositeFunction_sptr fnWithBk(new API::CompositeFunction());
boost::shared_ptr<LinearBackground> bk(new LinearBackground());
boost::shared_ptr<LinearBackground> bk =
boost::make_shared<LinearBackground>();
bk->initialize();
bk->setParameter("A0", 0.0);
......@@ -296,7 +302,7 @@ public:
bk->tie("A1", "0");
// set up Gaussian fitting function
boost::shared_ptr<Gaussian> fn(new Gaussian());
boost::shared_ptr<Gaussian> fn = boost::make_shared<Gaussian>();
fn->initialize();
fn->setParameter("PeakCentre", 79450.0);
fn->setParameter("Height", 200.0);
......@@ -305,7 +311,8 @@ public:
fnWithBk->addFunction(bk);
fnWithBk->addFunction(fn);
boost::shared_ptr<CostFuncLeastSquares> costFun(new CostFuncLeastSquares);
boost::shared_ptr<CostFuncLeastSquares> costFun =
boost::make_shared<CostFuncLeastSquares>();
// costFun->setFittingFunction(fun1,domain,values);
costFun->setFittingFunction(fnWithBk, domain, values);
......
......@@ -458,8 +458,7 @@ public:
const std::string inputWSName = "FitMWTest_CompositeTest";
// AnalysisDataService::Instance().add(inputWSName, ws2);
auto composite =
boost::shared_ptr<API::CompositeFunction>(new API::CompositeFunction);
auto composite = boost::make_shared<API::CompositeFunction>();
API::IFunction_sptr expDecay(new ExpDecay);
expDecay->setParameter("Height", 1.5);
expDecay->setError(0, 0.01);
......@@ -653,7 +652,7 @@ public:
}
void do_test_convolve_members_option(bool withBackground) {
auto conv = boost::shared_ptr<Convolution>(new Convolution);
auto conv = boost::make_shared<Convolution>();
auto resolution = IFunction_sptr(new Gaussian);
resolution->initialize();
resolution->setParameter("Height", 1.0);
......@@ -675,7 +674,8 @@ public:
conv->addFunction(gaussian2);
// workspace with 100 points on interval -10 <= x <= 10
boost::shared_ptr<WorkspaceTester> data(new WorkspaceTester());
boost::shared_ptr<WorkspaceTester> data =
boost::make_shared<WorkspaceTester>();
data->init(1, 100, 100);
for (size_t i = 0; i < data->blocksize(); i++) {
data->dataX(0)[i] = -10.0 + 0.2 * double(i);
......@@ -696,8 +696,7 @@ public:
API::IFunction_sptr bckgd(new ExpDecay);
bckgd->setParameter("Height", 1.);
bckgd->setParameter("Lifetime", 1.);
auto composite =
boost::shared_ptr<API::CompositeFunction>(new API::CompositeFunction);
auto composite = boost::make_shared<API::CompositeFunction>();
composite->addFunction(bckgd);
composite->addFunction(conv);
fitfun = composite;
......
......@@ -38,14 +38,15 @@ public:
values->setFitDataFromCalculated(mockData);
values->setFitWeights(1.0);
boost::shared_ptr<UserFunction> fun(new UserFunction);
boost::shared_ptr<UserFunction> fun = boost::make_shared<UserFunction>();
fun->setAttributeValue("Formula", "a*x+b+h*exp(-s*x^2)");
fun->setParameter("a", 1.);
fun->setParameter("b", 2.);
fun->setParameter("h", 3.);
fun->setParameter("s", 0.1);
boost::shared_ptr<CostFuncLeastSquares> costFun(new CostFuncLeastSquares);
boost::shared_ptr<CostFuncLeastSquares> costFun =
boost::make_shared<CostFuncLeastSquares>();
costFun->setFittingFunction(fun, domain, values);
DampingMinimizer s;
......@@ -79,14 +80,15 @@ public:
values->setFitDataFromCalculated(mockData);
values->setFitWeights(1.0);
boost::shared_ptr<UserFunction> fun(new UserFunction);
boost::shared_ptr<UserFunction> fun = boost::make_shared<UserFunction>();
fun->setAttributeValue("Formula", "a*x+b+h*exp(-s*x^2)");
fun->setParameter("a", 1.);
fun->setParameter("b", 2.);
fun->setParameter("h", 3.);
fun->setParameter("s", 0.1);
boost::shared_ptr<CostFuncLeastSquares> costFun(new CostFuncLeastSquares);
boost::shared_ptr<CostFuncLeastSquares> costFun =
boost::make_shared<CostFuncLeastSquares>();
costFun->setFittingFunction(fun, domain, values);
DampingMinimizer s;
......@@ -120,7 +122,7 @@ public:
values->setFitDataFromCalculated(mockData);
values->setFitWeights(1.0);
boost::shared_ptr<UserFunction> fun(new UserFunction);
boost::shared_ptr<UserFunction> fun = boost::make_shared<UserFunction>();
fun->setAttributeValue("Formula", "a*x+b+h*exp(-s*x^2)");
fun->setParameter("a", 1.);
fun->setParameter("b", 2.);
......@@ -128,7 +130,8 @@ public:
fun->setParameter("s", 0.1);
fun->fix(0);
boost::shared_ptr<CostFuncLeastSquares> costFun(new CostFuncLeastSquares);
boost::shared_ptr<CostFuncLeastSquares> costFun =
boost::make_shared<CostFuncLeastSquares>();
costFun->setFittingFunction(fun, domain, values);
TS_ASSERT_EQUALS(costFun->nParams(), 3);
......@@ -159,7 +162,7 @@ public:
values->setFitDataFromCalculated(mockData);
values->setFitWeights(1.0);
boost::shared_ptr<UserFunction> fun(new UserFunction);
boost::shared_ptr<UserFunction> fun = boost::make_shared<UserFunction>();
fun->setAttributeValue("Formula", "a*x+b+h*exp(-s*x^2)");
fun->setParameter("a", 1.);
fun->setParameter("b", 2.);
......@@ -167,7 +170,8 @@ public:
fun->setParameter("s", 0.1);
fun->tie("a", "1");
boost::shared_ptr<CostFuncLeastSquares> costFun(new CostFuncLeastSquares);
boost::shared_ptr<CostFuncLeastSquares> costFun =
boost::make_shared<CostFuncLeastSquares>();
costFun->setFittingFunction(fun, domain, values);
TS_ASSERT_EQUALS(costFun->nParams(), 3);
......@@ -198,7 +202,7 @@ public:
values->setFitDataFromCalculated(mockData);
values->setFitWeights(1.0);
boost::shared_ptr<UserFunction> fun(new UserFunction);
boost::shared_ptr<UserFunction> fun = boost::make_shared<UserFunction>();
fun->setAttributeValue("Formula", "a*x+b+h*exp(-s*x^2)");
fun->setParameter("a", 1.);
fun->setParameter("b", 2.);
......@@ -206,7 +210,8 @@ public:
fun->setParameter("s", 0.1);
fun->tie("b", "2*a+0.1");
boost::shared_ptr<CostFuncLeastSquares> costFun(new CostFuncLeastSquares);
boost::shared_ptr<CostFuncLeastSquares> costFun =
boost::make_shared<CostFuncLeastSquares>();
costFun->setFittingFunction(fun, domain, values);
TS_ASSERT_EQUALS(costFun->nParams(), 3);
......@@ -236,7 +241,7 @@ public:
values->setFitDataFromCalculated(mockData);
values->setFitWeights(1.0);
boost::shared_ptr<UserFunction> fun(new UserFunction);
boost::shared_ptr<UserFunction> fun = boost::make_shared<UserFunction>();
fun->setAttributeValue("Formula", "a*x+b");
fun->setParameter("a", 1.);
fun->setParameter("b", 2.);
......@@ -246,7 +251,8 @@ public:
fun->addConstraint(constraint);
boost::shared_ptr<CostFuncLeastSquares> costFun(new CostFuncLeastSquares);
boost::shared_ptr<CostFuncLeastSquares> costFun =
boost::make_shared<CostFuncLeastSquares>();
costFun->setFittingFunction(fun, domain, values);
TS_ASSERT_EQUALS(costFun->nParams(), 2);
......
......@@ -45,14 +45,15 @@ public:
values->setFitDataFromCalculated(mockData);
values->setFitWeights(1.0);
boost::shared_ptr<UserFunction> fun(new UserFunction);
boost::shared_ptr<UserFunction> fun = boost::make_shared<UserFunction>();
fun->setAttributeValue("Formula", "a*x+b+h*exp(-s*x^2)");
fun->setParameter("a", 1.);
fun->setParameter("b", 2.);
fun->setParameter("h", 3.);
fun->setParameter("s", 0.1);
boost::shared_ptr<CostFuncLeastSquares> costFun(new CostFuncLeastSquares);
boost::shared_ptr<CostFuncLeastSquares> costFun =
boost::make_shared<CostFuncLeastSquares>();
costFun->setFittingFunction(fun, domain, values);
LevenbergMarquardtMDMinimizer s;
......@@ -82,7 +83,7 @@ public:
values->setFitDataFromCalculated(mockData);
values->setFitWeights(1.0);
boost::shared_ptr<UserFunction> fun(new UserFunction);
boost::shared_ptr<UserFunction> fun = boost::make_shared<UserFunction>();
fun->setAttributeValue("Formula", "a*x+b+h*exp(-s*x^2)");
fun->setParameter("a", 1.);
fun->setParameter("b", 2.);
......@@ -90,7 +91,8 @@ public:
fun->setParameter("s", 0.1);
fun->fix(0);
boost::shared_ptr<CostFuncLeastSquares> costFun(new CostFuncLeastSquares);
boost::shared_ptr<CostFuncLeastSquares> costFun =
boost::make_shared<CostFuncLeastSquares>();
costFun->setFittingFunction(fun, domain, values);
TS_ASSERT_EQUALS(costFun->nParams(), 3);
......@@ -121,7 +123,7 @@ public:
values->setFitDataFromCalculated(mockData);
values->setFitWeights(1.0);
boost::shared_ptr<UserFunction> fun(new UserFunction);
boost::shared_ptr<UserFunction> fun = boost::make_shared<UserFunction>();
fun->setAttributeValue("Formula", "a*x+b+h*exp(-s*x^2)");
fun->setParameter("a", 1.);
fun->setParameter("b", 2.);
......@@ -129,7 +131,8 @@ public:
fun->setParameter("s", 0.1);
fun->tie("a", "1");
boost::shared_ptr<CostFuncLeastSquares> costFun(new CostFuncLeastSquares);
boost::shared_ptr<CostFuncLeastSquares> costFun =
boost::make_shared<CostFuncLeastSquares>();
costFun->setFittingFunction(fun, domain, values);
TS_ASSERT_EQUALS(costFun->nParams(), 3);
......@@ -160,7 +163,7 @@ public:
values->setFitDataFromCalculated(mockData);
values->setFitWeights(1.0);
boost::shared_ptr<UserFunction> fun(new UserFunction);
boost::shared_ptr<UserFunction> fun = boost::make_shared<UserFunction>();
fun->setAttributeValue("Formula", "a*x+b+h*exp(-s*x^2)");
fun->setParameter("a", 1.);
fun->setParameter("b", 2.);
......@@ -168,7 +171,8 @@ public:
fun->setParameter("s", 0.1);
fun->tie("b", "2*a+0.1");
boost::shared_ptr<CostFuncLeastSquares> costFun(new CostFuncLeastSquares);
boost::shared_ptr<CostFuncLeastSquares> costFun =
boost::make_shared<CostFuncLeastSquares>();
costFun->setFittingFunction(fun, domain, values);
TS_ASSERT_EQUALS(costFun->nParams(), 3);
......@@ -198,7 +202,7 @@ public:
values->setFitDataFromCalculated(mockData);
values->setFitWeights(1.0);
boost::shared_ptr<UserFunction> fun(new UserFunction);
boost::shared_ptr<UserFunction> fun = boost::make_shared<UserFunction>();
fun->setAttributeValue("Formula", "a*x+b");
fun->setParameter("a", 1.);
fun->setParameter("b", 2.);
......@@ -208,7 +212,8 @@ public:
fun->addConstraint(constraint);
boost::shared_ptr<CostFuncLeastSquares> costFun(new CostFuncLeastSquares);
boost::shared_ptr<CostFuncLeastSquares> costFun =
boost::make_shared<CostFuncLeastSquares>();
costFun->setFittingFunction(fun, domain, values);
TS_ASSERT_EQUALS(costFun->nParams(), 2);
......@@ -235,7 +240,7 @@ public:
values->setFitDataFromCalculated(mockData);
values->setFitWeights(1.0);
boost::shared_ptr<UserFunction> fun(new UserFunction);
boost::shared_ptr<UserFunction> fun = boost::make_shared<UserFunction>();
fun->setAttributeValue("Formula", "a^2*x+b");
fun->setParameter("a", -0.5);
fun->setParameter("b", 2.2);
......@@ -246,7 +251,8 @@ public:
new BoundaryConstraint(fun.get(), "a", 0.001, 2.0);
fun->addConstraint(constraint);
boost::shared_ptr<CostFuncLeastSquares> costFun(new CostFuncLeastSquares);
boost::shared_ptr<CostFuncLeastSquares> costFun =
boost::make_shared<CostFuncLeastSquares>();
costFun->setFittingFunction(fun, domain, values);
TS_ASSERT_EQUALS(costFun->nParams(), 2);
......
......@@ -43,12 +43,13 @@ public:
values->setFitDataFromCalculated(mockData);
values->setFitWeights(1.0);
boost::shared_ptr<UserFunction> fun(new UserFunction);
boost::shared_ptr<UserFunction> fun = boost::make_shared<UserFunction>();
fun->setAttributeValue("Formula", "a*x+b");
fun->setParameter("a", 1.);
fun->setParameter("b", 2.);
boost::shared_ptr<CostFuncLeastSquares> costFun(new CostFuncLeastSquares);
boost::shared_ptr<CostFuncLeastSquares> costFun =
boost::make_shared<CostFuncLeastSquares>();
costFun->setFittingFunction(fun, domain, values);
TS_ASSERT_EQUALS(costFun->nParams(), 2);
......@@ -77,14 +78,15 @@ public:
values->setFitDataFromCalculated(mockData);
values->setFitWeights(1.0);
boost::shared_ptr<UserFunction> fun(new UserFunction);
boost::shared_ptr<UserFunction> fun = boost::make_shared<UserFunction>();
fun->setAttributeValue("Formula", "a*x+b+h*exp(-s*x^2)");
fun->setParameter("a", 1.);
fun->setParameter("b", 2.);
fun->setParameter("h", 3.);
fun->setParameter("s", 0.1);
boost::shared_ptr<CostFuncLeastSquares> costFun(new CostFuncLeastSquares);
boost::shared_ptr<CostFuncLeastSquares> costFun =
boost::make_shared<CostFuncLeastSquares>();
costFun->setFittingFunction(fun, domain, values);
LevenbergMarquardtMinimizer s;
......@@ -114,7 +116,7 @@ public:
values->setFitDataFromCalculated(mockData);
values->setFitWeights(1.0);
boost::shared_ptr<UserFunction> fun(new UserFunction);
boost::shared_ptr<UserFunction> fun = boost::make_shared<UserFunction>();
fun->setAttributeValue("Formula", "a*x+b+h*exp(-s*x^2)");
fun->setParameter("a", 1.);
fun->setParameter("b", 2.);
......@@ -122,7 +124,8 @@ public:
fun->setParameter("s", 0.1);
fun->fix(0);
boost::shared_ptr<CostFuncLeastSquares> costFun(new CostFuncLeastSquares);
boost::shared_ptr<CostFuncLeastSquares> costFun =
boost::make_shared<CostFuncLeastSquares>();
costFun->setFittingFunction(fun, domain, values);
TS_ASSERT_EQUALS(costFun->nParams(), 3);
......@@ -153,7 +156,7 @@ public:
values->setFitDataFromCalculated(mockData);
values->setFitWeights(1.0);
boost::shared_ptr<UserFunction> fun(new UserFunction);
boost::shared_ptr<UserFunction> fun = boost::make_shared<UserFunction>();
fun->setAttributeValue("Formula", "a*x+b+h*exp(-s*x^2)");
fun->setParameter("a", 1.);
fun->setParameter("b", 2.);
......@@ -161,7 +164,8 @@ public:
fun->setParameter("s", 0.1);