26 #ifndef TILEDARRAY_EXPRESSIONS_BINARY_ENGINE_H__INCLUDED 27 #define TILEDARRAY_EXPRESSIONS_BINARY_ENGINE_H__INCLUDED 33 namespace expressions {
39 template <
typename Derived>
100 bool left_target =
true, right_target =
true, left_right =
true;
101 for(
unsigned int i = 0u; i < target_vars.
dim(); ++i) {
102 left_target = left_target &&
left_.vars()[i] == target_vars[i];
103 right_target = right_target &&
right_.vars()[i] == target_vars[i];
104 left_right = left_right &&
left_.vars()[i] ==
right_.vars()[i];
111 const bool perm_left = (right_target || ((! (left_target || right_target))
112 && (left_type::leaves <= right_type::leaves)));
128 left_.init_vars(target_vars);
129 right_.init_vars(target_vars);
136 if(left_type::leaves <= right_type::leaves) {
157 if(TiledArray::get_default_world().rank() == 0) {
159 "The TiledRanges of the left- and right-hand arguments of the " \
160 "binary operation are not equal:" \
161 <<
"\n left = " <<
left_.trange() \
162 <<
"\n right = " <<
right_.trange() );
165 TA_EXCEPTION(
"The TiledRanges of the left- and right-hand arguments " \
166 "of the binary operation are not equal.");
179 const std::shared_ptr<pmap_interface>&
pmap)
204 typename right_type::dist_eval_type,
op_type,
policy> impl_type;
207 const typename left_type::dist_eval_type left =
left_.make_dist_eval();
208 const typename right_type::dist_eval_type right =
right_.make_dist_eval();
211 std::shared_ptr<impl_type> pimpl =
234 #endif // TILEDARRAY_EXPRESSIONS_BINARY_ENGINE_H__INCLUDED dist_eval_type make_dist_eval() const
Construct the distributed evaluator for this expression.
right_type right_
The right-hand argument.
bool permute_tiles_
Result tile permutation flag (true == permute tile)
void init_struct(const VariableList &target_vars)
Initialize result tensor structure.
const Permutation & perm() const
Permutation accessor.
BinaryEngine< Derived > BinaryEngine_
This class type.
EngineTrait< Derived >::shape_type shape_type
Shape type.
EngineTrait< Derived >::policy policy
The result policy type.
World * world() const
World accessor.
op_type make_op() const
Tile operation factory function.
EngineTrait< Derived >::op_type op_type
The tile operation type.
void init_distribution(World *world, const std::shared_ptr< pmap_interface > &pmap)
Initialize result tensor distribution.
const std::shared_ptr< pmap_interface > & pmap() const
Process map accessor.
VariableList vars_
The variable list of this expression.
static constexpr unsigned int leaves
EngineTrait< Derived >::size_type size_type
Size type.
EngineTrait< Derived >::trange_type trange_type
Tiled range type.
EngineTrait< Derived >::dist_eval_type dist_eval_type
The distributed evaluator type.
unsigned int dim() const
Returns the number of strings in the variable list.
const VariableList & vars() const
Variable list accessor.
void init_struct(const VariableList &target_vars)
Initialize result tensor structure.
EngineTrait< Derived >::pmap_interface pmap_interface
Process map interface type.
void init_vars()
Initialize the variable list of this expression.
BinaryEngine(const BinaryExpr< D > &expr)
Binary expression object.
Variable list manages a list variable strings.
void perm_vars(const VariableList &target_vars)
Set the variable list for this expression.
std::shared_ptr< pmap_interface > pmap_
The process map for the result tensor.
static constexpr bool consumable
World * world_
The world where this expression will be evaluated.
void inc()
Increment the number of tabs.
Permutation of a sequence of objects indexed by base-0 indices.
trange_type make_trange() const
Non-permuting tiled range factory function.
EngineTrait< Derived >::left_type left_type
The left-hand expression type.
Binary, distributed tensor evaluator.
Permutation perm_
The permutation that will be applied to the result.
ExprEngine< Derived > ExprEngine_
Base class type.
void init_distribution(World *world, const std::shared_ptr< pmap_interface > &pmap)
Initialize result tensor distribution.
shape_type shape_
The shape of the result tensor.
Expression output stream.
trange_type make_trange(const Permutation &perm) const
Permuting tiled range factory function.
EngineTrait< Derived >::value_type value_type
The result tile type.
trange_type trange_
The tiled range of the result tensor.
#define TA_USER_ERROR_MESSAGE(m)
left_type left_
The left-hand argument.
void print(ExprOStream os, const VariableList &target_vars) const
Expression print.
void print(ExprOStream &os, const VariableList &target_vars) const
Expression print.
EngineTrait< Derived >::right_type right_type
The right-hand expression type.
void dec()
Decrement the number of tabs.
void init_vars(const VariableList &target_vars)
Initialize the variable list of this expression.