npc.zeros and labels

How do I use this algorithm? What does that parameter do?
Post Reply
gunheepark0229
Posts: 9
Joined: 15 May 2020, 10:52

npc.zeros and labels

Post 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.

User avatar
Johannes
Site Admin
Posts: 159
Joined: 21 Jul 2018, 12:52
Location: UC Berkeley

Re: npc.zeros and labels

Post 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 :)

gunheepark0229
Posts: 9
Joined: 15 May 2020, 10:52

Re: npc.zeros and labels

Post by gunheepark0229 »

I see the difference!

Thanks Johannes

Post Reply