phase_estimation.py 文件源码

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

项目:grove 作者: rigetticomputing 项目源码 文件源码
def controlled(m):
    """
    Make a one-qubit-controlled version of a matrix.

    :param m: (numpy.ndarray) A matrix.
    :return: A controlled version of that matrix.
    """
    rows, cols = m.shape
    assert rows == cols
    n = rows
    I = np.eye(n)
    Z = np.zeros((n, n))
    controlled_m = np.bmat([[I, Z],
                            [Z, m]])
    return controlled_m
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号