blk_tsr_expr.h
Go to the documentation of this file.
1 /*
2  * This file is a part of TiledArray.
3  * Copyright (C) 2015 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  * blk_tsr_expr.h
22  * May 20, 2015
23  *
24  */
25 
26 #ifndef TILEDARRAY_EXPRESSIONS_BLK_TSR_EXPR_H__INCLUDED
27 #define TILEDARRAY_EXPRESSIONS_BLK_TSR_EXPR_H__INCLUDED
28 
33 #include "blk_tsr_engine.h"
34 
35 namespace TiledArray {
36 namespace expressions {
37 
38 // Forward declaration
39 template <typename, bool>
40 class TsrExpr;
41 template <typename, bool>
42 class BlkTsrExpr;
43 template <typename, typename>
44 class ScalBlkTsrExpr;
45 
46 template <typename Array>
49 
50 template <typename Array, typename Scalar>
53 
58 
59 template <typename>
60 struct is_aliased;
61 template <typename Array, bool Alias>
62 struct is_aliased<BlkTsrExpr<Array, Alias>>
63  : public std::integral_constant<bool, Alias> {};
64 
65 template <typename Array, bool Alias>
66 struct ExprTrait<BlkTsrExpr<Array, Alias>> {
67  typedef Array array_type;
68  typedef Array& reference;
69  typedef numeric_t<Array> numeric_type;
70  typedef scalar_t<Array> scalar_type;
73 };
74 
75 template <typename Array, bool Alias>
76 struct ExprTrait<BlkTsrExpr<const Array, Alias>> {
77  typedef Array array_type;
78  typedef const Array& reference;
79  typedef numeric_t<Array> numeric_type;
80  typedef scalar_t<Array> scalar_type;
83 };
84 
85 template <typename Array, typename Scalar>
86 struct ExprTrait<ScalBlkTsrExpr<Array, Scalar>> {
87  typedef Array array_type;
88  typedef const Array& reference;
91  typedef numeric_t<Array> numeric_type;
92  typedef Scalar scalar_type;
93 };
94 
95 template <typename Array, typename Scalar>
96 struct ExprTrait<ScalBlkTsrExpr<const Array, Scalar>> {
97  typedef Array array_type;
98  typedef const Array& reference;
101  typedef numeric_t<Array> numeric_type;
102  typedef Scalar scalar_type;
103 };
104 
106 
108 template <typename Derived>
109 class BlkTsrExprBase : public Expr<Derived> {
110  public:
117 
118  protected:
120  std::string annotation_;
125 
126  void check_valid() const {
127  const unsigned int rank = array_.trange().tiles_range().rank();
128  // Check the dimension of the lower block bound
129  using std::size;
130  if (size(lower_bound_) != rank) {
131  if (TiledArray::get_default_world().rank() == 0) {
132  using TiledArray::operator<<;
134  "The size lower bound of the block is not equal to rank of "
135  "the array: "
136  << "\n array rank = " << array_.trange().tiles_range().rank()
137  << "\n lower bound = " << lower_bound_);
138 
139  TA_EXCEPTION(
140  "The size lower bound of the block is not equal to "
141  "rank of the array.");
142  }
143  }
144 
145  // Check the dimension of the upper block bound
146  if (size(upper_bound_) != rank) {
147  if (TiledArray::get_default_world().rank() == 0) {
148  using TiledArray::operator<<;
150  "The size upper bound of the block is not equal to rank of "
151  "the array: "
152  << "\n array rank = " << rank
153  << "\n upper bound = " << upper_bound_);
154 
155  TA_EXCEPTION(
156  "The size upper bound of the block is not equal to "
157  "rank of the array.");
158  }
159  }
160 
161  const bool lower_bound_check =
162  std::equal(std::begin(lower_bound_), std::end(lower_bound_),
163  array_.trange().tiles_range().lobound_data(),
164  [](std::size_t l, std::size_t r) { return l >= r; });
165  const bool upper_bound_check =
166  std::equal(std::begin(upper_bound_), std::end(upper_bound_),
167  array_.trange().tiles_range().upbound_data(),
168  [](std::size_t l, std::size_t r) { return l <= r; });
169  if (!(lower_bound_check && upper_bound_check)) {
170  if (TiledArray::get_default_world().rank() == 0) {
171  using TiledArray::operator<<;
173  "The block range is not a sub-block of the array range: "
174  << "\n array range = " << array_.trange().tiles_range()
175  << "\n block range = [ " << lower_bound_ << " , " << upper_bound_
176  << " )");
177  }
178 
179  TA_EXCEPTION("The block range is not a sub-block of the array range.");
180  }
181 
182  const bool lower_upper_bound_check =
183  std::equal(std::begin(lower_bound_), std::end(lower_bound_),
184  std::begin(upper_bound_),
185  [](std::size_t l, std::size_t r) { return l < r; });
186  if (!lower_upper_bound_check) {
187  if (TiledArray::get_default_world().rank() == 0) {
188  using TiledArray::operator<<;
190  "The block lower bound is not less than the upper bound: "
191  << "\n lower bound = " << lower_bound_
192  << "\n upper bound = " << upper_bound_);
193  }
194 
195  TA_EXCEPTION("The block lower bound is not less than the upper bound.");
196  }
197  }
198 
199  public:
200  // Compiler generated functions
201  BlkTsrExprBase(const BlkTsrExprBase_&) = default;
203  ~BlkTsrExprBase() = default;
206 
208 
215  template <typename Index1, typename Index2,
216  typename = std::enable_if_t<
217  TiledArray::detail::is_integral_range_v<Index1> &&
218  TiledArray::detail::is_integral_range_v<Index2>>>
220  const Index1& lower_bound, const Index2& upper_bound)
221  : Expr_(),
222  array_(array),
224  lower_bound_(std::begin(lower_bound), std::end(lower_bound)),
225  upper_bound_(std::begin(upper_bound), std::end(upper_bound)) {
226 #ifndef NDEBUG
227  check_valid();
228 #endif // NDEBUG
229  }
230 
232 
235  // \param array The array object
236  // \param annotation The array annotation
237  // \param bounds The {lower,upper} bounds of
239  template <typename PairRange,
240  typename = std::enable_if_t<
241  TiledArray::detail::is_gpair_range_v<PairRange>>>
243  const PairRange& bounds)
245  const auto rank = array.range().rank();
246  lower_bound_.reserve(rank);
247  upper_bound_.reserve(rank);
248  int d = 0;
249  for (auto&& bound_d : bounds) {
250  TA_ASSERT(d < rank);
251  lower_bound_.push_back(TiledArray::detail::at(bound_d, 0));
252  upper_bound_.push_back(TiledArray::detail::at(bound_d, 1));
253  ++d;
254  }
255  TA_ASSERT(d == rank);
256 #ifndef NDEBUG
257  check_valid();
258 #endif // NDEBUG
259  }
260 
262 
264  reference array() const { return array_; }
265 
267 
269  const std::string& annotation() const { return annotation_; }
270 
272 
274  const auto& lower_bound() const { return lower_bound_; }
275 
277 
279  const auto& upper_bound() const { return upper_bound_; }
280 
281 }; // class BlkTsrExprBase
282 
284 
288 template <typename Array, bool Alias>
289 class BlkTsrExpr : public BlkTsrExprBase<BlkTsrExpr<Array, Alias>> {
290  public:
300 
301  // Compiler generated functions
302  BlkTsrExpr() = delete;
303  BlkTsrExpr(const BlkTsrExpr_&) = default;
304  BlkTsrExpr(BlkTsrExpr_&&) = default;
305  ~BlkTsrExpr() = default;
306 
308 
315  template <typename Index1, typename Index2,
316  typename = std::enable_if_t<
317  TiledArray::detail::is_integral_range_v<Index1> &&
318  TiledArray::detail::is_integral_range_v<Index2>>>
319  BlkTsrExpr(reference array, const std::string& annotation,
320  const Index1& lower_bound, const Index2& upper_bound)
321  : BlkTsrExprBase_(array, annotation, lower_bound, upper_bound) {}
322 
324 
327  // \param array The array object
328  // \param annotation The array annotation
329  // \param bounds The {lower,upper} bounds of
331  template <typename PairRange,
332  typename = std::enable_if_t<
333  TiledArray::detail::is_gpair_range_v<PairRange>>>
334  BlkTsrExpr(reference array, const std::string& annotation,
335  const PairRange& bounds)
336  : BlkTsrExprBase_(array, annotation, bounds) {}
337 
339 
343  // template <typename Index, typename =
344  // std::enable_if_t<std::is_integral_v<Index>>> BlkTsrExpr(reference array,
345  // const std::string& annotation, const
346  // std::initializer_list<std::initializer_list<Index>>& bounds)
347  // : BlkTsrExprBase_(array, annotation, bounds) {}
348 
350 
353  other.eval_to(*this);
355  }
356 
358 
361  other.eval_to(*this);
363  }
364 
366 
369  template <typename D>
370  reference operator=(const Expr<D>& other) {
371  static_assert(
373  "no_alias() expressions are not allowed on the right-hand side of "
374  "the assignment operator.");
375  other.derived().eval_to(*this);
377  }
378 
380 
383  template <typename D>
384  reference operator+=(const Expr<D>& other) {
385  static_assert(
387  "no_alias() expressions are not allowed on the right-hand side of "
388  "the assignment operator.");
389  return operator=(AddExpr<BlkTsrExpr_, D>(*this, other.derived()));
390  }
391 
393 
396  template <typename D>
397  reference operator-=(const Expr<D>& other) {
398  static_assert(
400  "no_alias() expressions are not allowed on the right-hand side of "
401  "the assignment operator.");
402  return operator=(SubtExpr<BlkTsrExpr_, D>(*this, other.derived()));
403  }
404 
406 
409  template <typename D>
410  reference operator*=(const Expr<D>& other) {
411  static_assert(
413  "no_alias() expressions are not allowed on the right-hand side of "
414  "the assignment operator.");
415  return operator=(MultExpr<BlkTsrExpr_, D>(*this, other.derived()));
416  }
417 
419 
424  }
425 
427 
433  }
434 
435 }; // class BlkTsrExpr
436 
438 
440 template <typename Array>
441 class BlkTsrExpr<const Array, true>
442  : public BlkTsrExprBase<BlkTsrExpr<const Array, true>> {
443  public:
453 
454  // Compiler generated functions
455  BlkTsrExpr() = delete;
456  BlkTsrExpr(const BlkTsrExpr_&) = default;
457  BlkTsrExpr(BlkTsrExpr_&&) = default;
458  ~BlkTsrExpr() = default;
459  BlkTsrExpr_& operator=(const BlkTsrExpr_&) = delete;
461 
463 
470  template <typename Index1, typename Index2,
471  typename = std::enable_if_t<
472  TiledArray::detail::is_integral_range_v<Index1> &&
473  TiledArray::detail::is_integral_range_v<Index2>>>
474  BlkTsrExpr(reference array, const std::string& annotation,
475  const Index1& lower_bound, const Index2& upper_bound)
476  : BlkTsrExprBase_(array, annotation, lower_bound, upper_bound) {}
477 
479 
482  // \param array The array object
483  // \param annotation The array annotation
484  // \param bounds The {lower,upper} bounds of
486  template <typename PairRange,
487  typename = std::enable_if_t<
488  TiledArray::detail::is_gpair_range_v<PairRange>>>
489  BlkTsrExpr(reference array, const std::string& annotation,
490  const PairRange& bounds)
491  : BlkTsrExprBase_(array, annotation, bounds) {}
492 
494 
500  }
501 
502 }; // class BlkTsrExpr<const Array>
503 
505 
508 template <typename Array, typename Scalar>
509 class ScalBlkTsrExpr : public BlkTsrExprBase<ScalBlkTsrExpr<Array, Scalar>> {
510  public:
522 
523  private:
524  scalar_type factor_;
525 
526  public:
527  // Compiler generated functions
528  ScalBlkTsrExpr() = delete;
529  ScalBlkTsrExpr(const ScalBlkTsrExpr_&) = default;
531  ~ScalBlkTsrExpr() = default;
534 
536 
544  template <typename Index1, typename Index2,
545  typename = std::enable_if_t<
546  TiledArray::detail::is_integral_range_v<Index1> &&
547  TiledArray::detail::is_integral_range_v<Index2>>>
548  ScalBlkTsrExpr(reference array, const std::string& annotation,
549  const scalar_type factor, const Index1& lower_bound,
550  const Index2& upper_bound)
551  : BlkTsrExprBase_(array, annotation, lower_bound, upper_bound),
552  factor_(factor) {}
553 
555 
558  // \param array The array object
559  // \param annotation The array annotation
560  // \param factor The scaling factor \param
562  template <typename PairRange,
563  typename = std::enable_if_t<
564  TiledArray::detail::is_gpair_range_v<PairRange>>>
565  ScalBlkTsrExpr(reference array, const std::string& annotation,
566  const scalar_type factor, const PairRange& bounds)
567  : BlkTsrExprBase_(array, annotation, bounds), factor_(factor) {}
568 
570 
572  scalar_type factor() const { return factor_; }
573 
574 }; // class ScalBlkTsrExpr
575 
577 
584 template <typename Array, typename Scalar, bool Alias,
585  typename std::enable_if<
586  TiledArray::detail::is_numeric_v<Scalar>>::type* = nullptr>
587 inline ScalBlkTsrExpr<typename std::remove_const<Array>::type, Scalar>
588 operator*(const BlkTsrExpr<Array, Alias>& expr, const Scalar& factor) {
590  expr.array(), expr.annotation(), factor, expr.lower_bound(),
591  expr.upper_bound());
592 }
593 
595 
602 template <typename Array, typename Scalar, bool Alias,
603  typename std::enable_if<
604  TiledArray::detail::is_numeric_v<Scalar>>::type* = nullptr>
605 inline ScalBlkTsrExpr<typename std::remove_const<Array>::type, Scalar>
606 operator*(const Scalar& factor, const BlkTsrExpr<Array, Alias>& expr) {
608  expr.array(), expr.annotation(), factor, expr.lower_bound(),
609  expr.upper_bound());
610 }
611 
613 
620 template <typename Array, typename Scalar1, typename Scalar2,
621  typename std::enable_if<
622  TiledArray::detail::is_numeric_v<Scalar2>>::type* = nullptr>
624  const ScalBlkTsrExpr<Array, Scalar1>& expr, const Scalar2& factor) {
626  expr.array(), expr.annotation(), expr.factor() * factor,
627  expr.lower_bound(), expr.upper_bound());
628 }
629 
631 
638 template <typename Array, typename Scalar1, typename Scalar2,
639  typename std::enable_if<
640  TiledArray::detail::is_numeric_v<Scalar1>>::type* = nullptr>
642  const Scalar1& factor, const ScalBlkTsrExpr<Array, Scalar2>& expr) {
644  expr.array(), expr.annotation(), expr.factor() * factor,
645  expr.lower_bound(), expr.upper_bound());
646 }
647 
649 
653 template <typename Array>
654 inline ScalBlkTsrExpr<typename std::remove_const<Array>::type,
655  typename ExprTrait<BlkTsrExpr<Array, true>>::numeric_type>
657  typedef
658  typename ExprTrait<BlkTsrExpr<Array, true>>::numeric_type numeric_type;
660  expr.array(), expr.annotation(), -1, expr.lower_bound(),
661  expr.upper_bound());
662 }
663 
665 
670 template <typename Array, typename Scalar>
672  const ScalBlkTsrExpr<Array, Scalar>& expr) {
673  return ScalBlkTsrExpr<Array, Scalar>(expr.array(), expr.annotation(),
674  -expr.factor(), expr.lower_bound(),
675  expr.upper_bound());
676 }
677 
679 
684 template <typename Array, bool Alias>
686  const BlkTsrExpr<Array, Alias>& expr) {
688  expr.array(), expr.annotation(), conj_op(), expr.lower_bound(),
689  expr.upper_bound());
690 }
691 
693 
697 template <typename Array>
699  return BlkTsrExpr<const Array, true>(expr.array(), expr.annotation(),
700  expr.lower_bound(), expr.upper_bound());
701 }
702 
704 
709 template <typename Array, typename Scalar>
711  const ScalBlkTsrExpr<Array, Scalar>& expr) {
713  expr.array(), expr.annotation(),
714  conj_op(TiledArray::detail::conj(expr.factor())), expr.lower_bound(),
715  expr.upper_bound());
716 }
717 
719 
724 template <typename Array, typename Scalar>
726  const ScalConjBlkTsrExpr<Array, Scalar>& expr) {
728  expr.array(), expr.annotation(),
729  TiledArray::detail::conj(expr.factor().factor()), expr.lower_bound(),
730  expr.upper_bound());
731 }
732 
734 
740 template <typename Array, typename Scalar,
741  typename std::enable_if<
742  TiledArray::detail::is_numeric_v<Scalar>>::type* = nullptr>
744  const ConjBlkTsrExpr<const Array>& expr, const Scalar& factor) {
745  return ScalConjBlkTsrExpr<Array, Scalar>(expr.array(), expr.annotation(),
746  conj_op(factor), expr.lower_bound(),
747  expr.upper_bound());
748 }
749 
751 
757 template <typename Array, typename Scalar,
758  typename std::enable_if<
759  TiledArray::detail::is_numeric_v<Scalar>>::type* = nullptr>
761  const Scalar& factor, const ConjBlkTsrExpr<Array>& expr) {
762  return ScalConjBlkTsrExpr<Array, Scalar>(expr.array(), expr.annotation(),
763  conj_op(factor), expr.lower_bound(),
764  expr.upper_bound());
765 }
766 
768 
774 template <typename Array, typename Scalar1, typename Scalar2,
775  typename std::enable_if<
776  TiledArray::detail::is_numeric_v<Scalar2>>::type* = nullptr>
778  const ScalConjBlkTsrExpr<Array, Scalar1>& expr, const Scalar2& factor) {
780  expr.array(), expr.annotation(), conj_op(expr.factor().factor() * factor),
781  expr.lower_bound(), expr.upper_bound());
782 }
783 
785 
791 template <typename Array, typename Scalar1, typename Scalar2,
792  typename std::enable_if<
793  TiledArray::detail::is_numeric_v<Scalar1>>::type* = nullptr>
795  const Scalar1& factor, const ScalConjBlkTsrExpr<Array, Scalar2>& expr) {
797  expr.array(), expr.annotation(), conj_op(expr.factor().factor() * factor),
798  expr.lower_bound(), expr.upper_bound());
799 }
800 
802 
806 template <typename Array>
807 inline ScalConjBlkTsrExpr<
808  Array, typename ExprTrait<ConjBlkTsrExpr<Array>>::numeric_type>
810  typedef typename ExprTrait<ConjBlkTsrExpr<Array>>::numeric_type numeric_type;
812  expr.array(), expr.annotation(), conj_op<numeric_type>(-1),
813  expr.lower_bound(), expr.upper_bound());
814 }
815 
817 
822 template <typename Array, typename Scalar>
824  const ScalConjBlkTsrExpr<Array, Scalar>& expr) {
826  expr.array(), expr.annotation(), conj_op(-expr.factor().factor()),
827  expr.lower_bound(), expr.upper_bound());
828 }
829 
830 } // namespace expressions
831 } // namespace TiledArray
832 
833 #endif // TILEDARRAY_EXPRESSIONS_BLK_TSR_EXPR_H__INCLUDED
reference operator+=(const Expr< D > &other)
Expression plus-assignment operator.
Definition: blk_tsr_expr.h:384
BlkTsrExpr(reference array, const std::string &annotation, const Index1 &lower_bound, const Index2 &upper_bound)
Block expression constructor.
Definition: blk_tsr_expr.h:474
BlkTsrExprBase(reference array, const std::string &annotation, const PairRange &bounds)
Block expression constructor.
Definition: blk_tsr_expr.h:242
boost::container::small_vector< T, N > svector
Definition: vector.h:43
ExprTrait< BlkTsrExpr_ >::engine_type engine_type
Expression engine type.
Definition: blk_tsr_expr.h:447
BlkTsrExprBase_ & operator=(BlkTsrExprBase_ &&)=delete
const auto & lower_bound() const
Lower bound accessor.
Definition: blk_tsr_expr.h:274
scalar_t< Array > scalar_type
Array base scalar type.
Definition: blk_tsr_expr.h:70
ScalAddExpr< Left, Right, typename ExprTrait< AddExpr< Left, Right > >::numeric_type > operator-(const AddExpr< Left, Right > &expr)
Negated addition expression factor.
Definition: add_expr.h:255
typename TiledArray::detail::numeric_type< T >::type numeric_t
numeric_t<T> is an alias for numeric_type<T>::type
Definition: type_traits.h:730
ScalBlkTsrExpr_ & operator=(ScalBlkTsrExpr_ &&)=delete
ExprTrait< ScalBlkTsrExpr_ >::reference reference
The array reference type.
Definition: blk_tsr_expr.h:518
decltype(std::declval< Scalar1 >() *std::declval< Scalar2 >()) mult_t
Definition: type_traits.h:1159
ScalBlkTsrEngine< Array, Scalar, typename Array::eval_type > engine_type
Expression engine type.
Definition: blk_tsr_expr.h:100
scalar_type factor() const
Scaling factor accessor.
Definition: blk_tsr_expr.h:572
BlkTsrExprBase(const BlkTsrExprBase_ &)=default
BlkTsrExpr(const BlkTsrExpr_ &)=default
BlkTsrExprBase(BlkTsrExprBase_ &&)=default
BlkTsrExpr< Array, false > no_alias() const
Flag this tensor expression for a non-aliasing assignment.
Definition: blk_tsr_expr.h:421
Subtraction expression.
Definition: subt_expr.h:88
ExprTrait< Derived >::reference reference
The array reference type.
Definition: blk_tsr_expr.h:115
ScalBlkTsrExpr< Array, Scalar > ScalBlkTsrExpr_
This class type.
Definition: blk_tsr_expr.h:511
BlkTsrExprBase(reference array, const std::string &annotation, const Index1 &lower_bound, const Index2 &upper_bound)
Block expression constructor.
Definition: blk_tsr_expr.h:219
container::svector< std::size_t > lower_bound_
Lower bound of the tile block.
Definition: blk_tsr_expr.h:122
Base class for expression evaluation.
Definition: expr.h:97
ExprTrait< Derived >::array_type array_type
The array type.
Definition: blk_tsr_expr.h:113
BlkTsrEngine< Array, typename Array::eval_type, Alias > engine_type
Expression engine type.
Definition: blk_tsr_expr.h:72
#define TA_EXCEPTION(m)
Definition: error.h:83
BlkTsrExpr_ & operator=(BlkTsrExpr_ &&)=delete
std::enable_if< TiledArray::detail::is_numeric_v< Scalar >, ScalAddExpr< Left, Right, Scalar > >::type operator*(const AddExpr< Left, Right > &expr, const Scalar &factor)
Scaled-addition expression factor.
Definition: add_expr.h:191
ExprTrait< ScalBlkTsrExpr_ >::array_type array_type
The array type.
Definition: blk_tsr_expr.h:516
reference operator*=(const Expr< D > &other)
Expression multiply-assignment operator.
Definition: blk_tsr_expr.h:410
auto rank(const DistArray< Tile, Policy > &a)
Definition: dist_array.h:1617
Expr< Derived > Expr_
Unary base class type.
Definition: blk_tsr_expr.h:112
BlkTsrExprBase_ & operator=(const BlkTsrExprBase_ &)=delete
const auto & upper_bound() const
Upper bound accessor.
Definition: blk_tsr_expr.h:279
ConjAddExpr< Left, Right > conj(const AddExpr< Left, Right > &expr)
Conjugated addition expression factory.
Definition: add_expr.h:281
BlkTsrExprBase< Derived > BlkTsrExprBase_
This class type.
Definition: blk_tsr_expr.h:111
#define TA_ASSERT(EXPR,...)
Definition: error.h:39
World & get_default_world()
Definition: madness.h:90
typename TiledArray::detail::scalar_type< T >::type scalar_t
scalar_t<T> is an alias for scalar_type<T>::type
Definition: type_traits.h:760
reference array() const
Array accessor.
Definition: blk_tsr_expr.h:264
ExprTrait< BlkTsrExpr_ >::reference reference
The array reference type.
Definition: blk_tsr_expr.h:451
ScalBlkTsrExpr(reference array, const std::string &annotation, const scalar_type factor, const Index1 &lower_bound, const Index2 &upper_bound)
Block expression constructor.
Definition: blk_tsr_expr.h:548
Addition expression.
Definition: add_expr.h:88
ExprTrait< BlkTsrExpr_ >::reference reference
The array reference type.
Definition: blk_tsr_expr.h:298
DistArray< Tile, Policy > Array
BlkTsrExpr_ & operator=(const BlkTsrExpr_ &)=delete
BlkTsrExprBase< BlkTsrExpr_ > BlkTsrExprBase_
Block expression base type.
Definition: blk_tsr_expr.h:293
container::svector< std::size_t > upper_bound_
Upper bound of the tile block.
Definition: blk_tsr_expr.h:124
BlkTsrExpr< const Array, true > BlkTsrExpr_
This class type.
Definition: blk_tsr_expr.h:444
Scaled tensor block expression engine.
ConjBlkTsrExpr< array_type > conj() const
Conjugated block tensor expression factory.
Definition: blk_tsr_expr.h:496
Forward declarations.
Definition: dist_array.h:57
ScalBlkTsrExpr< Array, TiledArray::detail::ComplexConjugate< Scalar > > ScalConjBlkTsrExpr
Definition: blk_tsr_expr.h:52
ExprTrait< BlkTsrExpr_ >::array_type array_type
The array type.
Definition: blk_tsr_expr.h:296
BlkTsrExpr(reference array, const std::string &annotation, const PairRange &bounds)
Block expression constructor.
Definition: blk_tsr_expr.h:334
ScalBlkTsrExpr(ScalBlkTsrExpr_ &&)=default
reference array_
The array that this expression is bound to.
Definition: blk_tsr_expr.h:119
std::string annotation_
The array annotation.
Definition: blk_tsr_expr.h:120
ScalBlkTsrExpr(const ScalBlkTsrExpr_ &)=default
ScalBlkTsrExpr(reference array, const std::string &annotation, const scalar_type factor, const PairRange &bounds)
Block expression constructor.
Definition: blk_tsr_expr.h:565
BlkTsrExpr(BlkTsrExpr_ &&)=default
BlkTsrExpr(reference array, const std::string &annotation, const PairRange &bounds)
Block expression constructor.
Definition: blk_tsr_expr.h:489
BlkTsrEngine< Array, typename Array::eval_type, Alias > engine_type
Expression engine type.
Definition: blk_tsr_expr.h:82
reference operator=(BlkTsrExpr_ &&other)
Expression assignment operator.
Definition: blk_tsr_expr.h:360
reference operator-=(const Expr< D > &other)
Expression minus-assignment operator.
Definition: blk_tsr_expr.h:397
numeric_t< Array > numeric_type
Array base numeric type.
Definition: blk_tsr_expr.h:91
ScalBlkTsrEngine< Array, Scalar, typename Array::eval_type > engine_type
Expression engine type.
Definition: blk_tsr_expr.h:90
ExprTrait< ScalBlkTsrExpr_ >::engine_type engine_type
Expression engine type.
Definition: blk_tsr_expr.h:514
ComplexConjugate< S > conj_op(const S factor)
ComplexConjugate operator factory function.
Definition: complex.h:204
const std::string & annotation() const
Tensor annotation accessor.
Definition: blk_tsr_expr.h:269
reference operator=(const BlkTsrExpr_ &other)
Block expression constructor.
Definition: blk_tsr_expr.h:352
ConjBlkTsrExpr< array_type > conj() const
Conjugated block tensor expression factory.
Definition: blk_tsr_expr.h:429
BlkTsrExprBase< ScalBlkTsrExpr_ > BlkTsrExprBase_
Block expresion base type.
Definition: blk_tsr_expr.h:512
ScalBlkTsrExpr_ & operator=(const ScalBlkTsrExpr_ &)=delete
#define TA_USER_ERROR_MESSAGE(m)
Definition: error.h:93
BlkTsrExpr(reference array, const std::string &annotation, const Index1 &lower_bound, const Index2 &upper_bound)
Block expression constructor.
Definition: blk_tsr_expr.h:319
BlkTsrExprBase< BlkTsrExpr_ > BlkTsrExprBase_
Block expression base type.
Definition: blk_tsr_expr.h:446
BlkTsrExpr< Array, Alias > BlkTsrExpr_
This class type.
Definition: blk_tsr_expr.h:291
Multiplication expression.
Definition: mult_expr.h:88
decltype(auto) at(GeneralizedPair &&v, std::size_t idx)
at(pair, i) extracts i-th element from gpair
Definition: type_traits.h:1268
ExprTrait< BlkTsrExpr_ >::engine_type engine_type
Expression engine type.
Definition: blk_tsr_expr.h:294
TILEDARRAY_FORCE_INLINE R conj(const R r)
Wrapper function for std::conj
Definition: complex.h:45
reference operator=(const Expr< D > &other)
Expression assignment operator.
Definition: blk_tsr_expr.h:370
ExprTrait< BlkTsrExpr_ >::array_type array_type
The array type.
Definition: blk_tsr_expr.h:449
ExprTrait< ScalBlkTsrExpr_ >::scalar_type scalar_type
Scalar type.
Definition: blk_tsr_expr.h:520
derived_type & derived()
Cast this object to its derived type.
Definition: expr.h:365
numeric_t< Array > numeric_type
Array base numeric type.
Definition: blk_tsr_expr.h:69