Matrix Copy
2026/3/9小于 1 分钟
Matrix Copy
题面
Implement a program that copies an
𝑁
×
𝑁
matrix of 32-bit floating point numbers from input array
𝐴
to output array
𝐵
on the GPU. The program should perform a direct element-wise copy so that
𝐵
𝑖
,
𝑗
𝐴
𝑖
,
𝑗
for all valid indices.
Implementation Requirements
- External libraries are not permitted
- The solve function signature must remain unchanged
- The final result must be stored in matrix B
Examples
Example 1:
Input: A = [[1.0, 2.0],
[3.0, 4.0]]
Output: B = [[1.0, 2.0],
[3.0, 4.0]]Example 2:
Input: A = [[5.5, 6.6, 7.7],
[8.8, 9.9, 10.1],
[11.2, 12.3, 13.4]]
Output: B = [[5.5, 6.6, 7.7],
[8.8, 9.9, 10.1],
[11.2, 12.3, 13.4]]Constraints
- 1 ≤ N ≤ 4096
- All elements are 32-bit floating point numbers
- Performance is measured with N = 4,096