Template Function Pennylane::LightningQubit::Util::Transpose(const std::vector<T, Allocator>&, std::size_t, std::size_t)

Function Documentation

template<class T, class Allocator>
inline auto Pennylane::LightningQubit::Util::Transpose(const std::vector<T, Allocator> &mat, std::size_t m, std::size_t n) -> std::vector<T, Allocator>

Transpose a matrix of shape m * n to n * m using the best available method.

This version may be merged with the above one when std::ranges is well supported.

Template Parameters

T – Floating point precision type.

Parameters
  • mat – Row-wise flatten matrix of shape m * n.

  • m – Number of rows of mat.

  • n – Number of columns of mat.

Returns

mat transpose of shape n * m.