np.triu_indices_from() 返回方阵的上三角矩阵的索引
生活随笔
收集整理的這篇文章主要介紹了
np.triu_indices_from() 返回方阵的上三角矩阵的索引
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
np.triu_indices_from()
返回方陣的上三角矩陣的索引
numpy.triu_indices_from(arr,k = 0 )
參數:
arr :ndarray,shape(N,N)
k:int,可選,對角線偏移
例子:
import numpy as np a = np.array([[1,2],[4,5]]) np.triu_indices_from(a) #(array([0, 0, 1], dtype=int64), array([0, 1, 1], dtype=int64))
https://numpy.org/doc/stable/reference/generated/numpy.triu_indices_from.html
總結
以上是生活随笔為你收集整理的np.triu_indices_from() 返回方阵的上三角矩阵的索引的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: c++函数相关
- 下一篇: 单页面的应用,以及优点和缺点