Template Function Pennylane::NanoBindings::Utils::createNumpyArrayFromVector(std::vector<VectorT>&&, const std::vector<size_t>&)

Function Documentation

template<typename VectorT>
nb::ndarray<VectorT, nb::numpy, nb::c_contig> Pennylane::NanoBindings::Utils::createNumpyArrayFromVector(std::vector<VectorT> &&data, const std::vector<size_t> &shape)

Create an ndarray from a vector of data with proper ownership transfer.

Template Parameters

VectorT – Data type of the vector elements

Parameters
  • data – Vector containing the data to transfer

  • shape – Vector containing the shape of the resulting array

Returns

nb::ndarray<VectorT, nb::numpy, nb::c_contig> Array with copied data in numpy format