Go to the documentation of this file.
20 #ifndef TILEDARRAY_SPECIAL_KRONECKER_DELTA_H__INCLUDED
21 #define TILEDARRAY_SPECIAL_KRONECKER_DELTA_H__INCLUDED
51 template <
unsigned _N = 1>
55 static constexpr
unsigned N = _N;
73 : range_(
range), empty_(is_empty(range_)) {}
89 bool empty()
const {
return empty_; }
92 template <
typename Archive>
94 std::cout <<
"KroneckerDelta::serialize not implemented by design!"
106 for (
auto i = 0; i != 2 *
N && not
empty; i += 2)
107 empty = (upbound[i] > lobound[i + 1] && upbound[i + 1] > lobound[i])
118 template <
unsigned _N>
122 template <
unsigned _N>
126 template <
unsigned _N>
130 template <
unsigned _N>
134 template <
unsigned _N>
138 template <
unsigned _N>
142 template <
unsigned _N>
146 template <
unsigned _N>
154 unsigned N,
typename Perm,
155 typename = std::enable_if_t<TiledArray::detail::is_permutation_v<Perm>>>
162 template <
typename T,
unsigned _N>
169 typename T,
unsigned _N,
typename Perm,
170 typename = std::enable_if_t<TiledArray::detail::is_permutation_v<Perm>>>
178 template <
typename T,
unsigned N>
186 template <
typename T,
unsigned _N,
typename Op>
193 typename T,
unsigned _N,
typename Op,
typename Perm,
194 typename = std::enable_if_t<TiledArray::detail::is_permutation_v<Perm>>>
205 template <
typename T,
unsigned N>
215 auto arg1_range = arg1.
range();
216 auto arg2_range = arg2.
range();
221 auto result_data = result.data();
223 auto arg2_data = arg2.
data();
224 auto arg2_volume = arg2_range.volume();
226 if (not arg1.
empty()) {
229 auto i0_range =
std::min(arg1_extents[0], arg1_extents[1]);
230 for (decltype(i0_range) i0 = 0; i0 != i0_range; ++i0) {
231 auto result_i0i0_ptr =
232 result_data + (i0 * arg1_extents[1] + i0) * arg2_volume;
233 std::copy(arg2_data, arg2_data + arg2_volume, result_i0i0_ptr);
237 auto i0_range =
std::min(arg1_extents[0], arg1_extents[1]);
238 auto i1_range =
std::min(arg1_extents[2], arg1_extents[3]);
239 auto ndim23 = arg1_extents[2] * arg1_extents[3];
240 for (decltype(i0_range) i0 = 0; i0 != i0_range; ++i0) {
241 auto result_i0i0i1i1_ptr_offset =
242 result_data + (i0 * arg1_extents[1] + i0) * ndim23 * arg2_volume;
243 for (decltype(i1_range) i1 = 0; i1 != i1_range; ++i1) {
244 auto result_i0i0i1i1_ptr =
245 result_i0i0i1i1_ptr_offset +
246 (i1 * arg1_extents[3] + i1) * arg2_volume;
247 std::copy(arg2_data, arg2_data + arg2_volume, result_i0i0i1i1_ptr);
261 template <
typename T,
unsigned N>
269 #endif // TILEDARRAY_TEST_SPARSE_TILE_H__INCLUDED
R make_result_range(const Left &left, const Right &right) const
Construct a result range based on left and right ranges.
TiledArray::detail::numeric_type< T >::type numeric_type
the numeric type that supports T
const index1_type * lobound_data() const
Range lower bound data accessor.
Contraction to *GEMM helper.
unsigned int left_rank() const
Left-hand argument rank accessor.
KroneckerDeltaTile< _N >::numeric_type trace(const KroneckerDeltaTile< _N > &arg)
const range_type & range() const
Tensor range object accessor.
KroneckerDeltaTile< _N >::numeric_type min(const KroneckerDeltaTile< _N > &arg)
static constexpr unsigned N
generalized (asymmetric) Kronecker delta
const index1_type * upbound_data() const
Range upper bound data accessor.
KroneckerDeltaTile(const KroneckerDeltaTile &)=default
copy constructor (= deep copy)
TiledArray::Tensor< T > gemm(const KroneckerDeltaTile< N > &arg1, const TiledArray::Tensor< T > &arg2, const typename TiledArray::Tensor< T >::numeric_type factor, const TiledArray::math::GemmHelper &gemm_config)
TiledArray::Tensor< T > mult(const KroneckerDeltaTile< _N > &arg1, const TiledArray::Tensor< T > &arg2)
const_pointer data() const
Data direct access.
KroneckerDeltaTile< N > permute(const KroneckerDeltaTile< N > &tile, const Perm &perm)
KroneckerDeltaTile< _N >::numeric_type squared_norm(const KroneckerDeltaTile< _N > &arg)
void serialize(Archive &ar)
MADNESS compliant serialization.
#define TA_ASSERT(EXPR,...)
unsigned int result_rank() const
Result rank accessor.
KroneckerDeltaTile< _N >::numeric_type product(const KroneckerDeltaTile< _N > &arg)
KroneckerDeltaTile< _N >::numeric_type max(const KroneckerDeltaTile< _N > &arg)
TiledArray::Tensor< T > & mult_to(TiledArray::Tensor< T > &result, const KroneckerDeltaTile< N > &arg1)
TiledArray::Tensor< T > binary(const KroneckerDeltaTile< _N > &arg1, const TiledArray::Tensor< T > &arg2, Op &&op)
KroneckerDeltaTile(const range_type &range)
Productive ctor 1.
KroneckerDeltaTile clone() const
clone = copy
unsigned int right_rank() const
Right-hand argument rank accessor.
KroneckerDeltaTile< _N >::numeric_type sum(const KroneckerDeltaTile< _N > &arg)
TiledArray::Range range_type
KroneckerDeltaTile< _N >::numeric_type abs_max(const KroneckerDeltaTile< _N > &arg)
KroneckerDeltaTile< _N >::numeric_type abs_min(const KroneckerDeltaTile< _N > &arg)
An N-dimensional tensor object.
KroneckerDeltaTile()
default constructor makes an empty tile
KroneckerDeltaTile & operator=(const KroneckerDeltaTile &other)=default
assignment
const index1_type * extent_data() const
Range extent data accessor.
unsigned int rank() const
Rank accessor.
A (hyperrectangular) interval on , space of integer -indices.