[英]How to make matrix from vector Python
使用來自np.tril_indices
的相同索引來重建-
N = 68 # Number of rows/cols in original array
r,c = np.tril_indices(N) # Get the lower triangular region indices
# Initialize o/p array and assign from data_array (2346) elems array
out = np.zeros((N,N),dtype=data_array.dtype)
out[r,c] = data_array
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.