40 template <
class T,
class U>
57 virtual std::vector<T>
evaluate()
const;
60 virtual void print(std::ostream &str,
int precedence = 99)
const;
80 template <
class T,
class U>
inline
82 AList<
T>(), fun(rhs.fun), lft(rhs.lft->clone()), rgt(rhs.rgt->clone())
86 template <
class T,
class U>
inline
93 template <
class T,
class U>
inline
98 template <
class T,
class U>
inline
104 template <
class T,
class U>
inline
107 std::vector<U> op1 = lft->evaluate();
108 std::vector<U> op2 = rgt->evaluate();
109 std::vector<T> result;
111 if(op1.size() == op2.size()) {
112 for(
typename std::vector<U>::size_type i = 0; i < op1.size(); ++i) {
113 result.push_back((*fun.function)(op1[i], op2[i]));
115 }
else if(op1.size() == 1) {
116 for(
typename std::vector<U>::size_type i = 0; i < op2.size(); ++i) {
117 result.push_back((*fun.function)(op1[0], op2[i]));
119 }
else if(op2.size() == 1) {
120 for(
typename std::vector<U>::size_type i = 0; i < op1.size(); ++i) {
121 result.push_back((*fun.function)(op1[i], op2[0]));
125 "Inconsistent array dimensions.");
143 template <
class T,
class U>
inline
145 if(fun.precedence >= 0) {
147 if(fun.precedence <= precedence) os <<
"(";
148 lft->print(os, fun.precedence - 1);
150 rgt->print(os, fun.precedence);
151 if(fun.precedence <= precedence) os <<
")";
154 os << fun.name <<
'(';
py::list function(PolynomialPatch *patch, py::list point)
Representation objects and parsers for attribute expressions.
An array expression with two array operands.
virtual OArray< T > * clone() const
Make clone.
void operator=(const ABinary &)
virtual void print(std::ostream &str, int precedence=99) const
Print expression.
const TFunction2< T, U > & fun
virtual std::vector< T > evaluate() const
Evaluate.
An array expression defined by a list of scalar expressions.
A function of two U's returning a T.
The base class for all OPAL exceptions.