7 #ifndef ALPSCORE_GF_TENSORVIEW_H 8 #define ALPSCORE_GF_TENSORVIEW_H 35 data_view(data_storage<T> & storage) : data_slice_(storage), size_(storage.
size()) {}
36 data_view(
const data_storage<T> & storage) : data_slice_(storage.data(), storage.
size()), size_(storage.
size()) {}
38 data_view(
const data_storage<S> & storage,
size_t size,
size_t offset = 0) : data_slice_(storage.data() + offset, size), size_(size) {}
40 data_view(data_storage<T> & storage,
size_t size,
size_t offset = 0) : data_slice_(storage.data() + offset, size), size_(size) {}
42 data_view(data_view<T> && storage,
size_t size,
size_t offset) : data_slice_(storage.data_slice_.data() + offset, size), size_(size) {}
44 data_view(
const data_view<T> & storage,
size_t size,
size_t offset) : data_slice_(storage.data_slice_.data() + offset, size), size_(size) {}
46 data_view(T*data,
size_t size) : data_slice_(data, size), size_(size){}
48 data_view(
const data_view<T> & storage) =
default;
51 data_view(
const data_view<S>& storage,
size_t size = 0,
size_t offset = 0) :
52 data_slice_(&storage.data()[offset],
size), size_(
size) {};
56 data_view(data_view<T> && storage) =
default;
59 data_view<T>& operator=(
const data_view<T>& rhs) =
default;
61 data_view<T>& operator=(data_view<T>&& rhs) =
default;
64 T& data(
size_t i) {
return data_slice_.data(i);};
66 const T& data(
size_t i)
const {
return data_slice_.data(i);};
68 inline const T& operator()(
size_t i)
const {
return data_slice_.data(i);};
69 inline T& operator()(
size_t i) {
return data_slice_.data(i);};
71 size_t size()
const {
return size_;}
73 T* data() {
return data_slice_.data();}
75 const T* data()
const {
return data_slice_.data();}
80 return size() == r.size() && std::equal(r.data(), r.data() + r.size(), data());
85 bool operator==(
const data_storage<T2>& r)
const {
86 return size() == r.size() && std::equal(r.data(), r.data() + r.size(), data());
92 #endif //ALPSCORE_GF_TENSORVIEW_H
std::enable_if<!is_sequence< T >::value, std::size_t >::type size(T const &)
bool operator==(const dictionary &lhs, const dictionary &rhs)
T r(T x, T y=T(), T z=T())