diff --git a/src/include/multi_array_operation.h b/src/include/multi_array_operation.h index e4b65f0..b3754ae 100644 --- a/src/include/multi_array_operation.h +++ b/src/include/multi_array_operation.h @@ -305,6 +305,71 @@ namespace MultiArrayTools { return Operation(ops...); } + + template + auto operator+(const T& a, const OperationBase& b) + -> Operation,OperationValue,OperationClass> + { + OperationValue v(a); + return Operation,OperationValue,OperationClass>(v, b.THIS()); + } + + template + auto operator-(const T& a, const OperationBase& b) + -> Operation,OperationValue,OperationClass> + { + OperationValue v(a); + return Operation,OperationValue,OperationClass>(v, b.THIS()); + } + + template + auto operator*(const T& a, const OperationBase& b) + -> Operation,OperationValue,OperationClass> + { + OperationValue v(a); + return Operation,OperationValue,OperationClass>(v, b.THIS()); + } + + template + auto operator/(const T& a, const OperationBase& b) + -> Operation,OperationValue,OperationClass> + { + OperationValue v(a); + return Operation,OperationValue,OperationClass>(v, b.THIS()); + } + + template + auto operator+(const OperationBase& a, const T& b) + -> Operation,OperationClass,OperationValue > + { + OperationValue v(b); + return Operation,OperationClass,OperationValue >(a.THIS(), v); + } + + template + auto operator-(const OperationBase& a, const T& b) + -> Operation,OperationClass,OperationValue > + { + OperationValue v(b); + return Operation,OperationClass,OperationValue >(a.THIS(), v); + } + + template + auto operator*(const OperationBase& a, const T& b) + -> Operation,OperationClass,OperationValue > + { + OperationValue v(b); + return Operation,OperationClass,OperationValue >(a.THIS(), v); + } + + template + auto operator/(const OperationBase& a, const T& b) + -> Operation,OperationClass,OperationValue > + { + OperationValue v(b); + return Operation,OperationClass,OperationValue >(a.THIS(), v); + } + template class Contraction : public OperationTemplate >