def init_mps_allzero(nsites, physdim, left_label='left',
right_label='right', phys_label='phys'):
"""
Create an MPS with `nsites` sites in the "all zero" state |00..0>.
Parameters
----------
nsites : int
physdim : int or list of ints
left_label : str
right_label : str
phys_label : str
"""
if not np.iterable(physdim):
physdim = [physdim] * nsites
tensors = []
for j in range(nsites):
t = np.zeros(physdim[j])
t[0] = 1.0
t = tnc.Tensor(t.reshape(physdim[j], 1, 1), [phys_label, left_label,
right_label])
tensors.append(t)
return onedim.MatrixProductState(tensors, left_label=left_label,
right_label=right_label, phys_label=phys_label)
评论列表
文章目录