How to get the data of NPC arrays
Posted: 03 May 2019, 13:47
Hello again,
I sometimes want to look at the actual data of the tensors in an MPS or MPO network, but I am a bit puzzled by the ._data attribute. For example, I want the W tensor of a Bose Hubbard model w/o conservation. I create the model
and then get the W at, say, site 50:
Now the way I understand it is that if I want the actual entries of this npc.Array instance I get the attribute ._data, but
outputs a list with 7 (1,1,5,5) arrays, so clearly not all the data from the (4,4,5,5) tensor. What am I missing here?
The same question goes for MPS tensors.
As always all the help is much appreciated!
Thanks in advance,
Best regards,
Korbinian
I sometimes want to look at the actual data of the tensors in an MPS or MPO network, but I am a bit puzzled by the ._data attribute. For example, I want the W tensor of a Bose Hubbard model w/o conservation. I create the model
Code: Select all
model_params = dict(
filling = 1.,
n_max = 4,
t = 1,
U = 1,
mu = 1,
L=100,
bc_MPS='finite',
conserve = None,
verbose=0)
M = BoseHubbardChain(model_params)
Code: Select all
M.calc_H_MPO().get_W(50)
>>> <npc.Array shape=(4, 4, 5, 5) charge=ChargeInfo([], []) labels=['wL', 'wR', 'p', 'p*']>
Code: Select all
M.calc_H_MPO().get_W(50)._data
The same question goes for MPS tensors.
As always all the help is much appreciated!
Thanks in advance,
Best regards,
Korbinian