26 #ifndef TILEDARRAY_TENSOR_TENSOR_MAP_H__INCLUDED
27 #define TILEDARRAY_TENSOR_TENSOR_MAP_H__INCLUDED
29 #include <initializer_list>
30 #include <type_traits>
39 template <
typename,
typename,
typename>
40 class TensorInterface;
44 template <
typename T,
typename Range_ = Range,
typename OpResult = Tensor<T>>
47 template <
typename T,
typename Range_ = Range,
typename OpResult = Tensor<T>>
51 template <
typename T,
typename Range_ = Range,
typename OpResult = Tensor<T>,
54 const Index& lower_bound,
55 const Index& upper_bound) {
59 template <
typename T,
typename Range_ = Range,
typename OpResult = Tensor<T>>
61 T*
const data,
const std::initializer_list<std::size_t>& lower_bound,
62 const std::initializer_list<std::size_t>& upper_bound) {
66 template <
typename T,
typename Range_,
typename OpResult = Tensor<T>>
72 template <
typename T,
typename Range_ = Range,
typename OpResult = Tensor<T>,
75 const Index& lower_bound,
76 const Index& upper_bound) {
81 template <
typename T,
typename Range_ = Range,
typename OpResult = Tensor<T>>
83 const T*
const data,
const std::initializer_list<std::size_t>& lower_bound,
84 const std::initializer_list<std::size_t>& upper_bound) {
89 template <
typename T,
typename Range_,
typename OpResult = Tensor<T>>
91 const T*
const data, Range_&& range) {
93 std::forward<Range_>(range), data);
96 template <
typename T,
typename Range_ = Range,
typename OpResult = Tensor<T>,
99 const T*
const data,
const Index& lower_bound,
const Index& upper_bound) {
104 template <
typename T,
typename Range_ = Range,
typename OpResult = Tensor<T>>
106 const T*
const data,
const std::initializer_list<std::size_t>& lower_bound,
107 const std::initializer_list<std::size_t>& upper_bound) {
112 template <
typename T,
typename Range_,
typename OpResult = Tensor<T>>
114 const T*
const data, Range_&& range) {
116 std::forward<Range_>(range), data);
119 template <
typename T,
typename Range_,
typename OpResult = Tensor<T>,
122 T*
const data,
const Index& lower_bound,
const Index& upper_bound) {
124 const_cast<const T*
>(data));
127 template <
typename T,
typename Range_,
typename OpResult = Tensor<T>>
129 T*
const data,
const std::initializer_list<std::size_t>& lower_bound,
130 const std::initializer_list<std::size_t>& upper_bound) {
132 const_cast<const T*
>(data));
135 template <
typename T,
typename Range_,
typename OpResult = Tensor<T>>
137 T*
const data, Range_&& range) {
139 std::forward<Range_>(range),
const_cast<const T*
>(data));
143 template <
typename T,
typename Range_,
typename OpResult,
typename Index1,
146 const Index1& lower_bound,
const Index2& upper_bound) {
147 map.range_.resize(lower_bound, upper_bound);
151 template <
typename T,
typename Range_,
typename OpResult,
typename Index1,
153 typename = std::enable_if_t<!std::is_const<T>::value>>
155 const Index1& lower_bound,
const Index2& upper_bound) {
156 map.range_.resize(lower_bound, upper_bound);
157 map.data_ =
const_cast<const T*
>(data);
160 template <
typename T,
typename Range_,
typename OpResult,
typename Index1,
163 const std::initializer_list<Index1>& lower_bound,
164 const std::initializer_list<Index2>& upper_bound) {
165 map.range_.resize(lower_bound, upper_bound);
169 template <
typename T,
typename Range_,
typename OpResult,
typename Index1,
171 typename = std::enable_if_t<!std::is_const<T>::value>>
173 const std::initializer_list<Index1>& lower_bound,
174 const std::initializer_list<Index2>& upper_bound) {
175 map.range_.resize(lower_bound, upper_bound);
176 map.data_ =
const_cast<const T*
>(data);
181 #endif // TILEDARRAY_TENSOR_TENSOR_MAP_H__INCLUDED