jcmgray / quimb

A python library for quantum information and many-body calculations including tensor networks.
http://quimb.readthedocs.io
Other
455 stars 107 forks source link

TypeError: unsupported operand type(s) for |: 'dict' and 'dict' #141

Closed HamidArianZad closed 1 year ago

HamidArianZad commented 1 year ago

What happened?

Dear QUIMB organizers,

I tried to plot the last tensor network as shown in section: 2.8. ‘Publication style’ figures, but I get below error:

node_shape={tag: 'h' for tag in tags} | {tag0: 's'}, TypeError: unsupported operand type(s) for |: 'dict' and 'dict'

I am using the Python 3.8 via Anaconda 3. How can I resolve the problem?

I could plot other tensor networks.

What did you expect to happen?

No response

Minimal Complete Verifiable Example

No response

Relevant log output

No response

Anything else we need to know?

No response

Environment

I am using quimb version: 1.4.0

HamidArianZad commented 1 year ago

What happened?

Dear QUIMB organizers,

I tried to plot the last tensor network as shown in section: 2.8. ‘Publication style’ figures, but I get below error:

node_shape={tag: 'h' for tag in tags} | {tag0: 's'}, TypeError: unsupported operand type(s) for |: 'dict' and 'dict'

I am using the Python 3.8 via Anaconda 3. How can I resolve the problem?

I could plot other tensor networks.

What did you expect to happen?

No response

Minimal Complete Verifiable Example

No response

Relevant log output

No response

Anything else we need to know?

No response

Environment

I am using quimb version: 1.4.0

I could solve this problem by adding few lines as follows:

d1 = {tag: 'h' for tag in tags} d2 = {tag0: 's'} d = d1.copy() d.update(d2) ..... node_shape=d, ....

jcmgray commented 1 year ago

The union operator for dicts was added in python 3.9 I believe. While supporting python 3.8 in the actual code-base is still desirable, my feeling is this doc is fine as-is going forward.