30 const std::string &, bool, bool);
32 const std::string &,
const std::string &, bool, bool);
34 const std::string &,
const std::string &, bool, bool);
36 const std::string &,
const std::string &, bool, bool);
39 const std::string &,
const std::string &, bool, bool);
41 using binary_fn_md_db =
44 const std::string &, bool, bool);
45 using binary_fn_gp_db =
49 using ReturnWorkspaceSptr = return_value_policy<AsType<Workspace_sptr>>;
52 using boost::python::def;
56 def(
"performBinaryOp", (binary_fn_md_md)&performBinaryOp, ReturnWorkspaceSptr());
57 def(
"performBinaryOp", (binary_fn_md_gp)&performBinaryOp, ReturnWorkspaceSptr());
58 def(
"performBinaryOp", (binary_fn_gp_md)&performBinaryOp, ReturnWorkspaceSptr());
59 def(
"performBinaryOp", (binary_fn_gp_gp)&performBinaryOp, ReturnWorkspaceSptr());
60 def(
"performBinaryOp", (binary_fn_mh_mh)&performBinaryOp, ReturnWorkspaceSptr());
62 def(
"performBinaryOp", (binary_fn_md_db)&performBinaryOpWithDouble, ReturnWorkspaceSptr());
63 def(
"performBinaryOp", (binary_fn_mh_db)&performBinaryOpWithDouble, ReturnWorkspaceSptr());
64 def(
"performBinaryOp", (binary_fn_gp_db)&performBinaryOpWithDouble, ReturnWorkspaceSptr());
85 bool inplace,
bool reverse) {
92 const auto algoName = (lhs_mat || lhs_grp) && (rhs_mat || rhs_grp) ? op : op +
"MD";
98 result = API::OperatorOverloads::executeBinaryOperation<RHSType, LHSType, ResultType>(algoName,
rhs, lhs, inplace,
101 result = API::OperatorOverloads::executeBinaryOperation<LHSType, RHSType, ResultType>(algoName, lhs,
rhs, inplace,
104 }
catch (std::runtime_error &exc) {
105 std::string
error = exc.what();
106 if (
error ==
"algorithm") {
107 error =
"Unknown binary operation requested: " + op;
108 throw std::runtime_error(
error);
132 const std::string &
name,
bool inplace,
bool reverse) {
134 auto alg = API::AlgorithmManager::Instance().createUnmanaged(
"CreateSingleValuedWorkspace");
135 alg->setChild(
false);
136 alg->setAlwaysStoreInADS(
false);
138 alg->setProperty<
double>(
"DataValue",
value);
139 alg->setPropertyValue(
"OutputWorkspace",
"python_binary_op_single_value");
146 if (alg->isExecuted()) {
147 singleValue = alg->getProperty(
"OutputWorkspace");
149 throw std::runtime_error(
"performBinaryOp: Error in execution of "
150 "CreateSingleValuedWorkspace");
153 performBinaryOp<LHSType, MatrixWorkspace_sptr, ResultType>(inputWS, singleValue, op,
name, inplace, reverse);
ResultType performBinaryOpWithDouble(const LHSType inputWS, const double value, const std::string &op, const std::string &name, bool inplace, bool reverse)
Binary op for a workspace and a double.
ResultType performBinaryOp(const LHSType lhs, const RHSType rhs, const std::string &op, const std::string &name, bool inplace, bool reverse)
Binary op for two workspaces.