template<typename T>
struct nda::tensor::tensor_view< T >
A type-erased, non-owning view of an nda::MemoryArray or a conjugate lazy expression.
It holds a pointer to the data, extents and strides of the viewed array or conjugate expression, as well as its rank and an element-wise unary operation to apply to each element (see nda::tensor::unary_op).
All pointers are non-owning and must remain valid for the lifetime of this object.
- Template Parameters
-
| T | Value type of the tensor. |
Definition at line 146 of file tools.hpp.
|
|
| tensor_view ()=default |
| | Default constructor initializes an empty view.
|
template<BlasArrayOrConj A>
requires std::convertible_to<data_ptr_t<A>, T *> |
| | tensor_view (A &&a) |
| | Construct a tensor view from an nda::MemoryArray or a conjugate lazy expression.
|
template<BlasArray A>
requires std::convertible_to<data_ptr_t<A>, T *> |
| | tensor_view (A &&a, unary_op op) |
| | Construct a tensor view from an nda::MemoryArray and an nda::tensor::unary_op.
|
| | tensor_view (T *p) |
| | Construct a rank-0 tensor view from a pointer to a scalar value.
|
template<typename U>
requires (!std::same_as<U, T> && std::convertible_to<U *, T *>) |
| | tensor_view (tensor_view< U > tv) |
| | Construct a tensor view from from another tensor view with a convertible value type.
|
template<typename T>
template<typename U>
requires (!std::same_as<U, T> && std::convertible_to<U *, T *>)
Construct a tensor view from from another tensor view with a convertible value type.
This enables implicit conversion from tensor_view<T> to tensor_view<const T>, analogous to T* converting to const T*.
- Template Parameters
-
| U | Value type of the source. |
- Parameters
-
Definition at line 221 of file tools.hpp.