qi.py 文件源码

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

项目:qiskit-sdk-py 作者: QISKit 项目源码 文件源码
def outer(v1, v2=None):
    """
    Construct the outer product of two vectors.

    The second vector argument is optional, if absent the projector
    of the first vector will be returned.

    Args:
        v1 (ndarray): the first vector.
        v2 (ndarray): the (optional) second vector.

    Returns:
        The matrix |v1><v2|.

    """
    if v2 is None:
        u = np.array(v1).conj()
    else:
        u = np.array(v2).conj()
    return np.outer(v1, u)


###############################################################
# Measures.
###############################################################
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号