import numpy as np
#https://www.cnblogs.com/xzcfightingup/p/7598293.html
a = np.zeros((2,3),dtype=int) 
a = np.ones((2,3),dtype=int) 
a = np.eye(3)#3维单位矩阵
a = np.empty([2,3],dtype=int)
a = np.random.randint(0, 10, (4,3))

y = np.array([4, 5, 6])
np.diag(y)#以y为主对角线创建矩阵

a = np.arange(0, 30, 2)# start at 0 count up by 2, stop before 30
a = a.reshape(3, 5) # reshape array to be 3x5

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2023-02-10
  • 2021-10-10
  • 2021-10-03
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-08
  • 2021-12-23
  • 2022-01-23
  • 2021-08-03
  • 2022-12-23
  • 2021-11-05
相关资源
相似解决方案