20 #ifndef TILEDARRAY_SPECIAL_KRONECKER_DELTA_H__INCLUDED 21 #define TILEDARRAY_SPECIAL_KRONECKER_DELTA_H__INCLUDED 49 template<
unsigned _N = 1>
53 static constexpr
unsigned N = _N;
93 bool empty()
const {
return empty_; }
96 template<
typename Archive>
99 std::cout <<
"KroneckerDelta::serialize not implemented by design!" << std::endl;
110 for(
auto i=0; i!=2*
N && not
empty; i+=2)
111 empty = (upbound[i] > lobound[i+1] && upbound[i+1] > lobound[i]) ? true :
false;
120 template <
unsigned _N>
124 template <
unsigned _N>
128 template <
unsigned _N>
132 template <
unsigned _N>
136 template <
unsigned _N>
140 template <
unsigned _N>
144 template <
unsigned _N>
148 template <
unsigned _N>
155 template <
unsigned N>
162 template<
typename T,
unsigned _N>
169 template<
typename T,
unsigned _N>
173 const Permutation& perm) {
178 template<
typename T,
unsigned N>
190 template<
typename T,
unsigned N>
202 auto arg1_range = arg1.
range();
203 auto arg2_range = arg2.
range();
205 arg1_range, arg2_range);
208 auto result_data = result.data();
210 auto arg2_data = arg2.
data();
211 auto arg2_volume = arg2_range.volume();
213 if (not arg1.
empty ()) {
216 auto i0_range =
std::min (arg1_extents[0], arg1_extents[1]);
217 for (decltype(i0_range) i0 = 0; i0 != i0_range; ++i0) {
218 auto result_i0i0_ptr = result_data
219 + (i0 * arg1_extents[1] + i0) * arg2_volume;
220 std::copy (arg2_data, arg2_data + arg2_volume, result_i0i0_ptr);
225 auto i0_range =
std::min (arg1_extents[0], arg1_extents[1]);
226 auto i1_range =
std::min (arg1_extents[2], arg1_extents[3]);
227 auto ndim23 = arg1_extents[2] * arg1_extents[3];
228 for (decltype(i0_range) i0 = 0; i0 != i0_range; ++i0) {
229 auto result_i0i0i1i1_ptr_offset = result_data
230 + (i0 * arg1_extents[1] + i0) * ndim23 * arg2_volume;
231 for (decltype(i1_range) i1 = 0; i1 != i1_range; ++i1) {
232 auto result_i0i0i1i1_ptr = result_i0i0i1i1_ptr_offset
233 + (i1 * arg1_extents[3] + i1) * arg2_volume;
234 std::copy (arg2_data, arg2_data + arg2_volume, result_i0i0i1i1_ptr);
249 template<
typename T,
unsigned N>
260 #endif // TILEDARRAY_TEST_SPARSE_TILE_H__INCLUDED static constexpr unsigned N
A (hyperrectangular) interval on , space of integer n-indices.
KroneckerDeltaTile< _N >::numeric_type sum(const KroneckerDeltaTile< _N > &arg)
const size_type * extent_data() const
Range extent data accessor.
generalized (asymmetric) Kronecker delta
An N-dimensional tensor object.
TiledArray::Range range_type
const range_type & range() const
Tensor range object accessor.
KroneckerDeltaTile< _N >::numeric_type product(const KroneckerDeltaTile< _N > &arg)
TiledArray::detail::numeric_type< T >::type numeric_type
the numeric type that supports T
KroneckerDeltaTile< _N >::numeric_type abs_max(const KroneckerDeltaTile< _N > &arg)
unsigned int result_rank() const
Result rank accessor.
KroneckerDeltaTile< _N >::numeric_type max(const KroneckerDeltaTile< _N > &arg)
KroneckerDeltaTile(const range_type &range)
Productive ctor 1.
unsigned int rank() const
Rank accessor.
R make_result_range(const Left &left, const Right &right) const
Construct a result range based on left and right ranges.
const size_type * upbound_data() const
Range upper bound data accessor.
const_pointer data() const
Data direct access.
KroneckerDeltaTile< _N >::numeric_type trace(const KroneckerDeltaTile< _N > &arg)
KroneckerDeltaTile clone() const
clone = copy
KroneckerDeltaTile< _N >::numeric_type squared_norm(const KroneckerDeltaTile< _N > &arg)
KroneckerDeltaTile & operator=(const KroneckerDeltaTile &other)=default
assignment
KroneckerDeltaTile< N > permute(const KroneckerDeltaTile< N > &tile, const TiledArray::Permutation &perm)
DistArray< Tile, Policy > copy(const DistArray< Tile, Policy > &a)
TiledArray::Tensor< T > & mult_to(TiledArray::Tensor< T > &result, const KroneckerDeltaTile< N > &arg1)
unsigned int right_rank() const
Right-hand argument rank accessor.
Contraction to *GEMM helper.
Permutation of a sequence of objects indexed by base-0 indices.
const size_type * lobound_data() const
Range lower bound data accessor.
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)
KroneckerDeltaTile< _N >::numeric_type abs_min(const KroneckerDeltaTile< _N > &arg)
TiledArray::Tensor< T > mult(const KroneckerDeltaTile< _N > &arg1, const TiledArray::Tensor< T > &arg2)
KroneckerDeltaTile< _N >::numeric_type min(const KroneckerDeltaTile< _N > &arg)
unsigned int left_rank() const
Left-hand argument rank accessor.
void serialize(Archive &ar)
MADNESS compliant serialization.
KroneckerDeltaTile()
default constructor makes an empty tile