tensorcircuit icon indicating copy to clipboard operation
tensorcircuit copied to clipboard

Wired input and output of function "c.amplitude"

Open FelixXu35 opened this issue 2 years ago • 3 comments

Issue Description

For a quantum circuit with n qubits, function "c.amplitude" returns the amplitude of a given quantum state. It will work when an n-bit binary string is passed into. An error will raise if the length of the string is not n, except n+1. If an (n+1)-bit string is passed into, "c.amplitude" will return the amplitude of a state corresponding to the first n bits, while the last bit controls the "phase". For example, if a circuit has 3 qubits, and one amplitude is "000" -> 0.5 then "0000" -> 0.5 "0001" -> 0.5*j and j is the imaginary unit

How to Reproduce

Screenshot 2023-05-12 at 23 14 19

Error Output

Screenshot 2023-05-12 at 23 14 39

Environment Context

macOS 13.3.1(a) tensorcircuit 0.8.0 BTW, why tc.about() gives me "module 'tensorcircuit' has no attribute 'about'"?

FelixXu35 avatar May 12 '23 15:05 FelixXu35