TiledArray  0.7.0
tile.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  */
19 
20 #ifndef TILEDARRAY_TILE_H__INCLUDED
21 #define TILEDARRAY_TILE_H__INCLUDED
22 
25 #include <memory>
26 
27 // Forward declaration of MADNESS archive type traits
28 namespace madness {
29  namespace archive {
30 
31  template <typename> struct is_output_archive;
32  template <typename> struct is_input_archive;
33 
34  } // namespace archive
35 } // namespace madness
36 
37 namespace TiledArray {
38 
39 
45 
79  template <typename T>
80  class Tile {
81  public:
83  typedef Tile<T> Tile_;
85  typedef T tensor_type;
86 
87  private:
88 
89  std::shared_ptr<tensor_type> pimpl_;
90 
91  public:
92 
93  // Constructors and destructor ---------------------------------------------
94 
95  Tile() = default;
96  Tile(const Tile_&) = default;
97  Tile(Tile_&&) = default;
98 
100 
105  template <typename Arg,
106  typename = typename std::enable_if<
108  not std::is_convertible<Arg,Tile_>::value &&
110  >::type
111  >
112  explicit Tile(Arg&& arg) :
113  pimpl_(std::make_shared<tensor_type>(std::forward<Arg>(arg)))
114  { }
115 
116  template <typename Arg1, typename Arg2, typename ... Args>
117  Tile(Arg1&& arg1, Arg2&& arg2, Args&&... args) :
118  pimpl_(std::make_shared<tensor_type>(std::forward<Arg1>(arg1),
119  std::forward<Arg2>(arg2),
120  std::forward<Args>(args)...))
121  { }
122 
123  ~Tile() = default;
124 
125  // Assignment operators ----------------------------------------------------
126 
127  Tile_& operator=(Tile_&&) = default;
128  Tile_& operator=(const Tile_&) = default;
129 
131  *pimpl_ = tensor;
132  return *this;
133  }
134 
136  *pimpl_ = std::move(tensor);
137  return *this;
138  }
139 
140 
141  // State accessor ----------------------------------------------------------
142 
143  bool empty() const {
144  return not bool(pimpl_);
145  }
146 
147  // Tile accessor -----------------------------------------------------------
148 
149  tensor_type& tensor() { return *pimpl_; }
150 
151  const tensor_type& tensor() const { return *pimpl_; }
152 
153 
154  // Iterator accessor -------------------------------------------------------
155 
157 
159  decltype(auto) begin()
160  { return std::begin(tensor()); }
161 
163 
165  decltype(auto) begin() const
166  { return std::begin(tensor()); }
167 
169 
171  decltype(auto) end()
172  { return std::end(tensor()); }
173 
175 
177  decltype(auto) end() const
178  { return std::end(tensor()); }
179 
180 
181  // Dimension information accessors -----------------------------------------
182 
184 
186  decltype(auto) size() const
187  { return tensor().size(); }
188 
190 
192  decltype(auto) range() const
193  { return tensor().range(); }
194 
195 
196  // Element accessors -------------------------------------------------------
197 
199 
202  decltype(auto) operator[](std::size_t i) const
203  { return tensor()[i]; }
204 
206 
209  decltype(auto) operator[](std::size_t i)
210  { return tensor()[i]; }
211 
213 
217  template <typename... I>
218  decltype(auto) operator()(const I... i) const
219  { return tensor()(i...); }
220 
222 
226  template <typename... I>
227  decltype(auto) operator()(const I... i)
228  { return tensor()(i...); }
229 
230 
231  // Serialization -----------------------------------------------------------
232 
233  template <typename Archive,
234  typename std::enable_if<madness::archive::is_output_archive<Archive>::value>::type* = nullptr>
235  void serialize(Archive &ar) const {
236  // Serialize data for empty tile check
237  bool empty = !static_cast<bool>(pimpl_);
238  ar & empty;
239  if (!empty) {
240  // Serialize tile data
241  ar & *pimpl_;
242  }
243  }
244 
245  template <typename Archive,
246  typename std::enable_if<madness::archive::is_input_archive<Archive>::value>::type* = nullptr>
247  void serialize(Archive &ar) {
248  // Check for empty tile
249  bool empty = false;
250  ar & empty;
251 
252  if (!empty) {
253  // Deserialize tile data
255  ar & tensor;
256 
257  // construct a new pimpl
258  pimpl_ = std::make_shared<T>(std::move(tensor));
259  } else {
260  // Set pimpl to an empty tile
261  pimpl_.reset();
262  }
263  }
264 
265  }; // class Tile
266 
267  // The following functions define the non-intrusive interface used to apply
268  // math operations to Tiles. These functions in turn use the non-intrusive
269  // interface functions to evaluate tiles.
270 
271  namespace detail {
272 
274 
278  template <typename T>
279  Tile<T> make_tile(T&& t) { return Tile<T>(std::forward<T>(t)); }
280 
281  } // namespace detail
282 
283 
284  // Clone operations ----------------------------------------------------------
285 
287 
291  template <typename Arg>
292  inline Tile<Arg> clone(const Tile<Arg>& arg) {
293  return Tile<Arg>(clone(arg.tensor()));
294  }
295 
296 
297  // Empty operations ----------------------------------------------------------
298 
300 
304  template <typename Arg>
305  inline bool empty(const Tile<Arg>& arg) {
306  return arg.empty() || empty(arg.tensor());
307  }
308 
309 
310  // Permutation operations ----------------------------------------------------
311 
313 
318  template <typename Arg>
319  inline decltype(auto) permute(const Tile<Arg>& arg, const Permutation& perm)
320  {
321  return Tile<Arg>(permute(arg.tensor(), perm));
322  }
323 
324 
325  // Shift operations ----------------------------------------------------------
326 
328 
334  template <typename Arg, typename Index>
335  inline decltype(auto) shift(const Tile<Arg>& arg, const Index& range_shift)
336  { return detail::make_tile(shift(arg.tensor(), range_shift)); }
337 
339 
345  template <typename Arg, typename Index>
346  inline Tile<Arg>& shift_to(Tile<Arg>& arg, const Index& range_shift) {
347  shift_to(arg.tensor(), range_shift);
348  return arg;
349  }
350 
351 
352  // Addition operations -------------------------------------------------------
353 
355 
361  template <typename Left, typename Right>
362  inline decltype(auto) add(const Tile<Left>& left, const Tile<Right>& right)
363  { return detail::make_tile(add(left.tensor(), right.tensor())); }
364 
366 
374  template <typename Left, typename Right, typename Scalar,
375  typename std::enable_if<detail::is_numeric<Scalar>::value>::type* = nullptr>
376  inline decltype(auto) add(const Tile<Left>& left, const Tile<Right>& right, const Scalar factor)
377  { return detail::make_tile(add(left.tensor(), right.tensor(), factor)); }
378 
380 
387  template <typename Left, typename Right>
388  inline decltype(auto) add(const Tile<Left>& left, const Tile<Right>& right, const Permutation& perm)
389  { return detail::make_tile(add(left.tensor(), right.tensor(), perm)); }
390 
392 
401  template <typename Left, typename Right, typename Scalar,
402  typename std::enable_if<detail::is_numeric<Scalar>::value>::type* = nullptr>
403  inline decltype(auto) add(const Tile<Left>& left, const Tile<Right>& right,
404  const Scalar factor, const Permutation& perm)
405  { return detail::make_tile(add(left.tensor(), right.tensor(), factor, perm)); }
406 
408 
414  template <typename Arg, typename Scalar,
415  typename std::enable_if<detail::is_numeric<Scalar>::value>::type* = nullptr>
416  inline decltype(auto) add(const Tile<Arg>& arg, const Scalar value)
417  { return detail::make_tile(add(arg.tensor(), value)); }
418 
420 
427  template <typename Arg, typename Scalar,
428  typename std::enable_if<detail::is_numeric<Scalar>::value>::type* = nullptr>
429  inline decltype(auto)
430  add(const Tile<Arg>& arg, const Scalar value, const Permutation& perm)
431  { return detail::make_tile(add(arg.tensor(), value, perm)); }
432 
434 
440  template <typename Result, typename Arg>
441  inline Tile<Result>& add_to(Tile<Result>& result, const Tile<Arg>& arg) {
442  add_to(result.tensor(), arg.tensor());
443  return result;
444  }
445 
447 
455  template <typename Result, typename Arg, typename Scalar,
456  typename std::enable_if<detail::is_numeric<Scalar>::value>::type* = nullptr>
457  inline Tile<Result>&
458  add_to(Tile<Result>& result, const Tile<Arg>& arg, const Scalar factor) {
459  add_to(result.tensor(), arg.tensor(), factor);
460  return result;
461  }
462 
464 
470  template <typename Result, typename Scalar,
471  typename std::enable_if<detail::is_numeric<Scalar>::value>::type* = nullptr>
472  inline Tile<Result>& add_to(Tile<Result>& result, const Scalar value) {
473  add_to(result.tensor(), value);
474  return result;
475  }
476 
477 
478  // Subtraction ---------------------------------------------------------------
479 
481 
487  template <typename Left, typename Right>
488  inline decltype(auto)
489  subt(const Tile<Left>& left, const Tile<Right>& right)
490  { return detail::make_tile(subt(left.tensor(), right.tensor())); }
491 
493 
500  template <typename Left, typename Right, typename Scalar,
501  typename std::enable_if<detail::is_numeric<Scalar>::value>::type* = nullptr>
502  inline decltype(auto)
503  subt(const Tile<Left>& left, const Tile<Right>& right, const Scalar factor)
504  { return detail::make_tile(subt(left.tensor(), right.tensor(), factor)); }
505 
507 
514  template <typename Left, typename Right>
515  inline decltype(auto)
516  subt(const Tile<Left>& left, const Tile<Right>& right, const Permutation& perm)
517  { return detail::make_tile(subt(left.tensor(), right.tensor(), perm)); }
518 
520 
528  template <typename Left, typename Right, typename Scalar,
529  typename std::enable_if<detail::is_numeric<Scalar>::value>::type* = nullptr>
530  inline decltype(auto)
531  subt(const Tile<Left>& left, const Tile<Right>& right, const Scalar factor,
532  const Permutation& perm)
533  { return detail::make_tile(subt(left.tensor(), right.tensor(), factor, perm)); }
534 
536 
541  template <typename Arg, typename Scalar,
542  typename std::enable_if<detail::is_numeric<Scalar>::value>::type* = nullptr>
543  inline decltype(auto)
544  subt(const Tile<Arg>& arg, const Scalar value)
545  { return detail::make_tile(subt(arg.tensor(), value)); }
546 
548 
554  template <typename Arg, typename Scalar,
555  typename std::enable_if<detail::is_numeric<Scalar>::value>::type* = nullptr>
556  inline decltype(auto)
557  subt(const Tile<Arg>& arg, const Scalar value, const Permutation& perm)
558  { return detail::make_tile(subt(arg.tensor(), value, perm)); }
559 
561 
567  template <typename Result, typename Arg>
568  inline Tile<Result>& subt_to(Tile<Result>& result, const Tile<Arg>& arg) {
569  subt_to(result.tensor(), arg.tensor());
570  return result;
571  }
572 
574 
581  template <typename Result, typename Arg, typename Scalar,
582  typename std::enable_if<detail::is_numeric<Scalar>::value>::type* = nullptr>
583  inline Tile<Result>&
584  subt_to(Tile<Result>& result, const Tile<Arg>& arg, const Scalar factor) {
585  subt_to(result.tensor(), arg.tensor(), factor);
586  return result;
587  }
588 
590 
595  template <typename Result, typename Scalar,
596  typename std::enable_if<detail::is_numeric<Scalar>::value>::type* = nullptr>
597  inline Tile<Result>& subt_to(Tile<Result>& result, const Scalar value) {
598  subt_to(result.tensor(), value);
599  return result;
600  }
601 
602 
603  // Multiplication operations -------------------------------------------------
604 
605 
607 
613  template <typename Left, typename Right>
614  inline decltype(auto) mult(const Tile<Left>& left, const Tile<Right>& right)
615  { return detail::make_tile(mult(left.tensor(), right.tensor())); }
616 
618 
625  template <typename Left, typename Right, typename Scalar,
626  typename std::enable_if<detail::is_numeric<Scalar>::value>::type* = nullptr>
627  inline decltype(auto)
628  mult(const Tile<Left>& left, const Tile<Right>& right, const Scalar factor)
629  { return detail::make_tile(mult(left.tensor(), right.tensor(), factor)); }
630 
632 
639  template <typename Left, typename Right>
640  inline decltype(auto)
641  mult(const Tile<Left>& left, const Tile<Right>& right, const Permutation& perm)
642  { return detail::make_tile(mult(left.tensor(), right.tensor(), perm)); }
643 
645 
653  template <typename Left, typename Right, typename Scalar,
654  typename std::enable_if<detail::is_numeric<Scalar>::value>::type* = nullptr>
655  inline decltype(auto)
656  mult(const Tile<Left>& left, const Tile<Right>& right, const Scalar factor,
657  const Permutation& perm)
658  { return detail::make_tile(mult(left.tensor(), right.tensor(), factor, perm)); }
659 
661 
667  template <typename Result, typename Arg>
668  inline Tile<Result>& mult_to(Tile<Result>& result, const Tile<Arg>& arg) {
669  mult_to(result.tensor(), arg.tensor());
670  return result;
671  }
672 
674 
681  template <typename Result, typename Arg, typename Scalar,
682  typename std::enable_if<detail::is_numeric<Scalar>::value>::type* = nullptr>
683  inline Tile<Result>& mult_to(Tile<Result>& result, const Tile<Arg>& arg,
684  const Scalar factor)
685  {
686  mult_to(result.tensor(), arg.tensor(), factor);
687  return result;
688  }
689 
690 
691  // Scaling operations --------------------------------------------------------
692 
694 
699  template <typename Arg, typename Scalar,
700  typename std::enable_if<detail::is_numeric<Scalar>::value>::type* = nullptr>
701  inline decltype(auto) scale(const Tile<Arg>& arg, const Scalar factor)
702  { return detail::make_tile(scale(arg.tensor(), factor)); }
703 
705 
711  template <typename Arg, typename Scalar,
712  typename std::enable_if<detail::is_numeric<Scalar>::value>::type* = nullptr>
713  inline decltype(auto)
714  scale(const Tile<Arg>& arg, const Scalar factor, const Permutation& perm)
715  { return detail::make_tile(scale(arg.tensor(), factor, perm)); }
716 
718 
723  template <typename Result, typename Scalar,
724  typename std::enable_if<detail::is_numeric<Scalar>::value>::type* = nullptr>
725  inline Tile<Result>& scale_to(Tile<Result>& result, const Scalar factor) {
726  scale_to(result.tensor(), factor);
727  return result;
728  }
729 
730 
731  // Negation operations -------------------------------------------------------
732 
734 
738  template <typename Arg>
739  inline decltype(auto) neg(const Tile<Arg>& arg)
740  { return detail::make_tile(neg(arg.tensor())); }
741 
743 
748  template <typename Arg>
749  inline decltype(auto) neg(const Tile<Arg>& arg, const Permutation& perm)
750  { return detail::make_tile(neg(arg.tensor(), perm)); }
751 
753 
757  template <typename Result>
758  inline Tile<Result>& neg_to(Tile<Result>& result) {
759  neg_to(result.tensor());
760  return result;
761  }
762 
763 
764  // Complex conjugate operations ---------------------------------------------
765 
767 
771  template <typename Arg>
772  inline decltype(auto) conj(const Tile<Arg>& arg)
773  { return detail::make_tile(conj(arg.tensor())); }
774 
776 
782  template <typename Arg, typename Scalar,
783  typename std::enable_if<
785  >::type* = nullptr>
786  inline decltype(auto) conj(const Tile<Arg>& arg, const Scalar factor)
787  { return detail::make_tile(conj(arg.tensor(), factor)); }
788 
790 
795  template <typename Arg>
796  inline decltype(auto) conj(const Tile<Arg>& arg, const Permutation& perm)
797  { return detail::make_tile(conj(arg.tensor(), perm)); }
798 
800 
807  template <typename Arg, typename Scalar,
808  typename std::enable_if<
810  >::type* = nullptr>
811  inline decltype(auto) conj(const Tile<Arg>& arg, const Scalar factor, const Permutation& perm)
812  { return detail::make_tile(conj(arg.tensor(), factor, perm)); }
813 
815 
819  template <typename Result>
820  inline Result& conj_to(Tile<Result>& result) {
821  conj_to(result.tensor());
822  return result;
823  }
824 
826 
832  template <typename Result, typename Scalar,
833  typename std::enable_if<
835  >::type* = nullptr>
836  inline Result& conj_to(Tile<Result>& result, const Scalar factor) {
837  conj_to(result.tensor(), factor);
838  return result;
839  }
840 
841  // Contraction operations ----------------------------------------------------
842 
843 
845 
855  template <typename Left, typename Right, typename Scalar,
856  typename std::enable_if<detail::is_numeric<Scalar>::value>::type* = nullptr>
857  inline decltype(auto) gemm(const Tile<Left>& left, const Tile<Right>& right,
858  const Scalar factor, const math::GemmHelper& gemm_config)
859  { return detail::make_tile(gemm(left.tensor(), right.tensor(), factor, gemm_config)); }
860 
862 
874  template <typename Result, typename Left, typename Right, typename Scalar,
875  typename std::enable_if<detail::is_numeric<Scalar>::value>::type* = nullptr>
876  inline Tile<Result>& gemm(Tile<Result>& result, const Tile<Left>& left,
877  const Tile<Right>& right, const Scalar factor,
878  const math::GemmHelper& gemm_config)
879  {
880  gemm(result.tensor(), left.tensor(), right.tensor(), factor, gemm_config);
881  return result;
882  }
883 
884 
885  // Reduction operations ------------------------------------------------------
886 
888 
892  template <typename Arg>
893  inline decltype(auto) trace(const Tile<Arg>& arg)
894  { return trace(arg.tensor()); }
895 
897 
901  template <typename Arg>
902  inline decltype(auto) sum(const Tile<Arg>& arg)
903  { return sum(arg.tensor()); }
904 
906 
910  template <typename Arg>
911  inline decltype(auto) product(const Tile<Arg>& arg)
912  { return product(arg.tensor()); }
913 
915 
920  template <typename Arg>
921  inline decltype(auto) squared_norm(const Tile<Arg>& arg)
922  { return squared_norm(arg.tensor()); }
923 
925 
929  template <typename Arg>
930  inline decltype(auto) norm(const Tile<Arg>& arg)
931  { return norm(arg.tensor()); }
932 
934 
938  template <typename Arg>
939  inline decltype(auto) max(const Tile<Arg>& arg)
940  { return max(arg.tensor()); }
941 
943 
947  template <typename Arg>
948  inline decltype(auto) min(const Tile<Arg>& arg)
949  { return min(arg.tensor()); }
950 
952 
956  template <typename Arg>
957  inline decltype(auto) abs_max(const Tile<Arg>& arg)
958  { return abs_max(arg.tensor()); }
959 
961 
965  template <typename Arg>
966  inline decltype(auto) abs_min(const Tile<Arg>& arg)
967  { return abs_min(arg.tensor()); }
968 
970 
976  template <typename Left, typename Right>
977  inline decltype(auto) dot(const Tile<Left>& left, const Tile<Right>& right)
978  { return dot(left.tensor(), right.tensor()); }
979 
980  // Tile arithmetic operators -------------------------------------------------
981 
982 
984 
990  template <typename Left, typename Right>
991  inline decltype(auto) operator+(const Tile<Left>& left, const Tile<Right>& right)
992  { return add(left, right); }
993 
995 
1002  template <typename Left, typename Right>
1003  inline Tile<Left>& operator+=(Tile<Left>& left, const Tile<Right>& right)
1004  { return add_to(left, right); }
1005 
1007 
1013  template <typename Left, typename Right>
1014  inline decltype(auto) operator-(const Tile<Left>& left, const Tile<Right>& right)
1015  { return subt(left, right); }
1016 
1018 
1025  template <typename Left, typename Right>
1026  inline Tile<Left>& operator-=(Tile<Left>& left, const Tile<Right>& right)
1027  { return subt_to(left, right); }
1028 
1030 
1036  template <typename Left, typename Right>
1037  inline decltype(auto) operator*(const Tile<Left>& left, const Tile<Right>& right)
1038  { return mult(left, right); }
1039 
1041 
1047  template <typename Left, typename Right,
1048  typename std::enable_if<detail::is_numeric<Right>::value>::type* = nullptr>
1049  inline decltype(auto) operator*(const Tile<Left>& left, const Right right)
1050  { return scale(left, right); }
1051 
1053 
1059  template <typename Left, typename Right,
1060  typename std::enable_if<TiledArray::detail::is_numeric<Left>::value>::type* = nullptr>
1061  inline decltype(auto) operator*(const Left left, const Tile<Right>& right)
1062  { return scale(right, left); }
1063 
1065 
1072  template <typename Left, typename Right>
1073  inline Tile<Left>& operator*=(Tile<Left>& left, const Tile<Right>& right)
1074  { return mult_to(left, right); }
1075 
1077 
1081  template <typename Arg>
1082  inline decltype(auto) operator-(const Tile<Arg>& arg)
1083  { return neg(arg); }
1084 
1086 
1091  template <typename Arg>
1092  inline decltype(auto) operator*(const Permutation& perm, Tile<Arg> const arg)
1093  { return permute(arg, perm); }
1094 
1096 
1101  template <typename T>
1102  inline std::ostream &operator<<(std::ostream &os, const Tile<T>& tile) {
1103  os << tile.tensor();
1104  return os;
1105  }
1106 
1108 template<typename Allocator, typename T>
1109 struct Cast<TiledArray::Tensor<typename T::value_type, Allocator>,
1110  Tile<T>,
1111  detail::void_t<decltype(std::declval<TiledArray::Cast<TiledArray::Tensor<typename T::value_type, Allocator>,
1112  T>>()(std::declval<const T &>()))>> {
1113  auto operator()(const Tile<T> &arg) const {
1115  T>{}(arg.tensor());
1116  }
1117 };
1118 
1121 } // namespace TiledArray
1122 
1123 #endif // TILEDARRAY_TILE_H__INCLUDED
detail::ShiftWrapper< T > shift(T &tensor)
Shift a tensor from one range to another.
Tile cast operation.
Definition: cast.h:34
decltype(auto) product(const Tile< Arg > &arg)
Multiply the elements of a tile.
Definition: tile.h:911
decltype(auto) subt(const Tile< Left > &left, const Tile< Right > &right)
Subtract tile arguments.
Definition: tile.h:489
decltype(auto) begin()
Iterator factory.
Definition: tile.h:159
decltype(auto) min(const Tile< Arg > &arg)
Minimum element of a tile.
Definition: tile.h:948
decltype(auto) squared_norm(const Tile< Arg > &arg)
Squared vector 2-norm of the elements of a tile.
Definition: tile.h:921
decltype(auto) size() const
Size accessors.
Definition: tile.h:186
Tile< Result > & scale_to(Tile< Result > &result, const Scalar factor)
Scale to the result tile.
Definition: tile.h:725
An N-dimensional tensor object.
Definition: foreach.h:40
Tile< Result > & mult_to(Tile< Result > &result, const Tile< Arg > &arg)
Multiply to the result tile.
Definition: tile.h:668
void scale(DistArray< Tile, Policy > &a, typename DistArray< Tile, Policy >::element_type scaling_factor)
Definition: utils.h:108
T tensor_type
Tensor type used to represent tile data.
Definition: tile.h:85
void serialize(Archive &ar) const
Definition: tile.h:235
decltype(auto) norm(const Tile< Arg > &arg)
Vector 2-norm of a tile.
Definition: tile.h:930
STL namespace.
Tile< Result > & add_to(Tile< Result > &result, const Tile< Arg > &arg)
Add to the result tile.
Definition: tile.h:441
decltype(auto) end()
Iterator factory.
Definition: tile.h:171
decltype(auto) conj(const Tile< Arg > &arg)
Create a complex conjugated copy of a tile.
Definition: tile.h:772
Tile_ & operator=(Tile_ &&)=default
decltype(auto) add(const Tile< Left > &left, const Tile< Right > &right)
Add tile arguments.
Definition: tile.h:362
bool empty() const
Definition: tile.h:143
const tensor_type & tensor() const
Definition: tile.h:151
DistArray< Tile, Policy > clone(const DistArray< Tile, Policy > &arg)
Create a deep copy of an array.
Definition: clone.h:43
auto operator+=(T1 &left, const T2 &right)
Tensor plus operator.
Definition: operators.h:153
decltype(auto) abs_min(const Tile< Arg > &arg)
Absolute mainimum element of a tile.
Definition: tile.h:966
typename make_void< Ts... >::type void_t
Definition: type_traits.h:282
Tile(Arg1 &&arg1, Arg2 &&arg2, Args &&... args)
Definition: tile.h:117
decltype(auto) abs_max(const Tile< Arg > &arg)
Absolute maximum element of a tile.
Definition: tile.h:957
Tile_ & operator=(tensor_type &&tensor)
Definition: tile.h:135
void serialize(Archive &ar)
Definition: tile.h:247
Tile_ & operator=(const tensor_type &tensor)
Definition: tile.h:130
Tile(Arg &&arg)
Forwarding ctor.
Definition: tile.h:112
TiledArray::expressions::ExprTrait< Left >::scalar_type dot(const TiledArray::expressions::Expr< Left > &a1, const TiledArray::expressions::Expr< Right > &a2)
Definition: utils.h:96
Tile< T > Tile_
This object type.
Definition: tile.h:83
std::array< T, N > & operator*=(std::array< T, N > &, const Permutation &)
In-place permute a std::array.
Definition: permutation.h:501
Tile< Result > & neg_to(Tile< Result > &result)
Multiplication constant scalar to a tile.
Definition: tile.h:758
auto operator-=(T1 &left, const T2 &right)
Tensor minus operator.
Definition: operators.h:169
decltype(auto) max(const Tile< Arg > &arg)
Maximum element of a tile.
Definition: tile.h:939
decltype(auto) neg(const Tile< Arg > &arg)
Negate the tile argument.
Definition: tile.h:739
Contraction to *GEMM helper.
Definition: gemm_helper.h:39
Permutation of a sequence of objects indexed by base-0 indices.
Definition: permutation.h:119
tensor_type & tensor()
Definition: tile.h:149
bool empty(const Tile< Arg > &arg)
Check that arg is empty (no data)
Definition: tile.h:305
Tile< T > make_tile(T &&t)
Factory function for tiles.
Definition: tile.h:279
Tile< Arg > & shift_to(Tile< Arg > &arg, const Index &range_shift)
Shift the range of arg in place.
Definition: tile.h:346
decltype(auto) range() const
Range accessor.
Definition: tile.h:192
decltype(auto) sum(const Tile< Arg > &arg)
Sum the elements of a tile.
Definition: tile.h:902
TiledArray::Range permute(const TiledArray::Range &r, const Perm &p)
Definition: btas.h:285
decltype(auto) mult(const Tile< Left > &left, const Tile< Right > &right)
Multiplication tile arguments.
Definition: tile.h:614
Tile< Result > & subt_to(Tile< Result > &result, const Tile< Arg > &arg)
Subtract from the result tile.
Definition: tile.h:568
An N-dimensional shallow copy wrapper for tile objects.
Definition: tile.h:80
decltype(auto) gemm(const Tile< Left > &left, const Tile< Right > &right, const Scalar factor, const math::GemmHelper &gemm_config)
Contract and scale tile arguments.
Definition: tile.h:857
Result & conj_to(Tile< Result > &result)
In-place complex conjugate a tile.
Definition: tile.h:820
decltype(auto) trace(const Tile< Arg > &arg)
Sum the hyper-diagonal elements a tile.
Definition: tile.h:893