From ac866fa84282da1e06d1d97ce75246eb2ced239f Mon Sep 17 00:00:00 2001 From: Pete Peterson <petersonpf@ornl.gov> Date: Thu, 28 Sep 2017 13:59:24 -0400 Subject: [PATCH] Fix performance regression --- Framework/Algorithms/src/MaxEnt.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/Framework/Algorithms/src/MaxEnt.cpp b/Framework/Algorithms/src/MaxEnt.cpp index 7590dcbf0f1..b7188504c85 100644 --- a/Framework/Algorithms/src/MaxEnt.cpp +++ b/Framework/Algorithms/src/MaxEnt.cpp @@ -19,13 +19,8 @@ namespace Mantid { namespace Algorithms { -using Mantid::Kernel::Direction; -using Mantid::API::WorkspaceProperty; -using Mantid::HistogramData::Points; -using Mantid::HistogramData::BinEdges; -using Mantid::HistogramData::Counts; -using Mantid::HistogramData::CountStandardDeviations; using Mantid::HistogramData::LinearGenerator; +using Mantid::HistogramData::Points; using namespace API; using namespace Kernel; @@ -227,8 +222,8 @@ void MaxEnt::exec() { MatrixWorkspace_const_sptr inWS = getProperty("InputWorkspace"); // Number of spectra size_t nspec = inWS->getNumberHistograms(); - // Number of data points - size_t npoints = inWS->blocksize() * resolutionFactor; + // Number of data points - assumed to be constant between spectra + size_t npoints = inWS->y(0).size() * resolutionFactor; // Number of X bins const size_t npointsX = inWS->isHistogramData() ? npoints + 1 : npoints; @@ -378,7 +373,7 @@ void MaxEnt::exec() { */ std::vector<double> MaxEnt::toComplex(API::MatrixWorkspace_const_sptr &inWS, size_t spec, bool errors) { - const size_t numBins = inWS->blocksize(); + const size_t numBins = inWS->y(0).size(); std::vector<double> result(numBins * 2); if (inWS->getNumberHistograms() % 2) @@ -687,11 +682,11 @@ void MaxEnt::populateImageWS(MatrixWorkspace_const_sptr &inWS, size_t spec, double dx = dataPoints[1] - x0; double delta = 1. / dx / npoints; - int isOdd = (inWS->blocksize() % 2) ? 1 : 0; + const int isOdd = (inWS->y(0).size() % 2) ? 1 : 0; - double shift = x0 * 2 * M_PI; + double shift = x0 * 2. * M_PI; if (!autoShift) - shift = 0; + shift = 0.; // X values for (int i = 0; i < npoints; i++) { -- GitLab