Page 1 of 1

npc.zeros and labels

Posted: 15 May 2020, 10:59
by gunheepark0229
Hi! I am now learning how to use the Tenpy library and I am now following the example code.
At the first a_np_conserved.py code, I tried to execute it, but it showed an error.
The error was at
B_even = npc.zeros([v_leg_even, v_leg_odd.conj(), p_leg], label=['vL', 'vR', 'p']) # virtual left/right, physical
TypeError: zeros() got an unexpected keyword argument 'label'

I checked the source code of 'zeros()', and this function does not have the argument 'label'

[docs]def zeros(legcharges, dtype=np.float64, qtotal=None):
"""Create a npc array full of zeros (with no _data).

This is just a wrapper around ``Array(...)``, detailed documentation can be found in the class
doc-string of :class:`Array`.
"""
return Array(legcharges, dtype, qtotal)

Was the example code outdated?
How can I label the index for zeros?

Thanks in advance.

Re: npc.zeros and labels

Posted: 15 May 2020, 18:55
by Johannes
In the latest version of the master branch, the function definitely has the labels arguments, introduced in 8dd1f93b719074770a9d6cef16f0d89d9fd6229d on Jan. 27th.

This change was introduced after the last official release of v0.5.0 on Dez.18 last year, however, so if you used the pip install physics-tenpy method, you didn't get that change yet.

It just happens that I will release v.0.6.0 in the next few days, maybe even today. After updating, it should work :)

Re: npc.zeros and labels

Posted: 16 May 2020, 02:47
by gunheepark0229
I see the difference!

Thanks Johannes