20 #ifndef TILEDARRAY_TENSOR_TENSOR_H__INCLUDED 21 #define TILEDARRAY_TENSOR_TENSOR_H__INCLUDED 34 template <
typename T,
typename A = Eigen::aligned_allocator<T> >
42 typedef typename allocator_type::reference
reference;
44 typedef typename allocator_type::pointer
pointer;
90 allocator_type::deallocate(data_, range_.volume());
98 template <
typename... Ts>
100 static constexpr
bool value =
104 template <typename U, typename std::enable_if<std::is_scalar<U>::value>::type* =
nullptr>
105 static void default_init(
size_type, U*) { }
107 template <typename U, typename std::enable_if<! std::is_scalar<U>::value>::type* =
nullptr>
108 static void default_init(
size_type n, U* u) {
112 std::shared_ptr<Impl> pimpl_;
123 pimpl_ = other.pimpl_;
127 pimpl_ = std::move(other.pimpl_);
137 pimpl_(
std::make_shared<Impl>(
range))
147 template <
typename Value,
148 typename std::enable_if<std::is_same<Value, value_type>::value &&
151 pimpl_(
std::make_shared<Impl>(
range))
153 const size_type n = pimpl_->range_.volume();
154 pointer MADNESS_RESTRICT
const data = pimpl_->data_;
163 template <
typename Value,
164 typename std::enable_if<detail::is_numeric<Value>::value>::type* =
nullptr>
166 pimpl_(
std::make_shared<Impl>(
range))
172 template <
typename InIter,
173 typename std::enable_if<TiledArray::detail::is_input_iterator<InIter>::value &&
174 ! std::is_pointer<InIter>::value>::type* =
nullptr>
176 pimpl_(
std::make_shared<Impl>(
range))
179 pointer MADNESS_RESTRICT
const data = pimpl_->data_;
184 template <
typename U>
186 pimpl_(
std::make_shared<Impl>(
range))
195 template <
typename T1,
196 typename std::enable_if<is_tensor<T1>::value &&
197 ! std::is_same<T1, Tensor_>::value>::type* =
nullptr>
202 [] (
const numeric_t<T1> arg) -> numeric_t<T1>
213 template <
typename T1,
214 typename std::enable_if<is_tensor<T1>::value>::type* =
nullptr>
216 pimpl_(
std::make_shared<Impl>(perm * other.
range()))
219 [] (
const numeric_t<T1> arg) -> numeric_t<T1>
231 template <
typename T1,
typename Op,
232 typename std::enable_if<is_tensor<T1>::value
233 && ! std::is_same<typename std::decay<Op>::type,
247 template <
typename T1,
typename Op,
248 typename std::enable_if<is_tensor<T1>::value>::type* =
nullptr>
250 pimpl_(
std::make_shared<Impl>(perm * other.
range()))
263 template <
typename T1,
typename T2,
typename Op,
264 typename std::enable_if<is_tensor<T1, T2>::value>::type* =
nullptr>
265 Tensor(
const T1& left,
const T2& right, Op&& op) :
280 template <
typename T1,
typename T2,
typename Op,
281 typename std::enable_if<is_tensor<T1, T2>::value>::type* =
nullptr>
283 pimpl_(
std::make_shared<Impl>(perm * left.
range()))
291 result = detail::tensor_op<Tensor_>(
298 template <
typename T1,
299 typename std::enable_if<is_tensor<T1>::value>::type* =
nullptr>
302 typename T1::const_reference MADNESS_RESTRICT t1) { tr = t1; }, *
this, other);
311 return (pimpl_ ? pimpl_->range_ : empty_range_);
318 return (pimpl_ ? pimpl_->range_.volume() : 0ul);
327 return pimpl_->data_[i];
337 return pimpl_->data_[i];
345 template <
typename Index,
346 typename std::enable_if<
347 ! std::is_integral<Index>::value>::type* =
nullptr>
351 return pimpl_->data_[pimpl_->range_.ordinal(i)];
358 template <
typename Index,
359 typename std::enable_if<
360 ! std::is_integral<Index>::value>::type* =
nullptr>
364 return pimpl_->data_[pimpl_->range_.ordinal(i)];
371 template<
typename... Index>
374 TA_ASSERT(pimpl_->range_.includes(idx...));
375 return pimpl_->data_[pimpl_->range_.ordinal(idx...)];
382 template<
typename... Index>
385 TA_ASSERT(pimpl_->range_.includes(idx...));
386 return pimpl_->data_[pimpl_->range_.ordinal(idx...)];
403 return (pimpl_ ? pimpl_->data_ + pimpl_->range_.volume() : NULL);
410 return (pimpl_ ? pimpl_->data_ + pimpl_->range_.volume() : NULL);
427 bool empty()
const {
return !pimpl_; }
434 template <
typename Archive,
435 typename std::enable_if<
439 ar & pimpl_->range_.volume();
440 ar & madness::archive::wrap(pimpl_->data_, pimpl_->range_.volume());
452 template <
typename Archive,
453 typename std::enable_if<
459 std::shared_ptr<Impl> temp = std::make_shared<Impl>();
460 temp->data_ = temp->allocate(n);
464 auto* data_ptr = temp->data_;
465 for(
size_type i=0; i!=n; ++i, ++data_ptr)
468 ar & madness::archive::wrap(temp->data_, n);
471 temp->deallocate(temp->data_, n);
488 template <
typename Index>
490 block(
const Index& lower_bound,
const Index& upper_bound) {
493 lower_bound, upper_bound), pimpl_->data_);
497 block(
const std::initializer_list<size_type>& lower_bound,
498 const std::initializer_list<size_type>& upper_bound)
502 lower_bound, upper_bound), pimpl_->data_);
505 template <
typename Index>
507 block(
const Index& lower_bound,
const Index& upper_bound)
const {
510 lower_bound, upper_bound), pimpl_->data_);
514 block(
const std::initializer_list<size_type>& lower_bound,
515 const std::initializer_list<size_type>& upper_bound)
const 519 lower_bound, upper_bound), pimpl_->data_);
536 template <
typename Index>
539 pimpl_->range_.inplace_shift(bound_shift);
548 template <
typename Index>
566 template <
typename Right,
typename Op,
567 typename std::enable_if<is_tensor<Right>::value>::type* =
nullptr>
569 return Tensor_(*
this, right, op);
581 template <
typename Right,
typename Op,
582 typename std::enable_if<is_tensor<Right>::value>::type* =
nullptr>
584 return Tensor_(*
this, right, op, perm);
599 template <
typename Right,
typename Op,
600 typename std::enable_if<is_tensor<Right>::value>::type* =
nullptr>
613 template <
typename Op>
627 template <
typename Op>
629 return Tensor_(*
this, op, perm);
638 template <
typename Op>
652 template <
typename Scalar,
653 typename std::enable_if<detail::is_numeric<Scalar>::value>::type* =
nullptr>
656 {
return a * factor; });
666 template <
typename Scalar,
667 typename std::enable_if<detail::is_numeric<Scalar>::value>::type* =
nullptr>
670 {
return a * factor; }, perm);
678 template <
typename Scalar,
679 typename std::enable_if<detail::is_numeric<Scalar>::value>::type* =
nullptr>
692 template <
typename Right,
693 typename std::enable_if<is_tensor<Right>::value>::type* =
nullptr>
696 const numeric_t<Right> r)
707 template <
typename Right,
708 typename std::enable_if<is_tensor<Right>::value>::type* =
nullptr>
711 const numeric_t<Right> r)
723 template <
typename Right,
typename Scalar,
724 typename std::enable_if<is_tensor<Right>::value &&
728 const numeric_t<Right> r)
741 template <
typename Right,
typename Scalar,
742 typename std::enable_if<is_tensor<Right>::value &&
749 {
return (l + r) * factor; }, perm);
759 {
return a + value; });
770 {
return a + value; }, perm);
778 template <
typename Right,
779 typename std::enable_if<is_tensor<Right>::value>::type* =
nullptr>
782 const numeric_t<Right> r) { l += r; });
792 template <
typename Right,
typename Scalar,
793 typename std::enable_if<is_tensor<Right>::value &&
797 const numeric_t<Right> r)
798 { (l += r) *= factor; });
817 template <
typename Right,
818 typename std::enable_if<is_tensor<Right>::value>::type* =
nullptr>
821 const numeric_t<Right> r)
832 template <
typename Right,
833 typename std::enable_if<is_tensor<Right>::value>::type* =
nullptr>
836 const numeric_t<Right> r)
848 template <
typename Right,
typename Scalar,
849 typename std::enable_if<is_tensor<Right>::value &&
853 const numeric_t<Right> r)
866 template <
typename Right,
typename Scalar,
867 typename std::enable_if<is_tensor<Right>::value &&
873 const numeric_t<Right> r)
892 return add(-value, perm);
900 template <
typename Right,
901 typename std::enable_if<is_tensor<Right>::value>::type* =
nullptr>
904 const numeric_t<Right> r)
915 template <
typename Right,
typename Scalar,
916 typename std::enable_if<is_tensor<Right>::value &&
920 const numeric_t<Right> r)
921 { (l -= r) *= factor; });
939 template <
typename Right,
940 typename std::enable_if<is_tensor<Right>::value>::type* =
nullptr>
943 const numeric_t<Right> r)
954 template <
typename Right,
955 typename std::enable_if<is_tensor<Right>::value>::type* =
nullptr>
958 const numeric_t<Right> r)
970 template <
typename Right,
typename Scalar,
971 typename std::enable_if<is_tensor<Right>::value &&
975 const numeric_t<Right> r)
988 template <
typename Right,
typename Scalar,
989 typename std::enable_if<is_tensor<Right>::value &&
995 const numeric_t<Right> r)
1004 template <
typename Right,
1005 typename std::enable_if<is_tensor<Right>::value>::type* =
nullptr>
1008 const numeric_t<Right> r)
1019 template <
typename Right,
typename Scalar,
1020 typename std::enable_if<is_tensor<Right>::value &&
1024 const numeric_t<Right> r)
1025 { (l *= r) *= factor; });
1069 template <
typename Scalar,
1070 typename std::enable_if<detail::is_numeric<Scalar>::value>::type* =
nullptr>
1093 template <
typename Scalar,
1094 typename std::enable_if<detail::is_numeric<Scalar>::value>::type* =
nullptr>
1113 template <
typename Scalar,
1114 typename std::enable_if<detail::is_numeric<Scalar>::value>::type* =
nullptr>
1132 template <
typename U,
typename AU,
typename V,
1155 integer m = 1, n = 1, k = 1;
1159 const integer lda = (gemm_helper.
left_op() == madness::cblas::NoTrans ? k : m);
1160 const integer ldb = (gemm_helper.
right_op() == madness::cblas::NoTrans ? n : k);
1163 pimpl_->data_, lda, other.data(), ldb,
numeric_type(0), result.data(), n);
1208 typename U,
typename AU,
typename V,
typename AV,
typename W,
1226 pimpl_->range_.lobound_data()));
1228 pimpl_->range_.upbound_data()));
1230 pimpl_->range_.extent_data()));
1235 pimpl_->range_.lobound_data()));
1237 pimpl_->range_.upbound_data()));
1239 pimpl_->range_.extent_data()));
1243 right.range().lobound_data()));
1245 right.range().upbound_data()));
1247 right.range().extent_data()));
1255 (gemm_helper.
left_op() == madness::cblas::NoTrans ? k : m);
1257 (gemm_helper.
right_op() == madness::cblas::NoTrans ? n : k);
1260 left.data(), lda, right.data(), ldb,
numeric_type(1), pimpl_->data_, n);
1277 const size_type n = pimpl_->range_.rank();
1278 const size_type* MADNESS_RESTRICT
const lower = pimpl_->range_.lobound_data();
1279 const size_type* MADNESS_RESTRICT
const upper = pimpl_->range_.upbound_data();
1280 const size_type* MADNESS_RESTRICT
const stride = pimpl_->range_.stride_data();
1289 lower_max =
std::max(lower_max, lower_i);
1290 upper_min =
std::min(upper_min, upper_i);
1295 if(lower_max < upper_min) {
1297 size_type first = 0ul, last = 0ul, trace_stride = 0ul;
1302 first += (lower_max - lower_i) * stride_i;
1303 last += (upper_min - lower_i) * stride_i;
1304 trace_stride += stride_i;
1309 for(; first < last; first += trace_stride)
1310 result +=
data[first];
1329 template <
typename ReduceOp,
typename JoinOp,
typename Scalar>
1351 template <
typename Right,
typename ReduceOp,
typename JoinOp,
typename Scalar,
1352 typename std::enable_if<is_tensor<Right>::value>::type* =
nullptr>
1398 template <
typename Numeric = numeric_type>
1411 template <
typename Numeric = numeric_type>
1450 template <
typename Right,
1451 typename std::enable_if<is_tensor<Right>::value>::type* =
nullptr>
1454 const numeric_t<Right> r)
1468 template <
typename Right,
1469 typename std::enable_if<is_tensor<Right>::value>::type* =
nullptr>
1472 const numeric_t<Right> r)
1481 template <
typename T,
typename A>
1484 template <
typename T,
typename A>
1486 return a.range() == b.range() && std::equal(a.data(), a.data() + a.size(), b.data());
1488 template <
typename T,
typename A>
1495 template <
typename T,
typename A>
1497 template <
typename Op,
typename T1>
1499 return Tensor<T, A>(std::forward<T1>(t1), std::forward<Op>(op));
1501 template <
typename Op,
typename T1>
1503 return Tensor<T, A>(std::forward<T1>(t1), std::forward<Op>(op), perm);
1505 template <
typename Op,
typename T1,
typename T2>
1507 return Tensor<T, A>(std::forward<T1>(t1), std::forward<T2>(t2),
1508 std::forward<Op>(op));
1510 template <
typename Op,
typename T1,
typename T2>
1512 const Permutation& perm, T1&& t1, T2&& t2)
const {
1513 return Tensor<T, A>(std::forward<T1>(t1), std::forward<T2>(t2),
1514 std::forward<Op>(op), perm);
1519 #ifndef TILEDARRAY_HEADER_ONLY 1522 class Tensor<double, Eigen::aligned_allocator<double> >;
1524 class Tensor<float, Eigen::aligned_allocator<float> >;
1526 class Tensor<int, Eigen::aligned_allocator<int> >;
1528 class Tensor<long, Eigen::aligned_allocator<long> >;
1534 #endif // TILEDARRAY_HEADER_ONLY 1538 #endif // TILEDARRAY_TENSOR_TENSOR_H__INCLUDED
detail::TensorInterface< T, BlockRange > block(const Index &lower_bound, const Index &upper_bound)
allocator_type::const_pointer const_pointer
Element const pointer type.
allocator_type::value_type value_type
Array element type.
constexpr bool operator==(const DenseShape &a, const DenseShape &b)
pointer data()
Data direct access.
A (hyperrectangular) interval on , space of integer n-indices.
void compute_matrix_sizes(integer &m, integer &n, integer &k, const Left &left, const Right &right) const
Compute the matrix dimension that can be used in a *GEMM call.
void inplace_tensor_op(Op &&op, TR &result, const Ts &... tensors)
In-place tensor operations with contiguous data.
allocator_type::const_reference const_reference
Element reference type.
bool left_result_congruent(const Left &left, const Result &result) const
Test that the outer dimensions of left are congruent (have equal extent) with that of the result tens...
allocator_type::reference reference
Element reference type.
allocator_type::difference_type difference_type
Difference type.
Tensor_ neg(const Permutation &perm) const
Create a negated and permuted copy of this tensor.
reference operator[](const size_type i)
Element accessor.
const_pointer const_iterator
Element const iterator type.
Tensor_ & add_to(const Right &right)
Add other to this tensor.
An N-dimensional tensor object.
bool right_result_congruent(const Right &right, const Result &result) const
Test that the outer dimensions of right are congruent (have equal extent) with that of the result ten...
void swap(Bitset< B > &b0, Bitset< B > &b1)
Tensor_ permute(const Permutation &perm) const
Create a permuted copy of this tensor.
madness::cblas::CBLAS_TRANSPOSE right_op() const
bool left_right_congruent(const Left &left, const Right &right) const
Test that the inner dimensions of left are congruent (have equal extent) with that of right...
std::enable_if<!(std::is_scalar< Arg >::value &&std::is_scalar< Result >::value)>::type uninitialized_copy_vector(const std::size_t n, const Arg *const arg, Result *const result)
const range_type & range() const
Tensor range object accessor.
Tensor_ scale(const Scalar factor) const
Construct a scaled copy of this tensor.
numeric_type inner_product(const Right &other) const
Vector inner product.
TiledArray::detail::numeric_type< T >::type numeric_type
the numeric type that supports T
Tensor_ add(const Right &right, const Permutation &perm) const
Add this and other to construct a new, permuted tensor.
TILEDARRAY_FORCE_INLINE R norm(const R r)
Wrapper function for std::norm
Tensor_ & add_to(const Right &right, const Scalar factor)
Add other to this tensor, and scale the result.
unsigned int result_rank() const
Result rank accessor.
Tensor_ conj(const Scalar factor, const Permutation &perm) const
Create a complex conjugated, scaled, and permuted copy of this tensor.
Type trait for extracting the numeric type of tensors and arrays.
Tensor(const T1 &other, const Permutation &perm)
Construct a permuted tensor copy.
Tensor_ conj() const
Create a complex conjugated copy of this tensor.
Tensor_ add(const numeric_type value, const Permutation &perm) const
Add a constant to a permuted copy of this tensor.
Tensor_ subt(const numeric_type value, const Permutation &perm) const
Subtract a constant from a permuted copy of this tensor.
KroneckerDeltaTile< _N >::numeric_type max(const KroneckerDeltaTile< _N > &arg)
Tensor_ mult(const Right &right, const Scalar factor) const
Scale and multiply this by right to create a new tensor.
scalar_type abs_max() const
Absolute maximum element.
Tensor_ & operator=(const Tensor_ &other)
constexpr bool operator!=(const DenseShape &a, const DenseShape &b)
void tensor_init(Op &&op, TR &result, const Ts &... tensors)
Initialize tensor with contiguous tensor arguments.
auto clone_range(const T &tensor)
Create a copy of the range of the tensor.
auto abs(const ComplexConjugate< T > &a)
Type trait for extracting the scalar type of tensors and arrays.
Tensor(const Range &range, const U *u)
const_iterator end() const
Iterator factory.
R make_result_range(const Left &left, const Right &right) const
Construct a result range based on left and right ranges.
Tensor_ & inplace_binary(const Right &right, Op &&op)
Use a binary, element wise operation to modify this tensor.
Tensor(const Tensor_ &other)
bool empty() const
Test if the tensor is empty.
Tensor_ mult(const Right &right) const
Multiply this by right to create a new tensor.
std::enable_if<! std::is_scalar< Arg >::value >::type destroy_vector(const std::size_t n, Arg *const arg)
Tensor_ subt(const Right &right, const Scalar factor, const Permutation &perm) const
Subtract right from this and return the result scaled by a scaling factor and permuted by perm...
TiledArray::detail::scalar_type< T >::type scalar_type
the scalar type that supports T
Tensor_ & mult_to(const Right &right)
Multiply this tensor by right.
const_pointer data() const
Data direct access.
Tensor_ & gemm(const Tensor< U, AU > &left, const Tensor< V, AV > &right, const W factor, const math::GemmHelper &gemm_helper)
Contract two tensors and accumulate the scaled result to this tensor.
ordinal_type volume() const
Range volume accessor.
Tensor_ & operator=(Tensor_ &&other)
const_reference operator[](const Index &i) const
Element accessor.
numeric_type product() const
Product of elements.
Tensor(const T1 &other, Op &&op, const Permutation &perm)
Copy, modify, and permute the data from other.
const_iterator begin() const
Iterator factory.
const_reference operator[](const size_type i) const
Element accessor.
Tensor(const T1 &left, const T2 &right, Op &&op, const Permutation &perm)
Copy, modify, and permute the data from left, and right.
Tensor_ unary(Op &&op, const Permutation &perm) const
Use a unary, element wise operation to construct a new, permuted tensor.
Tensor_ binary(const Right &right, Op &&op) const
Use a binary, element wise operation to construct a new tensor.
T identity()
identity for group of objects of type T
scalar_type norm() const
Vector 2-norm.
Tensor_ & subt_to(const Right &right, const Scalar factor)
Subtract right from and scale this tensor.
Tensor_ add(const Right &right) const
Add this and other to construct a new tensors.
Tensor_ subt(const Right &right, const Scalar factor) const
Subtract right from this and return the result scaled by a scaling factor.
Tensor_ add(const Right &right, const Scalar factor, const Permutation &perm) const
Scale and add this and other to construct a new, permuted tensor.
numeric_type max(typename std::enable_if< detail::is_strictly_ordered< Numeric >::value >::type *=nullptr) const
Maximum element.
Tensor_ mult(const Right &right, const Permutation &perm) const
Multiply this by right to create a new, permuted tensor.
void reduce_op(ReduceOp &&reduce_op, JoinOp &&join_op, const Result &identity, const std::size_t n, Result &result, const Args *const ... args)
Tensor(const T1 &other, Op &&op)
Copy and modify the data from other.
Tensor interface for external data.
scalar_type abs_min() const
Absolute minimum element.
reference operator[](const Index &i)
Element accessor.
Tensor_ conj(const Scalar factor) const
Create a complex conjugated and scaled copy of this tensor.
Tensor< T, A > Tensor_
This class type.
Tensor_ & scale_to(const Scalar factor)
Scale this tensor.
iterator begin()
Iterator factory.
iterator end()
Iterator factory.
Tensor_ & mult_to(const Right &right, const Scalar factor)
Scale and multiply this tensor by right.
detail::TensorInterface< T, BlockRange > block(const std::initializer_list< size_type > &lower_bound, const std::initializer_list< size_type > &upper_bound)
Tensor_ & conj_to()
Complex conjugate this tensor.
Tensor_ subt(const Right &right, const Permutation &perm) const
Subtract right from this and return the result permuted by perm.
numeric_type dot(const Right &other) const
Vector dot (not inner!) product.
Tensor_ gemm(const Tensor< U, AU > &other, const V factor, const math::GemmHelper &gemm_helper) const
Contract this tensor with other.
Tensor_ add(const numeric_type value) const
Add a constant to a copy of this tensor.
Range range_type
Tensor range type.
range_type::size_type size_type
size type
detail::TensorInterface< const T, BlockRange > block(const std::initializer_list< size_type > &lower_bound, const std::initializer_list< size_type > &upper_bound) const
Tensor_ scale(const Scalar factor, const Permutation &perm) const
Construct a scaled and permuted copy of this tensor.
unsigned int right_rank() const
Right-hand argument rank accessor.
Tensor_ binary(const Right &right, Op &&op, const Permutation &perm) const
Use a binary, element wise operation to construct a new, permuted tensor.
std::size_t size_type
Size type.
void serialize(Archive &ar)
Output serialization function.
void gemm(madness::cblas::CBLAS_TRANSPOSE op_a, madness::cblas::CBLAS_TRANSPOSE op_b, const integer m, const integer n, const integer k, const S1 alpha, const T1 *a, const integer lda, const T2 *b, const integer ldb, const S2 beta, T3 *c, const integer ldc)
Contraction to *GEMM helper.
size_type size() const
Tensor dimension size accessor.
Permutation of a sequence of objects indexed by base-0 indices.
ComplexConjugate< S > conj_op(const S factor)
ComplexConjugate operator factory function.
Tensor_ neg() const
Create a negated copy of this tensor.
A allocator_type
Allocator type.
Range that references a subblock of another range.
Tensor_ subt(const Right &right) const
Subtract right from this and return the result.
Tensor_ shift(const Index &bound_shift) const
Shift the lower and upper bound of this range.
Tensor_ & operator=(const T1 &other)
pointer iterator
Element iterator type.
value_type trace() const
Generalized tensor trace.
madness::cblas::CBLAS_TRANSPOSE left_op() const
Tensor_ & inplace_unary(Op &&op)
Use a unary, element wise operation to modify this tensor.
Tensor(const range_type &range)
Construct tensor.
reference operator()(const Index &... idx)
Element accessor.
Tensor_ subt(const numeric_type value) const
Subtract a constant from a copy of this tensor.
Tensor_ & shift_to(const Index &bound_shift)
Shift the lower and upper bound of this tensor.
void swap(Tensor_ &other)
Swap tensor data.
numeric_type sum() const
Sum of elements.
decltype(auto) reduce(ReduceOp &&reduce_op, JoinOp &&join_op, Scalar identity) const
Unary reduction operation.
Tensor(const range_type &range, const Value &value)
Construct a tensor with a fill value.
Scalar tensor_reduce(ReduceOp &&reduce_op, JoinOp &&join_op, Scalar identity, const T1 &tensor1, const Ts &... tensors)
Reduction operation for contiguous tensors.
Tensor(const T1 &left, const T2 &right, Op &&op)
Copy and modify the data from left, and right.
allocator_type::pointer pointer
Element pointer type.
scalar_type squared_norm() const
Square of vector 2-norm.
numeric_type min(typename std::enable_if< detail::is_strictly_ordered< Numeric >::value >::type *=nullptr) const
Minimum element.
const_reference operator()(const Index &... idx) const
Element accessor.
Tensor(const T1 &other)
Construct a copy of a tensor interface object.
KroneckerDeltaTile< _N >::numeric_type min(const KroneckerDeltaTile< _N > &arg)
Tensor_ & neg_to()
Negate elements of this tensor.
unsigned int left_rank() const
Left-hand argument rank accessor.
Tensor_ mult(const Right &right, const Scalar factor, const Permutation &perm) const
Scale and multiply this by right to create a new, permuted tensor.
Tensor_ & add_to(const numeric_type value)
Add a constant to this tensor.
Tensor(const range_type &range, InIter it)
Construct an evaluated tensor.
TILEDARRAY_FORCE_INLINE auto inner_product(const L l, const R r)
Inner product of a real value and a numeric value.
Tensor_ conj(const Permutation &perm) const
Create a complex conjugated and permuted copy of this tensor.
detail::TensorInterface< const T, BlockRange > block(const Index &lower_bound, const Index &upper_bound) const
std::enable_if<!(std::is_scalar< Arg >::value &&std::is_scalar< Result >::value)>::type uninitialized_fill_vector(const std::size_t n, const Arg &arg, Result *const result)
Tensor_ & conj_to(const Scalar factor)
Complex conjugate and scale this tensor.
Tensor_ unary(Op &&op) const
Use a unary, element wise operation to construct a new tensor.
Tensor_ & subt_to(const Right &right)
Subtract right from this tensor.
Tensor_ add(const Right &right, const Scalar factor) const
Scale and add this and other to construct a new tensor.
Tensor_ & subt_to(const numeric_type value)
Subtract a constant from this tensor.