Skip to content

Commit

Permalink
Refs #9782. AutoDiffTestAlg improved
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Wedel committed Aug 15, 2014
1 parent 8b0f0e5 commit f620746
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions Code/Mantid/Framework/CurveFitting/src/AutoDiffTestAlg.cpp
Expand Up @@ -96,6 +96,8 @@ void AutoDiffTestAlg::exec()
MatrixWorkspace_sptr fitData = getProperty("InputWorkspace");
m_derType = getPropertyValue("DerivativeType");

g_log.warning() << "Using " << m_derType << " derivatives." << std::endl;

std::string parameterString = getProperty("GaussianParameters");
std::vector<double> paramValues = parameterValues(parameterString);

Expand Down Expand Up @@ -134,15 +136,22 @@ void AutoDiffTestAlg::exec()
FunctionValues y(x);
CurveFitting::Jacobian J(x.size(), 3);

g->function(x, y);
Kernel::Timer timerF;

for(size_t i = 0; i < 10000; ++i) {
g->function(x, y);
}

g_log.warning() << "Calculating function took " << timerF.elapsed() / 10000 << " seconds to complete." << std::endl;


Kernel::Timer timer;
Kernel::Timer timerDf;

for(size_t i = 0; i < 10000; ++i) {
g->functionDeriv(x, J);
}

g_log.warning() << "Calculating derivatives took " << timer.elapsed() / 10000 << " seconds to complete." << std::endl;
g_log.warning() << "Calculating derivatives took " << timerDf.elapsed() / 10000 << " seconds to complete." << std::endl;


MatrixWorkspace_sptr t = WorkspaceFactory::Instance().create(fitData);
Expand Down Expand Up @@ -206,7 +215,6 @@ std::vector<double> AutoDiffTestAlg::parameterValues(const std::string &paramete
std::cout << std::setprecision(17);
for(size_t i = 0; i < values.size(); ++i) {
values[i] = boost::lexical_cast<double>(strings[i]);
std::cout << values[i] << std::endl;
}

return values;
Expand Down

0 comments on commit f620746

Please sign in to comment.