_repr_utils.py 文件源码

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

项目:kdotp-symmetry 作者: greschd 项目源码 文件源码
def hermitian_to_vector(matrix, basis):
    """
    Returns a the vector representing the ``matrix`` w.r.t. the given *orthonormal* ``basis``.
    """
    _assert_orthogonal(basis)
    vec = tuple(
        frobenius_product(matrix, b) / frobenius_product(b, b) for b in basis
    )
    vec = tuple(v.nsimplify() for v in vec)
    # check consistency
    assert matrix.equals(
        sum((v * b for v, b in zip(vec, basis)), sp.zeros(*matrix.shape))
    )
    return vec
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号