util.py 文件源码

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

项目:spectre 作者: steinmanngroup 项目源码 文件源码
def idamin(a):
    """ Returns the index of minimum absolute value (positive or negative)
        in the input array a.

        Arguments:
        a -- a numpy array where we are to find the minimum
             value in (either positive or negative)

        Returns:
        the index in the array where the maximum value is.
    """
    idx = -1
    v = 1.0e30
    for i, value in enumerate(numpy.abs(a)):
        if value < v:
            idx = i
            v = value

    return idx
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号