Error in pcvl.pdisplay(simulator.prob(input_state, pcvl.BasicState('|0,1>')))

Hallo!
I am trying to get familiar with the Basics from circuits, everything works well till

#Get the actual probability associated to each output state:
pcvl.pdisplay(simulator.prob(input_state, pcvl.BasicState('|0,1>')))

and I get the following error:

AttributeError                            Traceback (most recent call last)
/var/folders/4f/b5n_b3wj16n_66605bzq06ph0000gn/T/ipykernel_32335/1927292369.py in <module>
      1 # to get the actual probability for each output state:
      2 
----> 3 pcvl.pdisplay(simulator.prob(input_state, pcvl.BasicState('|0,1>')))

/opt/anaconda3/lib/python3.9/site-packages/perceval/utils/utils.py in pdisplay(o, output_format, **opts)
     24             output_format = "text"
     25 
---> 26     r = o.pdisplay(output_format=output_format, **opts)
     27     if in_notebook and output_format != "text":
     28         display(HTML(r))

AttributeError: 'numpy.float64' object has no attribute 'pdisplay'

do you have any idea, how to solve it?

Hallo Wolfgang,

Thanks for the report !

pcvl.pdisplay normally applies on complex objects: Circuits, Matrices, etc… In current documentation, it has also been applied on simple float and complex numbers. This was actually an anticipation of a feature that is part of the coming release (0.3.1 that we are releasing on Monday).

Using pcvl.pdisplay on floats will allow to benefit from the identification of special number (for instance 0.7071067 as sqrt(2)/2) that is commonly used in complex object display - and is convenient to identify special numbers.

In the meantime, replacing pcvl.pdisplay by a simple print will work as documented.

Sorry for the confusion !

Thank you very much for the explanation, and ja great job!