You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

480 B

1. 2 设置值1, 2, 3, 4落在5x5矩阵对角线下方位置

(1). 解题思路

numpy库中提供了一个名为diag的方法用来提取或者构造对角矩阵,当它用于构造矩阵时,其第一个参数可以指定设置的元素,第二个参数设定元素落入的位置,大于0表示位于对角线上方位置,小于0表示位于对角线下方的位置,对于本题,设置为为-1。

(2). 运行结果