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.
###############################################################
评论列表
文章目录