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

Function Documentation

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

Create a 2D ndarray from a vector of data.

Template Parameters

VectorT – Data type of the vector elements

Parameters
  • data – Vector containing the data to transfer

  • rows – Number of rows in the resulting 2D array

  • cols – Number of columns in the resulting 2D array

Returns

nb::ndarray<VectorT, nb::numpy, nb::c_contig> 2D array with copied data