📜  numpy.tril_indices()函数| Python

📅  最后修改于: 2022-05-13 01:54:32.089000             🧑  作者: Mango

numpy.tril_indices()函数| Python

numpy.tril_indices()函数返回 (n, m) 数组的下三角形的索引。

代码#1:

# Python program explaining
# numpy.tril_indices() function
  
# importing numpy as geek 
import numpy as geek
  
gfg = geek.tril_indices(3)
  
print (gfg)

输出 :

(array([0, 1, 1, 2, 2, 2]), array([0, 0, 1, 0, 1, 2]))


代码#2:

# Python program explaining
# numpy.tril_indices() function
  
# importing numpy as geek 
import numpy as geek
  
gfg = geek.tril_indices(3, 2)
  
print (gfg)

输出 :

(array([0, 0, 0, 1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2, 0, 1, 2]))