vt::astensor#

template<typename T>
Tensor<T, 1> vt::astensor(const std::vector<T> &vector, const Order order = Order::C)#

Copy std::vector to the tensor.

Template Parameters:

T – Data type of the tensor.

Parameters:
  • vector – std::vector object.

  • order – Order of the tensor.

Returns:

Tensor: The tensor from std::vector.

Warning

doxygenfunction: Unable to resolve function “vt::astensor” with arguments (const xt::xarray<T, L>&) in doxygen xml output for project “vtensor” from directory: ../build/xml. Potential matches:

- template<typename T, size_t N, typename C> Tensor<T, N> astensor(const C &arr)
- template<typename T, size_t N> Tensor<T, N> astensor(const T *ptr, const Shape<N> shape, const Order order = Order::C)
- template<typename T> Tensor<T, 1> astensor(const T *ptr, const size_t size, const Order order = Order::C)
- template<typename T> Tensor<T, 1> astensor(const std::vector<T> &vector, const Order order = Order::C)
template<typename T>
Tensor<T, 1> vt::astensor(const T *ptr, const size_t size, const Order order = Order::C)#

Copy the raw pointer to the tensor.

Template Parameters:

T – Data type of the tensor.

Parameters:
  • ptr – The raw pointer.

  • size – The size of the tensor.

  • order – Order of the tensor.

Returns:

Tensor: The tensor from the raw pointer.

template<typename T, size_t N>
Tensor<T, N> vt::astensor(const T *ptr, const Shape<N> shape, const Order order = Order::C)#

Copy the raw pointer to the tensor.

Template Parameters:
  • T – Data type of the tensor.

  • N – Number of dimensions of the tensor.

Parameters:
  • ptr – The raw pointer.

  • shape – The shape of the tensor.

  • order – Order of the tensor.

Returns:

Tensor: The tensor from the raw pointer.