diff --git a/src/Numerics/OhmmsPETE/OhmmsMatrixOperators.h b/src/Numerics/OhmmsPETE/OhmmsMatrixOperators.h index c76929862..a3eda1bb9 100644 --- a/src/Numerics/OhmmsPETE/OhmmsMatrixOperators.h +++ b/src/Numerics/OhmmsPETE/OhmmsMatrixOperators.h @@ -16,959 +16,10 @@ #ifndef OHMMS_MATRIXOPERATOR_H #define OHMMS_MATRIXOPERATOR_H -/////////////////////////////////////////////////////////////////////////////// -// -// WARNING: THIS FILE WAS GENERATED AUTOMATICALLY! -// YOU SHOULD MODIFY THE INPUT FILES INSTEAD OF CHANGING THIS FILE DIRECTLY! -// -// THE FOLLOWING INPUT FILES WERE USED TO MAKE THIS FILE: -// -// MakeOperators -// matrixOps.in -// MatrixDefs.in -/////////////////////////////////////////////////////////////////////////////// namespace qmcplusplus { -// clang-format off -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - operator-(const Matrix & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - operator+(const Matrix & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - operator~(const Matrix & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - PETE_identity(const Matrix & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn, - typename CreateLeaf >::Leaf_t> >::Expression_t - peteCast(const T1&, const Matrix & l) -{ - typedef UnaryNode, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator+(const Matrix & l,const Matrix & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator-(const Matrix & l,const Matrix & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -///////////////////////////////////////////////////////// -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator*(const Matrix & l,const Matrix & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} -//////////////////////////////////////////////////////// -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator%(const Matrix & l,const Matrix & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator&(const Matrix & l,const Matrix & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator|(const Matrix & l,const Matrix & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator^(const Matrix & l,const Matrix & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator+(const Matrix & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator-(const Matrix & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator*(const Matrix & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator%(const Matrix & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator&(const Matrix & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator|(const Matrix & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator^(const Matrix & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator+(const Expression & l,const Matrix & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator-(const Expression & l,const Matrix & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator*(const Expression & l,const Matrix & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator%(const Expression & l,const Matrix & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator&(const Expression & l,const Matrix & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator|(const Expression & l,const Matrix & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator^(const Expression & l,const Matrix & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator+(const Matrix & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator-(const Matrix & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator*(const Matrix & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator%(const Matrix & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator&(const Matrix & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator|(const Matrix & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator^(const Matrix & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator+(const T1 & l,const Matrix & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator-(const T1 & l,const Matrix & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator*(const T1 & l,const Matrix & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator%(const T1 & l,const Matrix & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator&(const T1 & l,const Matrix & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator|(const T1 & l,const Matrix & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator^(const T1 & l,const Matrix & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} -#ifdef PETE_ALLOW_SCALAR_SHIFT -#endif // PETE_ALLOW_SCALAR_SHIFT - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - where(const Matrix & c,const T2 & t,const T3 & f) -{ - typedef TrinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(c), - CreateLeaf::make(t), - CreateLeaf::make(f))); -} -#ifndef PETE_EXPRESSION_OPERATORS -#define PETE_EXPRESSION_OPERATORS - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - operator-(const Expression & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - operator+(const Expression & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - operator~(const Expression & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - PETE_identity(const Expression & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn, - typename CreateLeaf >::Leaf_t> >::Expression_t - peteCast(const T1&, const Expression & l) -{ - typedef UnaryNode, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator+(const Expression & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator-(const Expression & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator*(const Expression & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator%(const Expression & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator&(const Expression & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator|(const Expression & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator^(const Expression & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator+(const Expression & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator-(const Expression & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator*(const Expression & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator%(const Expression & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator&(const Expression & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator|(const Expression & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator^(const Expression & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator+(const T1 & l,const Expression & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator-(const T1 & l,const Expression & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator*(const T1 & l,const Expression & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator%(const T1 & l,const Expression & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator&(const T1 & l,const Expression & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator|(const T1 & l,const Expression & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator^(const T1 & l,const Expression & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} -#ifdef PETE_ALLOW_SCALAR_SHIFT -#endif // PETE_ALLOW_SCALAR_SHIFT - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - where(const Expression & c,const T2 & t,const T3 & f) -{ - typedef TrinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(c), - CreateLeaf::make(t), - CreateLeaf::make(f))); -} -#endif // PETE_EXPRESSION_OPERATORS -// clang-format on - template inline Matrix &assign(Matrix &lhs, const RHS &rhs) { @@ -1005,146 +56,7 @@ inline Matrix &operator*=(Matrix &lhs, const RHS &rhs) return lhs; } -template -inline Matrix &operator%=(Matrix &lhs, const RHS &rhs) -{ - typedef typename CreateLeaf::Leaf_t Leaf_t; - evaluate(lhs, OpModAssign(), - MakeReturn::make(CreateLeaf::make(rhs))); - return lhs; -} - -template -inline Matrix &operator|=(Matrix &lhs, const RHS &rhs) -{ - typedef typename CreateLeaf::Leaf_t Leaf_t; - evaluate(lhs, OpBitwiseOrAssign(), - MakeReturn::make(CreateLeaf::make(rhs))); - return lhs; -} - -template -inline Matrix &operator&=(Matrix &lhs, const RHS &rhs) -{ - typedef typename CreateLeaf::Leaf_t Leaf_t; - evaluate(lhs, OpBitwiseAndAssign(), - MakeReturn::make(CreateLeaf::make(rhs))); - return lhs; -} - -template -inline Matrix &operator^=(Matrix &lhs, const RHS &rhs) -{ - typedef typename CreateLeaf::Leaf_t Leaf_t; - evaluate(lhs, OpBitwiseXorAssign(), - MakeReturn::make(CreateLeaf::make(rhs))); - return lhs; -} } #endif // OHMMS_MATRIXOPERATOR_H -/* -MatrixDefs.in -classes ------ - ARG = "class T[n], class C[n]" - CLASS = "Matrix" - - -unaryOps ------ - TAG = "OpUnaryMinus" - FUNCTION = "operator-" - EXPR = "return (-a);" ------ - TAG = "OpUnaryPlus" - FUNCTION = "operator+" - EXPR = "return (+a);" ------ - TAG = "OpBitwiseNot" - FUNCTION = "operator~" - EXPR = "return (~a);" ------ - TAG = "OpIdentity" - FUNCTION = "PETE_identity" - EXPR = "return (a);" - -unaryCastOps ------ - TAG = "OpCast" - FUNCTION = "peteCast" - EXPR = "return T1(a);" - -binaryOps ------ - TAG = "OpAdd" - FUNCTION = "operator+" - EXPR = "return (a + b);" ------ - TAG = "OpSubtract" - FUNCTION = "operator-" - EXPR = "return (a - b);" ------ - TAG = "OpMultiply" - FUNCTION = "operator*" - EXPR = "return (a * b);" ------ - TAG = "OpMod" - FUNCTION = "operator%" - EXPR = "return (a % b);" ------ - TAG = "OpBitwiseAnd" - FUNCTION = "operator&" - EXPR = "return (a & b);" ------ - TAG = "OpBitwiseOr" - FUNCTION = "operator|" - EXPR = "return (a | b);" ------ - TAG = "OpBitwiseXor" - FUNCTION = "operator^" - EXPR = "return (a ^ b);" - -assignOp ------ - TAG = "OpAssign" - FUNCTION = "assign" - EXPR = "return (const_cast(a) = b);" - -binaryAssignOps ------ - TAG = "OpAddAssign" - FUNCTION = "operator+=" - EXPR = "(const_cast(a) += b); return const_cast(a);" ------ - TAG = "OpSubtractAssign" - FUNCTION = "operator-=" - EXPR = "(const_cast(a) -= b); return const_cast(a);" ------ - TAG = "OpMultiplyAssign" - FUNCTION = "operator*=" - EXPR = "(const_cast(a) *= b); return const_cast(a);" ------ - TAG = "OpModAssign" - FUNCTION = "operator%=" - EXPR = "(const_cast(a) %= b); return const_cast(a);" ------ - TAG = "OpBitwiseOrAssign" - FUNCTION = "operator|=" - EXPR = "(const_cast(a) |= b); return const_cast(a);" ------ - TAG = "OpBitwiseAndAssign" - FUNCTION = "operator&=" - EXPR = "(const_cast(a) &= b); return const_cast(a);" ------ - TAG = "OpBitwiseXorAssign" - FUNCTION = "operator^=" - EXPR = "(const_cast(a) ^= b); return const_cast(a);" - -trinaryOps ------ - TAG = "FnWhere" - FUNCTION = "where" - EXPR = "if (a) return b; else return c;" -*/ diff --git a/src/Numerics/OhmmsPETE/OhmmsTinyMeta.h b/src/Numerics/OhmmsPETE/OhmmsTinyMeta.h index 7b2be2d26..fe5f19e40 100644 --- a/src/Numerics/OhmmsPETE/OhmmsTinyMeta.h +++ b/src/Numerics/OhmmsPETE/OhmmsTinyMeta.h @@ -43,14 +43,13 @@ template struct OTDot {}; //////////////////////////////////////////////////////////////////////////////// // TinyVectorOps.h assignment/unary and binary operators for TinyVector -// TensorOps.h assignment/unary and binary operators for Tensors TinyVectorTensorOps.h binary operators for TinyVector and Tensor combinations -// TinyMatrixOps.h assignment/unary and binary operators for TinyMatrix +// TensorOps.h assignment/unary and binary operators for Tensors +// TinyVectorTensorOps.h binary operators for TinyVector and Tensor combinations //////////////////////////////////////////////////////////////////////////////// #define PAssert #include "Numerics/OhmmsPETE/TinyVectorOps.h" #include "Numerics/OhmmsPETE/TensorOps.h" #include "Numerics/OhmmsPETE/TinyVectorTensorOps.h" -#include "Numerics/OhmmsPETE/TinyMatrixOps.h" // macros to generate a set of binary and unary combintions for each operator // e.g., OHMMS_META_BINARY_OPERATORS(TinyVector,operator+,OpAdd) @@ -103,7 +102,7 @@ FUNC( const T1& x, const TENT& v2) \ { \ return OTBinary,TAG>::apply(x,v2,TAG()); \ } \ - + #define OHMMS_META_ACCUM_OPERATORS(TENT,FUNC,TAG) \ \ template \ @@ -121,7 +120,7 @@ FUNC( TENT& v1, const T2& v2 ) \ OTAssign,T2,TAG>::apply(v1,v2,TAG()); \ return v1; \ } \ - + #define OHMMS_TINYMAT_BINARY_OPERATORS(TENT,FUNC,TAG) \ \ template \ @@ -165,7 +164,7 @@ FUNC( const T1& x, const TENT& v2) \ { \ return OTBinary,TAG>::apply(x,v2,TAG()); \ } \ - + #define OHMMS_TINYMAT_ACCUM_OPERATORS(TENT,FUNC,TAG) \ \ template \ diff --git a/src/Numerics/OhmmsPETE/OhmmsVectorOperators.h b/src/Numerics/OhmmsPETE/OhmmsVectorOperators.h index 12fe9e3fa..eb616e240 100644 --- a/src/Numerics/OhmmsPETE/OhmmsVectorOperators.h +++ b/src/Numerics/OhmmsPETE/OhmmsVectorOperators.h @@ -19,3009 +19,6 @@ namespace qmcplusplus { -// clang-format off -/////////////////////////////////////////////////////////////////////////////// -// -// WARNING: THIS FILE WAS GENERATED AUTOMATICALLY! -// YOU SHOULD MODIFY THE INPUT FILES INSTEAD OF CHANGING THIS FILE DIRECTLY! -// -// THE FOLLOWING INPUT FILES WERE USED TO MAKE THIS FILE: -// -// MakeOperators -// VectorDefs.in -// -/////////////////////////////////////////////////////////////////////////////// - - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - acos(const Vector & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - asin(const Vector & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - atan(const Vector & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - ceil(const Vector & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - cos(const Vector & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - cosh(const Vector & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - exp(const Vector & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - abs(const Vector & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - floor(const Vector & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - log(const Vector & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - log10(const Vector & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - sin(const Vector & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - sinh(const Vector & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - sqrt(const Vector & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - tan(const Vector & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - tanh(const Vector & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - operator-(const Vector & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - operator+(const Vector & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - operator~(const Vector & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - PETE_identity(const Vector & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - operator!(const Vector & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn, - typename CreateLeaf >::Leaf_t> >::Expression_t - peteCast(const T1&, const Vector & l) -{ - typedef UnaryNode, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator+(const Vector & l,const Vector & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator-(const Vector & l,const Vector & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator*(const Vector & l,const Vector & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator/(const Vector & l,const Vector & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator%(const Vector & l,const Vector & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator&(const Vector & l,const Vector & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator|(const Vector & l,const Vector & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator^(const Vector & l,const Vector & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - ldexp(const Vector & l,const Vector & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - pow(const Vector & l,const Vector & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - fmod(const Vector & l,const Vector & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - atan2(const Vector & l,const Vector & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator<(const Vector & l,const Vector & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator<=(const Vector & l,const Vector & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator>(const Vector & l,const Vector & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator>=(const Vector & l,const Vector & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator==(const Vector & l,const Vector & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator!=(const Vector & l,const Vector & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator&&(const Vector & l,const Vector & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator||(const Vector & l,const Vector & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator<<(const Vector & l,const Vector & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator>>(const Vector & l,const Vector & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator+(const Vector & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator-(const Vector & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator*(const Vector & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator/(const Vector & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator%(const Vector & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator&(const Vector & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator|(const Vector & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator^(const Vector & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - ldexp(const Vector & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - pow(const Vector & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - fmod(const Vector & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - atan2(const Vector & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator<(const Vector & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator<=(const Vector & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator>(const Vector & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator>=(const Vector & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator==(const Vector & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator!=(const Vector & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator&&(const Vector & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator||(const Vector & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator<<(const Vector & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator>>(const Vector & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator+(const Expression & l,const Vector & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator-(const Expression & l,const Vector & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator*(const Expression & l,const Vector & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator/(const Expression & l,const Vector & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator%(const Expression & l,const Vector & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator&(const Expression & l,const Vector & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator|(const Expression & l,const Vector & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator^(const Expression & l,const Vector & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - ldexp(const Expression & l,const Vector & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - pow(const Expression & l,const Vector & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - fmod(const Expression & l,const Vector & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - atan2(const Expression & l,const Vector & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator<(const Expression & l,const Vector & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator<=(const Expression & l,const Vector & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator>(const Expression & l,const Vector & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator>=(const Expression & l,const Vector & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator==(const Expression & l,const Vector & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator!=(const Expression & l,const Vector & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator&&(const Expression & l,const Vector & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator||(const Expression & l,const Vector & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator<<(const Expression & l,const Vector & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator>>(const Expression & l,const Vector & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator+(const Vector & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator-(const Vector & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator*(const Vector & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator/(const Vector & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator%(const Vector & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator&(const Vector & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator|(const Vector & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator^(const Vector & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - ldexp(const Vector & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - pow(const Vector & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - fmod(const Vector & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - atan2(const Vector & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator<(const Vector & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator<=(const Vector & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator>(const Vector & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator>=(const Vector & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator==(const Vector & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator!=(const Vector & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator&&(const Vector & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator||(const Vector & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator<<(const Vector & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator>>(const Vector & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator+(const T1 & l,const Vector & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator-(const T1 & l,const Vector & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator*(const T1 & l,const Vector & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator/(const T1 & l,const Vector & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator%(const T1 & l,const Vector & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator&(const T1 & l,const Vector & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator|(const T1 & l,const Vector & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator^(const T1 & l,const Vector & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - ldexp(const T1 & l,const Vector & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - pow(const T1 & l,const Vector & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - fmod(const T1 & l,const Vector & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - atan2(const T1 & l,const Vector & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator<(const T1 & l,const Vector & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator<=(const T1 & l,const Vector & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator>(const T1 & l,const Vector & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator>=(const T1 & l,const Vector & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator==(const T1 & l,const Vector & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator!=(const T1 & l,const Vector & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator&&(const T1 & l,const Vector & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator||(const T1 & l,const Vector & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} -#ifdef PETE_ALLOW_SCALAR_SHIFT - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator<<(const T1 & l,const Vector & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator>>(const T1 & l,const Vector & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} -#endif // PETE_ALLOW_SCALAR_SHIFT - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - where(const Vector & c,const T2 & t,const T3 & f) -{ - typedef TrinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(c), - CreateLeaf::make(t), - CreateLeaf::make(f))); -} -#ifndef PETE_EXPRESSION_OPERATORS -#define PETE_EXPRESSION_OPERATORS - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - acos(const Expression & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - asin(const Expression & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - atan(const Expression & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - ceil(const Expression & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - cos(const Expression & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - cosh(const Expression & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - exp(const Expression & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - abs(const Expression & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - floor(const Expression & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - log(const Expression & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - log10(const Expression & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - sin(const Expression & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - sinh(const Expression & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - sqrt(const Expression & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - tan(const Expression & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - tanh(const Expression & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - operator-(const Expression & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - operator+(const Expression & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - operator~(const Expression & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - PETE_identity(const Expression & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t> >::Expression_t - operator!(const Expression & l) -{ - typedef UnaryNode >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn, - typename CreateLeaf >::Leaf_t> >::Expression_t - peteCast(const T1&, const Expression & l) -{ - typedef UnaryNode, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator+(const Expression & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator-(const Expression & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator*(const Expression & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator/(const Expression & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator%(const Expression & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator&(const Expression & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator|(const Expression & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator^(const Expression & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - ldexp(const Expression & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - pow(const Expression & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - fmod(const Expression & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - atan2(const Expression & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator<(const Expression & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator<=(const Expression & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator>(const Expression & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator>=(const Expression & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator==(const Expression & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator!=(const Expression & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator&&(const Expression & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator||(const Expression & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator<<(const Expression & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator>>(const Expression & l,const Expression & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator+(const Expression & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator-(const Expression & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator*(const Expression & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator/(const Expression & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator%(const Expression & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator&(const Expression & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator|(const Expression & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator^(const Expression & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - ldexp(const Expression & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - pow(const Expression & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - fmod(const Expression & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - atan2(const Expression & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator<(const Expression & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator<=(const Expression & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator>(const Expression & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator>=(const Expression & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator==(const Expression & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator!=(const Expression & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator&&(const Expression & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator||(const Expression & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator<<(const Expression & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - operator>>(const Expression & l,const T2 & r) -{ - typedef BinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(l), - CreateLeaf::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator+(const T1 & l,const Expression & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator-(const T1 & l,const Expression & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator*(const T1 & l,const Expression & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator/(const T1 & l,const Expression & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator%(const T1 & l,const Expression & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator&(const T1 & l,const Expression & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator|(const T1 & l,const Expression & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator^(const T1 & l,const Expression & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - ldexp(const T1 & l,const Expression & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - pow(const T1 & l,const Expression & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - fmod(const T1 & l,const Expression & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - atan2(const T1 & l,const Expression & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator<(const T1 & l,const Expression & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator<=(const T1 & l,const Expression & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator>(const T1 & l,const Expression & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator>=(const T1 & l,const Expression & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator==(const T1 & l,const Expression & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator!=(const T1 & l,const Expression & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator&&(const T1 & l,const Expression & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator||(const T1 & l,const Expression & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} -#ifdef PETE_ALLOW_SCALAR_SHIFT - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator<<(const T1 & l,const Expression & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} - -template -inline typename MakeReturn::Leaf_t, - typename CreateLeaf >::Leaf_t> >::Expression_t - operator>>(const T1 & l,const Expression & r) -{ - typedef BinaryNode::Leaf_t, - typename CreateLeaf >::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf::make(l), - CreateLeaf >::make(r))); -} -#endif // PETE_ALLOW_SCALAR_SHIFT - -template -inline typename MakeReturn >::Leaf_t, - typename CreateLeaf::Leaf_t, - typename CreateLeaf::Leaf_t> >::Expression_t - where(const Expression & c,const T2 & t,const T3 & f) -{ - typedef TrinaryNode >::Leaf_t, - typename CreateLeaf::Leaf_t, - typename CreateLeaf::Leaf_t> Tree_t; - return MakeReturn::make(Tree_t( - CreateLeaf >::make(c), - CreateLeaf::make(t), - CreateLeaf::make(f))); -} -#endif // PETE_EXPRESSION_OPERATORS - template inline Vector& assign(Vector& lhs,const RHS& rhs) @@ -3067,62 +64,7 @@ Vector& operator/=(Vector& lhs,const RHS& rhs) return lhs; } -template -inline -Vector& operator%=(Vector& lhs,const RHS& rhs) -{ - typedef typename CreateLeaf::Leaf_t Leaf_t; - evaluate(lhs,OpModAssign(),MakeReturn::make(CreateLeaf::make(rhs))); - return lhs; -} - -template -inline -Vector& operator|=(Vector& lhs,const RHS& rhs) -{ - typedef typename CreateLeaf::Leaf_t Leaf_t; - evaluate(lhs,OpBitwiseOrAssign(),MakeReturn::make(CreateLeaf::make(rhs))); - return lhs; -} - -template -inline -Vector& operator&=(Vector& lhs,const RHS& rhs) -{ - typedef typename CreateLeaf::Leaf_t Leaf_t; - evaluate(lhs,OpBitwiseAndAssign(),MakeReturn::make(CreateLeaf::make(rhs))); - return lhs; -} - -template -inline -Vector& operator^=(Vector& lhs,const RHS& rhs) -{ - typedef typename CreateLeaf::Leaf_t Leaf_t; - evaluate(lhs,OpBitwiseXorAssign(),MakeReturn::make(CreateLeaf::make(rhs))); - return lhs; -} - -template -inline -Vector& operator<<=(Vector& lhs,const RHS& rhs) -{ - typedef typename CreateLeaf::Leaf_t Leaf_t; - evaluate(lhs,OpLeftShiftAssign(),MakeReturn::make(CreateLeaf::make(rhs))); - return lhs; -} - -template -inline -Vector& operator>>=(Vector& lhs,const RHS& rhs) -{ - typedef typename CreateLeaf::Leaf_t Leaf_t; - evaluate(lhs,OpRightShiftAssign(),MakeReturn::make(CreateLeaf::make(rhs))); - return lhs; -} - } -// clang-format on #endif // GENERATED_OPERATORS_H diff --git a/src/Numerics/OhmmsPETE/TensorOps.h b/src/Numerics/OhmmsPETE/TensorOps.h index 086c0f78e..55d7a54ef 100644 --- a/src/Numerics/OhmmsPETE/TensorOps.h +++ b/src/Numerics/OhmmsPETE/TensorOps.h @@ -39,96 +39,6 @@ struct OTAssign, T2, OP> } }; -////////////////////////////////////////////////////////////////////// -// -// Specializations for Tensors with D=1. -// -////////////////////////////////////////////////////////////////////// - -template -struct OTAssign, Tensor, OP> -{ - inline static void apply(Tensor &lhs, const Tensor &rhs, OP op) - { - op(lhs[0], rhs[0]); - } -}; - -template struct OTAssign, T2, OP> -{ - inline static void apply(Tensor &lhs, T2 rhs, OP op) - { - op(lhs[0], rhs); - } -}; - -////////////////////////////////////////////////////////////////////// -// -// Specializations for Tensors with D=2. -// -////////////////////////////////////////////////////////////////////// - -template -struct OTAssign, Tensor, OP> -{ - inline static void apply(Tensor &lhs, const Tensor &rhs, OP op) - { - op(lhs[0], rhs[0]); - op(lhs[1], rhs[1]); - op(lhs[2], rhs[2]); - op(lhs[3], rhs[3]); - } -}; - -template struct OTAssign, T2, OP> -{ - inline static void apply(Tensor &lhs, T2 rhs, OP op) - { - op(lhs[0], rhs); - op(lhs[1], rhs); - op(lhs[2], rhs); - op(lhs[3], rhs); - } -}; - -////////////////////////////////////////////////////////////////////// -// -// Specializations for Tensors with D=3. -// -////////////////////////////////////////////////////////////////////// - -template -struct OTAssign, Tensor, OP> -{ - inline static void apply(Tensor &lhs, const Tensor &rhs, OP op) - { - op(lhs[0], rhs[0]); - op(lhs[1], rhs[1]); - op(lhs[2], rhs[2]); - op(lhs[3], rhs[3]); - op(lhs[4], rhs[4]); - op(lhs[5], rhs[5]); - op(lhs[6], rhs[6]); - op(lhs[7], rhs[7]); - op(lhs[8], rhs[8]); - } -}; - -template struct OTAssign, T2, OP> -{ - inline static void apply(Tensor &lhs, T2 rhs, OP op) - { - op(lhs[0], rhs); - op(lhs[1], rhs); - op(lhs[2], rhs); - op(lhs[3], rhs); - op(lhs[4], rhs); - op(lhs[5], rhs); - op(lhs[6], rhs); - op(lhs[7], rhs); - op(lhs[8], rhs); - } -}; ////////////////////////////////////////////////////////////////////// // @@ -173,121 +83,6 @@ struct OTBinary, OP> } }; -////////////////////////////////////////////////////////////////////// -// -// Specializations of OTBinary for Tensors with D=1. -// -////////////////////////////////////////////////////////////////////// - -template -struct OTBinary, Tensor, OP> -{ - typedef typename BinaryReturn::Type_t Type_t; - inline static Tensor apply(const Tensor &lhs, - const Tensor &rhs, OP op) - { - return Tensor(op(lhs[0], rhs[0])); - } -}; - -template struct OTBinary, T2, OP> -{ - typedef typename BinaryReturn::Type_t Type_t; - inline static Tensor apply(const Tensor &lhs, T2 rhs, OP op) - { - return Tensor(op(lhs[0], rhs)); - } -}; - -template struct OTBinary, OP> -{ - typedef typename BinaryReturn::Type_t Type_t; - inline static Tensor apply(T1 lhs, const Tensor &rhs, OP op) - { - return Tensor(op(lhs, rhs[0])); - } -}; - -////////////////////////////////////////////////////////////////////// -// -// Specializations of OTBinary for Tensors with D=2. -// -////////////////////////////////////////////////////////////////////// - -template -struct OTBinary, Tensor, OP> -{ - typedef typename BinaryReturn::Type_t Type_t; - inline static Tensor apply(const Tensor &lhs, - const Tensor &rhs, OP op) - { - return Tensor(op(lhs[0], rhs[0]), op(lhs[1], rhs[1]), - op(lhs[2], rhs[2]), op(lhs[3], rhs[3])); - } -}; - -template struct OTBinary, T2, OP> -{ - typedef typename BinaryReturn::Type_t Type_t; - inline static Tensor apply(const Tensor &lhs, T2 rhs, OP op) - { - return Tensor(op(lhs[0], rhs), op(lhs[1], rhs), op(lhs[2], rhs), - op(lhs[3], rhs)); - } -}; - -template struct OTBinary, OP> -{ - typedef typename BinaryReturn::Type_t Type_t; - inline static Tensor apply(T1 lhs, const Tensor &rhs, OP op) - { - return Tensor(op(lhs, rhs[0]), op(lhs, rhs[1]), op(lhs, rhs[2]), - op(lhs, rhs[3])); - } -}; - -////////////////////////////////////////////////////////////////////// -// -// Specializations of OTBinary for Tensors with D=3. -// -////////////////////////////////////////////////////////////////////// - -template -struct OTBinary, Tensor, OP> -{ - typedef typename BinaryReturn::Type_t Type_t; - inline static Tensor apply(const Tensor &lhs, - const Tensor &rhs, OP op) - { - return Tensor( - op(lhs[0], rhs[0]), op(lhs[1], rhs[1]), op(lhs[2], rhs[2]), - op(lhs[3], rhs[3]), op(lhs[4], rhs[4]), op(lhs[5], rhs[5]), - op(lhs[6], rhs[6]), op(lhs[7], rhs[7]), op(lhs[8], rhs[8])); - } -}; - -template struct OTBinary, T2, OP> -{ - typedef typename BinaryReturn::Type_t Type_t; - inline static Tensor apply(const Tensor &lhs, T2 rhs, OP op) - { - return Tensor(op(lhs[0], rhs), op(lhs[1], rhs), op(lhs[2], rhs), - op(lhs[3], rhs), op(lhs[4], rhs), op(lhs[5], rhs), - op(lhs[6], rhs), op(lhs[7], rhs), op(lhs[8], rhs)); - } -}; - -template struct OTBinary, OP> -{ - typedef typename BinaryReturn::Type_t Type_t; - inline static Tensor apply(T1 lhs, const Tensor &rhs, OP op) - { - return Tensor(op(lhs, rhs[0]), op(lhs, rhs[1]), op(lhs, rhs[2]), - op(lhs, rhs[3]), op(lhs, rhs[4]), op(lhs, rhs[5]), - op(lhs, rhs[6]), op(lhs, rhs[7]), op(lhs, rhs[8])); - } -}; - ////////////////////////////////////////////////////// // // determinant: generalized diff --git a/src/Numerics/OhmmsPETE/TinyMatrixOps.h b/src/Numerics/OhmmsPETE/TinyMatrixOps.h deleted file mode 100644 index 2fd8d05b7..000000000 --- a/src/Numerics/OhmmsPETE/TinyMatrixOps.h +++ /dev/null @@ -1,849 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// This file is distributed under the University of Illinois/NCSA Open Source -// License. See LICENSE file in top directory for details. -// -// Copyright (c) 2016 Jeongnim Kim and QMCPACK developers. -// -// File developed by: -// Jeremy McMinnis, jmcminis@gmail.com, -// University of Illinois at Urbana-Champaign -// -// File created by: -// Jeongnim Kim, jeongnim.kim@gmail.com, -// University of Illinois at Urbana-Champaign -//////////////////////////////////////////////////////////////////////////////// - -#ifndef OHMMS_TINYMATRIX_OPERATORS_H -#define OHMMS_TINYMATRIX_OPERATORS_H - -namespace qmcplusplus -{ - -/////////////////////////////////////////////////////////////////////// -// specialized assignment and element-by-element binary functors for tinymatrix -// -// Generic Assignment operators (defined in OhmmsTinyMeta.h) -// template struct OTAssign {}; -// -// Generic Binary operators (defined in OhmmsTinyMeta.h) -// template struct OTBinary {}; -// -/////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////// -// Specializations for TinyMatrixs of arbitrary size. -////////////////////////////////////////////////////////////////////// -template -struct OTAssign< TinyMatrix , TinyMatrix , OP > -{ - inline static void - apply( TinyMatrix& lhs, const TinyMatrix& rhs, OP op) - { - for (unsigned d=0; d -struct OTAssign< TinyMatrix , T2 , OP > -{ - inline static void - apply( TinyMatrix& lhs, const T2& rhs, OP op ) - { - for (unsigned d=0; d -struct OTAssign< TinyMatrix , TinyMatrix , OP > -{ - inline static void - apply( TinyMatrix& lhs, const TinyMatrix& rhs, OP op) - { - op(lhs[0] , rhs[0] ); - } -}; - -template -struct OTAssign< TinyMatrix , T2 , OP > -{ - inline static void - apply( TinyMatrix& lhs, const T2& rhs, OP op ) - { - op(lhs[0] , rhs ); - } -}; - -////////////////////////////////////////////////////////////////////// -// Specializations for TinyMatrixs with D=1x2 and 2x1 -////////////////////////////////////////////////////////////////////// - -template -struct OTAssign< TinyMatrix , TinyMatrix , OP > -{ - inline static void - apply( TinyMatrix& lhs, const TinyMatrix& rhs, OP op) - { - op(lhs[0] , rhs[0] ); - op(lhs[1] , rhs[1] ); - } -}; - -template -struct OTAssign< TinyMatrix , T2 , OP > -{ - inline static void - apply( TinyMatrix& lhs, const T2& rhs, OP op ) - { - op(lhs[0] , rhs); - op(lhs[1] , rhs); - } -}; - -template -struct OTAssign< TinyMatrix , TinyMatrix , OP > -{ - inline static void - apply( TinyMatrix& lhs, const TinyMatrix& rhs, OP op) - { - op(lhs[0] , rhs[0] ); - op(lhs[1] , rhs[1] ); - } -}; - -template -struct OTAssign< TinyMatrix , T2 , OP > -{ - inline static void - apply( TinyMatrix& lhs, const T2& rhs, OP op ) - { - op(lhs[0] , rhs); - op(lhs[1] , rhs); - } -}; -////////////////////////////////////////////////////////////////////// -// Specializations for TinyMatrixs with D=3x1 1x3 -////////////////////////////////////////////////////////////////////// - -template -struct OTAssign< TinyMatrix , TinyMatrix , OP > -{ - inline static void - apply( TinyMatrix& lhs, const TinyMatrix& rhs, OP op) - { - op(lhs[0] , rhs[0] ); - op(lhs[1] , rhs[1] ); - op(lhs[2] , rhs[2] ); - } -}; - -template -struct OTAssign< TinyMatrix , T2 , OP > -{ - inline static void - apply( TinyMatrix& lhs, const T2& rhs, OP op ) - { - op(lhs[0] , rhs ); - op(lhs[1] , rhs ); - op(lhs[2] , rhs ); - } -}; - -template -struct OTAssign< TinyMatrix , TinyMatrix , OP > -{ - inline static void - apply( TinyMatrix& lhs, const TinyMatrix& rhs, OP op) - { - op(lhs[0] , rhs[0] ); - op(lhs[1] , rhs[1] ); - op(lhs[2] , rhs[2] ); - } -}; - -template -struct OTAssign< TinyMatrix , T2 , OP > -{ - inline static void - apply( TinyMatrix& lhs, const T2& rhs, OP op ) - { - op(lhs[0] , rhs ); - op(lhs[1] , rhs ); - op(lhs[2] , rhs ); - } -}; -////////////////////////////////////////////////////////////////////// -// Specializations for TinyMatrix with D=2x2 -////////////////////////////////////////////////////////////////////// - -template -struct OTAssign< TinyMatrix , TinyMatrix , OP > -{ - inline static void - apply( TinyMatrix& lhs, const TinyMatrix& rhs, OP op) - { - op(lhs[0] , rhs[0] ); - op(lhs[1] , rhs[1] ); - op(lhs[2] , rhs[2] ); - op(lhs[3] , rhs[3] ); - } -}; - -template -struct OTAssign< TinyMatrix , T2 , OP > -{ - inline static void - apply( TinyMatrix& lhs, const T2& rhs, OP op ) - { - op(lhs[0] , rhs ); - op(lhs[1] , rhs ); - op(lhs[2] , rhs ); - op(lhs[3] , rhs ); - } -}; - -////////////////////////////////////////////////////////////////////// -// Specializations for TinyMatrix with D=3x3 -////////////////////////////////////////////////////////////////////// - -template -struct OTAssign< TinyMatrix , TinyMatrix , OP > -{ - inline static void - apply( TinyMatrix& lhs, const TinyMatrix& rhs, OP op) - { - op(lhs[0] , rhs[0] ); - op(lhs[1] , rhs[1] ); - op(lhs[2] , rhs[2] ); - op(lhs[3] , rhs[3] ); - op(lhs[4] , rhs[4] ); - op(lhs[5] , rhs[5] ); - op(lhs[6] , rhs[6] ); - op(lhs[7] , rhs[7] ); - op(lhs[8] , rhs[8] ); - } -}; - -template -struct OTAssign< TinyMatrix , T2 , OP > -{ - inline static void - apply( TinyMatrix& lhs, const T2& rhs, OP op ) - { - op(lhs[0] , rhs ); - op(lhs[1] , rhs ); - op(lhs[2] , rhs ); - op(lhs[3] , rhs ); - op(lhs[4] , rhs ); - op(lhs[5] , rhs ); - op(lhs[6] , rhs ); - op(lhs[7] , rhs ); - op(lhs[8] , rhs ); - } -}; - -////////////////////////////////////////////////////////////////////// -// Specializations for TinyMatrix with D=4x4 -////////////////////////////////////////////////////////////////////// - -template -struct OTAssign< TinyMatrix , TinyMatrix , OP > -{ - inline static void - apply( TinyMatrix& lhs, const TinyMatrix& rhs, OP op) - { - op(lhs[ 0] , rhs[ 0] ); - op(lhs[ 1] , rhs[ 1] ); - op(lhs[ 2] , rhs[ 2] ); - op(lhs[ 3] , rhs[ 3] ); - op(lhs[ 4] , rhs[ 4] ); - op(lhs[ 5] , rhs[ 5] ); - op(lhs[ 6] , rhs[ 6] ); - op(lhs[ 7] , rhs[ 7] ); - op(lhs[ 8] , rhs[ 8] ); - op(lhs[ 9] , rhs[ 9] ); - op(lhs[10] , rhs[10] ); - op(lhs[11] , rhs[11] ); - op(lhs[12] , rhs[12] ); - op(lhs[13] , rhs[13] ); - op(lhs[14] , rhs[14] ); - op(lhs[15] , rhs[15] ); - } -}; - -template -struct OTAssign< TinyMatrix , T2 , OP > -{ - inline static void - apply( TinyMatrix& lhs, const T2& rhs, OP op ) - { - op(lhs[ 0] , rhs ); - op(lhs[ 1] , rhs ); - op(lhs[ 2] , rhs ); - op(lhs[ 3] , rhs ); - op(lhs[ 4] , rhs ); - op(lhs[ 5] , rhs ); - op(lhs[ 6] , rhs ); - op(lhs[ 7] , rhs ); - op(lhs[ 8] , rhs ); - op(lhs[ 9] , rhs ); - op(lhs[10] , rhs ); - op(lhs[11] , rhs ); - op(lhs[12] , rhs ); - op(lhs[13] , rhs ); - op(lhs[14] , rhs ); - op(lhs[15] , rhs ); - } -}; - -/////////////////////////////////////////////////////////////////////// -// -// Binary operators -// template struct OTBinary {}; -// -/////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////// -// Specializations for TinyMatrixs of arbitrary size. -////////////////////////////////////////////////////////////////////// - -template -struct OTBinary< TinyMatrix , TinyMatrix , OP > -{ - typedef typename BinaryReturn::Type_t Type_t; - inline static TinyMatrix - apply(const TinyMatrix& lhs, const TinyMatrix& rhs, OP op) - { - TinyMatrix ret; - for (unsigned d=0; d -struct OTBinary< TinyMatrix , T2 , OP > -{ - typedef typename BinaryReturn::Type_t Type_t; - inline static TinyMatrix - apply(const TinyMatrix& lhs, const T2& rhs, OP op) - { - TinyMatrix ret; - for (unsigned d=0 ; d -struct OTBinary< T1, TinyMatrix , OP > -{ - typedef typename BinaryReturn::Type_t Type_t; - inline static TinyMatrix - apply(const T1& lhs, const TinyMatrix& rhs, OP op) - { - TinyMatrix ret; - for (unsigned d=0; d -struct OTBinary< TinyMatrix , TinyMatrix , OP > -{ - typedef typename BinaryReturn::Type_t Type_t; - inline static TinyMatrix - apply(const TinyMatrix& lhs, const TinyMatrix& rhs, OP op) - { - return TinyMatrix( op(lhs[0], rhs[0] ) ); - } -}; - -template -struct OTBinary< TinyMatrix , T2 , OP > -{ - typedef typename BinaryReturn::Type_t Type_t; - inline static TinyMatrix - apply(const TinyMatrix& lhs, const T2& rhs, OP op) - { - return TinyMatrix( op(lhs[0], rhs ) ); - } -}; - -template -struct OTBinary< T1, TinyMatrix , OP > -{ - typedef typename BinaryReturn::Type_t Type_t; - inline static TinyMatrix - apply(const T1& lhs, const TinyMatrix& rhs, OP op) - { - return TinyMatrix( op(lhs, rhs[0] ) ); - } -}; - -////////////////////////////////////////////////////////////////////// -// Specializations of OTBinary for TinyMatrixs with 1 x 2 -////////////////////////////////////////////////////////////////////// - -template -struct OTBinary< TinyMatrix , TinyMatrix , OP > -{ - typedef typename BinaryReturn::Type_t Type_t; - inline static TinyMatrix - apply(const TinyMatrix& lhs, const TinyMatrix& rhs, OP op) - { - return TinyMatrix( op(lhs[0], rhs[0]),op(lhs[1], rhs[1] ) ); - } -}; - -template -struct OTBinary< TinyMatrix , T2 , OP > -{ - typedef typename BinaryReturn::Type_t Type_t; - inline static TinyMatrix - apply(const TinyMatrix& lhs, const T2& rhs, OP op) - { - return TinyMatrix( op(lhs[0], rhs ) ,op(lhs[1], rhs)); - } -}; - -template -struct OTBinary< T1, TinyMatrix , OP > -{ - typedef typename BinaryReturn::Type_t Type_t; - inline static TinyMatrix - apply(const T1& lhs, const TinyMatrix& rhs, OP op) - { - return TinyMatrix( op(lhs, rhs[0] ) ,op(lhs, rhs[1] ) ); - } -}; - -////////////////////////////////////////////////////////////////////// -// Specializations for TinyMatrixs with D=3x1 1x3 -////////////////////////////////////////////////////////////////////// -template -struct OTBinary< TinyMatrix , TinyMatrix , OP > -{ - typedef typename BinaryReturn::Type_t Type_t; - inline static TinyMatrix - apply(const TinyMatrix& lhs, const TinyMatrix& rhs, OP op) - { - return TinyMatrix( op(lhs[0], rhs[0]), - op(lhs[1], rhs[1]), - op(lhs[2], rhs[2]) ); - } -}; - -template -struct OTBinary< TinyMatrix , T2 , OP > -{ - typedef typename BinaryReturn::Type_t Type_t; - inline static TinyMatrix - apply(const TinyMatrix& lhs, const T2& rhs, OP op) - { - return TinyMatrix( op(lhs[0], rhs), - op(lhs[1], rhs), - op(lhs[2], rhs)); - } -}; - -template -struct OTBinary< T1, TinyMatrix , OP > -{ - typedef typename BinaryReturn::Type_t Type_t; - inline static TinyMatrix - apply(const T1& lhs, const TinyMatrix& rhs, OP op) - { - return TinyMatrix( op(lhs, rhs[0]), - op(lhs, rhs[1]), - op(lhs, rhs[2])); - } -}; - -////////////////////////////////////////////////////////////////////// -// Specializations of OTBinary for TinyMatrixs with D=2x2 -////////////////////////////////////////////////////////////////////// - -template -struct OTBinary< TinyMatrix , TinyMatrix , OP > -{ - typedef typename BinaryReturn::Type_t Type_t; - inline static TinyMatrix - apply(const TinyMatrix& lhs, const TinyMatrix& rhs, OP op) - { - return TinyMatrix( op(lhs[0], rhs[0] ) , - op(lhs[1], rhs[1] ) , - op(lhs[2], rhs[2] ) , - op(lhs[3], rhs[3] ) ); - } -}; - -template -struct OTBinary< TinyMatrix , T2 , OP > -{ - typedef typename BinaryReturn::Type_t Type_t; - inline static TinyMatrix - apply(const TinyMatrix& lhs, const T2& rhs, OP op) - { - return TinyMatrix( op(lhs[0], rhs ) , - op(lhs[1], rhs ) , - op(lhs[2], rhs ) , - op(lhs[3], rhs ) ); - } -}; - -template -struct OTBinary< T1, TinyMatrix , OP > -{ - typedef typename BinaryReturn::Type_t Type_t; - inline static TinyMatrix - apply(const T1& lhs, const TinyMatrix& rhs, OP op) - { - return TinyMatrix( op( lhs, rhs[0] ) , - op( lhs, rhs[1] ) , - op( lhs, rhs[2] ) , - op( lhs, rhs[3] ) ); - } -}; - -/////////////////////////////////////////////////////////////// -// Specialization for 3x3 -/////////////////////////////////////////////////////////////// -template -struct OTBinary< TinyMatrix , TinyMatrix, OP > -{ - typedef typename BinaryReturn::Type_t Type_t; - typedef TinyMatrix Return_t; - inline static Return_t - apply(const TinyMatrix& lhs, const TinyMatrix& rhs, OP op) - { - return Return_t(op(lhs[0],rhs[0]), op(lhs[1],rhs[1]), op(lhs[2],rhs[2]), - op(lhs[3],rhs[3]), op(lhs[4],rhs[4]), op(lhs[5],rhs[5]), - op(lhs[6],rhs[6]), op(lhs[7],rhs[7]), op(lhs[8],rhs[8])); - } -}; - -template -struct OTBinary< TinyMatrix , T2, OP > -{ - typedef typename BinaryReturn::Type_t Type_t; - typedef TinyMatrix Return_t; - inline static Return_t - apply(const TinyMatrix& lhs, T2 rhs, OP op) - { - return Return_t(op(lhs[0],rhs), op(lhs[1],rhs), op(lhs[2],rhs), - op(lhs[3],rhs), op(lhs[4],rhs), op(lhs[5],rhs), - op(lhs[6],rhs), op(lhs[7],rhs), op(lhs[8],rhs)); - } -}; - -template -struct OTBinary< T1, TinyMatrix, OP > -{ - typedef typename BinaryReturn::Type_t Type_t; - typedef TinyMatrix Return_t; - inline static Return_t - apply(T1 lhs, const TinyMatrix& rhs, OP op) - { - return Return_t(op(lhs,rhs[0]), op(lhs,rhs[1]), op(lhs,rhs[2]), - op(lhs,rhs[3]), op(lhs,rhs[4]), op(lhs,rhs[5]), - op(lhs,rhs[6]), op(lhs,rhs[7]), op(lhs,rhs[8])); - } -}; - -/////////////////////////////////////////////////////////////// -// Specialization for 4x4 -/////////////////////////////////////////////////////////////// -template -struct OTBinary< TinyMatrix , TinyMatrix, OP > -{ - typedef typename BinaryReturn::Type_t Type_t; - typedef TinyMatrix Return_t; - inline static Return_t - apply(const TinyMatrix& lhs, const TinyMatrix& rhs, OP op) - { - // clang-format off - return Return_t(op(lhs[ 0],rhs[ 0]), op(lhs[ 1],rhs[ 1]), op(lhs[ 2],rhs[ 2]), - op(lhs[ 3],rhs[ 3]), op(lhs[ 4],rhs[ 4]), op(lhs[ 5],rhs[ 5]), - op(lhs[ 6],rhs[ 6]), op(lhs[ 7],rhs[ 7]), op(lhs[ 8],rhs[ 8]), - op(lhs[ 9],rhs[ 9]), op(lhs[10],rhs[10]), op(lhs[11],rhs[11]), - op(lhs[12],rhs[12]), op(lhs[13],rhs[13]), op(lhs[14],rhs[14]), - op(lhs[15],rhs[15])); - // clang-format on - } -}; - -template -struct OTBinary< TinyMatrix , T2, OP > -{ - typedef typename BinaryReturn::Type_t Type_t; - typedef TinyMatrix Return_t; - inline static Return_t - apply(const TinyMatrix& lhs, T2 rhs, OP op) - { - return Return_t(op(lhs[ 0],rhs), op(lhs[ 1],rhs), op(lhs[ 2],rhs), - op(lhs[ 3],rhs), op(lhs[ 4],rhs), op(lhs[ 5],rhs), - op(lhs[ 6],rhs), op(lhs[ 7],rhs), op(lhs[ 8],rhs), - op(lhs[ 9],rhs), op(lhs[10],rhs), op(lhs[11],rhs), - op(lhs[12],rhs), op(lhs[13],rhs), op(lhs[14],rhs), - op(lhs[15],rhs)); - } -}; - -template -struct OTBinary< T1, TinyMatrix, OP > -{ - typedef typename BinaryReturn::Type_t Type_t; - typedef TinyMatrix Return_t; - inline static Return_t - apply(T1 lhs, const TinyMatrix& rhs, OP op) - { - return Return_t(op(lhs,rhs[ 0]), op(lhs,rhs[ 1]), op(lhs,rhs[ 2]), - op(lhs,rhs[ 3]), op(lhs,rhs[ 4]), op(lhs,rhs[ 5]), - op(lhs,rhs[ 6]), op(lhs,rhs[ 7]), op(lhs,rhs[ 8]), - op(lhs,rhs[ 9]), op(lhs,rhs[10]), op(lhs,rhs[11]), - op(lhs,rhs[12]), op(lhs,rhs[13]), op(lhs,rhs[14]), - op(lhs,rhs[15])); - } -}; - -////////////////////////////////////////////////////////////////////// -// -// ! = Transpose of matrix(D1,D2) to matrix(D2,D1) -// -////////////////////////////////////////////////////////////////////// -template -inline TinyMatrix -operator!(const TinyMatrix& a ) -{ - TinyMatrix res; - for(int i=0; i -inline TinyMatrix -operator!(const TinyMatrix& a ) -{ - return TinyMatrix(a(0,0),a(1,0),a(2,0), - a(0,1),a(1,1),a(2,1), - a(0,2),a(1,2),a(2,2)); -} - -////////////////////////////////////////////////////////////////////// -// ! specialization for 4x4 -////////////////////////////////////////////////////////////////////// -template -inline TinyMatrix -operator!(const TinyMatrix& a ) -{ - return TinyMatrix(a(0,0),a(1,0),a(2,0),a(3,0), - a(0,1),a(1,1),a(2,1),a(3,1), - a(0,2),a(1,2),a(2,2),a(3,2), - a(0,3),a(1,3),a(2,3),a(3,3)); -} - -////////////////////////////////////////////////////////////////////// -// -// template struct OTDot {}; -// Specializations for TinyMatrix x TinyMatrix matrix multiplication -// Matrix(D1,D2)* Matrix(D2,D3) = Matrix(D1,D3) -// -////////////////////////////////////////////////////////////////////// -template -struct OTDot< TinyMatrix , TinyMatrix > -{ - typedef typename BinaryReturn::Type_t Type_t; - typedef TinyMatrix Return_t; - inline static Return_t - apply(const TinyMatrix& lhs, const TinyMatrix& rhs) - { - Return_t res; - for(int i=0; i -struct OTDot< TinyMatrix , TinyMatrix > -{ - typedef typename BinaryReturn::Type_t Type_t; - typedef TinyMatrix Return_t; - inline static Return_t - apply(const TinyMatrix& lhs, const TinyMatrix& rhs) - { - return Return_t(lhs(0,0)*rhs(0,0)+lhs(0,1)*rhs(1,0)+lhs(0,2)*rhs(2,0), - lhs(0,0)*rhs(0,1)+lhs(0,1)*rhs(1,1)+lhs(0,2)*rhs(2,1), - lhs(0,0)*rhs(0,2)+lhs(0,1)*rhs(1,2)+lhs(0,2)*rhs(2,2), - lhs(1,0)*rhs(0,0)+lhs(1,1)*rhs(1,0)+lhs(1,2)*rhs(2,0), - lhs(1,0)*rhs(0,1)+lhs(1,1)*rhs(1,1)+lhs(1,2)*rhs(2,1), - lhs(1,0)*rhs(0,2)+lhs(1,1)*rhs(1,2)+lhs(1,2)*rhs(2,2), - lhs(2,0)*rhs(0,0)+lhs(2,1)*rhs(1,0)+lhs(2,2)*rhs(2,0), - lhs(2,0)*rhs(0,1)+lhs(2,1)*rhs(1,1)+lhs(2,2)*rhs(2,1), - lhs(2,0)*rhs(0,2)+lhs(2,1)*rhs(1,2)+lhs(2,2)*rhs(2,2)); - } -}; - -////////////////////////////////////////////////////////////////////// -// -// template struct OTDot {}; -// Specializations for TinyMatrix x TinyVector multiplication -// -////////////////////////////////////////////////////////////////////// -template -struct OTDot< TinyMatrix , TinyVector > -{ - typedef typename BinaryReturn::Type_t Type_t; - typedef TinyVector Return_t; - inline static Return_t - apply(const TinyMatrix& lhs, const TinyVector& rhs) - { - Return_t res; - for(int i=0; i -struct OTDot< TinyVector, TinyMatrix > -{ - typedef typename BinaryReturn::Type_t Type_t; - typedef TinyVector Return_t; - inline static Return_t - apply(const TinyVector& lhs, const TinyMatrix& rhs) - { - Return_t res; - for(int i=0; i -struct OTDot< TinyMatrix , TinyVector > -{ - typedef typename BinaryReturn::Type_t Type_t; - typedef TinyVector Return_t; - inline static Return_t - apply(const TinyMatrix& lhs, const TinyVector& rhs) - { - return Return_t(lhs(0,0)*rhs(0) + lhs(0,1)*rhs(1) + lhs(0,2)*rhs(2), - lhs(1,0)*rhs(0) + lhs(1,1)*rhs(1) + lhs(1,2)*rhs(2), - lhs(2,0)*rhs(0) + lhs(2,1)*rhs(1) + lhs(2,2)*rhs(2)); - } -}; - -template -struct OTDot< TinyVector, TinyMatrix > -{ - typedef typename BinaryReturn::Type_t Type_t; - typedef TinyVector Return_t; - inline static Return_t - apply(const TinyVector& lhs, const TinyMatrix& rhs) - { - return Return_t(lhs(0)*rhs(0,0) + lhs(1)*rhs(1,0) + lhs(2)*rhs(2,0), - lhs(0)*rhs(0,1) + lhs(1)*rhs(1,1) + lhs(2)*rhs(2,1), - lhs(0)*rhs(0,2) + lhs(1)*rhs(1,2) + lhs(2)*rhs(2,2)); - } -}; - -////////////////////////////////////////////////////////////////////// -// Specializations for TinyMatrixs with D=4x4 -////////////////////////////////////////////////////////////////////// -template -struct OTDot< TinyMatrix , TinyVector > -{ - typedef typename BinaryReturn::Type_t Type_t; - typedef TinyVector Return_t; - inline static Return_t - apply(const TinyMatrix& lhs, const TinyVector& rhs) - { - return Return_t(lhs(0,0)*rhs(0)+lhs(0,1)*rhs(1)+lhs(0,2)*rhs(2)+lhs(0,3)*rhs(3), - lhs(1,0)*rhs(0)+lhs(1,1)*rhs(1)+lhs(1,2)*rhs(2)+lhs(1,3)*rhs(3), - lhs(2,0)*rhs(0)+lhs(2,1)*rhs(1)+lhs(2,2)*rhs(2)+lhs(2,3)*rhs(3), - lhs(3,0)*rhs(0)+lhs(3,1)*rhs(1)+lhs(3,2)*rhs(2)+lhs(3,3)*rhs(3)); - } -}; - -template -struct OTDot< TinyVector, TinyMatrix > -{ - typedef typename BinaryReturn::Type_t Type_t; - typedef TinyVector Return_t; - inline static Return_t - apply(const TinyVector& lhs, const TinyMatrix& rhs) - { - return Return_t(lhs(0)*rhs(0,0) + lhs(1)*rhs(1,0) + lhs(2)*rhs(2,0) + lhs(3)*rhs(3,0), - lhs(0)*rhs(0,1) + lhs(1)*rhs(1,1) + lhs(2)*rhs(2,1) + lhs(3)*rhs(3,1), - lhs(0)*rhs(0,2) + lhs(1)*rhs(1,2) + lhs(2)*rhs(2,2) + lhs(3)*rhs(3,2), - lhs(0)*rhs(0,3) + lhs(1)*rhs(1,3) + lhs(2)*rhs(2,3) + lhs(3)*rhs(3,3)); - } -}; - - -template -struct OTDot< TinyMatrix , TinyMatrix > -{ - typedef typename BinaryReturn::Type_t Type_t; - typedef TinyMatrix Return_t; - inline static Return_t - apply(const TinyMatrix& lhs, const TinyMatrix& rhs) - { - return Return_t(lhs(0,0)*rhs(0,0)+lhs(0,1)*rhs(1,0)+lhs(0,2)*rhs(2,0)+lhs(0,3)*rhs(3,0), - lhs(0,0)*rhs(0,1)+lhs(0,1)*rhs(1,1)+lhs(0,2)*rhs(2,1)+lhs(0,3)*rhs(3,1), - lhs(0,0)*rhs(0,2)+lhs(0,1)*rhs(1,2)+lhs(0,2)*rhs(2,2)+lhs(0,3)*rhs(3,2), - lhs(0,0)*rhs(0,3)+lhs(0,1)*rhs(1,3)+lhs(0,2)*rhs(2,3)+lhs(0,3)*rhs(3,3), - lhs(1,0)*rhs(0,0)+lhs(1,1)*rhs(1,0)+lhs(1,2)*rhs(2,0)+lhs(1,3)*rhs(3,0), - lhs(1,0)*rhs(0,1)+lhs(1,1)*rhs(1,1)+lhs(1,2)*rhs(2,1)+lhs(1,3)*rhs(3,1), - lhs(1,0)*rhs(0,2)+lhs(1,1)*rhs(1,2)+lhs(1,2)*rhs(2,2)+lhs(1,3)*rhs(3,2), - lhs(1,0)*rhs(0,3)+lhs(1,1)*rhs(1,3)+lhs(1,2)*rhs(2,3)+lhs(1,3)*rhs(3,3), - lhs(2,0)*rhs(0,0)+lhs(2,1)*rhs(1,0)+lhs(2,2)*rhs(2,0)+lhs(2,3)*rhs(3,0), - lhs(2,0)*rhs(0,1)+lhs(2,1)*rhs(1,1)+lhs(2,2)*rhs(2,1)+lhs(2,3)*rhs(3,1), - lhs(2,0)*rhs(0,2)+lhs(2,1)*rhs(1,2)+lhs(2,2)*rhs(2,2)+lhs(2,3)*rhs(3,2), - lhs(2,0)*rhs(0,3)+lhs(2,1)*rhs(1,3)+lhs(2,2)*rhs(2,3)+lhs(2,3)*rhs(3,3), - lhs(3,0)*rhs(0,0)+lhs(3,1)*rhs(1,0)+lhs(3,2)*rhs(2,0)+lhs(3,3)*rhs(3,0), - lhs(3,0)*rhs(0,1)+lhs(3,1)*rhs(1,1)+lhs(3,2)*rhs(2,1)+lhs(3,3)*rhs(3,1), - lhs(3,0)*rhs(0,2)+lhs(3,1)*rhs(1,2)+lhs(3,2)*rhs(2,2)+lhs(3,3)*rhs(3,2), - lhs(3,0)*rhs(0,3)+lhs(3,1)*rhs(1,3)+lhs(3,2)*rhs(2,3)+lhs(3,3)*rhs(3,3)); - } -}; - -} -#endif // OHMMS_TINYVECTOR_OPERATORS_H - diff --git a/src/Numerics/OhmmsPETE/TinyVectorOps.h b/src/Numerics/OhmmsPETE/TinyVectorOps.h index 52acceaba..0e3ccb330 100644 --- a/src/Numerics/OhmmsPETE/TinyVectorOps.h +++ b/src/Numerics/OhmmsPETE/TinyVectorOps.h @@ -64,107 +64,6 @@ struct OTAssign< TinyVector , T2 , OP > } }; -////////////////////////////////////////////////////////////////////// -// Specializations for TinyVectors with D=1. -////////////////////////////////////////////////////////////////////// - -template -struct OTAssign< TinyVector , TinyVector , OP > -{ - inline static void - apply( TinyVector& lhs, const TinyVector& rhs, OP op) - { - op(lhs[0] , rhs[0] ); - } -}; - -template -struct OTAssign< TinyVector , T2 , OP > -{ - inline static void - apply( TinyVector& lhs, const T2& rhs, OP op ) - { - op(lhs[0] , rhs ); - } -}; - -////////////////////////////////////////////////////////////////////// -// Specializations for TinyVectors with D=2. -////////////////////////////////////////////////////////////////////// - -template -struct OTAssign< TinyVector , TinyVector , OP > -{ - inline static void - apply( TinyVector& lhs, const TinyVector& rhs, OP op) - { - op(lhs[0] , rhs[0] ); - op(lhs[1] , rhs[1] ); - } -}; - -template -struct OTAssign< TinyVector , T2 , OP > -{ - inline static void - apply( TinyVector& lhs, const T2& rhs, OP op ) - { - op(lhs[0] , rhs); - op(lhs[1] , rhs); - } -}; - -////////////////////////////////////////////////////////////////////// -// Specializations for TinyVectors with D=3. -////////////////////////////////////////////////////////////////////// - -template -struct OTAssign< TinyVector , TinyVector , OP > -{ - inline static void - apply( TinyVector& lhs, const TinyVector& rhs, OP op) - { - op(lhs[0] , rhs[0] ); - op(lhs[1] , rhs[1] ); - op(lhs[2] , rhs[2] ); - } -}; - -template -struct OTAssign< TinyVector , TinyVector,3> , OP > -{ - inline static void - apply( TinyVector& lhs, const TinyVector,3>& rhs, OP op) - { - op(lhs[0] , rhs[0].real() ); - op(lhs[1] , rhs[1].real() ); - op(lhs[2] , rhs[2].real() ); - } -}; - -template -struct OTAssign< TinyVector,3> , TinyVector,3> , OP > -{ - inline static void - apply( TinyVector,3>& lhs, const TinyVector,3>& rhs, OP op) - { - op(lhs[0] , rhs[0] ); - op(lhs[1] , rhs[1] ); - op(lhs[2] , rhs[2] ); - } -}; - -template -struct OTAssign< TinyVector , T2 , OP > -{ - inline static void - apply( TinyVector& lhs, const T2& rhs, OP op ) - { - op(lhs[0] , rhs ); - op(lhs[1] , rhs ); - op(lhs[2] , rhs ); - } -}; /////////////////////////////////////////////////////////////////////// // @@ -219,122 +118,6 @@ struct OTBinary< T1, TinyVector , OP > } }; -////////////////////////////////////////////////////////////////////// -// Specializations of OTBinary for TinyVectors with D=1. -////////////////////////////////////////////////////////////////////// - -template -struct OTBinary< TinyVector , TinyVector , OP > -{ - typedef typename BinaryReturn::Type_t Type_t; - inline static TinyVector - apply(const TinyVector& lhs, const TinyVector& rhs, OP op) - { - return TinyVector( op(lhs[0], rhs[0] ) ); - } -}; - -template -struct OTBinary< TinyVector , T2 , OP > -{ - typedef typename BinaryReturn::Type_t Type_t; - inline static TinyVector - apply(const TinyVector& lhs, const T2& rhs, OP op) - { - return TinyVector( op(lhs[0], rhs ) ); - } -}; - -template -struct OTBinary< T1, TinyVector , OP > -{ - typedef typename BinaryReturn::Type_t Type_t; - inline static TinyVector - apply(const T1& lhs, const TinyVector& rhs, OP op) - { - return TinyVector( op(lhs, rhs[0] ) ); - } -}; - -////////////////////////////////////////////////////////////////////// -// Specializations of OTBinary for TinyVectors with D=2. -////////////////////////////////////////////////////////////////////// - -template -struct OTBinary< TinyVector , TinyVector , OP > -{ - typedef typename BinaryReturn::Type_t Type_t; - inline static TinyVector - apply(const TinyVector& lhs, const TinyVector& rhs, OP op) - { - return TinyVector( op(lhs[0], rhs[0]),op(lhs[1], rhs[1] ) ); - } -}; - -template -struct OTBinary< TinyVector , T2 , OP > -{ - typedef typename BinaryReturn::Type_t Type_t; - inline static TinyVector - apply(const TinyVector& lhs, const T2& rhs, OP op) - { - return TinyVector( op(lhs[0], rhs ) ,op(lhs[1], rhs)); - } -}; - -template -struct OTBinary< T1, TinyVector , OP > -{ - typedef typename BinaryReturn::Type_t Type_t; - inline static TinyVector - apply(const T1& lhs, const TinyVector& rhs, OP op) - { - return TinyVector( op(lhs, rhs[0] ) ,op(lhs, rhs[1] ) ); - } -}; - -////////////////////////////////////////////////////////////////////// -// Specializations of OTBinary for TinyVectors with D=3. -////////////////////////////////////////////////////////////////////// - -template -struct OTBinary< TinyVector , TinyVector , OP > -{ - typedef typename BinaryReturn::Type_t Type_t; - inline static TinyVector - apply(const TinyVector& lhs, const TinyVector& rhs, OP op) - { - return TinyVector( op(lhs[0], rhs[0] ) , - op(lhs[1], rhs[1] ) , - op(lhs[2], rhs[2] ) ); - } -}; - -template -struct OTBinary< TinyVector , T2 , OP > -{ - typedef typename BinaryReturn::Type_t Type_t; - inline static TinyVector - apply(const TinyVector& lhs, const T2& rhs, OP op) - { - return TinyVector( op(lhs[0], rhs ) , - op(lhs[1], rhs ) , - op(lhs[2], rhs ) ); - } -}; - -template -struct OTBinary< T1, TinyVector , OP > -{ - typedef typename BinaryReturn::Type_t Type_t; - inline static TinyVector - apply(const T1& lhs, const TinyVector& rhs, OP op) - { - return TinyVector( op( lhs, rhs[0] ) , - op( lhs, rhs[1] ) , - op( lhs, rhs[2] ) ); - } -}; ////////////////////////////////////////////////////////////////////// // @@ -356,50 +139,6 @@ struct OTDot< TinyVector , TinyVector > } }; -template -struct OTDot< TinyVector , TinyVector > -{ - typedef typename BinaryReturn::Type_t Type_t; - inline static Type_t - apply(const TinyVector& lhs, const TinyVector& rhs) - { - return lhs[0]*rhs[0]; - } -}; - -template -struct OTDot< TinyVector , TinyVector > -{ - typedef typename BinaryReturn::Type_t Type_t; - inline static Type_t - apply(const TinyVector& lhs, const TinyVector& rhs) - { - return lhs[0]*rhs[0] + lhs[1]*rhs[1]; - } -}; - -template -struct OTDot< TinyVector , TinyVector > -{ - typedef typename BinaryReturn::Type_t Type_t; - inline static Type_t - apply(const TinyVector& lhs, const TinyVector& rhs) - { - return lhs[0]*rhs[0] + lhs[1]*rhs[1] + lhs[2]*rhs[2]; - } -}; - -template -struct OTDot< TinyVector , TinyVector > -{ - typedef typename BinaryReturn::Type_t Type_t; - inline static Type_t - apply(const TinyVector& lhs, const TinyVector& rhs) - { - return lhs[0]*rhs[0] + lhs[1]*rhs[1] + lhs[2]*rhs[2] + lhs[3]*rhs[3]; - } -}; - /** specialization for real-complex TinyVector */ template struct OTDot< TinyVector , TinyVector,3> > @@ -432,11 +171,11 @@ struct OTDot< TinyVector,3> , TinyVector,3> > inline static Type_t apply(const TinyVector,3>& lhs, const TinyVector,3>& rhs) { - return std::complex(lhs[0].real()*rhs[0].real() - lhs[0].imag()*rhs[0].imag() + - lhs[1].real()*rhs[1].real() - lhs[1].imag()*rhs[1].imag() + + return std::complex(lhs[0].real()*rhs[0].real() - lhs[0].imag()*rhs[0].imag() + + lhs[1].real()*rhs[1].real() - lhs[1].imag()*rhs[1].imag() + lhs[2].real()*rhs[2].real() - lhs[2].imag()*rhs[2].imag() , - lhs[0].real()*rhs[0].imag() + lhs[0].imag()*rhs[0].real() + - lhs[1].real()*rhs[1].imag() + lhs[1].imag()*rhs[1].real() + + lhs[0].real()*rhs[0].imag() + lhs[0].imag()*rhs[0].real() + + lhs[1].real()*rhs[1].imag() + lhs[1].imag()*rhs[1].real() + lhs[2].real()*rhs[2].imag() + lhs[2].imag()*rhs[2].real() ); } }; diff --git a/src/Numerics/PETE/OperatorTags.h b/src/Numerics/PETE/OperatorTags.h index 634a59560..c8ebefe3f 100644 --- a/src/Numerics/PETE/OperatorTags.h +++ b/src/Numerics/PETE/OperatorTags.h @@ -34,251 +34,6 @@ namespace qmcplusplus { -/////////////////////////////////////////////////////////////////////////////// -// -// WARNING: THIS FILE WAS GENERATED AUTOMATICALLY! -// YOU SHOULD MODIFY THE INPUT FILES INSTEAD OF CHANGING THIS FILE DIRECTLY! -// -// THE FOLLOWING INPUT FILES WERE USED TO MAKE THIS FILE: -// -// MakeOperators -// PeteOps.in -// -/////////////////////////////////////////////////////////////////////////////// - -struct FnArcCos -{ - PETE_EMPTY_CONSTRUCTORS(FnArcCos) - template - inline typename UnaryReturn::Type_t operator()(const T &a) const - { - return (acos(a)); - } -}; - -struct FnArcSin -{ - PETE_EMPTY_CONSTRUCTORS(FnArcSin) - template - inline typename UnaryReturn::Type_t operator()(const T &a) const - { - return (asin(a)); - } -}; - -struct FnArcTan -{ - PETE_EMPTY_CONSTRUCTORS(FnArcTan) - template - inline typename UnaryReturn::Type_t operator()(const T &a) const - { - return (atan(a)); - } -}; - -struct FnCeil -{ - PETE_EMPTY_CONSTRUCTORS(FnCeil) - template - inline typename UnaryReturn::Type_t operator()(const T &a) const - { - return (ceil(a)); - } -}; - -struct FnCos -{ - PETE_EMPTY_CONSTRUCTORS(FnCos) - template - inline typename UnaryReturn::Type_t operator()(const T &a) const - { - return (cos(a)); - } -}; - -struct FnHypCos -{ - PETE_EMPTY_CONSTRUCTORS(FnHypCos) - template - inline typename UnaryReturn::Type_t operator()(const T &a) const - { - return (cosh(a)); - } -}; - -struct FnExp -{ - PETE_EMPTY_CONSTRUCTORS(FnExp) - template - inline typename UnaryReturn::Type_t operator()(const T &a) const - { - return (exp(a)); - } -}; - -struct FnFabs -{ - PETE_EMPTY_CONSTRUCTORS(FnFabs) - template - inline typename UnaryReturn::Type_t operator()(const T &a) const - { - return (std::abs(a)); - } -}; - -struct FnFloor -{ - PETE_EMPTY_CONSTRUCTORS(FnFloor) - template - inline typename UnaryReturn::Type_t operator()(const T &a) const - { - return (floor(a)); - } -}; - -struct FnLog -{ - PETE_EMPTY_CONSTRUCTORS(FnLog) - template - inline typename UnaryReturn::Type_t operator()(const T &a) const - { - return (log(a)); - } -}; - -struct FnLog10 -{ - PETE_EMPTY_CONSTRUCTORS(FnLog10) - template - inline typename UnaryReturn::Type_t operator()(const T &a) const - { - return (log10(a)); - } -}; - -struct FnSin -{ - PETE_EMPTY_CONSTRUCTORS(FnSin) - template - inline typename UnaryReturn::Type_t operator()(const T &a) const - { - return (sin(a)); - } -}; - -struct FnHypSin -{ - PETE_EMPTY_CONSTRUCTORS(FnHypSin) - template - inline typename UnaryReturn::Type_t operator()(const T &a) const - { - return (sinh(a)); - } -}; - -struct FnSqrt -{ - PETE_EMPTY_CONSTRUCTORS(FnSqrt) - template - inline typename UnaryReturn::Type_t operator()(const T &a) const - { - return (sqrt(a)); - } -}; - -struct FnTan -{ - PETE_EMPTY_CONSTRUCTORS(FnTan) - template - inline typename UnaryReturn::Type_t operator()(const T &a) const - { - return (tan(a)); - } -}; - -struct FnHypTan -{ - PETE_EMPTY_CONSTRUCTORS(FnHypTan) - template - inline typename UnaryReturn::Type_t operator()(const T &a) const - { - return (tanh(a)); - } -}; - -struct OpUnaryMinus -{ - PETE_EMPTY_CONSTRUCTORS(OpUnaryMinus) - template - inline typename UnaryReturn::Type_t - operator()(const T &a) const - { - return (-a); - } -}; - -struct OpUnaryPlus -{ - PETE_EMPTY_CONSTRUCTORS(OpUnaryPlus) - template - inline typename UnaryReturn::Type_t - operator()(const T &a) const - { - return (+a); - } -}; - -struct OpBitwiseNot -{ - PETE_EMPTY_CONSTRUCTORS(OpBitwiseNot) - template - inline typename UnaryReturn::Type_t - operator()(const T &a) const - { - return (~a); - } -}; - -struct OpIdentity -{ - PETE_EMPTY_CONSTRUCTORS(OpIdentity) - template - inline typename UnaryReturn::Type_t - operator()(const T &a) const - { - return (a); - } -}; - -struct OpNot -{ - PETE_EMPTY_CONSTRUCTORS(OpNot) - template - inline typename UnaryReturn::Type_t operator()(const T &a) const - { - return (!a); - } -}; - -template struct UnaryReturn -{ - typedef bool Type_t; -}; - -template struct OpCast -{ - PETE_EMPTY_CONSTRUCTORS_TEMPLATE(OpCast, T1) - template - inline UnaryReturn> operator()(const T2 &a) const - { - return T1(a); - } -}; - -template struct UnaryReturn> -{ - typedef T1 Type_t; -}; struct OpAdd { @@ -335,242 +90,6 @@ struct OpMod } }; -struct OpBitwiseAnd -{ - PETE_EMPTY_CONSTRUCTORS(OpBitwiseAnd) - template - inline typename BinaryReturn::Type_t - operator()(const T1 &a, const T2 &b) const - { - return (a & b); - } -}; - -struct OpBitwiseOr -{ - PETE_EMPTY_CONSTRUCTORS(OpBitwiseOr) - template - inline typename BinaryReturn::Type_t - operator()(const T1 &a, const T2 &b) const - { - return (a | b); - } -}; - -struct OpBitwiseXor -{ - PETE_EMPTY_CONSTRUCTORS(OpBitwiseXor) - template - inline typename BinaryReturn::Type_t - operator()(const T1 &a, const T2 &b) const - { - return (a ^ b); - } -}; - -struct FnLdexp -{ - PETE_EMPTY_CONSTRUCTORS(FnLdexp) - template - inline typename BinaryReturn::Type_t - operator()(const T1 &a, const T2 &b) const - { - return (ldexp(a, b)); - } -}; - -struct FnPow -{ - PETE_EMPTY_CONSTRUCTORS(FnPow) - template - inline typename BinaryReturn::Type_t - operator()(const T1 &a, const T2 &b) const - { - return (pow(a, b)); - } -}; - -struct FnFmod -{ - PETE_EMPTY_CONSTRUCTORS(FnFmod) - template - inline typename BinaryReturn::Type_t - operator()(const T1 &a, const T2 &b) const - { - return (fmod(a, b)); - } -}; - -struct FnArcTan2 -{ - PETE_EMPTY_CONSTRUCTORS(FnArcTan2) - template - inline typename BinaryReturn::Type_t - operator()(const T1 &a, const T2 &b) const - { - return (atan2(a, b)); - } -}; - -struct OpLT -{ - PETE_EMPTY_CONSTRUCTORS(OpLT) - template - inline typename BinaryReturn::Type_t - operator()(const T1 &a, const T2 &b) const - { - return (a < b); - } -}; - -template struct BinaryReturn -{ - typedef bool Type_t; -}; - -struct OpLE -{ - PETE_EMPTY_CONSTRUCTORS(OpLE) - template - inline typename BinaryReturn::Type_t - operator()(const T1 &a, const T2 &b) const - { - return (a <= b); - } -}; - -template struct BinaryReturn -{ - typedef bool Type_t; -}; - -struct OpGT -{ - PETE_EMPTY_CONSTRUCTORS(OpGT) - template - inline typename BinaryReturn::Type_t - operator()(const T1 &a, const T2 &b) const - { - return (a > b); - } -}; - -template struct BinaryReturn -{ - typedef bool Type_t; -}; - -struct OpGE -{ - PETE_EMPTY_CONSTRUCTORS(OpGE) - template - inline typename BinaryReturn::Type_t - operator()(const T1 &a, const T2 &b) const - { - return (a >= b); - } -}; - -template struct BinaryReturn -{ - typedef bool Type_t; -}; - -struct OpEQ -{ - PETE_EMPTY_CONSTRUCTORS(OpEQ) - template - inline typename BinaryReturn::Type_t - operator()(const T1 &a, const T2 &b) const - { - return (a == b); - } -}; - -template struct BinaryReturn -{ - typedef bool Type_t; -}; - -struct OpNE -{ - PETE_EMPTY_CONSTRUCTORS(OpNE) - template - inline typename BinaryReturn::Type_t - operator()(const T1 &a, const T2 &b) const - { - return (a != b); - } -}; - -template struct BinaryReturn -{ - typedef bool Type_t; -}; - -struct OpAnd -{ - PETE_EMPTY_CONSTRUCTORS(OpAnd) - template - inline typename BinaryReturn::Type_t - operator()(const T1 &a, const T2 &b) const - { - return (a && b); - } -}; - -template struct BinaryReturn -{ - typedef bool Type_t; -}; - -struct OpOr -{ - PETE_EMPTY_CONSTRUCTORS(OpOr) - template - inline typename BinaryReturn::Type_t - operator()(const T1 &a, const T2 &b) const - { - return (a || b); - } -}; - -template struct BinaryReturn -{ - typedef bool Type_t; -}; - -struct OpLeftShift -{ - PETE_EMPTY_CONSTRUCTORS(OpLeftShift) - template - inline typename BinaryReturn::Type_t - operator()(const T1 &a, const T2 &b) const - { - return (a << b); - } -}; - -template struct BinaryReturn -{ - typedef T1 Type_t; -}; - -struct OpRightShift -{ - PETE_EMPTY_CONSTRUCTORS(OpRightShift) - template - inline typename BinaryReturn::Type_t - operator()(const T1 &a, const T2 &b) const - { - return (a >> b); - } -}; - -template struct BinaryReturn -{ - typedef T1 Type_t; -}; struct OpAddAssign { @@ -657,90 +176,6 @@ template struct BinaryReturn typedef T1 &Type_t; }; -struct OpBitwiseOrAssign -{ - PETE_EMPTY_CONSTRUCTORS(OpBitwiseOrAssign) - template - inline typename BinaryReturn::Type_t - operator()(const T1 &a, const T2 &b) const - { - (const_cast(a) |= b); - return const_cast(a); - } -}; - -template struct BinaryReturn -{ - typedef T1 &Type_t; -}; - -struct OpBitwiseAndAssign -{ - PETE_EMPTY_CONSTRUCTORS(OpBitwiseAndAssign) - template - inline typename BinaryReturn::Type_t - operator()(const T1 &a, const T2 &b) const - { - (const_cast(a) &= b); - return const_cast(a); - } -}; - -template struct BinaryReturn -{ - typedef T1 &Type_t; -}; - -struct OpBitwiseXorAssign -{ - PETE_EMPTY_CONSTRUCTORS(OpBitwiseXorAssign) - template - inline typename BinaryReturn::Type_t - operator()(const T1 &a, const T2 &b) const - { - (const_cast(a) ^= b); - return const_cast(a); - } -}; - -template struct BinaryReturn -{ - typedef T1 &Type_t; -}; - -struct OpLeftShiftAssign -{ - PETE_EMPTY_CONSTRUCTORS(OpLeftShiftAssign) - template - inline typename BinaryReturn::Type_t - operator()(const T1 &a, const T2 &b) const - { - (const_cast(a) <<= b); - return const_cast(a); - } -}; - -template struct BinaryReturn -{ - typedef T1 &Type_t; -}; - -struct OpRightShiftAssign -{ - PETE_EMPTY_CONSTRUCTORS(OpRightShiftAssign) - template - inline typename BinaryReturn::Type_t - operator()(const T1 &a, const T2 &b) const - { - (const_cast(a) >>= b); - return const_cast(a); - } -}; - -template struct BinaryReturn -{ - typedef T1 &Type_t; -}; struct OpAssign { @@ -758,20 +193,5 @@ template struct BinaryReturn typedef T1 &Type_t; }; -struct FnWhere -{ - PETE_EMPTY_CONSTRUCTORS(FnWhere) - template - inline typename TrinaryReturn::Type_t - operator()(T1 &a, const T2 &b, const T3 &c) const - { - if (a) - return b; - else - return c; - } -}; } #endif // PETE_PETE_OPERATORTAGS_H - -// ACL:rcsinfo diff --git a/src/Particle/AsymmetricDistanceTableData.h b/src/Particle/AsymmetricDistanceTableData.h deleted file mode 100644 index ac863d5ba..000000000 --- a/src/Particle/AsymmetricDistanceTableData.h +++ /dev/null @@ -1,265 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// This file is distributed under the University of Illinois/NCSA Open Source -// License. See LICENSE file in top directory for details. -// -// Copyright (c) 2016 Jeongnim Kim and QMCPACK developers. -// -// File developed by: -// Jeremy McMinnis, jmcminis@gmail.com, -// University of Illinois at Urbana-Champaign -// Jeongnim Kim, jeongnim.kim@gmail.com, -// University of Illinois at Urbana-Champaign -// Jaron T. Krogel, krogeljt@ornl.gov, -// Oak Ridge National Laboratory -// Mark A. Berrill, berrillma@ornl.gov, -// Oak Ridge National Laboratory -// -// File created by: -// Jeongnim Kim, jeongnim.kim@gmail.com, -// University of Illinois at Urbana-Champaign -//////////////////////////////////////////////////////////////////////////////// - -#ifndef QMCPLUSPLUS_ASYMMETRICDISTANCETABLEDATAIMPL_H -#define QMCPLUSPLUS_ASYMMETRICDISTANCETABLEDATAIMPL_H - -#include - -namespace qmcplusplus -{ - -/**@ingroup nnlist - * @brief A derived classe from DistacneTableData, specialized for - * dense-asymmetric case - * - * AsymmetricDTD stands for Asymmetric Distance Table Data with - * distinct source and target sets. - * The template parameter BC provides BC::apply member function - * to evaluate Cartesian distances. - */ -template -struct AsymmetricDTD : public DTD_BConds, public DistanceTableData -{ - const ParticleSet &Target; - AsymmetricDTD(const ParticleSet &source, const ParticleSet &target) - : DTD_BConds(source.Lattice), DistanceTableData(source, target), - Target(target) - { - reset(Origin->getTotalNum(), Target.getTotalNum(), 1); - } - - /*!\fn void reset(int n1, int n2, int nactive){ - *\param n1 the number of sources - *\param n2 the number of targets - *\param nactive the number of copies of the targets - *\brief Resize the internal data and assign indices - */ - inline void reset(int n1, int n2, int nactive) - { - if (n1 != N[SourceIndex] || n2 != N[VisitorIndex] || - nactive != N[WalkerIndex]) - { - N[SourceIndex] = n1; - N[VisitorIndex] = n2; - int m = n1 * n2; - if (m) - { - M.resize(n1 + 1); - J.resize(m); - PairID.resize(m); - resize(m, nactive); - M[0] = 0; - int ij = 0; - for (int i = 0; i < n1; i++) - { - for (int j = 0; j < n2; j++, ij++) - { - J[ij] = j; - PairID[ij] = Origin->GroupID[i]; - } - M[i + 1] = M[i] + n2; - } - npairs_m = n1 * n2; - } - } - } - - inline virtual void nearest_neighbor(std::vector &ri, - bool transposed = false) const - { - if (transposed) - { - for (int n = 0; n < ri.size(); ++n) - ri[n].first = std::numeric_limits::max(); - const int m = N[SourceIndex]; - const int nv = N[VisitorIndex]; - int shift = 0; - for (int i = 0; i < m; ++i, shift += nv) - for (int n = 0; n < ri.size(); ++n) - { - ripair &rin = ri[n]; - RealType rp = r_m[shift + n]; - if (rp < rin.first) - { - rin.first = rp; - rin.second = i; - } - } - } - else - { - const int m = N[VisitorIndex]; - for (int n = 0; n < ri.size(); ++n) - { - const int shift = M[n]; - ripair &rin = ri[n]; - rin.first = std::numeric_limits::max(); - for (int i = 0; i < m; ++i) - { - RealType rp = r_m[shift + i]; - if (rp < rin.first) - { - rin.first = rp; - rin.second = i; - } - } - } - } - } - - inline virtual void nearest_neighbors(int n, int neighbors, - std::vector &ri, - bool transposed = false) - { - if (transposed) - { - const int m = N[SourceIndex]; - const int nv = N[VisitorIndex]; - int shift = 0; - for (int i = 0; i < m; ++i, shift += nv) - { - ri[i].first = r_m[shift + n]; - ri[i].second = i; - } - } - else - { - const int m = N[VisitorIndex]; - const int shift = M[n]; - for (int i = 0; i < m; ++i) - { - ri[i].first = r_m[shift + i]; - ri[i].second = i; - } - } - std::partial_sort(ri.begin(), ri.begin() + neighbors, ri.end()); - } - - virtual void nearest_neighbors_by_spec(int n, int neighbors, int spec_start, - std::vector &ri, - bool transposed = false) - { - if (transposed) - { - const int nv = N[VisitorIndex]; - int shift = spec_start * nv; - for (int i = 0; i < ri.size(); ++i, shift += nv) - { - ri[i].first = r_m[shift + n]; - ri[i].second = i; - } - } - else - { - const int shift = M[n] + spec_start; - for (int i = 0; i < ri.size(); ++i) - { - ri[i].first = r_m[shift + i]; - ri[i].second = i; - } - } - std::partial_sort(ri.begin(), ri.begin() + neighbors, ri.end()); - } - - /// not so useful inline but who knows - inline void evaluate(ParticleSet &P) - { - const int ns = N[SourceIndex]; - const int nt = N[VisitorIndex]; - for (int i = 0; i < ns; i++) - for (int j = 0; j < nt; j++) - dr_m[i * nt + j] = P.R[j] - Origin->R[i]; - DTD_BConds::apply_bc(dr_m, r_m, rinv_m); - } - - inline void evaluate(ParticleSet &P, int jat) - { - // based on full evaluation. Only compute it if jat==0 - if (jat == 0) evaluate(P); - } - - /// evaluate the temporary pair relations - inline void move(const ParticleSet &P, const PosType &rnew, IndexType jat) - { - activePtcl = jat; - for (int iat = 0, loc = jat; iat < N[SourceIndex]; - iat++, loc += N[VisitorIndex]) - { - PosType drij(rnew - Origin->R[iat]); - // RealType sep2(BC::apply(Origin.Lattice,drij)); - RealType sep(std::sqrt(DTD_BConds::apply_bc(drij))); - Temp[iat].r1 = sep; - Temp[iat].rinv1 = 1.0 / sep; - Temp[iat].dr1 = drij; - // Temp[iat].r0=r_m[loc]; - // Temp[iat].rinv0=rinv_m[loc]; - // Temp[iat].dr0=dr_m[loc]; - } - } - - /// evaluate the temporary pair relations - inline void moveOnSphere(const ParticleSet &P, const PosType &rnew, - IndexType jat) - { - activePtcl = jat; - for (int iat = 0, loc = jat; iat < N[SourceIndex]; - iat++, loc += N[VisitorIndex]) - { - PosType drij(rnew - Origin->R[iat]); - Temp[iat].r1 = std::sqrt(DTD_BConds::apply_bc(drij)); - Temp[iat].dr1 = drij; - } - } - - inline void update(IndexType jat) - { - for (int iat = 0, loc = jat; iat < N[SourceIndex]; - iat++, loc += N[VisitorIndex]) - { - r_m[loc] = Temp[iat].r1; - rinv_m[loc] = 1 / Temp[iat].r1; - // rinv_m[loc]=Temp[iat].rinv1; - dr_m[loc] = Temp[iat].dr1; - } - } - - size_t get_neighbors(int iat, RealType rcut, int *restrict jid, - RealType *restrict dist, PosType *restrict displ) const - { - size_t nn = 0; - const int nt = N[VisitorIndex]; - for (int jat = 0, loc = iat * nt; jat < nt; ++jat, ++loc) - { - RealType rij = r_m[loc]; - if (rij < rcut) - { // make the compact list - jid[nn] = jat; - dist[nn] = rij; - displ[nn] = dr_m[loc]; - nn++; - } - } - return nn; - } -}; -} -#endif diff --git a/src/Particle/DistanceTableAA.cpp b/src/Particle/DistanceTableAA.cpp index a45d270be..11e04d858 100644 --- a/src/Particle/DistanceTableAA.cpp +++ b/src/Particle/DistanceTableAA.cpp @@ -24,7 +24,6 @@ #include "Particle/DistanceTable.h" #include "Particle/DistanceTableData.h" #include "Particle/Lattice/ParticleBConds.h" -#include "Particle/SymmetricDistanceTableData.h" #include "Particle/DistanceTableAA.h" namespace qmcplusplus @@ -49,17 +48,9 @@ DistanceTableData *createDistanceTable(ParticleSet &s, int dt_type) << " useSoA =" << useSoA << "\n"; if (sc == SUPERCELL_BULK) { - if (useSoA) - { - o << " Using SoaDistanceTableAA of SoA layout " << PPPG - << std::endl; - dt = new DistanceTableAA(s); - } - else - { - o << " Using SymmetricDTD " << PPPG << std::endl; - dt = new SymmetricDTD(s, s); - } + o << " Using SoaDistanceTableAA of SoA layout " << PPPG + << std::endl; + dt = new DistanceTableAA(s); o << "\n Setting Rmax = " << s.Lattice.SimulationCellRadius; } else @@ -70,7 +61,7 @@ DistanceTableData *createDistanceTable(ParticleSet &s, int dt_type) // set dt properties dt->CellType = sc; - dt->DTType = (useSoA) ? DT_SOA : DT_AOS; + dt->DTType = DT_SOA; std::ostringstream p; p << s.getName() << "_" << s.getName(); dt->Name = p.str(); // assign the table name diff --git a/src/Particle/DistanceTableAB.cpp b/src/Particle/DistanceTableAB.cpp index d4c3ce2e8..e41b6e71e 100644 --- a/src/Particle/DistanceTableAB.cpp +++ b/src/Particle/DistanceTableAB.cpp @@ -24,7 +24,6 @@ #include "Particle/DistanceTable.h" #include "Particle/DistanceTableData.h" #include "Particle/Lattice/ParticleBConds.h" -#include "Particle/AsymmetricDistanceTableData.h" #include "Utilities/SIMD/algorithm.hpp" #include "Particle/DistanceTableBA.h" @@ -44,25 +43,15 @@ DistanceTableData *createDistanceTable(const ParticleSet &s, ParticleSet &t, DIM = OHMMS_DIM }; DistanceTableData *dt = 0; - // int sc=s.Lattice.SuperCellEnum; int sc = t.Lattice.SuperCellEnum; std::ostringstream o; - bool useSoA = (dt_type == DT_SOA || dt_type == DT_SOA_PREFERRED); o << " Distance table for AB: source = " << s.getName() << " target = " << t.getName() << "\n"; if (sc == SUPERCELL_BULK) { - if (useSoA) - { - o << " Using SoaDistanceTableBA of SoA layout " << PPPG - << std::endl; - dt = new DistanceTableBA(s, t); - } - else - { - o << " Using AsymmetricDTD " << PPPG << std::endl; - dt = new AsymmetricDTD(s, t); - } + o << " Using SoaDistanceTableBA of SoA layout " << PPPG + << std::endl; + dt = new DistanceTableBA(s, t); o << " Setting Rmax = " << s.Lattice.SimulationCellRadius; } else @@ -73,7 +62,7 @@ DistanceTableData *createDistanceTable(const ParticleSet &s, ParticleSet &t, // set dt properties dt->CellType = sc; - dt->DTType = (useSoA) ? DT_SOA : DT_AOS; + dt->DTType = DT_SOA; std::ostringstream p; p << s.getName() << "_" << t.getName(); dt->Name = p.str(); // assign the table name diff --git a/src/Particle/SymmetricDistanceTableData.h b/src/Particle/SymmetricDistanceTableData.h deleted file mode 100644 index ecd8c0b25..000000000 --- a/src/Particle/SymmetricDistanceTableData.h +++ /dev/null @@ -1,227 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// This file is distributed under the University of Illinois/NCSA Open Source -// License. See LICENSE file in top directory for details. -// -// Copyright (c) 2016 Jeongnim Kim and QMCPACK developers. -// -// File developed by: -// Jeremy McMinnis, jmcminis@gmail.com, -// University of Illinois at Urbana-Champaign -// Jaron T. Krogel, krogeljt@ornl.gov, -// Oak Ridge National Laboratory -// Jeongnim Kim, jeongnim.kim@gmail.com, -// University of Illinois at Urbana-Champaign -// Mark A. Berrill, berrillma@ornl.gov, -// Oak Ridge National Laboratory -// -// File created by: -// Jeongnim Kim, jeongnim.kim@gmail.com, -// University of Illinois at Urbana-Champaign -//////////////////////////////////////////////////////////////////////////////// - -#ifndef QMCPLUSPLUS_SYMMETRICDISTANCETABLEDATAIMPL_H -#define QMCPLUSPLUS_SYMMETRICDISTANCETABLEDATAIMPL_H - -#include - -namespace qmcplusplus -{ - -/**@ingroup nnlist - * @brief A derived classe from DistacneTableData, specialized for - * dense-symmetric case - * - * SymmetricDTD stands for Symmetric Distance Table Data. - * The source and target sets are identical and the sum is over - * distict pairs, i.e., \f$\sum_{i}\sum_{j -struct SymmetricDTD : public DTD_BConds, public DistanceTableData -{ - - // blitz::Array IJ; - /// constructor using source and target arrays - SymmetricDTD(const ParticleSet &source, const ParticleSet &target) - : DTD_BConds(source.Lattice), DistanceTableData(source, target) - { - reset(Origin->getTotalNum(), 1); - } - - inline void reset(int m, int nactive) - { - if (m != N[SourceIndex] || nactive != N[WalkerIndex]) - { - N[SourceIndex] = m; - N[VisitorIndex] = m; - int nn = m * (m - 1) / 2; - M.resize(m + 1); - J.resize(nn); - IJ.resize(m * m); - PairID.resize(m * m); - resize(nn, nactive); - M[0] = 0; - int nsp = Origin->groups(); - int ij = 0; - for (int i = 0; i < m; i++) - { - for (int j = i + 1; j < m; j++, ij++) - { - J[ij] = j; - PairID[ij] = Origin->GroupID[j] + nsp * Origin->GroupID[i]; - IJ[i * m + j] = ij; - IJ[j * m + i] = ij; - //@warning: using a simple pair scheme - // Upper packed-storage scheme - // PairID[ij] = - // Origin.GroupID[j]+(2*nsp-Origin.GroupID[i]-1)*(Origin.GroupID[i])/2; - } - M[i + 1] = ij; - } - npairs_m = ij; - } - } - - inline virtual void nearest_neighbors(int n, int neighbors, - std::vector &ri, - bool transposed = false) - { - int m = N[VisitorIndex]; - int shift = n * m; - for (int i = 0; i < n; ++i) - { - ri[i].first = r_m[IJ[shift + i]]; - ri[i].second = i; - } - ri[n].first = std::numeric_limits::max(); - ri[n].second = n; - shift = M[n]; - for (int i = n + 1; i < m; ++i) - { - ri[i].first = r_m[shift + i]; - ri[i].second = i; - } - std::partial_sort(ri.begin(), ri.begin() + neighbors, ri.end()); - } - - /// evaluate the Distance Table using a set of Particle Positions - // inline void evaluate(const WalkerSetRef& W) { - // int copies = W.walkers(); - // int visitors = W.particles(); - // for(int iw=0; iw::apply_bc(dr_m, r_m, rinv_m); - } - - inline void evaluate(ParticleSet &P, int jat) - { - // based on full evaluation. Only compute it if jat==0 - if (jat == 0) evaluate(P); - } - - /// evaluate the temporary pair relations - inline void move(const ParticleSet &P, const PosType &rnew, IndexType jat) - { - activePtcl = jat; - for (int iat = 0; iat < N[SourceIndex]; ++iat) - { - PosType drij(rnew - P.R[iat]); - Temp[iat].dr1_nobox = drij; - RealType sep = std::sqrt(DTD_BConds::apply_bc(drij)); - Temp[iat].r1 = sep; - Temp[iat].rinv1 = 1.0 / sep; - Temp[iat].dr1 = drij; - } - // for(int iat=0; iat::apply_bc(drij)); - // Temp[iat].r1=sep; - // Temp[iat].rinv1=1.0/sep; - // Temp[iat].dr1=drij; - // //Temp[iat].r0=r_m[loc]; - // //Temp[iat].rinv0=rinv_m[loc]; - // //Temp[iat].dr0=-1.0*dr_m[loc]; - //} - // Temp[jat].reset(); - // for(int iat=jat+1,nn=jat; iat< N[SourceIndex]; iat++) { - // int loc = IJ[iat*N[SourceIndex]+jat]; - // PosType drij(rnew - P.R[iat]); - // //old with static type - // //RealType sep=std::sqrt(BC::apply(Origin.Lattice,drij)); - // RealType sep=std::sqrt(DTD_BConds::apply_bc(drij)); - // Temp[iat].r1=sep; - // Temp[iat].rinv1=1.0/sep; - // Temp[iat].dr1=drij; - // //Temp[iat].r0=r_m[loc]; - // //Temp[iat].rinv0=rinv_m[loc]; - // //Temp[iat].dr0=dr_m[loc]; - //} - } - - inline void moveOnSphere(const ParticleSet &P, const PosType &rnew, - IndexType jat) - { - activePtcl = jat; - for (int iat = 0; iat < N[SourceIndex]; ++iat) - { - PosType drij(rnew - P.R[iat]); - Temp[iat].r1 = std::sqrt(DTD_BConds::apply_bc(drij)); - Temp[iat].dr1 = drij; - } - } - - /// update the stripe for jat-th particle - inline void update(IndexType jat) - { - int nn = jat; - for (int iat = 0; iat < jat; iat++, nn += N[SourceIndex]) - { - int loc = IJ[nn]; - r_m[loc] = Temp[iat].r1; - rinv_m[loc] = 1.0 / Temp[iat].r1; - // rinv_m[loc]= Temp[iat].rinv1; - dr_m[loc] = Temp[iat].dr1; - } - for (int nn = M[jat]; nn < M[jat + 1]; nn++) - { - int iat = J[nn]; - r_m[nn] = Temp[iat].r1; - rinv_m[nn] = 1.0 / Temp[iat].r1; - // rinv_m[nn]= Temp[iat].rinv1; - dr_m[nn] = -1.0 * Temp[iat].dr1; - } - } -}; -} -#endif