17const
std::
string Minus::alias()
const {
return "Subtract"; }
20 HistogramData::HistogramY &YOut, HistogramData::HistogramE &EOut) {
21 std::transform(lhs.y().begin(), lhs.y().end(),
rhs.y().begin(), YOut.begin(), std::minus<>());
26 HistogramData::HistogramY &YOut, HistogramData::HistogramE &EOut) {
27 using std::placeholders::_1;
28 std::transform(lhs.y().begin(), lhs.y().end(), YOut.begin(), [rhsY](
double l) { return l - rhsY; });
31 double rhsE2 = rhsE * rhsE;
32 std::transform(lhs.e().begin(), lhs.e().end(), EOut.begin(),
33 [rhsE2](
double l) { return std::sqrt(l * l + rhsE2); });
68 "event list in an EventWorkspace. Try switching to a Workspace2D before "
85 "event list in an EventWorkspace. Try switching to a Workspace2D before "
126 if (lhs->size() > 1 &&
rhs->size() > 1) {
127 if (lhs->YUnit() !=
rhs->YUnit()) {
128 g_log.
error(
"The two workspaces are not compatible because they have "
129 "different units for the data (Y).");
132 if (lhs->isDistribution() !=
rhs->isDistribution()) {
133 g_log.
error(
"The two workspaces are not compatible because one is "
134 "flagged as a distribution.");
179 if (lhs->getNumberHistograms() ==
rhs->getNumberHistograms()) {
182 return "Number of histograms not identical.";
#define DECLARE_ALGORITHM(classname)
const std::vector< double > & rhs
bool m_do2D_even_for_SingleColumn_on_rhs
Special case for plus/minus: if there is only one bin on the RHS, use the 2D method (appending event ...
bool m_keepEventWorkspace
Variable set to true if the operation allows the output to stay as an EventWorkspace.
virtual bool checkCompatibility(const API::MatrixWorkspace_const_sptr lhs, const API::MatrixWorkspace_const_sptr rhs) const
Checks the compatibility of the two workspaces.
virtual std::string checkSizeCompatibility(const API::MatrixWorkspace_const_sptr lhs, const API::MatrixWorkspace_const_sptr rhs) const
Checks the overall size compatibility of two workspaces.
bool m_AllowDifferentNumberSpectra
The property value.
bool m_matchXSize
matchXSize set to true if the X sizes of histograms must match.
bool m_flipSides
flipSides set to true if the rhs and lhs operands should be flipped - for commutative binary operatio...
DataObjects::EventWorkspace_const_sptr m_erhs
Right-hand side EventWorkspace.
DataObjects::EventWorkspace_const_sptr m_elhs
Left-hand side EventWorkspace.
virtual void checkRequirements()
Check what operation will be needed in order to apply the operation to these two types of workspaces.
Minus performs the difference of two input workspaces.
bool checkUnitCompatibility(const API::MatrixWorkspace_const_sptr &lhs, const API::MatrixWorkspace_const_sptr &rhs) const
Return true if the units and distribution-type of the workspaces make them compatible.
void performBinaryOperation(const HistogramData::Histogram &lhs, const HistogramData::Histogram &rhs, HistogramData::HistogramY &YOut, HistogramData::HistogramE &EOut) override
Carries out the binary operation on a single spectrum, with another spectrum as the right-hand operan...
void checkRequirements() override
Check what operation will be needed in order to apply the operation to these two types of workspaces.
std::string checkSizeCompatibility(const API::MatrixWorkspace_const_sptr lhs, const API::MatrixWorkspace_const_sptr rhs) const override
Performs a simple check to see if the sizes of two workspaces are compatible for a binary operation I...
bool checkCompatibility(const API::MatrixWorkspace_const_sptr lhs, const API::MatrixWorkspace_const_sptr rhs) const override
Check the given workspaces for unit, distribution and binary operation compatibility.
void performEventBinaryOperation(DataObjects::EventList &lhs, const DataObjects::EventList &rhs) override
Carries out the binary operation IN-PLACE on a single EventList, with another EventList as the right-...
Marks code as not implemented yet.
void error(const std::string &msg)
Logs at error level.
std::shared_ptr< const MatrixWorkspace > MatrixWorkspace_const_sptr
shared pointer to the matrix workspace base class (const version)
std::vector< double > MantidVec
typedef for the data storage used in Mantid matrix workspaces
Functor used for computing the sum of the square values of a vector, using the accumulate algorithm.