def init_mps_logical(nsites, basis_state, physdim, left_label='left',
right_label='right', phys_label='phys'):
"""
Create an MPS with `nsites` sites in the logical basis state |ijk..l>.
Parameters
----------
nsites : int
basis_state : int or list of ints
Site `i` will be in the state |`basis_state[i]`> (or simply
|`basis_state`> if a single int is provided).
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[basis_state[j]] = 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)
评论列表
文章目录