| 1 | // |
| 2 | // SPDX-FileCopyrightText: Copyright 2024-2025 Arm Limited and/or its affiliates <open-source-office@arm.com> |
| 3 | // |
| 4 | // SPDX-License-Identifier: Apache-2.0 |
| 5 | // |
| 6 | |
| 7 | #pragma once |
| 8 | |
| 9 | #include <cstddef> |
| 10 | |
| 11 | #include "test/common/buffer.hpp" |
| 12 | #include "test/common/data_type.hpp" |
| 13 | |
| 14 | namespace kai::test { |
| 15 | |
| 16 | /// Transposes the matrix. |
| 17 | /// |
| 18 | /// @param[in] data Data buffer. |
| 19 | /// @param[in] data_type Element data type. |
| 20 | /// @param[in] height Number of rows. |
| 21 | /// @param[in] width Number of columns. |
| 22 | /// |
| 23 | /// @return The transposed matrix. |
| 24 | Buffer transpose(const void* data, DataType data_type, size_t height, size_t width); |
| 25 | |
| 26 | /// Transposes the matrix. |
| 27 | /// Works for non-packed and packed using provided strides. |
| 28 | /// |
| 29 | /// @param[in] data Data buffer. |
| 30 | /// @param[in] height Number of rows. |
| 31 | /// @param[in] width Number of columns. |
| 32 | /// @param[in] src_stride Stride of source buffer. |
| 33 | /// @param[in] dst_stride Stride for destination buffer. |
| 34 | /// @param[in] dst_size Size of destination buffer. |
| 35 | /// |
| 36 | /// @return The transposed matrix. |
| 37 | /// |
| 38 | template <typename T> |
| 39 | Buffer transpose_with_padding( |
| 40 | const void* data, size_t height, size_t width, size_t src_stride, size_t dst_stride, size_t dst_size); |
| 41 | |
| 42 | /// |
| 43 | /// @tparam T The data type. |
| 44 | /// |
| 45 | /// @param[in] src The data buffer of the source matrix. |
| 46 | /// @param[in] height The number of rows of the source matrix. |
| 47 | /// @param[in] width The number of columns of the source matrix. |
| 48 | /// |
| 49 | /// @return The transposed matrix. |
| 50 | template <typename T> |
| 51 | Buffer transpose(const void* src, size_t height, size_t width); |
| 52 | |
| 53 | } // namespace kai::test |