是否有一种优雅的方式(没有循环)通过numpy索引进行这种分配?
import numpy as np
m = 3
n = 5
small_matrix = np.random.randn(m, n)
big_matrix = np.zeros((100, 100))
row_indices = [3, 16, 9]
col_indices = [31, 45, 69, 71, 83]
for i in range(m):
for j in range(n):
big_matrix[row_indices[i], col_indices[j]] = small_matrix[i, j]