Runtime Tensor Views#

template<typename T>
class RuntimeTensorView : public virtual einsums::tensor_props::TensorViewBase<RuntimeTensor<T>>, public virtual einsums::tensor_props::TypedTensorBase<T>, public virtual einsums::tensor_props::BasicTensorBase, public virtual einsums::detail::RuntimeTensorViewNoType, public virtual einsums::tensor_props::CoreTensorBase#

Represents a view of a tensor whose properties can be determined at runtime but not compile time.

Subclassed by einsums::python::PyTensorView< T >

Public Functions

RuntimeTensorView() = default#
RuntimeTensorView(const RuntimeTensorView<T> &copy) = default#
inline RuntimeTensorView(RuntimeTensor<T> &view)#
inline RuntimeTensorView(const RuntimeTensor<T> &view)#
inline RuntimeTensorView(const RuntimeTensor<T> &other, const std::vector<size_t> &dims)#
inline RuntimeTensorView(RuntimeTensor<T> &other, const std::vector<size_t> &dims)#
inline RuntimeTensorView(RuntimeTensorView<T> &other, const std::vector<size_t> &dims)#
inline RuntimeTensorView(const RuntimeTensorView<T> &other, const std::vector<size_t> &dims)#
inline RuntimeTensorView(RuntimeTensor<T> &other, const std::vector<size_t> &dims, const std::vector<size_t> &strides, const std::vector<size_t> &offsets)#
inline RuntimeTensorView(const RuntimeTensor<T> &other, const std::vector<size_t> &dims, const std::vector<size_t> &strides, const std::vector<size_t> &offsets)#
inline RuntimeTensorView(RuntimeTensorView<T> &other, const std::vector<size_t> &dims, const std::vector<size_t> &strides, const std::vector<size_t> &offsets)#
inline RuntimeTensorView(const RuntimeTensorView<T> &other, const std::vector<size_t> &dims, const std::vector<size_t> &strides, const std::vector<size_t> &offsets)#
template<size_t Rank>
inline RuntimeTensorView(TensorView<T, Rank> &copy)#
template<size_t Rank>
inline RuntimeTensorView(const TensorView<T, Rank> &copy)#
template<size_t Rank>
inline RuntimeTensorView(Tensor<T, Rank> &copy)#
template<size_t Rank>
inline RuntimeTensorView(const Tensor<T, Rank> &copy)#
virtual ~RuntimeTensorView() = default#
inline virtual void zero()#
inline virtual void set_all(T val)#
inline T *data()#
inline const T *data() const#
template<typename Storage>
inline T *data(const Storage &index)#
template<typename Storage>
inline const T *data(const Storage &index) const#
template<typename Storage>
inline T &operator()(const Storage &index)#
template<typename Storage>
inline const T &operator()(const Storage &index) const#
inline T *data(ptrdiff_t index)#
inline const T *data(ptrdiff_t index) const#
template<typename ...Args>
inline T *data(Args... args)#
template<typename ...Args>
inline const T *data(Args... args) const#
template<typename ...Args>
inline T &operator()(Args... args)#

TODO: std::variant can’t handle references.

We might be able to make our own variant that can. This new variant may also be able to replace HostDevReference.

template<typename ...Args>
inline std::variant<T, RuntimeTensorView<T>> operator()(Args... args) const#
template<typename ...Args>
inline const RuntimeTensorView<T> operator()(Args... args) const#
template<typename ...Args>
inline RuntimeTensorView<T> operator()(Args... args)#
inline T &operator()(ptrdiff_t index)#
inline const T &operator()(ptrdiff_t index) const#
inline RuntimeTensorView<T> operator()(const std::vector<Range> &slices)#
inline RuntimeTensorView<T> operator()(const std::vector<Range> &slices) const#
template<typename TOther, size_t Rank>
inline RuntimeTensorView<T> &operator=(const Tensor<TOther, Rank> &other)#
template<typename TOther, size_t Rank>
inline RuntimeTensorView<T> &operator=(const TensorView<TOther, Rank> &other)#
inline virtual RuntimeTensorView<T> &operator=(const RuntimeTensor<T> &other)#
inline virtual RuntimeTensorView<T> &operator=(const RuntimeTensorView<T> &other)#
template<typename TOther>
inline RuntimeTensorView<T> &operator=(const RuntimeTensor<TOther> &other)#
template<typename TOther>
inline RuntimeTensorView<T> &operator=(const RuntimeTensorView<TOther> &other)#
inline virtual RuntimeTensorView<T> &operator=(T value)#
template<typename TOther>
inline RuntimeTensorView<T> &operator*=(const TOther &b)#
template<typename TOther>
inline RuntimeTensorView<T> &operator*=(const RuntimeTensor<TOther> &b)#
template<typename TOther>
inline RuntimeTensorView<T> &operator*=(const RuntimeTensorView<TOther> &b)#
template<typename TOther>
inline RuntimeTensorView<T> &operator/=(const TOther &b)#
template<typename TOther>
inline RuntimeTensorView<T> &operator/=(const RuntimeTensor<TOther> &b)#
template<typename TOther>
inline RuntimeTensorView<T> &operator/=(const RuntimeTensorView<TOther> &b)#
template<typename TOther>
inline RuntimeTensorView<T> &operator+=(const TOther &b)#
template<typename TOther>
inline RuntimeTensorView<T> &operator+=(const RuntimeTensor<TOther> &b)#
template<typename TOther>
inline RuntimeTensorView<T> &operator+=(const RuntimeTensorView<TOther> &b)#
template<typename TOther>
inline RuntimeTensorView<T> &operator-=(const TOther &b)#
template<typename TOther>
inline RuntimeTensorView<T> &operator-=(const RuntimeTensor<TOther> &b)#
template<typename TOther>
inline RuntimeTensorView<T> &operator-=(const RuntimeTensorView<TOther> &b)#
inline virtual size_t dim(int d) const#
inline virtual std::vector<size_t> dims() const noexcept#
inline virtual size_t stride(int d) const#
inline virtual std::vector<size_t> strides() const noexcept#
inline virtual RuntimeTensorView<T> to_rank_1_view() const#
inline virtual size_t size() const noexcept#
inline virtual bool full_view_of_underlying() const noexcept override#
inline virtual const std::string &name() const override#
inline virtual void set_name(const std::string &new_name) override#
inline virtual size_t rank() const noexcept override#

Protected Attributes

T *_data#
std::string _name = {"(unnamed view)"}#
std::vector<size_t> _dims#
std::vector<size_t> _strides#
std::vector<size_t> _index_strides#
size_t _rank = {0}#
size_t _size = {0}#
size_t _alloc_size = {0}#
bool _full_view = {false}#