mult_engine.h
Go to the documentation of this file.
1 /*
2  * This file is a part of TiledArray.
3  * Copyright (C) 2014 Virginia Tech
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * Justus Calvin
19  * Department of Chemistry, Virginia Tech
20  *
21  * mult_engine.h
22  * Mar 31, 2014
23  *
24  */
25 
26 #ifndef TILEDARRAY_EXPRESSIONS_MULT_ENGINE_H__INCLUDED
27 #define TILEDARRAY_EXPRESSIONS_MULT_ENGINE_H__INCLUDED
28 
33 #include <btas/optimize/contract.h>
34 
35 namespace TiledArray {
36 namespace expressions {
37 
38 // Forward declarations
39 template <typename, typename>
40 class MultExpr;
41 template <typename, typename, typename>
42 class ScalMultExpr;
43 template <typename, typename, typename>
44 class MultEngine;
45 template <typename, typename, typename, typename>
46 class ScalMultEngine;
47 
48 template <typename Tile>
49 inline auto make_tile_contract_op(const IndexList& left_indices,
50  const IndexList& right_indices,
51  const IndexList& result_indices) {
52  static_assert(TiledArray::detail::is_ta_tensor_v<Tile> ||
53  TiledArray::detail::is_btas_tensor_v<Tile>,
54  "only support BTAS and TA tensors as inner tensors of ToT");
55  // btas::contract only works for col-major storage
57  Tile>) { // can do arbitrary contractions here
58  // auto indices_to_integers = [&]() {
59  // // collect all unique indices
60  // IndexList::container_type all_indices;
61  // all_indices.reserve(left_indices.size() + right_indices.size() +
62  // result_indices.size());
63  // all_indices.insert(all_indices.end(), left_indices.data().begin(),
64  // left_indices.data().end());
65  // all_indices.insert(all_indices.end(), right_indices.data().begin(),
66  // right_indices.data().end());
67  // all_indices.insert(all_indices.end(), result_indices.data().begin(),
68  // result_indices.data().end());
69  // auto end_of_unique = std::unique(all_indices.begin(),
70  // all_indices.end()); all_indices.erase(end_of_unique,
71  // all_indices.end());
72  //
73  // // map each index list to numbers
74  // auto to_integers = [](const container::svector<std::string> indices,
75  // const container::svector<std::string>
76  // all_indices) {
77  // TA_ASSERT(!all_indices.empty());
78  // btas::DEFAULT::index<std::int64_t> result;
79  // result.reserve(indices.size());
80  // for (const auto& idx : indices) {
81  // auto pos = std::find(all_indices.begin(), all_indices.end(),
82  // idx) -
83  // all_indices.begin();
84  // TA_ASSERT(pos < all_indices.size());
85  // result.push_back(pos);
86  // }
87  // return result;
88  // };
89  // auto left_annotation = to_integers(left_indices.data(),
90  // all_indices); auto right_annotation =
91  // to_integers(right_indices.data(), all_indices); auto
92  // result_annotation = to_integers(result_indices.data(), all_indices);
93  // return std::make_tuple(left_annotation, right_annotation,
94  // result_annotation);
95  // };
96  // auto [left_annotation, right_annotation, result_annotation] =
97  // indices_to_integers();
98  // return [left_annotation = std::move(left_annotation),
99  // right_annotation = std::move(right_annotation),
100  // result_annotation = std::move(result_annotation)](
101  // const Tile& left_tile, const Tile& right_tile) {
102  // Tile result;
103  // btas::contract(1, left_tile, left_annotation, right_tile,
104  // right_annotation, 0, result, result_annotation);
105  // return result;
106  // };
107  }
108 }
109 
110 template <typename Left, typename Right, typename Result>
111 struct EngineTrait<MultEngine<Left, Right, Result>> {
112  static_assert(
113  std::is_same<typename EngineTrait<Left>::policy,
114  typename EngineTrait<Right>::policy>::value,
115  "The left- and right-hand expressions must use the same policy class");
116 
117  // Argument typedefs
118  typedef Left left_type;
119  typedef Right right_type;
120 
121  // Operational typedefs
122  typedef TiledArray::detail::Mult<
123  Result, typename EngineTrait<Left>::eval_type,
129  typedef typename op_type::result_type value_type;
130  typedef typename eval_trait<value_type>::type
134  typedef typename Left::policy policy;
137 
138  // Meta data typedefs
139  typedef typename policy::ordinal_type size_type;
140  typedef typename policy::trange_type trange_type;
141  typedef typename policy::shape_type shape_type;
142  typedef typename policy::pmap_interface
144 
145  static constexpr bool consumable = is_consumable_tile<eval_type>::value;
146  static constexpr unsigned int leaves =
148 };
149 
150 template <typename Left, typename Right, typename Scalar, typename Result>
151 struct EngineTrait<ScalMultEngine<Left, Right, Scalar, Result>> {
152  static_assert(
153  std::is_same<typename EngineTrait<Left>::policy,
154  typename EngineTrait<Right>::policy>::value,
155  "The left- and right-hand expressions must use the same policy class");
156 
157  // Argument typedefs
158  typedef Left left_type;
159  typedef Right right_type;
160 
161  // Operational typedefs
162  typedef Scalar scalar_type;
164  Result, typename EngineTrait<Left>::eval_type,
170  typedef typename op_type::result_type value_type;
171  typedef typename eval_trait<value_type>::type
173  typedef typename Left::policy policy;
176 
177  // Meta data typedefs
178  typedef typename policy::ordinal_type size_type;
179  typedef typename policy::trange_type trange_type;
180  typedef typename policy::shape_type shape_type;
181  typedef typename policy::pmap_interface
183 
184  static constexpr bool consumable = is_consumable_tile<eval_type>::value;
185  static constexpr unsigned int leaves =
187 };
188 
190 
201 template <typename Left, typename Right, typename Result>
202 class MultEngine : public ContEngine<MultEngine<Left, Right, Result>> {
203  public:
204  // Class hierarchy typedefs
211 
212  // Argument typedefs
213  typedef typename EngineTrait<MultEngine_>::left_type
215  typedef typename EngineTrait<MultEngine_>::right_type
217 
218  // Operational typedefs
219  typedef typename EngineTrait<MultEngine_>::value_type
223  typedef typename EngineTrait<MultEngine_>::op_type
225  typedef typename EngineTrait<MultEngine_>::policy
231 
232  // Meta data typedefs
233  typedef
237  typedef
241 
242  public:
244 
248  template <typename L, typename R>
249  MultEngine(const MultExpr<L, R>& expr) : ContEngine_(expr) {}
250 
252 
258  void perm_indices(const BipartiteIndexList& target_indices) {
259  if (this->product_type() == TensorProduct::Contraction)
260  ContEngine_::perm_indices(target_indices);
261  else {
262  BinaryEngine_::perm_indices(target_indices);
263  }
264  }
265 
267 
269  void init_indices(const BipartiteIndexList& target_indices) {
270  // to decide what type of product this is must initialize indices down
271  // the tree.
272  // N.B. since this may be a contraction we do not know the target indices
273  // for the left and right, hence do target-neutral initialization
274  BinaryEngine_::left_.init_indices();
275  BinaryEngine_::right_.init_indices();
276  this->product_type_ = compute_product_type(
277  outer(BinaryEngine_::left_.indices()),
278  outer(BinaryEngine_::right_.indices()), outer(target_indices));
279  this->inner_product_type_ = compute_product_type(
280  inner(BinaryEngine_::left_.indices()),
281  inner(BinaryEngine_::right_.indices()), inner(target_indices));
282 
283  // TODO support general products that involve fused, contracted, and free
284  // indices Example: in ijk * jkl -> ijl indices i and l are free, index k is
285  // contracted, and index j is fused
286  // N.B. Currently only 2 types of products are supported:
287  // - Hadamard product (in which all indices are fused), and,
288  // - pure contraction (>=1 contracted, 0 fused, >=1 free indices)
289  // For the ToT arguments only the Hadamard product is supported
290 
291  // Check the *outer* indices to determine whether the arguments are
292  // - contracted, or
293  // - Hadamard-multiplied
294  // The latter is indicated by the equality (modulo permutation) of
295  // the outer left and right arg indices to the target indices.
296  // Only the outer indices matter here since the inner indices only encode
297  // the tile op; the type of the tile op does not need to match the type of
298  // the operation on the outer indices
299  if (this->product_type() == TensorProduct::Hadamard) {
300  // assumes inner op is also Hadamard
301  BinaryEngine_::perm_indices(target_indices);
302  } else {
303  auto children_initialized = true;
304  ContEngine_::init_indices(children_initialized);
305  ContEngine_::perm_indices(target_indices);
306  }
307  }
308 
310  void init_indices() {
311  // to decide what type of product this is must initialize indices down the
312  // tree
313  BinaryEngine_::left_.init_indices();
314  BinaryEngine_::right_.init_indices();
315  auto children_initialized = true;
316  this->product_type_ =
318  outer(BinaryEngine_::right_.indices()));
319  this->inner_product_type_ =
321  inner(BinaryEngine_::right_.indices()));
322 
323  if (this->product_type() == TensorProduct::Hadamard) {
324  BinaryEngine_::init_indices(children_initialized);
325  } else {
326  ContEngine_::init_indices(children_initialized);
327  }
328  }
329 
331 
335  void init_struct(const BipartiteIndexList& target_indices) {
336  this->init_inner_tile_op(inner(target_indices));
337  if (this->product_type() == TensorProduct::Contraction)
338  ContEngine_::init_struct(target_indices);
339  else
340  BinaryEngine_::init_struct(target_indices);
341  }
342 
344 
349  void init_distribution(World* world, std::shared_ptr<pmap_interface> pmap) {
350  if (this->product_type() == TensorProduct::Contraction)
351  ContEngine_::init_distribution(world, pmap);
352  else
354  }
355 
357 
360  if (this->product_type() == TensorProduct::Contraction)
361  return ContEngine_::make_trange();
362  else
364  }
365 
367 
370  trange_type make_trange(const Permutation& perm) const {
371  if (this->product_type() == TensorProduct::Contraction)
372  return ContEngine_::make_trange(perm);
373  else
374  return BinaryEngine_::make_trange(perm);
375  }
376 
378 
381  return BinaryEngine_::left_.shape().mult(BinaryEngine_::right_.shape());
382  }
383 
385 
388  shape_type make_shape(const Permutation& perm) const {
389  return BinaryEngine_::left_.shape().mult(BinaryEngine_::right_.shape(),
390  outer(perm));
391  }
392 
394 
398  value_type>) { // nested tensors
399  const auto inner_prod = this->inner_product_type();
400  if (inner_prod == TensorProduct::Hadamard) {
401  TA_ASSERT(this->product_type() ==
402  inner_prod); // Hadamard automatically works for inner
403  // dimensions as well
404  return op_type(op_base_type());
405  } else if (inner_prod == TensorProduct::Contraction) {
406  return op_type(op_base_type(this->inner_tile_return_op_));
407  } else
408  abort();
409  } else { // plain tensors
410  return op_type(op_base_type());
411  }
412  abort(); // unreachable
413  }
414 
416 
419  template <typename Perm, typename = std::enable_if_t<
420  TiledArray::detail::is_permutation_v<Perm>>>
421  op_type make_tile_op(const Perm& perm) const {
423  value_type>) { // nested tensors
424  const auto inner_prod = this->inner_product_type();
425  if (inner_prod == TensorProduct::Hadamard) {
426  TA_ASSERT(this->product_type() ==
427  inner_prod); // Hadamard automatically works for inner
428  // dimensions as well
429  return op_type(op_base_type(), perm);
430  } else if (inner_prod == TensorProduct::Contraction) {
431  return op_type(op_base_type(this->inner_tile_return_op_), perm);
432  } else
433  abort();
434  } else { // plain tensor
435  return op_type(op_base_type(), perm);
436  }
437  abort(); // unreachable
438  }
439 
441 
444  if (this->product_type() == TensorProduct::Contraction)
446  else
448  }
449 
451 
453  const char* make_tag() const { return "[*] "; }
454 
456 
459  void print(ExprOStream os, const BipartiteIndexList& target_indices) const {
460  if (this->product_type() == TensorProduct::Contraction)
461  return ContEngine_::print(os, target_indices);
462  else
463  return BinaryEngine_::print(os, target_indices);
464  }
465 }; // class MultEngine
466 
468 
473 template <typename Left, typename Right, typename Scalar, typename Result>
475  : public ContEngine<ScalMultEngine<Left, Right, Scalar, Result>> {
476  public:
477  // Class hierarchy typedefs
486 
487  // Argument typedefs
492 
493  // Operational typedefs
502  typedef typename EngineTrait<ScalMultEngine_>::policy
506 
507  // Meta data typedefs
516 
517  public:
519 
524  template <typename L, typename R, typename S>
526 
528 
534  void perm_indices(const BipartiteIndexList& target_indices) {
535  if (this->product_type() == TensorProduct::Contraction)
536  ContEngine_::perm_indices(target_indices);
537  else {
538  BinaryEngine_::perm_indices(target_indices);
539  }
540  }
541 
543 
545  void init_indices(const BipartiteIndexList& target_indices) {
546  BinaryEngine_::left_.init_indices();
547  BinaryEngine_::right_.init_indices();
548  this->product_type_ = compute_product_type(
549  outer(BinaryEngine_::left_.indices()),
550  outer(BinaryEngine_::right_.indices()), outer(target_indices));
551 
552  if (this->product_type() == TensorProduct::Hadamard) {
553  // since already initialized left and right arg indices assign the target
554  // indices
555  BinaryEngine_::perm_indices(target_indices);
556  } else {
557  ContEngine_::init_indices(target_indices);
558  }
559  }
560 
562  void init_indices() {
563  BinaryEngine_::left_.init_indices();
564  BinaryEngine_::right_.init_indices();
565  this->product_type_ =
567  outer(BinaryEngine_::right_.indices()));
568  if (this->product_type() == TensorProduct::Hadamard) {
569  auto outer_indices = outer((left_type::leaves <= right_type::leaves)
570  ? BinaryEngine_::left_.indices()
571  : BinaryEngine_::right_.indices());
572  // assume inner op is also Hadamard
573  // TODO compute inner indices using inner_product_type_
574  auto inner_indices = inner((left_type::leaves <= right_type::leaves)
575  ? BinaryEngine_::left_.indices()
576  : BinaryEngine_::right_.indices());
577  ExprEngine_::indices_ = BipartiteIndexList(outer_indices, inner_indices);
578  } else {
580  }
581  }
582 
584 
588  void init_struct(const BipartiteIndexList& target_indices) {
589  this->init_inner_tile_op(inner(target_indices));
590  if (this->product_type() == TensorProduct::Contraction)
591  ContEngine_::init_struct(target_indices);
592  else
593  BinaryEngine_::init_struct(target_indices);
594  }
595 
597 
602  void init_distribution(World* world, std::shared_ptr<pmap_interface> pmap) {
603  if (this->product_type() == TensorProduct::Contraction)
604  ContEngine_::init_distribution(world, pmap);
605  else
607  }
608 
610 
613  if (this->product_type() == TensorProduct::Contraction)
615  else
617  }
618 
620 
623  if (this->product_type() == TensorProduct::Contraction)
624  return ContEngine_::make_trange();
625  else
627  }
628 
630 
633  trange_type make_trange(const Permutation& perm) const {
634  if (this->product_type() == TensorProduct::Contraction)
635  return ContEngine_::make_trange(perm);
636  else
637  return BinaryEngine_::make_trange(perm);
638  }
639 
641 
644  return BinaryEngine_::left_.shape().mult(BinaryEngine_::right_.shape(),
646  }
647 
649 
652  shape_type make_shape(const Permutation& perm) const {
653  return BinaryEngine_::left_.shape().mult(BinaryEngine_::right_.shape(),
654  ContEngine_::factor_, perm);
655  }
656 
658 
662  }
663 
665 
668  template <typename Perm, typename = std::enable_if_t<
669  TiledArray::detail::is_permutation_v<Perm>>>
670  op_type make_tile_op(const Perm& perm) const {
672  }
673 
675 
677  std::string make_tag() const {
678  std::stringstream ss;
679  ss << "[*] [" << ContEngine_::factor_ << "] ";
680  return ss.str();
681  }
682 
684 
687  void print(ExprOStream os, const BipartiteIndexList& target_indices) const {
688  if (this->product_type() == TensorProduct::Contraction)
689  return ContEngine_::print(os, target_indices);
690  else
691  return BinaryEngine_::print(os, target_indices);
692  }
693 
694 }; // class ScalMultEngine
695 
696 } // namespace expressions
697 } // namespace TiledArray
698 
699 #endif // TILEDARRAY_EXPRESSIONS_MULT_ENGINE_H__INCLUDED
void init_indices(bool children_initialized=false)
Initialize the index list of this expression.
Definition: cont_engine.h:212
dist_eval_type make_dist_eval() const
Definition: cont_engine.h:418
BinaryEngine< MultEngine_ > BinaryEngine_
Binary base class type.
Definition: mult_engine.h:208
EngineTrait< MultEngine_ >::right_type right_type
The right-hand expression type.
Definition: mult_engine.h:216
dist_eval_type make_dist_eval() const
Construct the distributed evaluator for this expression.
Definition: mult_engine.h:443
EngineTrait< MultEngine_ >::trange_type trange_type
Tiled range type.
Definition: mult_engine.h:236
Multiplication expression engine.
Definition: mult_engine.h:202
void perm_indices(const BipartiteIndexList &target_indices)
Set the index list for this expression.
Definition: mult_engine.h:534
EngineTrait< MultEngine_ >::policy policy
The result policy type.
Definition: mult_engine.h:226
dist_eval_type make_dist_eval() const
Construct the distributed evaluator for this expression.
Consumable tile type trait.
Definition: type_traits.h:611
void init_distribution(World *world, std::shared_ptr< pmap_interface > pmap)
Initialize result tensor distribution.
Definition: mult_engine.h:349
Tile scale-multiplication operation.
Definition: mult.h:269
EngineTrait< ScalMultEngine_ >::right_type right_type
The right-hand expression type.
Definition: mult_engine.h:491
trange_type make_trange(const Permutation &perm) const
Permuting tiled range factory function.
Definition: mult_engine.h:370
op_type make_tile_op() const
Non-permuting tile operation factory function.
Definition: mult_engine.h:396
const char * make_tag() const
Expression identification tag.
Definition: mult_engine.h:453
BinaryEngine< ScalMultEngine_ > ExprEngine_
Expression engine base class type.
Definition: mult_engine.h:485
Permutation of a sequence of objects indexed by base-0 indices.
Definition: permutation.h:130
EngineTrait< ScalMultEngine_ >::policy policy
The result policy type.
Definition: mult_engine.h:503
Tile multiplication operation.
Definition: mult.h:57
auto make_tile_contract_op(const IndexList &left_indices, const IndexList &right_indices, const IndexList &result_indices)
Definition: mult_engine.h:49
void perm_indices(const BipartiteIndexList &target_indices)
Set the index list for this expression.
constexpr const bool is_tensor_of_tensor_v
Definition: type_traits.h:155
auto outer(const IndexList &p)
Definition: index_list.h:879
trange_type make_trange() const
Non-permuting tiled range factory function.
Definition: mult_engine.h:359
op_type make_tile_op(const Perm &perm) const
Permuting tile operation factory function.
Definition: mult_engine.h:670
void init_struct(const BipartiteIndexList &target_indices)
Initialize result tensor structure.
Definition: mult_engine.h:588
EngineTrait< MultEngine_ >::value_type value_type
The result tile type.
Definition: mult_engine.h:220
void init_indices()
Initialize the index list of this expression.
Definition: mult_engine.h:562
trange_type make_trange() const
Non-permuting tiled range factory function.
Definition: mult_engine.h:622
trange_type make_trange() const
Non-permuting tiled range factory function.
void init_indices(const BipartiteIndexList &target_indices)
Initialize the index list of this expression.
EngineTrait< MultEngine_ >::op_base_type op_base_type
The tile operation type.
Definition: mult_engine.h:222
TiledArray::detail::BinaryWrapper< op_base_type > op_type
The tile operation type.
Definition: mult_engine.h:128
TiledArray::detail::BinaryWrapper< op_base_type > op_type
The tile operation type.
Definition: mult_engine.h:169
MultEngine(const MultExpr< L, R > &expr)
Constructor.
Definition: mult_engine.h:249
EngineTrait< ScalMultEngine_ >::trange_type trange_type
Tiled range type.
Definition: mult_engine.h:511
EngineTrait< MultEngine_ >::size_type size_type
Size type.
Definition: mult_engine.h:234
void init_indices(const BipartiteIndexList &target_indices)
Initialize the index list of this expression.
Definition: mult_engine.h:269
void init_struct(const BipartiteIndexList &target_indices)
Initialize result tensor structure.
void perm_indices(const BipartiteIndexList &target_indices)
Set the index list for this expression.
Definition: cont_engine.h:190
auto inner(const IndexList &p)
Definition: index_list.h:872
ContEngine< ScalMultEngine_ > ContEngine_
Contraction engine base class.
Definition: mult_engine.h:481
Binary tile operation wrapper.
std::string make_tag() const
Expression identification tag.
Definition: mult_engine.h:677
Multiplication expression.
Definition: mult_expr.h:143
EngineTrait< MultEngine_ >::op_type op_type
The tile operation type.
Definition: mult_engine.h:224
#define TA_ASSERT(EXPR,...)
Definition: error.h:39
EngineTrait< ScalMultEngine_ >::value_type value_type
The result tile type.
Definition: mult_engine.h:495
void init_indices()
Initialize the index list of this expression.
Definition: mult_engine.h:310
void init_struct(const BipartiteIndexList &target_indices)
Initialize result tensor structure.
Definition: mult_engine.h:335
void perm_indices(const BipartiteIndexList &target_indices)
Set the index list for this expression.
Definition: mult_engine.h:258
op_type make_tile_op(const Perm &perm) const
Permuting tile operation factory function.
Definition: mult_engine.h:421
constexpr const bool is_btas_tensor_v
Definition: btas.h:827
right_type right_
The right-hand argument.
Definition: binary_engine.h:87
left_type left_
The left-hand argument.
Definition: binary_engine.h:86
EngineTrait< ScalMultEngine_ >::dist_eval_type dist_eval_type
The distributed evaluator type.
Definition: mult_engine.h:505
TiledArray::detail::Mult< Result, typename EngineTrait< Left >::eval_type, typename EngineTrait< Right >::eval_type, EngineTrait< Left >::consumable, EngineTrait< Right >::consumable > op_base_type
The base tile operation type.
Definition: mult_engine.h:126
BinaryEngine< ScalMultEngine_ > BinaryEngine_
Binary base class type.
Definition: mult_engine.h:483
void print(ExprOStream os, const BipartiteIndexList &target_indices) const
Expression print.
Definition: mult_engine.h:687
ContEngine< MultEngine_ > ContEngine_
Contraction engine base class.
Definition: mult_engine.h:207
ScalMultEngine< Left, Right, Scalar, Result > ScalMultEngine_
This class type.
Definition: mult_engine.h:479
EngineTrait< ScalMultEngine_ >::shape_type shape_type
Shape type.
Definition: mult_engine.h:513
void print(ExprOStream os, const BipartiteIndexList &target_indices) const
Expression print.
Definition: cont_engine.h:449
Expression output stream.
Definition: expr_trace.h:41
void init_distribution(World *world, std::shared_ptr< pmap_interface > pmap)
Initialize result tensor distribution.
Definition: mult_engine.h:602
shape_type make_shape(const Permutation &perm) const
Permuting shape factory function.
Definition: mult_engine.h:652
void init_struct(const BipartiteIndexList &target_indices)
Initialize result tensor structure.
Definition: cont_engine.h:238
scalar_type factor_
Contraction scaling factor.
Definition: cont_engine.h:106
TiledArray::detail::DistEval< value_type, policy > dist_eval_type
The distributed evaluator type.
Definition: mult_engine.h:136
EngineTrait< MultEngine_ >::left_type left_type
The left-hand expression type.
Definition: mult_engine.h:214
op_type make_tile_op() const
Non-permuting tile operation factory function.
Definition: mult_engine.h:660
MultEngine< Left, Right, Result > MultEngine_
This class type.
Definition: mult_engine.h:205
shape_type make_shape() const
Non-permuting shape factory function.
Definition: mult_engine.h:643
EngineTrait< MultEngine_ >::scalar_type scalar_type
Tile scalar type.
Definition: mult_engine.h:230
void init_indices(const BipartiteIndexList &target_indices)
Initialize the index list of this expression.
Definition: mult_engine.h:545
shape_type make_shape() const
Non-permuting shape factory function.
Definition: mult_engine.h:380
EngineTrait< ScalMultEngine_ >::left_type left_type
The left-hand expression type.
Definition: mult_engine.h:489
TensorProduct compute_product_type(const IndexList &left_indices, const IndexList &right_indices)
Definition: product.h:51
EngineTrait< ScalMultEngine_ >::scalar_type scalar_type
Tile scalar type.
Definition: mult_engine.h:497
EngineTrait< ScalMultEngine_ >::pmap_interface pmap_interface
Process map interface type.
Definition: mult_engine.h:515
Op::result_type result_type
The result tile type.
trange_type make_trange(const Permutation &perm) const
Permuting tiled range factory function.
Definition: mult_engine.h:633
EngineTrait< MultEngine_ >::pmap_interface pmap_interface
Process map interface type.
Definition: mult_engine.h:240
void print(ExprOStream os, const BipartiteIndexList &target_indices) const
Expression print.
Multiplication expression engine.
Definition: cont_engine.h:50
dist_eval_type make_dist_eval() const
Construct the distributed evaluator for this expression.
Definition: mult_engine.h:612
EngineTrait< MultEngine_ >::dist_eval_type dist_eval_type
The distributed evaluator type.
Definition: mult_engine.h:228
EngineTrait< MultEngine_ >::shape_type shape_type
Shape type.
Definition: mult_engine.h:238
shape_type make_shape(const Permutation &perm) const
Permuting shape factory function.
Definition: mult_engine.h:388
void init_distribution(World *world, const std::shared_ptr< pmap_interface > &pmap)
Initialize result tensor distribution.
Type trait for extracting the numeric type of tensors and arrays.
Definition: type_traits.h:709
void print(ExprOStream os, const BipartiteIndexList &target_indices) const
Expression print.
Definition: mult_engine.h:459
eval_trait< value_type >::type eval_type
Evaluation tile type.
Definition: mult_engine.h:131
Determine the object type used in the evaluation of tensor expressions.
Definition: type_traits.h:580
Multiplication expression.
Definition: mult_expr.h:88
EngineTrait< ScalMultEngine_ >::op_base_type op_base_type
The tile operation type.
Definition: mult_engine.h:499
Tensor expression object.
Definition: dist_eval.h:247
ScalMultEngine(const ScalMultExpr< L, R, S > &expr)
Constructor.
Definition: mult_engine.h:525
void init_distribution(World *world, std::shared_ptr< pmap_interface > pmap)
Initialize result tensor distribution.
Definition: cont_engine.h:304
policy::pmap_interface pmap_interface
Process map interface type.
Definition: mult_engine.h:143
EngineTrait< ScalMultEngine_ >::op_type op_type
The tile operation type.
Definition: mult_engine.h:501
EngineTrait< ScalMultEngine_ >::size_type size_type
Size type.
Definition: mult_engine.h:509
TiledArray::detail::DistEval< value_type, policy > dist_eval_type
The distributed evaluator type.
Definition: mult_engine.h:175
An N-dimensional shallow copy wrapper for tile objects.
Definition: tile.h:82
Scaled multiplication expression engine.
Definition: mult_engine.h:475
TiledArray::detail::ScalMult< Result, typename EngineTrait< Left >::eval_type, typename EngineTrait< Right >::eval_type, scalar_type, EngineTrait< Left >::consumable, EngineTrait< Right >::consumable > op_base_type
The base tile operation type.
Definition: mult_engine.h:167
BinaryEngine< MultEngine_ > ExprEngine_
Expression engine base class type.
Definition: mult_engine.h:210
TiledArray::detail::numeric_type< value_type >::type scalar_type
Tile scalar type.
Definition: mult_engine.h:133