tad.py 文件源码

python
阅读 37 收藏 0 点赞 0 评论 0

项目:tadtool 作者: vaquerizaslab 项目源码 文件源码
def kth_diag_indices(n, k):
    """
    Return indices of bins k steps away from the diagonal.
    (from http://stackoverflow.com/questions/10925671/numpy-k-th-diagonal-indices)
    """

    rows, cols = np.diag_indices(n)
    if k < 0:
        return rows[:k], cols[-k:]
    elif k > 0:
        return rows[k:], cols[:-k]
    else:
        return rows, cols
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号