26 #ifndef TILEDARRAY_TENSOR_H__INCLUDED
27 #define TILEDARRAY_TENSOR_H__INCLUDED
54 template <typename T, typename std::enable_if<detail::is_tensor<T>::value &&
56 T>::value>::type* =
nullptr>
57 inline std::ostream&
operator<<(std::ostream& os,
const T& t) {
58 os << t.range() <<
" { ";
59 const auto n = t.range().volume();
60 for (
auto i = 0ul; i < n; ++i) os << t[i] <<
" ";
74 template <typename T, typename std::enable_if<detail::is_tensor<T>::value &&
75 !detail::is_contiguous_tensor<
76 T>::value>::type* =
nullptr>
77 inline std::ostream&
operator<<(std::ostream& os,
const T& t) {
79 const auto volume = t.range().volume();
81 auto tensor_print_range =
82 [&os, stride](
typename T::const_pointer MADNESS_RESTRICT
const t_data) {
83 for (decltype(t.range().volume()) i = 0ul; i < stride; ++i)
84 os << t_data[i] <<
" ";
87 os << t.range() <<
" { ";
89 for (decltype(t.range().volume()) i = 0ul; i <
volume; i += stride)
90 tensor_print_range(t.data() + t.range().ordinal(i));
98 typename = std::enable_if_t<detail::is_tensor_of_tensor_v<T>>>
99 inline std::ostream&
operator<<(std::ostream& os,
const T& t){
100 os << t.range() <<
" {" << std::endl;
101 for(
auto idx : t.range()){
102 const auto& inner_t = t(idx);
103 os <<
" " << idx <<
":" << inner_t << std::endl;
111 #endif // TILEDARRAY_SRC_TILEDARRAY_TENSOR_H__INCLUDED